From afdeae69017ebd84ab446a77f15fcd1d5d67a4c0 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Thu, 16 Dec 2010 12:53:48 +0000 Subject: [PATCH] fixed some formatting issues. changed conditional for lord and thises evaluation from hardcoded value to length of the array being evaluated. This doesn't change current functionality, but minimizes code change if these arrays were ever to change in size. --- projects/mtg/src/GameStateDeckViewer.cpp | 5 +++-- projects/mtg/src/GuiCombat.cpp | 8 ++++---- projects/mtg/src/MTGAbility.cpp | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/mtg/src/GameStateDeckViewer.cpp b/projects/mtg/src/GameStateDeckViewer.cpp index 5f00b5f05..4aad865d0 100644 --- a/projects/mtg/src/GameStateDeckViewer.cpp +++ b/projects/mtg/src/GameStateDeckViewer.cpp @@ -1393,7 +1393,8 @@ void GameStateDeckViewer::Render() JRenderer * r = JRenderer::GetInstance(); r->ClearScreen(ARGB(0,0,0,0)); - if (displayed_deck == myDeck && mStage != STAGE_MENU) renderDeckBackground(); + if (displayed_deck == myDeck && mStage != STAGE_MENU) + renderDeckBackground(); int order[3] = { 1, 2, 3 }; if (mRotation < 0.5 && mRotation > -0.5) { @@ -1601,7 +1602,7 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId) break; case MENU_ITEM_SWITCH_DECKS_NO_SAVE: - updateDecks(); + //updateDecks(); mStage = STAGE_WELCOME; mSwitching = true; break; diff --git a/projects/mtg/src/GuiCombat.cpp b/projects/mtg/src/GuiCombat.cpp index 31beee54b..b7a4e5945 100644 --- a/projects/mtg/src/GuiCombat.cpp +++ b/projects/mtg/src/GuiCombat.cpp @@ -637,9 +637,9 @@ int GuiCombat::receiveEventMinus(WEvent* e) for (inner_iterator attacker = attackers.begin(); attacker != attackers.end(); ++attacker) autoaffectDamage(*attacker, step); for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it) - (*it)->show = ((*it)->card->has(Constants::DOUBLESTRIKE) || ((*it)->card->has(Constants::FIRSTSTRIKE) ^ (DAMAGE - == step))) && (((*it)->card->has(Constants::TRAMPLE) ? (size_t) 0 : (size_t) 1) - < (*it)->blockers.size()); + (*it)->show = ((*it)->card->has(Constants::DOUBLESTRIKE) + || ((*it)->card->has(Constants::FIRSTSTRIKE) ^ (DAMAGE == step))) + && (((*it)->card->has(Constants::TRAMPLE) ? (size_t) 0 : (size_t) 1) < (*it)->blockers.size()); repos (attackers.begin(), attackers.end(), 0); active = activeAtk = NULL; for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it) @@ -656,7 +656,7 @@ int GuiCombat::receiveEventMinus(WEvent* e) cursor_pos = ATK; } else - go->nextCombatStep(); + go->nextCombatStep(); return 1; case END_DAMAGE: step = END_DAMAGE; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 8d86ed3ac..33ccba4dd 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -708,7 +708,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG string thises[] = { "this(", "thisforeach(" }; found = string::npos; int i = -1; - for (int j = 0; j < 2; ++j) + for (int j = 0; j < thises->length(); ++j) { size_t found2 = s.find(thises[j]); if (found2 != string::npos && ((found == string::npos) || found2 < found)) @@ -792,7 +792,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG string lords[] = { "lord(", "foreach(", "aslongas(", "teach(", "all(" }; found = string::npos; i = -1; - for (int j = 0; j < 5; ++j) + for (int j = 0; j < lords->length(); ++j) { size_t found2 = s.find(lords[j]); if (found2 != string::npos && ((found == string::npos) || found2 < found))