| 1665 | } |
| 1666 | |
| 1667 | std::vector<GameEntity*> Creature::getReachableAttackableObjects(const std::vector<GameEntity*>& objectsToCheck) |
| 1668 | { |
| 1669 | std::vector<GameEntity*> tempVector; |
| 1670 | Tile* myTile = getPositionTile(); |
| 1671 | |
| 1672 | // Loop over the vector of objects we are supposed to check. |
| 1673 | for (unsigned int i = 0; i < objectsToCheck.size(); ++i) |
| 1674 | { |
| 1675 | // Try to find a valid path from the tile this creature is in to the nearest tile where the current target object is. |
| 1676 | GameEntity* entity = objectsToCheck[i]; |
| 1677 | // We only consider alive objects |
| 1678 | if(entity->getHP(nullptr) <= 0) |
| 1679 | continue; |
| 1680 | |
| 1681 | Tile* objectTile = entity->getCoveredTile(0); |
| 1682 | if (getGameMap()->pathExists(this, myTile, objectTile)) |
| 1683 | tempVector.push_back(objectsToCheck[i]); |
| 1684 | } |
| 1685 | |
| 1686 | return tempVector; |
| 1687 | } |
| 1688 | |
| 1689 | std::vector<GameEntity*> Creature::getCreaturesFromList(const std::vector<GameEntity*> &objectsToCheck, bool workersOnly) |
| 1690 | { |
nothing calls this directly
no test coverage detected