* fixed some formatting

* pruned out unused local variables. 
----  There's no need to define something if it isn't going to be referenced. It consumes extra memory temporarily and more than anything is a potential cause for confusion down the road.
This commit is contained in:
techdragon.nguyen@gmail.com
2011-05-08 11:56:25 +00:00
parent 2c34aaf8a5
commit 82058e97c5
9 changed files with 21 additions and 29 deletions

View File

@@ -101,7 +101,7 @@ void DestroyGame(void)
return self; return self;
} }
-(id)initialize { - (id)initialize {
NSLog(@"EAGL View - initialize EAGL"); NSLog(@"EAGL View - initialize EAGL");

View File

@@ -4559,7 +4559,6 @@ public:
{ {
Interruptible * action = game->mLayers->stackLayer()->getAt(-1); Interruptible * action = game->mLayers->stackLayer()->getAt(-1);
Spell * spell = (Spell *) action;
AADrawer * draw = dynamic_cast <AADrawer *> (action); AADrawer * draw = dynamic_cast <AADrawer *> (action);
if (draw && draw->aType == MTGAbility::STANDARD_DRAW) if (draw && draw->aType == MTGAbility::STANDARD_DRAW)
return 1; return 1;

View File

@@ -910,7 +910,7 @@ AAMorph * AAMorph::clone() const
} }
// AADYNAMIC: dynamic ability builder // AADYNAMIC: dynamic ability builder
AADynamic::AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type,int effect,int who,int amountsource,MTGAbility * storedAbility, ManaCost * _cost) : AADynamic::AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type,int effect,int who,int amountsource,MTGAbility * storedAbility, ManaCost * _cost) :
ActivatedAbility(id, card, _cost, 0),type(type),effect(effect),who(who),amountsource(amountsource),eachother(eachother),storedAbility(storedAbility) ActivatedAbility(id, card, _cost, 0),type(type),effect(effect),who(who),amountsource(amountsource),storedAbility(storedAbility)
{ {
target = _target; target = _target;
sourceamount = 0; sourceamount = 0;
@@ -919,7 +919,6 @@ ActivatedAbility(id, card, _cost, 0),type(type),effect(effect),who(who),amountso
tosrc = false; tosrc = false;
menu = ""; menu = "";
OriginalSrc = source; OriginalSrc = source;
storedAbility = storedAbility;
clonedStored = NULL; clonedStored = NULL;
} }
@@ -2555,7 +2554,8 @@ int ATransformer::addToGame()
((GenericActivatedAbility *)aNew)->source = _target; ((GenericActivatedAbility *)aNew)->source = _target;
((GenericActivatedAbility *)aNew)->ability->source = _target; ((GenericActivatedAbility *)aNew)->ability->source = _target;
} }
if (MultiAbility * abi = dynamic_cast<MultiAbility*>(aNew)) MultiAbility * abi = dynamic_cast<MultiAbility*>(aNew);
if (abi)
{ {
((MultiAbility *)aNew)->source = _target; ((MultiAbility *)aNew)->source = _target;
((MultiAbility *)aNew)->abilities[0]->source = _target; ((MultiAbility *)aNew)->abilities[0]->source = _target;

View File

@@ -698,7 +698,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
++j; ++j;
} }
//Has X? //Has X?
if (int cost = manacost->hasX()) if (manacost->hasX())
{ {
char buffer[10]; char buffer[10];
sprintf(buffer, "X"); sprintf(buffer, "X");

View File

@@ -131,7 +131,8 @@ int Counters::removeCounter(const char * _name, int _power, int _toughness)
{ {
GameObserver * game = game->GetInstance(); GameObserver * game = game->GetInstance();
MTGCardInstance * copy = target->controller()->game->putInZone(target, target->currentZone, target->controller()->game->stack); MTGCardInstance * copy = target->controller()->game->putInZone(target, target->currentZone, target->controller()->game->stack);
Spell * spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL,1, 0);
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL,1, 0);
game->targetChooser = NULL; game->targetChooser = NULL;
} }
return mCount; return mCount;

View File

