- return to previous menu when tutorials / scenarios are empty

This commit is contained in:
Mark Vejvoda 2012-07-03 00:26:27 +00:00
parent a8af70cee1
commit 51d56926cc

View File

@ -172,17 +172,22 @@ void MenuStateScenario::mouseClick(int x, int y, MouseButton mouseButton) {
if(mainMessageBox.getEnabled()){ if(mainMessageBox.getEnabled()){
int button= 0; int button= 0;
if(mainMessageBox.mouseClick(x, y, button)) if(mainMessageBox.mouseClick(x, y, button)) {
{
soundRenderer.playFx(coreData.getClickSoundA()); soundRenderer.playFx(coreData.getClickSoundA());
if(button==0) { if(button==0) {
mainMessageBox.setEnabled(false); mainMessageBox.setEnabled(false);
if(scenarioFiles.empty() == true && mainMessageBoxState ==1) {
mainMenu->setState(new MenuStateNewGame(program, mainMenu));
return;
}
} }
} }
} }
else if(buttonReturn.mouseClick(x,y)){ else if(buttonReturn.mouseClick(x,y)){
soundRenderer.playFx(coreData.getClickSoundA()); soundRenderer.playFx(coreData.getClickSoundA());
mainMenu->setState(new MenuStateNewGame(program, mainMenu)); mainMenu->setState(new MenuStateNewGame(program, mainMenu));
return;
} }
else if(buttonPlayNow.mouseClick(x,y)){ else if(buttonPlayNow.mouseClick(x,y)){
soundRenderer.playFx(coreData.getClickSoundC()); soundRenderer.playFx(coreData.getClickSoundC());