diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index 894e295d..40cfe141 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -2510,7 +2510,7 @@ int BotWantsToCamp(bot_state_t *bs) { //if the bot isn't healthy anough if (BotAggression(bs) < 50) return qfalse; //the bot should have at least have the rocket launcher, the railgun or the bfg10k with some ammo - if ((bs->inventory[INVENTORY_ROCKETLAUNCHER] <= 0 || bs->inventory[INVENTORY_ROCKETS < 10]) && + if ((bs->inventory[INVENTORY_ROCKETLAUNCHER] <= 0 || bs->inventory[INVENTORY_ROCKETS] < 10) && (bs->inventory[INVENTORY_RAILGUN] <= 0 || bs->inventory[INVENTORY_SLUGS] < 10) && (bs->inventory[INVENTORY_BFG10K] <= 0 || bs->inventory[INVENTORY_BFGAMMO] < 10)) { return qfalse; diff --git a/code/q3_ui/ui_servers2.c b/code/q3_ui/ui_servers2.c index 6c7cf16c..04deb7a4 100644 --- a/code/q3_ui/ui_servers2.c +++ b/code/q3_ui/ui_servers2.c @@ -147,8 +147,8 @@ static char* gamenames[] = { }; static char* netnames[] = { - "???", - "UDP", + "??? ", + "UDP ", "UDP6", NULL }; @@ -534,7 +534,7 @@ static void ArenaServers_UpdateMenu( void ) { pingColor = S_COLOR_RED; } - Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %3s %s%3d " S_COLOR_YELLOW "%s", + Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %4s%s%3d " S_COLOR_YELLOW "%s", servernodeptr->hostname, servernodeptr->mapname, servernodeptr->numclients, servernodeptr->maxclients, servernodeptr->gamename, netnames[servernodeptr->nettype], pingColor, servernodeptr->pingtime, servernodeptr->bPB ? "Yes" : "No" ); @@ -672,6 +672,9 @@ static void ArenaServers_Insert( char* adrstr, char* info, int pingtime ) } */ servernodeptr->nettype = atoi(Info_ValueForKey(info, "nettype")); + if (servernodeptr->nettype < 0 || servernodeptr->nettype >= ARRAY_LEN(netnames)) { + servernodeptr->nettype = 0; + } s = Info_ValueForKey( info, "game"); i = atoi( Info_ValueForKey( info, "gametype") ); diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index b249e0ff..39b2c7f5 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -766,13 +766,13 @@ static void ServerOptions_Start( void ) { case GT_TEAM: trap_Cvar_SetValue( "ui_team_fraglimit", fraglimit ); trap_Cvar_SetValue( "ui_team_timelimit", timelimit ); - trap_Cvar_SetValue( "ui_team_friendlt", friendlyfire ); + trap_Cvar_SetValue( "ui_team_friendly", friendlyfire ); break; case GT_CTF: - trap_Cvar_SetValue( "ui_ctf_fraglimit", fraglimit ); + trap_Cvar_SetValue( "ui_ctf_capturelimit", flaglimit ); trap_Cvar_SetValue( "ui_ctf_timelimit", timelimit ); - trap_Cvar_SetValue( "ui_ctf_friendlt", friendlyfire ); + trap_Cvar_SetValue( "ui_ctf_friendly", friendlyfire ); break; } @@ -1239,7 +1239,7 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { memset( &s_serveroptions, 0 ,sizeof(serveroptions_t) ); s_serveroptions.multiplayer = multiplayer; - s_serveroptions.gametype = (int)Com_Clamp( 0, 5, trap_Cvar_VariableValue( "g_gameType" ) ); + s_serveroptions.gametype = (int)Com_Clamp( 0, GT_MAX_GAME_TYPE - 1, trap_Cvar_VariableValue( "g_gameType" ) ); s_serveroptions.punkbuster.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "sv_punkbuster" ) ); ServerOptions_Cache(); diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 6942a62f..4374ced8 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -191,6 +191,8 @@ typedef int clipHandle_t; #define MAX_QINT 0x7fffffff #define MIN_QINT (-MAX_QINT-1) +#define ARRAY_LEN(x) (sizeof(x) / sizeof(*x)) + // angle indexes #define PITCH 0 // up / down diff --git a/code/renderer/tr_shade_calc.c b/code/renderer/tr_shade_calc.c index 6f9b0be7..840c58eb 100644 --- a/code/renderer/tr_shade_calc.c +++ b/code/renderer/tr_shade_calc.c @@ -359,10 +359,10 @@ static void AutospriteDeform( void ) { vec3_t leftDir, upDir; if ( tess.numVertexes & 3 ) { - ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd vertex count", tess.shader->name ); + ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd vertex count\n", tess.shader->name ); } if ( tess.numIndexes != ( tess.numVertexes >> 2 ) * 6 ) { - ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd index count", tess.shader->name ); + ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd index count\n", tess.shader->name ); } oldVerts = tess.numVertexes; diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 1d120a7e..b8b6db4e 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -116,7 +116,7 @@ static const int numSortKeys = sizeof(sortKeys) / sizeof(const char*); static char* netnames[] = { "???", "UDP", - NULL + "UDP6" }; #ifndef MISSIONPACK @@ -941,7 +941,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { handle = trap_PC_LoadSource( menuFile ); if (!handle) { - trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) ); + Com_Printf( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ); handle = trap_PC_LoadSource( "ui/menus.txt" ); if (!handle) { trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n") ); @@ -2265,7 +2265,7 @@ static qboolean UI_Handicap_HandleKey(int flags, float *special, int key) { } if (h > 100) { h = 5; - } else if (h < 0) { + } else if (h < 5) { h = 100; } trap_Cvar_Set( "handicap", va( "%i", h) ); @@ -4307,9 +4307,15 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan return Info_ValueForKey(info, "addr"); } else { if ( ui_netSource.integer == AS_LOCAL ) { + int nettype = atoi(Info_ValueForKey(info, "nettype")); + + if (nettype < 0 || nettype >= ARRAY_LEN(netnames)) { + nettype = 0; + } + Com_sprintf( hostname, sizeof(hostname), "%s [%s]", Info_ValueForKey(info, "hostname"), - netnames[atoi(Info_ValueForKey(info, "nettype"))] ); + netnames[nettype] ); return hostname; } else {