fix: clear grenade pointers before checking active grenades (ref #436)
This commit is contained in:
parent
6ef03fc9fd
commit
048f47e863
1 changed files with 5 additions and 9 deletions
|
|
@ -122,10 +122,6 @@ bool Bot::seesEntity (const Vector &dest, bool fromBody) {
|
|||
void Bot::avoidGrenades () {
|
||||
// checks if bot 'sees' a grenade, and avoid it
|
||||
|
||||
if (!bots.hasActiveGrenades ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check if old pointers to grenade is invalid
|
||||
if (game.isNullEntity (m_avoidGrenade)) {
|
||||
m_avoidGrenade = nullptr;
|
||||
|
|
@ -135,6 +131,10 @@ void Bot::avoidGrenades () {
|
|||
m_avoidGrenade = nullptr;
|
||||
m_needAvoidGrenade = 0;
|
||||
}
|
||||
|
||||
if (!bots.hasActiveGrenades ()) {
|
||||
return;
|
||||
}
|
||||
auto &activeGrenades = bots.getActiveGrenades ();
|
||||
|
||||
// find all grenades on the map
|
||||
|
|
@ -158,11 +158,7 @@ void Bot::avoidGrenades () {
|
|||
m_preventFlashing = game.time () + rg.get (1.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
else if (strcmp (model, "hegrenade.mdl") == 0) {
|
||||
if (!game.isNullEntity (m_avoidGrenade)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (game.isNullEntity (m_avoidGrenade) && strcmp (model, "hegrenade.mdl") == 0) {
|
||||
if (game.getTeam (pent->v.owner) == m_team || pent->v.owner == ent ()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue