1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Many fixes, mostly related to hot-seat.

This commit is contained in:
Michał W. Urbańczyk
2010-02-22 13:30:46 +00:00
parent 94b289dab0
commit d7a1898676
5 changed files with 19 additions and 16 deletions

View File

@@ -2543,9 +2543,9 @@ void CBattleInterface::stackIsCatapulting(const CatapultAttack & ca)
void CBattleInterface::battleFinished(const BattleResult& br) void CBattleInterface::battleFinished(const BattleResult& br)
{ {
bresult = &br; bresult = &br;
curInt->pim->unlock(); LOCPLINT->pim->unlock();
animsAreDisplayed.waitUntil(false); animsAreDisplayed.waitUntil(false);
curInt->pim->lock(); LOCPLINT->pim->lock();
displayBattleFinished(); displayBattleFinished();
} }

View File

@@ -120,9 +120,16 @@ CPlayerInterface::~CPlayerInterface()
delete pim; delete pim;
delete showingDialog; delete showingDialog;
delete mainFPSmng; delete mainFPSmng;
if(adventureInt)
{
if(adventureInt->active & CIntObject::KEYBOARD) if(adventureInt->active & CIntObject::KEYBOARD)
adventureInt->deactivateKeys(); adventureInt->deactivateKeys();
delete adventureInt; delete adventureInt;
adventureInt = NULL;
}
if(cingconsole->active) //TODO
cingconsole->deactivate();
delete cingconsole; delete cingconsole;
for(std::map<int,SDL_Surface*>::iterator i=graphics->heroWins.begin(); i!= graphics->heroWins.end(); i++) for(std::map<int,SDL_Surface*>::iterator i=graphics->heroWins.begin(); i!= graphics->heroWins.end(); i++)
@@ -838,7 +845,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0)); pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
CInfoWindow * temp = new CInfoWindow(text,playerID,0,components,pom,false); CInfoWindow * temp = new CInfoWindow(text,playerID,0,components,pom,false);
if(/*makingTurn && */GH.listInt.size()) if(makingTurn && GH.listInt.size() && LOCPLINT == this)
{ {
CGI->soundh->playSound(static_cast<soundBase::soundID>(soundID)); CGI->soundh->playSound(static_cast<soundBase::soundID>(soundID));
showingDialog->set(true); showingDialog->set(true);
@@ -1691,6 +1698,9 @@ void CPlayerInterface::finishMovement( const TryMoveHero &details, const int3 &h
void CPlayerInterface::gameOver(ui8 player, bool victory ) void CPlayerInterface::gameOver(ui8 player, bool victory )
{ {
if(LOCPLINT != this)
return;
if(player == playerID) if(player == playerID)
{ {
if(!victory) if(!victory)

View File

@@ -255,7 +255,7 @@ int CSaveFile::write( const void * data, unsigned size )
return size; return size;
} }
CLoadFile::CLoadFile( const std::string &fname ) CLoadFile::CLoadFile( const std::string &fname, bool requireLatest )
:sfile(new std::ifstream(fname.c_str(),std::ios::binary)) :sfile(new std::ifstream(fname.c_str(),std::ios::binary))
{ {
registerTypes(*this); registerTypes(*this);
@@ -278,7 +278,7 @@ CLoadFile::CLoadFile( const std::string &fname )
} }
*this >> myVersion; *this >> myVersion;
if(myVersion != version) if(myVersion != version && requireLatest)
{ {
tlog1 << "Error: Not supported save format! (file " << fname << " )\n"; tlog1 << "Error: Not supported save format! (file " << fname << " )\n";
delete sfile; delete sfile;

View File

@@ -694,7 +694,7 @@ class DLL_EXPORT CLoadFile
} }
public: public:
std::ifstream *sfile; std::ifstream *sfile;
CLoadFile(const std::string &fname); CLoadFile(const std::string &fname, bool requireLatest = true);
~CLoadFile(); ~CLoadFile();
int read(const void * data, unsigned size); int read(const void * data, unsigned size);
}; };

View File

@@ -434,13 +434,6 @@ void CMapHandler::init()
initObjectRects(); initObjectRects();
tlog0<<"\tMaking object rects: "<<th.getDif()<<std::endl; tlog0<<"\tMaking object rects: "<<th.getDif()<<std::endl;
for (int i = 0; i < 8 ; i++)
{
TerrainTile2 &t = ttiles[24+i][0][0];
//tlog0 << t.objects.front().first->defInfo->name << ' ';
}
} }
// Update map window screen // Update map window screen