Minor code cleanup in ActionStack
This commit is contained in:
@@ -493,9 +493,9 @@ void LifeAction::Render()
|
|||||||
mFont->SetBase(0);
|
mFont->SetBase(0);
|
||||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
if(amount >= 0)
|
if(amount > 0)
|
||||||
sprintf(buffer, _("Player gains %i life").c_str(), amount);
|
sprintf(buffer, _("Player gains %i life").c_str(), amount);
|
||||||
else if(amount >= 0)
|
else if(amount < 0)
|
||||||
sprintf(buffer, _("Player loses %i life").c_str(), amount);
|
sprintf(buffer, _("Player loses %i life").c_str(), amount);
|
||||||
else
|
else
|
||||||
sprintf(buffer, _("Nothing happened").c_str(), amount);
|
sprintf(buffer, _("Nothing happened").c_str(), amount);
|
||||||
@@ -552,14 +552,11 @@ int ActionStack::AddNextGamePhase()
|
|||||||
{
|
{
|
||||||
if (getNext(NULL, NOT_RESOLVED))
|
if (getNext(NULL, NOT_RESOLVED))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
NextGamePhase * next = NEW NextGamePhase(mCount);
|
NextGamePhase * next = NEW NextGamePhase(mCount);
|
||||||
addAction(next);
|
addAction(next);
|
||||||
int playerId = 0;
|
|
||||||
game->currentActionPlayer = game->GetInstance()->currentActionPlayer;
|
game->currentActionPlayer = game->GetInstance()->currentActionPlayer;
|
||||||
if (game->currentActionPlayer == game->players[1])
|
int playerId = (game->currentActionPlayer == game->players[1]) ? 1 : 0;
|
||||||
{
|
|
||||||
playerId = 1;
|
|
||||||
}
|
|
||||||
interruptDecision[playerId] = 1;
|
interruptDecision[playerId] = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -568,6 +565,7 @@ int ActionStack::AddNextCombatStep()
|
|||||||
{
|
{
|
||||||
if (getNext(NULL, NOT_RESOLVED))
|
if (getNext(NULL, NOT_RESOLVED))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
NextGamePhase * next = NEW NextGamePhase(mCount);
|
NextGamePhase * next = NEW NextGamePhase(mCount);
|
||||||
addAction(next);
|
addAction(next);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -575,14 +573,8 @@ int ActionStack::AddNextCombatStep()
|
|||||||
|
|
||||||
int ActionStack::setIsInterrupting(Player * player)
|
int ActionStack::setIsInterrupting(Player * player)
|
||||||
{
|
{
|
||||||
if (player == game->players[0])
|
int playerId = (player == game->players[1]) ? 1 : 0;
|
||||||
{
|
interruptDecision[playerId] = -1;
|
||||||
interruptDecision[0] = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
interruptDecision[1] = -1;
|
|
||||||
}
|
|
||||||
game->isInterrupting = player;
|
game->isInterrupting = player;
|
||||||
askIfWishesToInterrupt = NULL;
|
askIfWishesToInterrupt = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -608,10 +600,6 @@ Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, Man
|
|||||||
{
|
{
|
||||||
mana = NULL;
|
mana = NULL;
|
||||||
}
|
}
|
||||||
if (mana < 0)
|
|
||||||
{
|
|
||||||
mana = 0;
|
|
||||||
}
|
|
||||||
Spell * spell = NEW Spell(mCount, _source, tc, mana, payResult);
|
Spell * spell = NEW Spell(mCount, _source, tc, mana, payResult);
|
||||||
addAction(spell);
|
addAction(spell);
|
||||||
if (!game->players[0]->isAI() && _source->controller() == game->players[0] && 0 == options[Options::INTERRUPTMYSPELLS].number)
|
if (!game->players[0]->isAI() && _source->controller() == game->players[0] && 0 == options[Options::INTERRUPTMYSPELLS].number)
|
||||||
@@ -760,6 +748,7 @@ int ActionStack::count(int type, int state, int display)
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionStack::getActionElementFromCard(MTGCardInstance * card)
|
int ActionStack::getActionElementFromCard(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -939,6 +928,7 @@ void ActionStack::Update(float dt)
|
|||||||
extraTime = count(0, NOT_RESOLVED, 0);
|
extraTime = count(0, NOT_RESOLVED, 0);
|
||||||
if (extraTime == 0)
|
if (extraTime == 0)
|
||||||
extraTime = 1;//we never want this int to be 0.
|
extraTime = 1;//we never want this int to be 0.
|
||||||
|
|
||||||
if (timer < 0)
|
if (timer < 0)
|
||||||
timer = options[Options::INTERRUPT_SECONDS].number * extraTime;
|
timer = options[Options::INTERRUPT_SECONDS].number * extraTime;
|
||||||
timer -= dt;
|
timer -= dt;
|
||||||
@@ -950,14 +940,8 @@ void ActionStack::Update(float dt)
|
|||||||
|
|
||||||
void ActionStack::cancelInterruptOffer(int cancelMode)
|
void ActionStack::cancelInterruptOffer(int cancelMode)
|
||||||
{
|
{
|
||||||
if (game->isInterrupting == game->players[0])
|
int playerId = (game->isInterrupting == game->players[1]) ? 1 : 0;
|
||||||
{
|
interruptDecision[playerId] = cancelMode;
|
||||||
interruptDecision[0] = cancelMode;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
interruptDecision[1] = cancelMode;
|
|
||||||
}
|
|
||||||
askIfWishesToInterrupt = NULL;
|
askIfWishesToInterrupt = NULL;
|
||||||
game->isInterrupting = NULL;
|
game->isInterrupting = NULL;
|
||||||
timer = -1;
|
timer = -1;
|
||||||
@@ -965,14 +949,8 @@ void ActionStack::cancelInterruptOffer(int cancelMode)
|
|||||||
|
|
||||||
void ActionStack::endOfInterruption()
|
void ActionStack::endOfInterruption()
|
||||||
{
|
{
|
||||||
if (game->isInterrupting == game->players[0])
|
int playerId = (game->isInterrupting == game->players[1]) ? 1 : 0;
|
||||||
{
|
interruptDecision[playerId] = 0;
|
||||||
interruptDecision[0] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
interruptDecision[1] = 0;
|
|
||||||
}
|
|
||||||
game->isInterrupting = NULL;
|
game->isInterrupting = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user