engine/maps/source/MapUtils.cpp
// Get all the creatures hostile to a particular creature.
Get all the creatures hostile to a particular creature.
Get all the creatures hostile to a particular creature .
vector<CreaturePtr> MapUtils::get_hostile_creatures(const string& creature_id, MapPtr current_map)
{
  vector<CreaturePtr> hostile_creatures;
  if (current_map != nullptr)
  {
    map<std::string, CreaturePtr>& creature_map = current_map->get_creatures_ref();
    for (auto& cr_pair : creature_map)
    {
      CreaturePtr creature = cr_pair.second;
      if (creature && creature->hostile_to(creature_id))
      {
        hostile_creatures.push_back(creature);
      }
    }
  }
  return hostile_creatures;
}
vector < CreaturePtr > MapUtils :: get_hostile_creatures ( const string & creature_id , MapPtr current_map ) { vector < CreaturePtr > hostile_creatures ; if ( current_map != nullptr ) { map < std :: string , CreaturePtr > & creature_map = current_map -> get_creatures_ref ( ) ; for ( auto & cr_pair : creature_map ) { CreaturePtr creature = cr_pair . second ; if ( creature && creature -> hostile_to ( creature_id ) ) { hostile_creatures . push_back ( creature ) ; } } } return hostile_creatures ; }
Get all the creatures hostile to a particular creature.
Get all the creatures hostile to a particular creature .