diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index e6c7b2fa0..22598d081 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -2900,16 +2900,22 @@ void CHeroList::clickLeft(tribool down) if (down) { /***************************ARROWS*****************************************/ - if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0) + if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y)) { - blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y); - pressed = true; + if(from>0) + { + blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y); + pressed = true; + } return; } - else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>SIZE)) + else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y)) { - blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y); - pressed = false; + if(items.size()-from>SIZE) + { + blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y); + pressed = false; + } return; } /***************************HEROES*****************************************/ @@ -3217,16 +3223,22 @@ void CTownList::clickLeft(tribool down) if (down) { /***************************ARROWS*****************************************/ - if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0) + if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y)) { - blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y); - pressed = true; + if(from>0) + { + blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y); + pressed = true; + } return; } - else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>SIZE)) + else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y)) { - blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y); - pressed = false; + if(items.size()-from > SIZE) + { + blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y); + pressed = false; + } return; } /***************************TOWNS*****************************************/ diff --git a/CPreGame.cpp b/CPreGame.cpp index d7bbdef53..a8e2ea0e5 100644 --- a/CPreGame.cpp +++ b/CPreGame.cpp @@ -1294,7 +1294,7 @@ void MapSel::moveByOne(bool up) } void MapSel::select(int which, bool updateMapsList, bool forceSettingsUpdate) { - if(which < 0) + if(which < 0 || which >= curVector().size()) // Empty list return; @@ -1303,7 +1303,8 @@ void MapSel::select(int which, bool updateMapsList, bool forceSettingsUpdate) selected = 0; bool dontSaveSettings = ((selected!=which) || (CPG->ret.playerInfos.size()==0) || forceSettingsUpdate); - if (selected >= 0) { + if (selected >= 0) + { selected = which; CPG->ret.mapname = curVector()[selected]->filename; } @@ -2532,6 +2533,14 @@ CPreGame::~CPreGame() delete cancel; } +void CPreGame::begin() +{ + if(!ret.mapname.size()) //empty mapname (savename) - do nothing (no map/game selected) + return; + run = false; + ret.difficulty=ourScenSel->selectedDiff; +} + CPreGame::menuItems::menuItems() { } diff --git a/CPreGame.h b/CPreGame.h index 30ccb7633..f0498c0fe 100644 --- a/CPreGame.h +++ b/CPreGame.h @@ -280,7 +280,7 @@ public: menuItems * currentItems(); void(CPreGame::*handleOther)(SDL_Event&); void scenHandleEv(SDL_Event& sEvent); - void begin(){run=false;ret.difficulty=ourScenSel->selectedDiff;}; + void begin(); void quitAskBox(); void quit(){exit(EXIT_SUCCESS);}; void initScenSel(); diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index bc3d7e2d5..ee7a14bbe 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -712,7 +712,11 @@ void CGameHandler::newTurn() for(int k=0;kgetDate(0)) //first day of game: use only basic growths + amin(sac.creatures[k], VLC->creh->creatures[(*j)->town->basicCreatures[k]].growth); + } } n.cres.push_back(sac); }