From fbdb3e08754725d0c837e4d9c6ec77f5ff5652d9 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 1 Sep 2014 11:09:11 +0100 Subject: [PATCH] Fix game warnings --- code/game/ai_main.c | 4 ++++ code/game/ai_team.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/game/ai_main.c b/code/game/ai_main.c index 9b3d7220..9c6fe3a7 100644 --- a/code/game/ai_main.c +++ b/code/game/ai_main.c @@ -1174,6 +1174,10 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta if (!botstates[client]) botstates[client] = G_Alloc(sizeof(bot_state_t)); bs = botstates[client]; + if (!bs) { + return qfalse; + } + if (bs && bs->inuse) { BotAI_Print(PRT_FATAL, "BotAISetupClient: client %d already setup\n", client); return qfalse; diff --git a/code/game/ai_team.c b/code/game/ai_team.c index 2077eff8..925a94d6 100644 --- a/code/game/ai_team.c +++ b/code/game/ai_team.c @@ -161,7 +161,7 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea //skip spectators if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; // - if (BotSameTeam(bs, i)) { + if (BotSameTeam(bs, i) && goal) { // traveltime = BotClientTravelTimeToGoal(i, goal); // @@ -337,7 +337,7 @@ BotCTFOrders */ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { int numteammates, defenders, attackers, i, other; - int teammates[MAX_CLIENTS]; + int teammates[MAX_CLIENTS] = {0}; char name[MAX_NETNAME], carriername[MAX_NETNAME]; numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -695,7 +695,7 @@ BotCTFOrders */ void BotCTFOrders_BothFlagsAtBase(bot_state_t *bs) { int numteammates, defenders, attackers, i; - int teammates[MAX_CLIENTS]; + int teammates[MAX_CLIENTS] = {0}; char name[MAX_NETNAME]; //sort team mates by travel time to base