Permalink
Browse files

Fix return value from npc::scan_new_items()

npc::scan_new_items() was supposed to return true if some action was
taken, but the logic was reversed, because npc::wield_better_weapon()
returns true if a weapon was wielded.

The upshot was that NPCs were being charged for the time to equip a
weapon when they got new items but *didn't* equip a weapon.

Rearrange the logic to make more sense.
  • Loading branch information...
jbytheway committed Jan 4, 2019
1 parent cd93984 commit d12bafd1d8e1d425a8ed7a181bbdb97f208ac9ec
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/npcmove.cpp
@@ -2440,10 +2440,11 @@ bool npc::wield_better_weapon()
bool npc::scan_new_items()
{
add_msg( m_debug, "%s scanning new items", name.c_str() );
if( !wield_better_weapon() ) {
if( wield_better_weapon() ) {
return true;
} else {
// Stop "having new items" when you no longer do anything with them
has_new_items = false;
return true;
}

return false;

0 comments on commit d12bafd

Please sign in to comment.