Do not use strstr()
This commit is contained in:
parent
da275733bc
commit
7da58623be
3 changed files with 5 additions and 5 deletions
|
|
@ -576,7 +576,7 @@ void Bot::updatePickups () {
|
||||||
allowPickup = true;
|
allowPickup = true;
|
||||||
pickupType = Pickup::PlantedC4;
|
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;
|
allowPickup = true;
|
||||||
pickupType = Pickup::None;
|
pickupType = Pickup::None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,10 +256,10 @@ bool Bot::lookupEnemies () {
|
||||||
// ignore shielded enemies, while we have real one
|
// ignore shielded enemies, while we have real one
|
||||||
edict_t *shieldEnemy = nullptr;
|
edict_t *shieldEnemy = nullptr;
|
||||||
|
|
||||||
if (cv_attack_monsters. bool_()) {
|
if (cv_attack_monsters.bool_ ()) {
|
||||||
// search the world for monsters...
|
// search the world for monsters...
|
||||||
for (const auto &intresting : bots.getIntrestingEntities ()) {
|
for (const auto &intresting : bots.getIntrestingEntities ()) {
|
||||||
if (!util.isMonster(intresting)) {
|
if (!util.isMonster (intresting)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ bool BotSupport::isMonster (edict_t *ent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp ("hostage", ent->v.classname.chars(), 7) == 0) {
|
if (strncmp ("hostage", ent->v.classname.chars (), 7) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ bool BotSupport::isMonster (edict_t *ent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BotSupport::isItem (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) {
|
bool BotSupport::isPlayerVIP (edict_t *ent) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue