fix: missing client check causing hlds crash. (fixes #159)
This commit is contained in:
parent
94ffdc022c
commit
d2a4de7b09
1 changed files with 6 additions and 2 deletions
|
|
@ -5798,8 +5798,12 @@ bool Bot::isBombDefusing (const Vector &bombOrigin) {
|
||||||
constexpr auto distanceToBomb = cr::square (140.0f);
|
constexpr auto distanceToBomb = cr::square (140.0f);
|
||||||
|
|
||||||
for (const auto &client : util.getClients ()) {
|
for (const auto &client : util.getClients ()) {
|
||||||
|
if (!(client.flags & ClientFlags::Used) || !(client.flags & ClientFlags::Alive)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto bot = bots[client.ent];
|
auto bot = bots[client.ent];
|
||||||
auto bombDistance = (client.ent->v.origin - bombOrigin).lengthSq ();
|
auto bombDistance = (client.origin - bombOrigin).lengthSq ();
|
||||||
|
|
||||||
if (bot && !bot->m_notKilled) {
|
if (bot && !bot->m_notKilled) {
|
||||||
if (m_team != bot->m_team || bot->getCurrentTaskId () == Task::EscapeFromBomb) {
|
if (m_team != bot->m_team || bot->getCurrentTaskId () == Task::EscapeFromBomb) {
|
||||||
|
|
@ -5815,7 +5819,7 @@ bool Bot::isBombDefusing (const Vector &bombOrigin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// take in account peoples too
|
// take in account peoples too
|
||||||
if ((client.flags & ClientFlags::Used) && (client.flags & ClientFlags::Alive) && client.team == m_team) {
|
if (client.team == m_team) {
|
||||||
|
|
||||||
// if close enough, mark as progressing
|
// if close enough, mark as progressing
|
||||||
if (bombDistance < distanceToBomb && ((client.ent->v.button | client.ent->v.oldbuttons) & IN_USE)) {
|
if (bombDistance < distanceToBomb && ((client.ent->v.button | client.ent->v.oldbuttons) & IN_USE)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue