From 92f59c31b2722eaef235e6c8717f0114514f14f8 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 15 Nov 2006 15:53:30 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@676 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/bot/ac_bot.cpp | 1 - source/src/bot/bot_ai.cpp | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/src/bot/ac_bot.cpp b/source/src/bot/ac_bot.cpp index 27ae0e01..3ccf17f6 100644 --- a/source/src/bot/ac_bot.cpp +++ b/source/src/bot/ac_bot.cpp @@ -148,7 +148,6 @@ void CACBot::PickUp(int n) { int np = 1; loopv(players) if(players[i]) np++; - loopv(bots) if(bots[i]) np++; np = np<3 ? 4 : (np>4 ? 2 : 3); // spawn times are dependent on number of players int ammo = np*2; switch(ents[n].type) diff --git a/source/src/bot/bot_ai.cpp b/source/src/bot/bot_ai.cpp index e11a437d..1b120c18 100644 --- a/source/src/bot/bot_ai.cpp +++ b/source/src/bot/bot_ai.cpp @@ -181,7 +181,7 @@ bool CBot::FindEnemy(void) { d = players[i]; // Handy shortcut - if (!d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) + if (d == m_pMyEnt || !d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) continue; // Check if the enemy is visible @@ -405,7 +405,7 @@ bool CBot::CheckHunt(void) { d = players[i]; // Handy shortcut - if (!d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) + if (d == m_pMyEnt || !d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) continue; flDist = GetDistance(d->o); @@ -2238,14 +2238,16 @@ void CBot::HearSound(int n, vec *o) // Check all players first loopv(players) { - if (!players[i] || (players[i]->state != CS_ALIVE) || - isteam(m_pMyEnt->team, players[i]->team)) + playerent *d = players[i]; + + if (d == m_pMyEnt || !d || (d->state != CS_ALIVE) || + isteam(m_pMyEnt->team, d->team)) continue; - flDist = GetDistance(*o, players[i]->o); - if ((flDist < flNearestDist) && IsVisible(players[i])) + flDist = GetDistance(*o, d->o); + if ((flDist < flNearestDist) && IsVisible(d)) { - pNearest = players[i]; + pNearest = d; flNearestDist = flDist; } }