Merge pull request #49 from aufau/faufixes

Fix build on singular system and improve Jedi Outcast support
This commit is contained in:
Thomas Debesse 2014-10-23 21:05:48 +02:00
commit 1668190258
7 changed files with 46 additions and 9 deletions

View File

@ -1241,12 +1241,12 @@ static char *jk2_gametypes[MAX_JK2_TYPES] = {
"FFA", // 0 - Free For All
"Holocron", // 1 - Holocron
"Jedi Master", // 2 - Jedi Master
"Duell", // 3 - Duell
"Duel", // 3 - Duel
"FFA", // 4 - Free For All
"TFFA", // 5 - Team Free For All
NULL, // 6 - Unknown
"CTF", // 7 - Capture the Flag
"Capture the Ysalimari" // 8 - Capture the Ysalimari
"CTY" // 8 - Capture the Ysalimari
};
#define MAX_JK3_TYPES 9
@ -1617,6 +1617,35 @@ void q3_decode_gametype (struct server *s, struct q3a_gametype_s map[]) {
}
}
void q3_decode_gametype_fallback (struct server *s, struct q3a_gametype_s map[]) {
char *endptr;
int n;
struct q3a_gametype_s* ptr;
if (!s->game) return;
n = strtol (s->gametype, &endptr, 10);
// strtol returns a pointer to the first invalid digit, if both pointers
// are equal there was no number at all
if (s->gametype == endptr || n < 0)
return;
// Exact match not found - use the first one in the list
// which should be the game's original game types
if ( n < map->number && map->gametypes[n] )
s->gametype = map->gametypes[n];
for ( ptr=map; ptr && ptr->mod; ptr++ ) {
if ( !strcasecmp (s->game, ptr->mod)
&& n < ptr->number
&& ptr->gametypes[n] ) {
s->gametype = ptr->gametypes[n];
break;
}
}
}
static void q3_analyze_serverinfo (struct server *s) {
char **info_ptr;
long n;
@ -1837,7 +1866,8 @@ static void q3_analyze_serverinfo (struct server *s) {
q3_decode_gametype( s, wolfet_gametype_map );
}
else if (s->type == JK2_SERVER) {
q3_decode_gametype( s, jk2_gametype_map );
// There is a ton of mods and they all use default gametype numbers
q3_decode_gametype_fallback( s, jk2_gametype_map );
}
else if (s->type == JK3_SERVER) {
q3_decode_gametype( s, jk3_gametype_map );

View File

@ -41,7 +41,7 @@ static char* stringlist038[] = { "main", NULL };
static char* stringlist039[] = { "codmp", NULL };
static char* stringlist040[] = { "savage", NULL };
static char* stringlist041[] = { "base", NULL };
static char* stringlist042[] = { "jamp", NULL };
static char* stringlist042[] = { "jk2mp", NULL };
static char* stringlist043[] = { "base", NULL };
static char* stringlist044[] = { "jamp", NULL };
static char* stringlist045[] = { "netpanzer", NULL };

View File

@ -671,7 +671,7 @@
<icon>jk2.xpm</icon>
<config_is_valid>config_is_valid_generic</config_is_valid>
<arch_identifier>NULL</arch_identifier>
<command>jamp</command>
<command>jk2mp</command>
<prefs_load>q3_prefs_load_common</prefs_load>
<update_prefs>q3_update_prefs_common</update_prefs>
<main_mod>base</main_mod>

View File

@ -374,7 +374,7 @@ static struct q3_common_prefs_s cod_prefs = {
};
static const char* jk2_masterprotocols[] = {
"26 - v1.5",
"15 - v1.02",
"16 - v1.04",
NULL
};
@ -387,7 +387,7 @@ static const char* jk3_masterprotocols[] = {
static struct q3_common_prefs_s jk2_prefs = {
protocols: jk2_masterprotocols,
defproto : "26",
defproto : "16",
};
static struct q3_common_prefs_s jk3_prefs = {

View File

@ -344,7 +344,8 @@ end
gametype JK2M new extend JK3M
name = Jedi Knight 2
default port = 28060
master protocol = 26
template var = JK2MASTER
master protocol = 16
master for gametype = JK2S
end

View File

@ -1119,7 +1119,9 @@ static char *builtin_masters_update_info[] = {
"DELETE BF1942 http://tourneys.multiplay.co.uk/public/servers.pl?opt=ListGamespy&event=Online&type=BF1942&hostport=1 multiplay.co.uk - BF1942",
"ADD JK2S master://masterjk2.ravensoft.com:29060 Ravensoft",
"ADD JK2S master://masterjk2.ravensoft.com:28060 Ravensoft",
"ADD JK2S master://master.ouned.de:28060 master.ouned.de",
"ADD JK3S master://masterjk3.ravensoft.com:29060 Ravensoft",
"ADD UT2004S master://ut2004master1.epicgames.com:28902 Epic 1",

View File

@ -35,6 +35,10 @@
extern "C" {
#endif
#ifndef OF
#define OF(args) args
#endif
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));