diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 048213f2..004f091e 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -639,10 +639,9 @@ std::pairMenu::GetMemoryLeakReportInfo(){ } void Menu::CloseAllMenus(){ - if(stack.size()>0){ - stack.clear(); - }else{ - ERR("WARNING! Trying to close out no menu?? Why are we doing this?") + if(stack.size()==0)ERR("WARNING! Trying to close out no menu?? Why are we doing this?"); + while(stack.size()>0){ + CloseMenu(); } } diff --git a/Adventures in Lestoria/State_LevelComplete.cpp b/Adventures in Lestoria/State_LevelComplete.cpp index 191423ad..0b9da4e5 100644 --- a/Adventures in Lestoria/State_LevelComplete.cpp +++ b/Adventures in Lestoria/State_LevelComplete.cpp @@ -61,15 +61,18 @@ void State_LevelComplete::OnStateChange(GameState*prevState){ Component(MenuType::LEVEL_COMPLETE,"XP Bar")->ResetProgressBar(game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired()); accumulatedXP=game->GetPlayer()->GetAccumulatedXP(); game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP()); - for(const ItemMapData&data:game->GetCurrentMap().GetStageLoot()){ - uint8_t amountDiff=data.maxAmt-data.minAmt; - uint8_t randomAmt=data.maxAmt; - if(amountDiff>0){ //This check avoids division by zero. - randomAmt=util::random()%(amountDiff+1)+data.minAmt; - } - for(uint8_t rolls=0;rolls(LEVEL_COMPLETE,"Stage Complete Label")->GetLabel()!="Stage Summary"){ //If the label says stage summary, we didn't actually the level. Don't reward any stage items to the player. + for(const ItemMapData&data:game->GetCurrentMap().GetStageLoot()){ + uint8_t amountDiff=data.maxAmt-data.minAmt; + uint8_t randomAmt=data.maxAmt; + if(amountDiff>0){ //This check avoids division by zero. + randomAmt=util::random()%(amountDiff+1)+data.minAmt; + } + for(uint8_t rolls=0;rolls