Browse Source

Add FindUniqueMonster

pull/5478/head
obligaron 3 years ago committed by Anders Jenbo
parent
commit
5f63060c28
  1. 11
      Source/monster.cpp
  2. 1
      Source/monster.h

11
Source/monster.cpp

@ -4392,6 +4392,17 @@ Monster *FindMonsterAtPosition(Point position, bool ignoreMovingMonsters)
return &Monsters[abs(monsterId) - 1];
}
Monster *FindUniqueMonster(UniqueMonsterType monsterType)
{
for (size_t i = 0; i < ActiveMonsterCount; i++) {
int monsterId = ActiveMonsters[i];
auto &monster = Monsters[monsterId];
if (monster.uniqueType == monsterType)
return &monster;
}
return nullptr;
}
bool IsTileAvailable(const Monster &monster, Point position)
{
if (!IsTileAvailable(position))

1
Source/monster.h

@ -489,6 +489,7 @@ void PlayEffect(Monster &monster, MonsterSound mode);
void MissToMonst(Missile &missile, Point position);
Monster *FindMonsterAtPosition(Point position, bool ignoreMovingMonsters = false);
Monster *FindUniqueMonster(UniqueMonsterType monsterType);
/**
* @brief Check that the given tile is available to the monster

Loading…
Cancel
Save