1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Remove redundant method - code review suggestion

This commit is contained in:
Dydzio 2023-01-25 13:06:13 +01:00
parent 4a23f93754
commit 68be7643f1
3 changed files with 1 additions and 17 deletions

View File

@ -900,7 +900,7 @@ std::vector<const CStack *> BattleStacksController::selectHoveredStacks()
auto hoveredQueueUnitId = owner.windowObject->getQueueHoveredUnitId();
if(hoveredQueueUnitId.is_initialized())
{
return { owner.curInt->cb->battleGetStackByUnitId(hoveredQueueUnitId.value(), true) };
return { owner.curInt->cb->battleGetStackByID(hoveredQueueUnitId.value(), true) };
}
auto hoveredHex = owner.fieldController->getHoveredHex();

View File

@ -185,21 +185,6 @@ const CStack* CBattleInfoEssentials::battleGetStackByID(int ID, bool onlyAlive)
return stacks[0];
}
const CStack* CBattleInfoEssentials::battleGetStackByUnitId(int unitId, bool onlyAlive) const
{
RETURN_IF_NOT_BATTLE(nullptr);
auto stacks = battleGetStacksIf([=](const CStack * s)
{
return s->unitId() == unitId && (!onlyAlive || s->alive());
});
if(stacks.empty())
return nullptr;
else
return stacks[0];
}
bool CBattleInfoEssentials::battleDoWeKnowAbout(ui8 side) const
{
RETURN_IF_NOT_BATTLE(false);

View File

@ -102,7 +102,6 @@ public:
TStacks battleGetAllStacks(bool includeTurrets = false) const;
const CStack * battleGetStackByID(int ID, bool onlyAlive = true) const; //returns stack info by given ID
const CStack * battleGetStackByUnitId(int unitId, bool onlyAlive = true) const; //returns stack info by given ID
bool battleIsObstacleVisibleForSide(const CObstacleInstance & coi, BattlePerspective::BattlePerspective side) const;
///returns player that controls given stack; mind control included