Do not use strstr()

This commit is contained in:
jeefo 2020-12-03 17:27:11 +03:00
commit 7da58623be
3 changed files with 5 additions and 5 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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) {