1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00
Fixed crash on closing creature info window when upgrade was possible ( http://forum.vcmi.eu/viewtopic.php?p=4669#4669 ).
This commit is contained in:
Michał W. Urbańczyk
2010-05-30 11:48:24 +00:00
parent 585bc8ae6b
commit abf54deaa3
4 changed files with 12 additions and 9 deletions

View File

@ -1268,6 +1268,10 @@ void CPlayerInterface::update()
if(terminate_cond.get()) if(terminate_cond.get())
return; return;
//in some conditions we may receive calls before selection is initialized - we must ignore them
if(!adventureInt->selection)
return;
//if there are any waiting dialogs, show them //if there are any waiting dialogs, show them
if(dialogs.size() && !showingDialog->get()) if(dialogs.size() && !showingDialog->get())
{ {

View File

@ -2243,11 +2243,11 @@ CCreInfoWindow::CCreInfoWindow(const CStackInstance &st, int Type, boost::functi
if(enough) if(enough)
{ {
CFunctionList<void()> fs[2]; CFunctionList<void()> fs;
fs[0] += Upg; fs += Upg;
fs[0] += boost::bind(&CCreInfoWindow::close,this); fs += boost::bind(&CCreInfoWindow::close,this);
CFunctionList<void()> cfl; CFunctionList<void()> cfl;
cfl = boost::bind(&CPlayerInterface::showYesNoDialog,LOCPLINT,CGI->generaltexth->allTexts[207],boost::ref(upgResCost),fs[0],fs[1],false); cfl = boost::bind(&CPlayerInterface::showYesNoDialog, LOCPLINT, CGI->generaltexth->allTexts[207], boost::ref(upgResCost), fs, 0, false);
upgrade = new AdventureMapButton("",CGI->generaltexth->zelp[446].second,cfl,76,237,"IVIEWCR.DEF",SDLK_u); upgrade = new AdventureMapButton("",CGI->generaltexth->zelp[446].second,cfl,76,237,"IVIEWCR.DEF",SDLK_u);
} }
else else
@ -2374,8 +2374,8 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount)
CCreInfoWindow::~CCreInfoWindow() CCreInfoWindow::~CCreInfoWindow()
{ {
delete anim; delete anim;
for(int i=0; i<upgResCost.size();i++) // for(int i=0; i<upgResCost.size();i++)
delete upgResCost[i]; // delete upgResCost[i];
} }
void CCreInfoWindow::activate() void CCreInfoWindow::activate()

View File

@ -310,8 +310,7 @@ public:
{ {
h & static_cast<CArmedInstance&>(*this); h & static_cast<CArmedInstance&>(*this);
h & exp & level & name & biography & portrait & mana & secSkills & movement h & exp & level & name & biography & portrait & mana & secSkills & movement
& sex & inTownGarrison & artifacts & artifWorn & spells & patrol & bonuses & sex & inTownGarrison & artifacts & artifWorn & spells & patrol & moveDir;
& moveDir;
h & type; h & type;
//visitied town pointer will be restored by map serialization method //visitied town pointer will be restored by map serialization method

View File

@ -21,7 +21,7 @@
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
const ui32 version = 721; const ui32 version = 722;
class CConnection; class CConnection;
class CGObjectInstance; class CGObjectInstance;
class CGameState; class CGameState;