mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Split army: dont highlight down garrison slots if there no visiting hero
Before UI always highlighted all slots in both town garrisons even if there no visiting here and you can't actually set army on these slots. Now garrison slots only highlighted if they're owned by us or our ally. If there no visiting hero in town then only suitable upper garrison slots will be highlighted.
This commit is contained in:
parent
078bf6c69c
commit
120301ecc8
@ -127,6 +127,14 @@ bool CGarrisonSlot::our() const
|
||||
return upg?(owner->owned[1]):(owner->owned[0]);
|
||||
}
|
||||
|
||||
bool CGarrisonSlot::ally() const
|
||||
{
|
||||
if(!getObj())
|
||||
return false;
|
||||
|
||||
return PlayerRelations::ALLIES == LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, getObj()->tempOwner);
|
||||
}
|
||||
|
||||
void CGarrisonSlot::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down && creature)
|
||||
@ -459,10 +467,10 @@ void CGarrisonInt::setSplittingMode(bool on)
|
||||
if (inSplittingMode || on)
|
||||
{
|
||||
for(CGarrisonSlot * slot : slotsUp)
|
||||
slot->setHighlight( ( on && (slot->creature == nullptr || slot->creature == getSelection()->creature)));
|
||||
slot->setHighlight( ( on && (slot->our() || slot->ally()) && (slot->creature == nullptr || slot->creature == getSelection()->creature)));
|
||||
|
||||
for(CGarrisonSlot * slot : slotsDown)
|
||||
slot->setHighlight( ( on && (slot->creature == nullptr || slot->creature == getSelection()->creature)));
|
||||
slot->setHighlight( ( on && (slot->our() || slot->ally()) && (slot->creature == nullptr || slot->creature == getSelection()->creature)));
|
||||
inSplittingMode = on;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
virtual void hover (bool on); //call-in
|
||||
const CArmedInstance * getObj() const;
|
||||
bool our() const;
|
||||
bool ally() const;
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void update();
|
||||
|
Loading…
Reference in New Issue
Block a user