mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Right-clicking dwellings will now show recruitable creatures (but not
their number) for all players
This commit is contained in:
parent
46669e78e8
commit
8ce6bcdf3b
@ -346,15 +346,19 @@ void CGDwelling::newTurn(CRandomGenerator & rand) const
|
||||
|
||||
std::vector<Component> CGDwelling::getPopupComponents(PlayerColor player) const
|
||||
{
|
||||
if (getOwner() != player)
|
||||
return {};
|
||||
bool visitedByOwner = getOwner() == player;
|
||||
|
||||
std::vector<Component> result;
|
||||
|
||||
if (ID == Obj::CREATURE_GENERATOR1 && !creatures.empty())
|
||||
{
|
||||
for (auto const & creature : creatures.front().second)
|
||||
result.emplace_back(ComponentType::CREATURE, creature, creatures.front().first);
|
||||
{
|
||||
if (visitedByOwner)
|
||||
result.emplace_back(ComponentType::CREATURE, creature, creatures.front().first);
|
||||
else
|
||||
result.emplace_back(ComponentType::CREATURE, creature);
|
||||
}
|
||||
}
|
||||
|
||||
if (ID == Obj::CREATURE_GENERATOR4)
|
||||
@ -362,7 +366,12 @@ std::vector<Component> CGDwelling::getPopupComponents(PlayerColor player) const
|
||||
for (auto const & creatureLevel : creatures)
|
||||
{
|
||||
if (!creatureLevel.second.empty())
|
||||
result.emplace_back(ComponentType::CREATURE, creatureLevel.second.back(), creatureLevel.first);
|
||||
{
|
||||
if (visitedByOwner)
|
||||
result.emplace_back(ComponentType::CREATURE, creatureLevel.second.back(), creatureLevel.first);
|
||||
else
|
||||
result.emplace_back(ComponentType::CREATURE, creatureLevel.second.back());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user