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:
parent
4a23f93754
commit
68be7643f1
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user