From ab9366f035cf8b4c7d71cbe0d09fa42ba9dd3810 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Thu, 4 Feb 2010 13:28:04 +0000 Subject: [PATCH] Erwan - fix issue 310 (exalted) - fix issue 312 (heap corruption) --- projects/mtg/bin/Res/test/_tests.txt | 1 + .../mtg/bin/Res/test/generic/exalted_i310.txt | 19 +++++++++++++++++++ projects/mtg/include/AllAbilities.h | 1 + projects/mtg/src/GameStateShop.cpp | 11 ++++++----- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 projects/mtg/bin/Res/test/generic/exalted_i310.txt diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 86e89341c..e97f43c2e 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -16,6 +16,7 @@ generic/equip_wither.txt generic/equipment_i252.txt generic/exalted.txt generic/exalted_i143.txt +generic/exalted_i310.txt generic/fear.txt generic/fear_i147.txt generic/first_and_double_strike1_i187.txt diff --git a/projects/mtg/bin/Res/test/generic/exalted_i310.txt b/projects/mtg/bin/Res/test/generic/exalted_i310.txt new file mode 100644 index 000000000..c6cb170f5 --- /dev/null +++ b/projects/mtg/bin/Res/test/generic/exalted_i310.txt @@ -0,0 +1,19 @@ +#NAME: Exalted i143 +#DESC: Exalted creature gets negaive bonus if it didn't attack alone +#see http://code.google.com/p/wagic/issues/detail?id=310 +[INIT] +combatattackers +[PLAYER1] +inplay:raging goblin,akrasan squire +[PLAYER2] +[DO] +raging goblin +akrasan squire +eot +[ASSERT] +untap +[PLAYER1] +inplay:raging goblin,akrasan squire +[PLAYER2] +life:18 +[END] diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index c248c4cf2..974ff69d1 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1564,6 +1564,7 @@ class AExalted:public TriggeredAbility{ } } if (nbattackers == 1) return 1; + else luckyWinner = NULL; } } return 0; diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index c51ef0f34..248374549 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -145,11 +145,13 @@ void GameStateShop::Update(float dt) // mParent->effect->UpdateSmall(dt); // mParent->effect->UpdateBig(dt); u32 btn; + if (menu){ + menu->Update(dt); + if (menu->closed) SAFE_DELETE(menu); + } switch(mStage){ case STAGE_SHOP_MENU: - if (menu){ - menu->Update(dt); - }else{ + if (!menu){ menu = NEW SimpleMenu(11,this,Constants::MENU_FONT,SCREEN_WIDTH/2-100,20); menu->Add(12,"Save & Back to Main Menu"); menu->Add(14,"See available tasks"); @@ -158,7 +160,6 @@ void GameStateShop::Update(float dt) break; case STAGE_SHOP_TASKS: if(menu){ - menu->Update(dt); return; } if(taskList){ @@ -263,6 +264,6 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId) default: mStage = STAGE_SHOP_SHOP; } - SAFE_DELETE(menu); + if (menu) menu->Close(); } }