This is an automated email from the git hooks/post-receive script. smcv pushed a commit to tag 1.51b in repository iortcw.
commit 77b1042632463eb1d0b7dd0ac56e84cedecc1326 Author: MAN-AT-ARMS <m4n4t4...@gmail.com> Date: Mon Jun 12 16:12:03 2017 -0400 All: Don't use uninitialized ps from BotAI_GetClientState --- MP/code/game/ai_chat.c | 12 ++++-------- MP/code/game/ai_dmq3.c | 5 ++++- MP/code/game/ai_main.c | 5 ++++- MP/code/game/ai_team.c | 8 ++++++-- SP/code/game/ai_chat.c | 12 ++++-------- SP/code/game/ai_dmq3.c | 5 ++++- SP/code/game/ai_main.c | 5 ++++- SP/code/game/ai_team.c | 8 ++++++-- 8 files changed, 36 insertions(+), 24 deletions(-) diff --git a/MP/code/game/ai_chat.c b/MP/code/game/ai_chat.c index 3eac6fb..82cceea 100644 --- a/MP/code/game/ai_chat.c +++ b/MP/code/game/ai_chat.c @@ -107,8 +107,7 @@ int BotIsFirstInRankings( bot_state_t *bs ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( score < ps.persistant[PERS_SCORE] ) { + if ( BotAI_GetClientState( i, &ps ) && score < ps.persistant[PERS_SCORE] ) { return qfalse; } } @@ -137,8 +136,7 @@ int BotIsLastInRankings( bot_state_t *bs ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( score > ps.persistant[PERS_SCORE] ) { + if ( BotAI_GetClientState( i, &ps ) && score > ps.persistant[PERS_SCORE] ) { return qfalse; } } @@ -169,8 +167,7 @@ char *BotFirstClientInRankings( void ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( ps.persistant[PERS_SCORE] > bestscore ) { + if ( BotAI_GetClientState( i, &ps ) && ps.persistant[PERS_SCORE] > bestscore ) { bestscore = ps.persistant[PERS_SCORE]; bestclient = i; } @@ -203,8 +200,7 @@ char *BotLastClientInRankings( void ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( ps.persistant[PERS_SCORE] < worstscore ) { + if ( BotAI_GetClientState( i, &ps ) && ps.persistant[PERS_SCORE] < worstscore ) { worstscore = ps.persistant[PERS_SCORE]; bestclient = i; } diff --git a/MP/code/game/ai_dmq3.c b/MP/code/game/ai_dmq3.c index 55990da..404a8f8 100644 --- a/MP/code/game/ai_dmq3.c +++ b/MP/code/game/ai_dmq3.c @@ -614,7 +614,10 @@ qboolean EntityIsDead( aas_entityinfo_t *entinfo ) { if ( entinfo->number >= 0 && entinfo->number < MAX_CLIENTS ) { //retrieve the current client state - BotAI_GetClientState( entinfo->number, &ps ); + if ( !BotAI_GetClientState( entinfo->number, &ps ) ) { + return qfalse; + } + if ( ps.pm_type != PM_NORMAL ) { return qtrue; } diff --git a/MP/code/game/ai_main.c b/MP/code/game/ai_main.c index eef1af4..c9a93b3 100644 --- a/MP/code/game/ai_main.c +++ b/MP/code/game/ai_main.c @@ -545,7 +545,10 @@ int BotAI( int client, float thinktime ) { } //retrieve the current client state - BotAI_GetClientState( client, &bs->cur_ps ); + if ( !BotAI_GetClientState( client, &bs->cur_ps ) ) { + BotAI_Print( PRT_FATAL, "BotAI: failed to get player state for player %d\n", client ); + return qfalse; + } //retrieve any waiting console messages while ( trap_BotGetServerCommand( client, buf, sizeof( buf ) ) ) { diff --git a/MP/code/game/ai_team.c b/MP/code/game/ai_team.c index 51b32f3..02629c3 100644 --- a/MP/code/game/ai_team.c +++ b/MP/code/game/ai_team.c @@ -106,8 +106,12 @@ int BotClientTravelTimeToGoal( int client, bot_goal_t *goal ) { playerState_t ps; int areanum; - BotAI_GetClientState( client, &ps ); - areanum = BotPointAreaNum( ps.origin ); + if ( BotAI_GetClientState( client, &ps ) ) { + areanum = BotPointAreaNum( ps.origin ); + } else { + areanum = 0; + } + if ( !areanum ) { return 1; } diff --git a/SP/code/game/ai_chat.c b/SP/code/game/ai_chat.c index 0942694..0c17366 100644 --- a/SP/code/game/ai_chat.c +++ b/SP/code/game/ai_chat.c @@ -107,8 +107,7 @@ int BotIsFirstInRankings( bot_state_t *bs ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( score < ps.persistant[PERS_SCORE] ) { + if ( BotAI_GetClientState( i, &ps ) && score < ps.persistant[PERS_SCORE] ) { return qfalse; } } @@ -137,8 +136,7 @@ int BotIsLastInRankings( bot_state_t *bs ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( score > ps.persistant[PERS_SCORE] ) { + if ( BotAI_GetClientState( i, &ps ) && score > ps.persistant[PERS_SCORE] ) { return qfalse; } } @@ -169,8 +167,7 @@ char *BotFirstClientInRankings( void ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( ps.persistant[PERS_SCORE] > bestscore ) { + if ( BotAI_GetClientState( i, &ps ) && ps.persistant[PERS_SCORE] > bestscore ) { bestscore = ps.persistant[PERS_SCORE]; bestclient = i; } @@ -203,8 +200,7 @@ char *BotLastClientInRankings( void ) { continue; } // - BotAI_GetClientState( i, &ps ); - if ( ps.persistant[PERS_SCORE] < worstscore ) { + if ( BotAI_GetClientState( i, &ps ) && ps.persistant[PERS_SCORE] < worstscore ) { worstscore = ps.persistant[PERS_SCORE]; bestclient = i; } diff --git a/SP/code/game/ai_dmq3.c b/SP/code/game/ai_dmq3.c index 4cb38d6..6a224e2 100644 --- a/SP/code/game/ai_dmq3.c +++ b/SP/code/game/ai_dmq3.c @@ -612,7 +612,10 @@ qboolean EntityIsDead( aas_entityinfo_t *entinfo ) { if ( entinfo->number >= 0 && entinfo->number < MAX_CLIENTS ) { //retrieve the current client state - BotAI_GetClientState( entinfo->number, &ps ); + if ( !BotAI_GetClientState( entinfo->number, &ps ) ) { + return qfalse; + } + if ( ps.pm_type != PM_NORMAL ) { return qtrue; } diff --git a/SP/code/game/ai_main.c b/SP/code/game/ai_main.c index 02e9364..8176237 100644 --- a/SP/code/game/ai_main.c +++ b/SP/code/game/ai_main.c @@ -543,7 +543,10 @@ int BotAI( int client, float thinktime ) { } //retrieve the current client state - BotAI_GetClientState( client, &bs->cur_ps ); + if ( !BotAI_GetClientState( client, &bs->cur_ps ) ) { + BotAI_Print( PRT_FATAL, "BotAI: failed to get player state for player %d\n", client ); + return qfalse; + } //retrieve any waiting console messages while ( trap_BotGetServerCommand( client, buf, sizeof( buf ) ) ) { diff --git a/SP/code/game/ai_team.c b/SP/code/game/ai_team.c index adeb31a..27f7d92 100644 --- a/SP/code/game/ai_team.c +++ b/SP/code/game/ai_team.c @@ -106,8 +106,12 @@ int BotClientTravelTimeToGoal( int client, bot_goal_t *goal ) { playerState_t ps; int areanum; - BotAI_GetClientState( client, &ps ); - areanum = BotPointAreaNum( ps.origin ); + if ( BotAI_GetClientState( client, &ps ) ) { + areanum = BotPointAreaNum( ps.origin ); + } else { + areanum = 0; + } + if ( !areanum ) { return 1; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits