[-] Fixed bug with rescued units icon drawing
This commit is contained in:
parent
9cfdae4f6a
commit
9c365ee68d
3 changed files with 9 additions and 9 deletions
|
@ -792,7 +792,7 @@ void CButtonPanel::Draw()
|
|||
} else {
|
||||
int player = -1;
|
||||
if (Selected.empty() == false && Selected[0]->IsAlive()) {
|
||||
player = Selected[0]->Player->Index;
|
||||
player = Selected[0]->RescuedFrom ? Selected[0]->RescuedFrom->Index : Selected[0]->Player->Index;
|
||||
}
|
||||
buttons[i].Icon.Icon->DrawUnitIcon(*UI.ButtonPanel.Buttons[i].Style,
|
||||
GetButtonStatus(buttons[i], ButtonUnderCursor),
|
||||
|
|
|
@ -245,7 +245,7 @@ static const CUnit *GetUnitRef(const CUnit &unit, EnumUnit e)
|
|||
const CUnit *unitToDraw = GetUnitRef(unit, this->UnitRef);
|
||||
|
||||
if (unitToDraw && unitToDraw->Type->Icon.Icon) {
|
||||
unitToDraw->Type->Icon.Icon->DrawIcon(this->Pos, unitToDraw->Player->Index);
|
||||
unitToDraw->Type->Icon.Icon->DrawIcon(this->Pos, unitToDraw->RescuedFrom ? unitToDraw->RescuedFrom->Index : unitToDraw->Player->Index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ static void DrawUnitInfo_Training(const CUnit &unit)
|
|||
const unsigned int flags = (ButtonAreaUnderCursor == ButtonAreaTraining && ButtonUnderCursor == 0) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
const PixelPos pos(UI.SingleTrainingButton->X, UI.SingleTrainingButton->Y);
|
||||
icon.DrawUnitIcon(*UI.SingleTrainingButton->Style, flags, pos, "", unit.Player->Index);
|
||||
icon.DrawUnitIcon(*UI.SingleTrainingButton->Style, flags, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
|
||||
}
|
||||
} else {
|
||||
if (!UI.TrainingText.empty()) {
|
||||
|
@ -374,7 +374,7 @@ static void DrawUnitInfo_Training(const CUnit &unit)
|
|||
&& static_cast<size_t>(ButtonUnderCursor) == i) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
const PixelPos pos(UI.TrainingButtons[i].X, UI.TrainingButtons[i].Y);
|
||||
icon.DrawUnitIcon(*UI.TrainingButtons[i].Style, flag, pos, "", unit.Player->Index);
|
||||
icon.DrawUnitIcon(*UI.TrainingButtons[i].Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ static void DrawUnitInfo_portrait(const CUnit &unit)
|
|||
const int flag = (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
|
||||
type.Icon.Icon->DrawUnitIcon(*UI.SingleSelectedButton->Style, flag, pos, "", unit.Player->Index);
|
||||
type.Icon.Icon->DrawUnitIcon(*UI.SingleSelectedButton->Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ static bool DrawUnitInfo_single_selection(const CUnit &unit)
|
|||
&& ButtonUnderCursor == 0) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
const PixelPos pos(UI.UpgradingButton->X, UI.UpgradingButton->Y);
|
||||
icon.DrawUnitIcon(*UI.UpgradingButton->Style, flag, pos, "", unit.Player->Index);
|
||||
icon.DrawUnitIcon(*UI.UpgradingButton->Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ static bool DrawUnitInfo_single_selection(const CUnit &unit)
|
|||
&& ButtonUnderCursor == 0) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
PixelPos pos(UI.ResearchingButton->X, UI.ResearchingButton->Y);
|
||||
icon.DrawUnitIcon(*UI.ResearchingButton->Style, flag, pos, "", unit.Player->Index);
|
||||
icon.DrawUnitIcon(*UI.ResearchingButton->Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ static void DrawUnitInfo_transporter(CUnit &unit)
|
|||
int flag = (ButtonAreaUnderCursor == ButtonAreaTransporting && static_cast<size_t>(ButtonUnderCursor) == j) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0;
|
||||
const PixelPos pos(UI.TransportingButtons[j].X, UI.TransportingButtons[j].Y);
|
||||
icon.DrawUnitIcon(*UI.TransportingButtons[j].Style, flag, pos, "", uins->Player->Index);
|
||||
icon.DrawUnitIcon(*UI.TransportingButtons[j].Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : uins->Player->Index);
|
||||
UiDrawLifeBar(*uins, pos.x, pos.y);
|
||||
if (uins->Type->CanCastSpell && uins->Variable[MANA_INDEX].Max) {
|
||||
UiDrawManaBar(*uins, pos.x, pos.y);
|
||||
|
@ -1156,7 +1156,7 @@ static void InfoPanel_draw_multiple_selection()
|
|||
icon.DrawUnitIcon(*UI.SelectedButtons[i].Style,
|
||||
(ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int)i) ?
|
||||
(IconActive | (MouseButtons & LeftButton)) : 0,
|
||||
pos, "", Selected[i]->Player->Index);
|
||||
pos, "", Selected[i]->RescuedFrom ? Selected[i]->RescuedFrom->Index : Selected[i]->Player->Index);
|
||||
UiDrawLifeBar(*Selected[i], UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);
|
||||
|
||||
if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int) i) {
|
||||
|
|
Loading…
Reference in a new issue