From 7da58623befb6f2db13e309a390bada7d82c2f76 Mon Sep 17 00:00:00 2001 From: jeefo Date: Thu, 3 Dec 2020 17:27:11 +0300 Subject: [PATCH] Do not use strstr() --- src/botlib.cpp | 2 +- src/combat.cpp | 4 ++-- src/support.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/botlib.cpp b/src/botlib.cpp index df28361..515bfe9 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -576,7 +576,7 @@ void Bot::updatePickups () { allowPickup = true; pickupType = Pickup::PlantedC4; } - else if (cv_pickup_custom_items.bool_ () && util.isItem(ent) && strncmp ("item_thighpack", classname, 14) != 0) { + else if (cv_pickup_custom_items.bool_ () && util.isItem (ent) && strncmp ("item_thighpack", classname, 14) != 0) { allowPickup = true; pickupType = Pickup::None; } diff --git a/src/combat.cpp b/src/combat.cpp index 70b070e..69d09fa 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -256,10 +256,10 @@ bool Bot::lookupEnemies () { // ignore shielded enemies, while we have real one edict_t *shieldEnemy = nullptr; - if (cv_attack_monsters. bool_()) { + if (cv_attack_monsters.bool_ ()) { // search the world for monsters... for (const auto &intresting : bots.getIntrestingEntities ()) { - if (!util.isMonster(intresting)) { + if (!util.isMonster (intresting)) { continue; } diff --git a/src/support.cpp b/src/support.cpp index 3584d7a..a291f0d 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -214,7 +214,7 @@ bool BotSupport::isMonster (edict_t *ent) { return false; } - if (strncmp ("hostage", ent->v.classname.chars(), 7) == 0) { + if (strncmp ("hostage", ent->v.classname.chars (), 7) == 0) { return false; } @@ -222,7 +222,7 @@ bool BotSupport::isMonster (edict_t *ent) { } bool BotSupport::isItem (edict_t *ent) { - return !!(strstr (ent->v.classname.chars(), "item")); + return strncmp (ent->v.classname.chars (), "item", 4) == 0; } bool BotSupport::isPlayerVIP (edict_t *ent) {