@@ -184,8 +184,8 @@ bool isSpell(CardView* c)
} }
void GuiPlay::Replace() void GuiPlay::Replace()
{ {
unsigned opponentSpellsN = 0, selfSpellsN = 0, opponentLandsN = 0, opponentCreaturesN = 0, battleFieldAttackersN = 0, unsigned opponentSpellsN = 0, selfSpellsN = 0, opponentLandsN = 0, opponentCreaturesN = 0,
battleFieldBlockersN = 0, selfCreaturesN = 0, selfLandsN = 0, selfPlaneswalkern = 0,opponentPlaneswalkern = 0; battleFieldAttackersN = 0, battleFieldBlockersN = 0, selfCreaturesN = 0, selfLandsN = 0;
end_spells = stable_partition(cards.begin(), cards.end(), &isSpell); end_spells = stable_partition(cards.begin(), cards.end(), &isSpell);

View File

@@ -860,7 +860,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
// figure out alternative cost effects // figure out alternative cost effects
string keyword; string keyword;
int costType = -1;
for (size_t i = 0; i < sizeof(kAlternateCostIds)/sizeof(kAlternateCostIds[0]); ++i) for (size_t i = 0; i < sizeof(kAlternateCostIds)/sizeof(kAlternateCostIds[0]); ++i)
{ {
@@ -1813,7 +1813,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
TargetChooserFactory tcf; TargetChooserFactory tcf;
TargetChooser * castTargets = tcf.createTargetChooser(splitCast[1], card); TargetChooser * castTargets = tcf.createTargetChooser(splitCast[1], card);
size_t space = s.find(" ");
vector<string> splitValue = parseBetween(splitCast[2], "", " ", false); vector<string> splitValue = parseBetween(splitCast[2], "", " ", false);
if (!splitValue.size()) if (!splitValue.size())
{ {
@@ -1987,8 +1986,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
found = s.find("transforms(("); found = s.find("transforms((");
if (found != string::npos) if (found != string::npos)
{ {
string extraTransforms = ""; string extraTransforms = "";
size_t stypesStartIndex = found + 12;
string transformsParamsString = ""; string transformsParamsString = "";
transformsParamsString.append(storedString);//the string between found and real end is removed at start. transformsParamsString.append(storedString);//the string between found and real end is removed at start.
@@ -2575,7 +2573,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int
{ {
// Anything involving Mana Producing abilities cannot be interrupted // Anything involving Mana Producing abilities cannot be interrupted
MTGAbility * core = getCoreAbility(a); MTGAbility * core = getCoreAbility(a);
if (AManaProducer * amp = dynamic_cast<AManaProducer*> (core)) if (dynamic_cast<AManaProducer*> (core))
a->canBeInterrupted = false; a->canBeInterrupted = false;
a->addToGame(); a->addToGame();

View File

@@ -49,7 +49,6 @@ MTGAbility(_id,NULL)
} }
int MTGEventBonus::receiveEvent(WEvent * event) int MTGEventBonus::receiveEvent(WEvent * event)
{ {
Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer; Player * currentPlayer = game->currentPlayer;
//bonus for chain chain casting without tapping for mana or being interupted; //bonus for chain chain casting without tapping for mana or being interupted;
//note gaining mana from other sources is still possible. //note gaining mana from other sources is still possible.
@@ -532,7 +531,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
} }
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool()); ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
int payResult = player->getManaPool()->pay(withKickerCost); player->getManaPool()->pay(withKickerCost);
withKickerCost->doPayExtra(); withKickerCost->doPayExtra();
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool()); ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
delete withKickerCost; delete withKickerCost;
@@ -630,7 +629,7 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
return 0; return 0;
if(!allowedToAltCast(card,player)) if(!allowedToAltCast(card,player))
return 0; return 0;
card->getManaCost()->alternativeName;
if(card->model->data->getManaCost()->alternative && card->model->data->getManaCost()->alternative->alternativeName.size()) if(card->model->data->getManaCost()->alternative && card->model->data->getManaCost()->alternative->alternativeName.size())
alternativeName = card->model->data->getManaCost()->alternative->alternativeName; alternativeName = card->model->data->getManaCost()->alternative->alternativeName;
@@ -673,11 +672,9 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card)
return 0; return 0;
ManaCost *alternateCost = card->getManaCost()->alternative; ManaCost *alternateCost = card->getManaCost()->alternative;
Player * player = game->currentlyActing();
ManaCost * playerMana = player->getManaPool();
card->paymenttype = MTGAbility::ALTERNATIVE_COST; card->paymenttype = MTGAbility::ALTERNATIVE_COST;
return reactToClick(card, card->getManaCost()->alternative, ManaCost::MANA_PAID_WITH_ALTERNATIVE); return reactToClick(card, alternateCost, ManaCost::MANA_PAID_WITH_ALTERNATIVE);
} }
int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType){ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType){
@@ -789,8 +786,6 @@ int MTGBuyBackRule::reactToClick(MTGCardInstance * card)
if (!isReactingToClick(card)) if (!isReactingToClick(card))
return 0; return 0;
Player *player = game->currentlyActing();
ManaCost * playerMana = player->getManaPool();
ManaCost * alternateCost = card->getManaCost()->BuyBack; ManaCost * alternateCost = card->getManaCost()->BuyBack;
card->paymenttype = MTGAbility::BUYBACK_COST; card->paymenttype = MTGAbility::BUYBACK_COST;
@@ -838,9 +833,8 @@ int MTGFlashBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
int MTGFlashBackRule::reactToClick(MTGCardInstance * card) int MTGFlashBackRule::reactToClick(MTGCardInstance * card)
{ {
Player *player = game->currentlyActing();
ManaCost * alternateCost = card->getManaCost()->FlashBack; ManaCost * alternateCost = card->getManaCost()->FlashBack;
ManaCost * playerMana = game->currentlyActing()->getManaPool();
if (!isReactingToClick(card)) if (!isReactingToClick(card))
return 0; return 0;
@@ -896,8 +890,7 @@ int MTGRetraceRule::reactToClick(MTGCardInstance * card)
{ {
if (!isReactingToClick(card)) if (!isReactingToClick(card))
return 0; return 0;
Player *player = game->currentlyActing();
ManaCost * playerMana = player->getManaPool();
ManaCost * alternateCost = card->getManaCost()->Retrace; ManaCost * alternateCost = card->getManaCost()->Retrace;
card->paymenttype = MTGAbility::RETRACE_COST; card->paymenttype = MTGAbility::RETRACE_COST;
@@ -1039,7 +1032,7 @@ MTGMorphCostRule::MTGMorphCostRule(int _id) :
} }
int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{ {
int cardsinhand = game->players[0]->game->hand->nb_cards;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer; Player * currentPlayer = game->currentPlayer;
if (!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card))
@@ -1058,11 +1051,13 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if (currentPlayer->game->playRestrictions->canPutIntoZone(card, currentPlayer->game->stack) == PlayRestriction::CANT_PLAY) if (currentPlayer->game->playRestrictions->canPutIntoZone(card, currentPlayer->game->stack) == PlayRestriction::CANT_PLAY)
return 0; return 0;
ManaCost * playerMana = player->getManaPool(); ManaCost * playerMana = player->getManaPool();
ManaCost * cost = card->getManaCost();
ManaCost * morph = card->getManaCost()->morph; ManaCost * morph = card->getManaCost()->morph;
#ifdef WIN32 #ifdef WIN32
ManaCost * cost = card->getManaCost();
cost->Dump(); cost->Dump();
#endif #endif
//cost of card. //cost of card.
if (morph && playerMana->canAfford(morph)) if (morph && playerMana->canAfford(morph))
{ {

View File

@@ -1118,7 +1118,6 @@ bool WGuiTabMenu::CheckUserInput(JButton key)
{ {
bool result = false; bool result = false;
bool kidModal = false; bool kidModal = false;
bool handledInput = false;
int nbitems = (int) items.size(); int nbitems = (int) items.size();
JGE * mEngine = JGE::GetInstance(); JGE * mEngine = JGE::GetInstance();
int i, j; int i, j;