mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
* the number of creatures at the beginning is their base growth
* clicking scrolling arrows in town/hero list won't open town/hero window * fixed crash on NewGame -> Single -> Back -> Back -> LoadGame -> Single when no saves available * fixed crash on clicking "Load" in load game menu when no saved games available
This commit is contained in:
parent
90fd75e66c
commit
b961d22052
@ -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*****************************************/
|
||||
|
13
CPreGame.cpp
13
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()
|
||||
{
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -712,7 +712,11 @@ void CGameHandler::newTurn()
|
||||
for(int k=0;k<CREATURES_PER_TOWN;k++) //creature growths
|
||||
{
|
||||
if((**j).creatureDwelling(k))//there is dwelling (k-level)
|
||||
{
|
||||
sac.creatures[k] += (**j).creatureGrowth(k);
|
||||
if(!gs->getDate(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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user