|
@@ -48,7 +48,7 @@
|
|
|
|
|
|
BattleWindow::BattleWindow(BattleInterface & owner):
|
|
|
owner(owner),
|
|
|
- defaultAction(PossiblePlayerBattleAction::INVALID)
|
|
|
+ lastAlternativeAction(PossiblePlayerBattleAction::INVALID)
|
|
|
{
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
|
|
pos.w = 800;
|
|
@@ -568,14 +568,18 @@ void BattleWindow::showAlternativeActionIcon(PossiblePlayerBattleAction action)
|
|
|
|
|
|
void BattleWindow::setAlternativeActions(const std::list<PossiblePlayerBattleAction> & actions)
|
|
|
{
|
|
|
+ assert(actions.size() != 1);
|
|
|
+
|
|
|
alternativeActions = actions;
|
|
|
- defaultAction = PossiblePlayerBattleAction::INVALID;
|
|
|
+ lastAlternativeAction = PossiblePlayerBattleAction::INVALID;
|
|
|
+
|
|
|
if(alternativeActions.size() > 1)
|
|
|
- defaultAction = alternativeActions.back();
|
|
|
- if(!alternativeActions.empty())
|
|
|
+ {
|
|
|
+ lastAlternativeAction = alternativeActions.back();
|
|
|
showAlternativeActionIcon(alternativeActions.front());
|
|
|
+ }
|
|
|
else
|
|
|
- showAlternativeActionIcon(defaultAction);
|
|
|
+ showAlternativeActionIcon(PossiblePlayerBattleAction::INVALID);
|
|
|
}
|
|
|
|
|
|
void BattleWindow::bAutofightf()
|
|
@@ -670,23 +674,18 @@ void BattleWindow::bSwitchActionf()
|
|
|
{
|
|
|
if(alternativeActions.empty())
|
|
|
return;
|
|
|
-
|
|
|
- if(alternativeActions.front() == defaultAction)
|
|
|
- {
|
|
|
- alternativeActions.push_back(alternativeActions.front());
|
|
|
- alternativeActions.pop_front();
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
auto actions = owner.actionsController->getPossibleActions();
|
|
|
- if(!actions.empty() && actions.front() == alternativeActions.front())
|
|
|
+
|
|
|
+ if(!actions.empty() && actions.front() != lastAlternativeAction)
|
|
|
{
|
|
|
owner.actionsController->removePossibleAction(alternativeActions.front());
|
|
|
- showAlternativeActionIcon(defaultAction);
|
|
|
+ showAlternativeActionIcon(*std::next(alternativeActions.begin()));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- owner.actionsController->pushFrontPossibleAction(alternativeActions.front());
|
|
|
- showAlternativeActionIcon(alternativeActions.front());
|
|
|
+ owner.actionsController->resetCurrentStackPossibleActions();
|
|
|
+ showAlternativeActionIcon(owner.actionsController->getPossibleActions().front());
|
|
|
}
|
|
|
|
|
|
alternativeActions.push_back(alternativeActions.front());
|