- Removing "mCount" variable from GuiLayers
This commit is contained in:
@@ -2658,7 +2658,7 @@ public:
|
|||||||
void livingWeaponToken(MTGCardInstance * card)
|
void livingWeaponToken(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
GameObserver * g = g->GetInstance();
|
GameObserver * g = g->GetInstance();
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
if (a->aType == MTGAbility::STANDARD_EQUIP && a->source == source)
|
if (a->aType == MTGAbility::STANDARD_EQUIP && a->source == source)
|
||||||
@@ -3908,7 +3908,7 @@ public:
|
|||||||
if (canprevent)
|
if (canprevent)
|
||||||
{
|
{
|
||||||
ActionStack * stack = game->mLayers->stackLayer();
|
ActionStack * stack = game->mLayers->stackLayer();
|
||||||
for (int i = stack->mCount - 1; i >= 0; i--)
|
for (int i = stack->mObjects.size() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (!canprevent) return 1;
|
if (!canprevent) return 1;
|
||||||
Interruptible * current = ((Interruptible *) stack->mObjects[i]);
|
Interruptible * current = ((Interruptible *) stack->mObjects[i]);
|
||||||
@@ -3920,7 +3920,7 @@ public:
|
|||||||
else if (current->type == ACTION_DAMAGES && current->state == NOT_RESOLVED)
|
else if (current->type == ACTION_DAMAGES && current->state == NOT_RESOLVED)
|
||||||
{
|
{
|
||||||
DamageStack * damages = (DamageStack *) current;
|
DamageStack * damages = (DamageStack *) current;
|
||||||
for (int j = damages->mCount - 1; j >= 0; j--)
|
for (int j = damages->mObjects.size() - 1; j >= 0; j--)
|
||||||
{
|
{
|
||||||
alterDamage(((Damage *) damages->mObjects[j]));
|
alterDamage(((Damage *) damages->mObjects[j]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class GuiLayer
|
|||||||
protected:
|
protected:
|
||||||
JButton mActionButton;
|
JButton mActionButton;
|
||||||
public:
|
public:
|
||||||
int mCount;
|
|
||||||
int mCurr;
|
int mCurr;
|
||||||
vector<JGuiObject *> mObjects;
|
vector<JGuiObject *> mObjects;
|
||||||
void Add(JGuiObject * object);
|
void Add(JGuiObject * object);
|
||||||
@@ -39,7 +38,7 @@ public:
|
|||||||
virtual void Render();
|
virtual void Render();
|
||||||
int empty()
|
int empty()
|
||||||
{
|
{
|
||||||
if (mCount)
|
if (mObjects.size())
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ vector<MTGAbility *> AIHints::findAbilities(AIHint * hint)
|
|||||||
std::vector<MTGAbility *> elems;
|
std::vector<MTGAbility *> elems;
|
||||||
ActionLayer * al = GameObserver::GetInstance()->mLayers->actionLayer();
|
ActionLayer * al = GameObserver::GetInstance()->mLayers->actionLayer();
|
||||||
|
|
||||||
for (int i = 1; i < al->mCount; i++) //0 is not a mtgability...hackish
|
for (size_t i = 1; i < al->mObjects.size(); i++) //0 is not a mtgability...hackish
|
||||||
{
|
{
|
||||||
MTGAbility * a = ((MTGAbility *) al->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) al->mObjects[i]);
|
||||||
if (abilityMatches(a, hint))
|
if (abilityMatches(a, hint))
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ bool AIPlayer::tapLandsForMana(ManaCost * cost, MTGCardInstance * target)
|
|||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
|
|
||||||
map<MTGCardInstance *, bool> used;
|
map<MTGCardInstance *, bool> used;
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{ //0 is not a mtgability...hackish
|
{ //0 is not a mtgability...hackish
|
||||||
//Make sure we can use the ability
|
//Make sure we can use the ability
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
@@ -190,7 +190,7 @@ ManaCost * AIPlayer::getPotentialMana(MTGCardInstance * target)
|
|||||||
ManaCost * result = NEW ManaCost();
|
ManaCost * result = NEW ManaCost();
|
||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
map<MTGCardInstance *, bool> used;
|
map<MTGCardInstance *, bool> used;
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{ //0 is not a mtgability...hackish
|
{ //0 is not a mtgability...hackish
|
||||||
//Make sure we can use the ability
|
//Make sure we can use the ability
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
@@ -841,7 +841,7 @@ int AIPlayer::selectAbility()
|
|||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
//This loop is extrmely inefficient. TODO: optimize!
|
//This loop is extrmely inefficient. TODO: optimize!
|
||||||
ManaCost * totalPotentialMana = getPotentialMana();
|
ManaCost * totalPotentialMana = getPotentialMana();
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{ //0 is not a mtgability...hackish
|
{ //0 is not a mtgability...hackish
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
//Skip mana abilities for performance
|
//Skip mana abilities for performance
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ int AIStats::receiveEvent(WEvent * event)
|
|||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
//Lords
|
//Lords
|
||||||
map<MTGCardInstance *, int> lords;
|
map<MTGCardInstance *, int> lords;
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{ //0 is not a mtgability...hackish
|
{ //0 is not a mtgability...hackish
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
if (ALord * al = dynamic_cast<ALord*>(a))
|
if (ALord * al = dynamic_cast<ALord*>(a))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
MTGAbility* ActionLayer::getAbility(int type)
|
MTGAbility* ActionLayer::getAbility(int type)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < mCount; i++)
|
for (size_t i = 1; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
MTGAbility * a = ((MTGAbility *) mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) mObjects[i]);
|
||||||
if (a->aType == type)
|
if (a->aType == type)
|
||||||
@@ -34,7 +34,6 @@ int ActionLayer::removeFromGame(ActionElement * e)
|
|||||||
return 0; //Should not happen, it means we deleted thesame object twice?
|
return 0; //Should not happen, it means we deleted thesame object twice?
|
||||||
|
|
||||||
mObjects.erase(mObjects.begin() + i);
|
mObjects.erase(mObjects.begin() + i);
|
||||||
mCount--;
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -88,7 +87,7 @@ bool ActionLayer::CheckUserInput(JButton key)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
{
|
{
|
||||||
@@ -110,7 +109,7 @@ void ActionLayer::Update(float dt)
|
|||||||
}
|
}
|
||||||
modal = 0;
|
modal = 0;
|
||||||
GameObserver* game = GameObserver::GetInstance();
|
GameObserver* game = GameObserver::GetInstance();
|
||||||
for (int i = mCount - 1; i >= 0; i--)
|
for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
//a dirty hack, there might be cases when the mObject array gets reshaped if an ability removes some of its children abilites
|
//a dirty hack, there might be cases when the mObject array gets reshaped if an ability removes some of its children abilites
|
||||||
if ((int) mObjects.size() <= i)
|
if ((int) mObjects.size() <= i)
|
||||||
@@ -128,7 +127,7 @@ void ActionLayer::Update(float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int newPhase = game->getCurrentGamePhase();
|
int newPhase = game->getCurrentGamePhase();
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
{
|
{
|
||||||
@@ -157,7 +156,7 @@ void ActionLayer::Render()
|
|||||||
abilitiesMenu->Render();
|
abilitiesMenu->Render();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
{
|
{
|
||||||
@@ -203,7 +202,7 @@ ActionElement * ActionLayer::isWaitingForAnswer()
|
|||||||
|
|
||||||
int ActionLayer::stillInUse(MTGCardInstance * card)
|
int ActionLayer::stillInUse(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
if (currentAction->stillInUse(card))
|
if (currentAction->stillInUse(card))
|
||||||
@@ -215,7 +214,7 @@ int ActionLayer::stillInUse(MTGCardInstance * card)
|
|||||||
int ActionLayer::receiveEventPlus(WEvent * event)
|
int ActionLayer::receiveEventPlus(WEvent * event)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
result += currentAction->receiveEvent(event);
|
result += currentAction->receiveEvent(event);
|
||||||
@@ -230,7 +229,7 @@ int ActionLayer::isReactingToTargetClick(Targetable * card)
|
|||||||
if (isWaitingForAnswer())
|
if (isWaitingForAnswer())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
result += currentAction->isReactingToTargetClick(card);
|
result += currentAction->isReactingToTargetClick(card);
|
||||||
@@ -246,7 +245,7 @@ int ActionLayer::reactToTargetClick(Targetable * card)
|
|||||||
if (ae)
|
if (ae)
|
||||||
return reactToTargetClick(ae, card);
|
return reactToTargetClick(ae, card);
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
result += currentAction->reactToTargetClick(card);
|
result += currentAction->reactToTargetClick(card);
|
||||||
@@ -262,7 +261,7 @@ int ActionLayer::isReactingToClick(MTGCardInstance * card)
|
|||||||
if (isWaitingForAnswer())
|
if (isWaitingForAnswer())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
if (currentAction->isReactingToClick(card))
|
if (currentAction->isReactingToClick(card))
|
||||||
@@ -315,7 +314,7 @@ void ActionLayer::setMenuObject(Targetable * object, bool must)
|
|||||||
|
|
||||||
abilitiesMenu = NEW SimpleMenu(10, this, Fonts::MAIN_FONT, 100, 100, object->getDisplayName().c_str());
|
abilitiesMenu = NEW SimpleMenu(10, this, Fonts::MAIN_FONT, 100, 100, object->getDisplayName().c_str());
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
if (currentAction->isReactingToTargetClick(object))
|
if (currentAction->isReactingToTargetClick(object))
|
||||||
|
|||||||
@@ -513,14 +513,14 @@ ostream& LifeAction::toString(ostream& out) const
|
|||||||
/* The Action Stack itself */
|
/* The Action Stack itself */
|
||||||
int ActionStack::addPutInGraveyard(MTGCardInstance * card)
|
int ActionStack::addPutInGraveyard(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
PutInGraveyard * death = NEW PutInGraveyard(mCount, card);
|
PutInGraveyard * death = NEW PutInGraveyard(mObjects.size(), card);
|
||||||
addAction(death);
|
addAction(death);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionStack::addAbility(MTGAbility * ability)
|
int ActionStack::addAbility(MTGAbility * ability)
|
||||||
{
|
{
|
||||||
StackAbility * stackAbility = NEW StackAbility(mCount, ability);
|
StackAbility * stackAbility = NEW StackAbility(mObjects.size(), ability);
|
||||||
int result = addAction(stackAbility);
|
int result = addAction(stackAbility);
|
||||||
if (!game->players[0]->isAI() && ability->source->controller() == game->players[0] && 0
|
if (!game->players[0]->isAI() && ability->source->controller() == game->players[0] && 0
|
||||||
== options[Options::INTERRUPTMYABILITIES].number)
|
== options[Options::INTERRUPTMYABILITIES].number)
|
||||||
@@ -530,14 +530,14 @@ int ActionStack::addAbility(MTGAbility * ability)
|
|||||||
|
|
||||||
int ActionStack::addDraw(Player * player, int nb_cards)
|
int ActionStack::addDraw(Player * player, int nb_cards)
|
||||||
{
|
{
|
||||||
DrawAction * draw = NEW DrawAction(mCount, player, nb_cards);
|
DrawAction * draw = NEW DrawAction(mObjects.size(), player, nb_cards);
|
||||||
addAction(draw);
|
addAction(draw);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionStack::addLife(Damageable * _target, int amount)
|
int ActionStack::addLife(Damageable * _target, int amount)
|
||||||
{
|
{
|
||||||
LifeAction * life = NEW LifeAction(mCount, _target, amount);
|
LifeAction * life = NEW LifeAction(mObjects.size(), _target, amount);
|
||||||
addAction(life);
|
addAction(life);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -556,7 +556,7 @@ 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(mObjects.size());
|
||||||
addAction(next);
|
addAction(next);
|
||||||
game->currentActionPlayer = game->GetInstance()->currentActionPlayer;
|
game->currentActionPlayer = game->GetInstance()->currentActionPlayer;
|
||||||
int playerId = (game->currentActionPlayer == game->players[1]) ? 1 : 0;
|
int playerId = (game->currentActionPlayer == game->players[1]) ? 1 : 0;
|
||||||
@@ -569,7 +569,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(mObjects.size());
|
||||||
addAction(next);
|
addAction(next);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -610,7 +610,7 @@ Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, Man
|
|||||||
{
|
{
|
||||||
mana = NULL;
|
mana = NULL;
|
||||||
}
|
}
|
||||||
Spell * spell = NEW Spell(mCount, _source, tc, mana, payResult);
|
Spell * spell = NEW Spell(mObjects.size(), _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)
|
||||||
interruptDecision[0] = DONT_INTERRUPT;
|
interruptDecision[0] = DONT_INTERRUPT;
|
||||||
@@ -619,11 +619,9 @@ Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, Man
|
|||||||
|
|
||||||
Interruptible * ActionStack::getAt(int id)
|
Interruptible * ActionStack::getAt(int id)
|
||||||
{
|
{
|
||||||
if (!mObjects.size())//nothing to get.
|
|
||||||
return NULL;
|
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
id = mCount + id;
|
id = mObjects.size() + id;
|
||||||
if (id > mCount - 1)
|
if (id > (int)(mObjects.size()) - 1 || id < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return (Interruptible *) mObjects[id];
|
return (Interruptible *) mObjects[id];
|
||||||
}
|
}
|
||||||
@@ -650,7 +648,7 @@ ActionStack::ActionStack(GameObserver* game)
|
|||||||
|
|
||||||
int ActionStack::has(MTGAbility * ability)
|
int ActionStack::has(MTGAbility * ability)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (((Interruptible *) mObjects[i])->type == ACTION_ABILITY)
|
if (((Interruptible *) mObjects[i])->type == ACTION_ABILITY)
|
||||||
{
|
{
|
||||||
@@ -664,7 +662,7 @@ int ActionStack::has(MTGAbility * ability)
|
|||||||
|
|
||||||
int ActionStack::has(Interruptible * action)
|
int ActionStack::has(Interruptible * action)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] == action)
|
if (mObjects[i] == action)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -724,7 +722,7 @@ int ActionStack::getPreviousIndex(Interruptible * next, int type, int state, int
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
if (!next)
|
if (!next)
|
||||||
found = 1;
|
found = 1;
|
||||||
for (int i = mCount - 1; i >= 0; i--)
|
for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (found && (type == 0 || current->type == type) && (state == 0 || current->state == state) && (display
|
if (found && (type == 0 || current->type == type) && (state == 0 || current->state == state) && (display
|
||||||
@@ -743,7 +741,7 @@ int ActionStack::getPreviousIndex(Interruptible * next, int type, int state, int
|
|||||||
int ActionStack::count(int type, int state, int display)
|
int ActionStack::count(int type, int state, int display)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if ((type == 0 || current->type == type) && (state == 0 || current->state == state) && (display == -1
|
if ((type == 0 || current->type == type) && (state == 0 || current->state == state) && (display == -1
|
||||||
@@ -760,7 +758,7 @@ int ActionStack::getActionElementFromCard(MTGCardInstance * card)
|
|||||||
|
|
||||||
if(!card)
|
if(!card)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (current->source == card)
|
if (current->source == card)
|
||||||
@@ -784,7 +782,7 @@ int ActionStack::getNextIndex(Interruptible * previous, int type, int state, int
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
if (!previous)
|
if (!previous)
|
||||||
found = 1;
|
found = 1;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (found && (type == 0 || current->type == type) && (state == 0 || current->state == state) && (display
|
if (found && (type == 0 || current->type == type) && (state == 0 || current->state == state) && (display
|
||||||
@@ -802,7 +800,7 @@ int ActionStack::getNextIndex(Interruptible * previous, int type, int state, int
|
|||||||
|
|
||||||
Interruptible * ActionStack::getLatest(int state)
|
Interruptible * ActionStack::getLatest(int state)
|
||||||
{
|
{
|
||||||
for (int i = mCount - 1; i >= 0; i--)
|
for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Interruptible * action = ((Interruptible *) mObjects[i]);
|
Interruptible * action = ((Interruptible *) mObjects[i]);
|
||||||
if (action->state == state)
|
if (action->state == state)
|
||||||
@@ -814,7 +812,7 @@ Interruptible * ActionStack::getLatest(int state)
|
|||||||
int ActionStack::receiveEventPlus(WEvent * event)
|
int ActionStack::receiveEventPlus(WEvent * event)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i = 0; i < mCount; ++i)
|
for (size_t i = 0; i < mObjects.size(); ++i)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
result += current->receiveEvent(event);
|
result += current->receiveEvent(event);
|
||||||
@@ -837,7 +835,7 @@ void ActionStack::Update(float dt)
|
|||||||
if (mode == ACTIONSTACK_STANDARD && tc && !checked)
|
if (mode == ACTIONSTACK_STANDARD && tc && !checked)
|
||||||
{
|
{
|
||||||
checked = 1;
|
checked = 1;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (tc->canTarget(current))
|
if (tc->canTarget(current))
|
||||||
@@ -1057,7 +1055,6 @@ int ActionStack::garbageCollect()
|
|||||||
if (current->state != NOT_RESOLVED)
|
if (current->state != NOT_RESOLVED)
|
||||||
{
|
{
|
||||||
iter = mObjects.erase(iter);
|
iter = mObjects.erase(iter);
|
||||||
mCount--;
|
|
||||||
SAFE_DELETE(current);
|
SAFE_DELETE(current);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1095,7 +1092,7 @@ void ActionStack::Render()
|
|||||||
if (!askIfWishesToInterrupt || !askIfWishesToInterrupt->displayStack())
|
if (!askIfWishesToInterrupt || !askIfWishesToInterrupt->displayStack())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (current->state == NOT_RESOLVED)
|
if (current->state == NOT_RESOLVED)
|
||||||
@@ -1147,7 +1144,7 @@ void ActionStack::Render()
|
|||||||
mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 6);
|
mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 6);
|
||||||
currentx+= mFont->GetStringWidth(_(kNoString).c_str()) + kBeforeIconSpace;
|
currentx+= mFont->GetStringWidth(_(kNoString).c_str()) + kBeforeIconSpace;
|
||||||
|
|
||||||
if (mCount > 1)
|
if (mObjects.size() > 1)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
currentx+= kIconHorizontalOffset;
|
currentx+= kIconHorizontalOffset;
|
||||||
@@ -1158,7 +1155,7 @@ void ActionStack::Render()
|
|||||||
|
|
||||||
currenty += kIconVerticalOffset + kSpacer;
|
currenty += kIconVerticalOffset + kSpacer;
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (current && current->state == NOT_RESOLVED)
|
if (current && current->state == NOT_RESOLVED)
|
||||||
@@ -1173,7 +1170,7 @@ void ActionStack::Render()
|
|||||||
}
|
}
|
||||||
else if (mode == ACTIONSTACK_TARGET && modal)
|
else if (mode == ACTIONSTACK_TARGET && modal)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (current->display)
|
if (current->display)
|
||||||
@@ -1188,13 +1185,13 @@ void ActionStack::Render()
|
|||||||
renderer->FillRect(x0, y0, width, height, ARGB(200,0,0,0));
|
renderer->FillRect(x0, y0, width, height, ARGB(200,0,0,0));
|
||||||
renderer->DrawRect(x0 - 1, y0 - 1, width + 2, height + 2, ARGB(255,255,255,255));
|
renderer->DrawRect(x0 - 1, y0 - 1, width + 2, height + 2, ARGB(255,255,255,255));
|
||||||
|
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *) mObjects[i];
|
Interruptible * current = (Interruptible *) mObjects[i];
|
||||||
if (mObjects[i] != NULL && current->display)
|
if (mObjects[i] != NULL && current->display)
|
||||||
{
|
{
|
||||||
((Interruptible *) mObjects[i])->x = x0 + 5;
|
((Interruptible *) mObjects[i])->x = x0 + 5;
|
||||||
if (i != mCount - 1)
|
if (i != mObjects.size() - 1)
|
||||||
{
|
{
|
||||||
((Interruptible *) mObjects[i])->y = currenty;
|
((Interruptible *) mObjects[i])->y = currenty;
|
||||||
currenty += ((Interruptible *) mObjects[i])->mHeight;
|
currenty += ((Interruptible *) mObjects[i])->mHeight;
|
||||||
@@ -1264,7 +1261,7 @@ void Interruptible::Dump()
|
|||||||
void ActionStack::Dump()
|
void ActionStack::Dump()
|
||||||
{
|
{
|
||||||
DebugTrace("=====\nDumping Action Stack=====");
|
DebugTrace("=====\nDumping Action Stack=====");
|
||||||
for (int i=0;i<mCount;i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Interruptible * current = (Interruptible *)mObjects[i];
|
Interruptible * current = (Interruptible *)mObjects[i];
|
||||||
current->Dump();
|
current->Dump();
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ int AANewTarget::resolve()
|
|||||||
{
|
{
|
||||||
reUp->resolve();
|
reUp->resolve();
|
||||||
GameObserver * g = g->GetInstance();
|
GameObserver * g = g->GetInstance();
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||||
@@ -2845,7 +2845,7 @@ int ALoseAbilities::addToGame()
|
|||||||
|
|
||||||
ActionLayer * al = game->mLayers->actionLayer();
|
ActionLayer * al = game->mLayers->actionLayer();
|
||||||
|
|
||||||
for (int i = al->mCount - 1; i > 0; i--) //0 is not a mtgability...hackish
|
for (int i = (int)(al->mObjects.size()) - 1; i > 0; i--) //0 is not a mtgability...hackish
|
||||||
{
|
{
|
||||||
if (al->mObjects[i])
|
if (al->mObjects[i])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ CardDisplay::CardDisplay(int id, GameObserver* game, int _x, int _y, JGuiListene
|
|||||||
|
|
||||||
void CardDisplay::AddCard(MTGCardInstance * _card)
|
void CardDisplay::AddCard(MTGCardInstance * _card)
|
||||||
{
|
{
|
||||||
CardGui * card = NEW CardView(CardView::nullZone, _card, static_cast<float> (x + 20 + (mCount - start_item) * 30),
|
CardGui * card = NEW CardView(CardView::nullZone, _card, static_cast<float> (x + 20 + (mObjects.size() - start_item) * 30),
|
||||||
static_cast<float> (y + 25));
|
static_cast<float> (y + 25));
|
||||||
Add(card);
|
Add(card);
|
||||||
}
|
}
|
||||||
@@ -48,13 +48,13 @@ void CardDisplay::init(MTGGameZone * zone)
|
|||||||
{
|
{
|
||||||
AddCard(zone->cards[i]);
|
AddCard(zone->cards[i]);
|
||||||
}
|
}
|
||||||
if (mCount) mObjects[0]->Entering();
|
if (mObjects.size()) mObjects[0]->Entering();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDisplay::rotateLeft()
|
void CardDisplay::rotateLeft()
|
||||||
{
|
{
|
||||||
if (start_item == 0) return;
|
if (start_item == 0) return;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
CardGui * cardg = (CardGui *) mObjects[i];
|
CardGui * cardg = (CardGui *) mObjects[i];
|
||||||
cardg->x += 30;
|
cardg->x += 30;
|
||||||
@@ -64,8 +64,8 @@ void CardDisplay::rotateLeft()
|
|||||||
|
|
||||||
void CardDisplay::rotateRight()
|
void CardDisplay::rotateRight()
|
||||||
{
|
{
|
||||||
if (start_item == mCount - 1) return;
|
if (start_item == (int)(mObjects.size()) - 1) return;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
CardGui * cardg = (CardGui *) mObjects[i];
|
CardGui * cardg = (CardGui *) mObjects[i];
|
||||||
cardg->x -= 30;
|
cardg->x -= 30;
|
||||||
@@ -80,7 +80,7 @@ void CardDisplay::Update(float dt)
|
|||||||
if (zone)
|
if (zone)
|
||||||
{
|
{
|
||||||
int size = zone->cards.size();
|
int size = zone->cards.size();
|
||||||
for (int i = start_item; i < start_item + nb_displayed_items && i < mCount; i++)
|
for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++)
|
||||||
{
|
{
|
||||||
if (i > size - 1)
|
if (i > size - 1)
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,7 @@ bool CardDisplay::CheckUserInput(int x, int y)
|
|||||||
JButton key;
|
JButton key;
|
||||||
if (JGE::GetInstance()->GetLeftClickCoordinates(x, y))
|
if (JGE::GetInstance()->GetLeftClickCoordinates(x, y))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
float top, left;
|
float top, left;
|
||||||
if (mObjects[i]->getTopLeft(top, left))
|
if (mObjects[i]->getTopLeft(top, left))
|
||||||
@@ -127,9 +127,9 @@ bool CardDisplay::CheckUserInput(int x, int y)
|
|||||||
{
|
{
|
||||||
rotateLeft();
|
rotateLeft();
|
||||||
}
|
}
|
||||||
else if (n >= mCount && mCount > 0)
|
else if (n >= (int)(mObjects.size()) && mObjects.size())
|
||||||
{
|
{
|
||||||
n = mCount - 1;
|
n = mObjects.size() - 1;
|
||||||
}
|
}
|
||||||
if (n >= start_item + nb_displayed_items)
|
if (n >= start_item + nb_displayed_items)
|
||||||
{
|
{
|
||||||
@@ -158,7 +158,7 @@ bool CardDisplay::CheckUserInput(JButton key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mCount) return false;
|
if (!mObjects.size()) return false;
|
||||||
|
|
||||||
if (mActionButton == key)
|
if (mActionButton == key)
|
||||||
{
|
{
|
||||||
@@ -207,9 +207,9 @@ bool CardDisplay::CheckUserInput(JButton key)
|
|||||||
{
|
{
|
||||||
int n = mCurr;
|
int n = mCurr;
|
||||||
n++;
|
n++;
|
||||||
if (n >= mCount)
|
if (n >= (int) (mObjects.size()))
|
||||||
{
|
{
|
||||||
n = mCount - 1;
|
n = mObjects.size() - 1;
|
||||||
}
|
}
|
||||||
if (n >= start_item + nb_displayed_items)
|
if (n >= start_item + nb_displayed_items)
|
||||||
{
|
{
|
||||||
@@ -234,8 +234,8 @@ void CardDisplay::Render()
|
|||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||||
ARGB(255,255,255,255));
|
ARGB(255,255,255,255));
|
||||||
if (!mCount) return;
|
if (!mObjects.size()) return;
|
||||||
for (int i = start_item; i < start_item + nb_displayed_items && i < mCount; i++)
|
for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i])
|
if (mObjects[i])
|
||||||
{
|
{
|
||||||
@@ -256,7 +256,7 @@ void CardDisplay::Render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: CardSelector should handle the graveyard and the library in the future...
|
//TODO: CardSelector should handle the graveyard and the library in the future...
|
||||||
if (mCount && mObjects[mCurr] != NULL)
|
if (mObjects.size() && mObjects[mCurr] != NULL)
|
||||||
{
|
{
|
||||||
mObjects[mCurr]->Render();
|
mObjects[mCurr]->Render();
|
||||||
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
|
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ DamageStack::DamageStack()
|
|||||||
*/
|
*/
|
||||||
int DamageStack::resolve()
|
int DamageStack::resolve()
|
||||||
{
|
{
|
||||||
for (int i = mCount - 1; i >= 0; i--)
|
for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Damage * damage = (Damage*) mObjects[i];
|
Damage * damage = (Damage*) mObjects[i];
|
||||||
if (damage->state == NOT_RESOLVED)
|
if (damage->state == NOT_RESOLVED)
|
||||||
@@ -263,7 +263,7 @@ int DamageStack::receiveEvent(WEvent * e)
|
|||||||
if (!event)
|
if (!event)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (int i = mCount - 1; i >= 0; i--)
|
for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Damage * damage = (Damage*) mObjects[i];
|
Damage * damage = (Damage*) mObjects[i];
|
||||||
if (damage->state == RESOLVED_OK)
|
if (damage->state == RESOLVED_OK)
|
||||||
@@ -275,7 +275,7 @@ int DamageStack::receiveEvent(WEvent * e)
|
|||||||
void DamageStack::Render()
|
void DamageStack::Render()
|
||||||
{
|
{
|
||||||
float currenty = y;
|
float currenty = y;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
Damage * damage = (Damage*) mObjects[i];
|
Damage * damage = (Damage*) mObjects[i];
|
||||||
if (damage->state == NOT_RESOLVED)
|
if (damage->state == NOT_RESOLVED)
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ int GuiCombat::resolve() // Returns the number of damage objects dealt this turn
|
|||||||
for (vector<Damage>::iterator d = (*it)->damages.begin(); d != (*it)->damages.end(); ++d)
|
for (vector<Damage>::iterator d = (*it)->damages.begin(); d != (*it)->damages.end(); ++d)
|
||||||
stack->Add(NEW Damage(*d));
|
stack->Add(NEW Damage(*d));
|
||||||
}
|
}
|
||||||
int v = stack->mCount;
|
int v = stack->mObjects.size();
|
||||||
if (v > 0)
|
if (v > 0)
|
||||||
{
|
{
|
||||||
go->mLayers->stackLayer()->Add(stack);
|
go->mLayers->stackLayer()->Add(stack);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ GuiLayer::GuiLayer()
|
|||||||
{
|
{
|
||||||
modal = 0;
|
modal = 0;
|
||||||
hasFocus = false;
|
hasFocus = false;
|
||||||
mCount = 0;
|
|
||||||
mCurr = 0;
|
mCurr = 0;
|
||||||
mActionButton = JGE_BTN_OK;
|
mActionButton = JGE_BTN_OK;
|
||||||
}
|
}
|
||||||
@@ -20,18 +19,16 @@ GuiLayer::~GuiLayer()
|
|||||||
void GuiLayer::Add(JGuiObject *object)
|
void GuiLayer::Add(JGuiObject *object)
|
||||||
{
|
{
|
||||||
mObjects.push_back(object);
|
mObjects.push_back(object);
|
||||||
mCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GuiLayer::Remove(JGuiObject *object)
|
int GuiLayer::Remove(JGuiObject *object)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
if (mObjects[i] == object)
|
if (mObjects[i] == object)
|
||||||
{
|
{
|
||||||
delete mObjects[i];
|
delete mObjects[i];
|
||||||
mObjects.erase(mObjects.begin() + i);
|
mObjects.erase(mObjects.begin() + i);
|
||||||
mCount--;
|
if (mCurr == (int)(mObjects.size()))
|
||||||
if (mCurr == mCount)
|
|
||||||
mCurr = 0;
|
mCurr = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -40,26 +37,26 @@ int GuiLayer::Remove(JGuiObject *object)
|
|||||||
|
|
||||||
int GuiLayer::getMaxId()
|
int GuiLayer::getMaxId()
|
||||||
{
|
{
|
||||||
return mCount;
|
return (int) (mObjects.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiLayer::Render()
|
void GuiLayer::Render()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
mObjects[i]->Render();
|
mObjects[i]->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiLayer::Update(float dt)
|
void GuiLayer::Update(float dt)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
mObjects[i]->Update(dt);
|
mObjects[i]->Update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiLayer::resetObjects()
|
void GuiLayer::resetObjects()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
if (mObjects[i])
|
if (mObjects[i])
|
||||||
{
|
{
|
||||||
// big, ugly hack around CardView / MTGCardInstance ownership problem - these two classes have an interdependency with naked pointers,
|
// big, ugly hack around CardView / MTGCardInstance ownership problem - these two classes have an interdependency with naked pointers,
|
||||||
@@ -74,13 +71,12 @@ void GuiLayer::resetObjects()
|
|||||||
delete mObjects[i];
|
delete mObjects[i];
|
||||||
}
|
}
|
||||||
mObjects.clear();
|
mObjects.clear();
|
||||||
mCount = 0;
|
|
||||||
mCurr = 0;
|
mCurr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GuiLayer::getIndexOf(JGuiObject * object)
|
int GuiLayer::getIndexOf(JGuiObject * object)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] == object)
|
if (mObjects[i] == object)
|
||||||
return i;
|
return i;
|
||||||
|
|||||||
@@ -1974,10 +1974,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
sabilities.append(",");
|
sabilities.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oneShot || forceUEOT)
|
if (oneShot || forceUEOT || forceFOREVER)
|
||||||
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
|
|
||||||
|
|
||||||
if(forceFOREVER)
|
|
||||||
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
|
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
|
||||||
|
|
||||||
return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
|
return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
|
||||||
|
|||||||
@@ -1676,7 +1676,7 @@ int MTGStoneHewerRule::receiveEvent(WEvent * event)
|
|||||||
spell->resolve();
|
spell->resolve();
|
||||||
spell->source->isToken = 1;
|
spell->source->isToken = 1;
|
||||||
GameObserver * g = g->GetInstance();
|
GameObserver * g = g->GetInstance();
|
||||||
for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++)
|
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ int PlayGuiObjectController::getClosestItem(int direction)
|
|||||||
|
|
||||||
int PlayGuiObjectController::getClosestItem(int direction, float tolerance)
|
int PlayGuiObjectController::getClosestItem(int direction, float tolerance)
|
||||||
{
|
{
|
||||||
if (mCount == 0)
|
if (mObjects.size() == 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (mCount == 1)
|
if (mObjects.size() == 1)
|
||||||
{
|
{
|
||||||
return mCurr;
|
return mCurr;
|
||||||
}
|
}
|
||||||
@@ -30,9 +30,9 @@ int PlayGuiObjectController::getClosestItem(int direction, float tolerance)
|
|||||||
float x0, y0, x1, y1;
|
float x0, y0, x1, y1;
|
||||||
x0 = current->x;
|
x0 = current->x;
|
||||||
y0 = current->y;
|
y0 = current->y;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (i == mCurr) continue;
|
if ((int) i == mCurr) continue;
|
||||||
PlayGuiObject * other = (PlayGuiObject *) mObjects[i];
|
PlayGuiObject * other = (PlayGuiObject *) mObjects[i];
|
||||||
x1 = other->x;
|
x1 = other->x;
|
||||||
y1 = other->y;
|
y1 = other->y;
|
||||||
@@ -88,7 +88,7 @@ int PlayGuiObjectController::getClosestItem(int direction, float tolerance)
|
|||||||
void PlayGuiObjectController::Update(float dt)
|
void PlayGuiObjectController::Update(float dt)
|
||||||
{
|
{
|
||||||
last_user_move += dt;
|
last_user_move += dt;
|
||||||
for (int i = 0; i < mCount; i++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mObjects[i] != NULL)
|
if (mObjects[i] != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user