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

Fixed game loading.

Release 0.75d
This commit is contained in:
Michał W. Urbańczyk
2010-02-13 21:45:46 +00:00
parent 40d50aaaa1
commit 78f54ffcd3
3 changed files with 10 additions and 3 deletions

View File

@@ -570,6 +570,7 @@ void SelectionTab::parseGames(std::vector<FileInfo> &files)
tlog1 << files[i].name << " is not a correct savefile!" << std::endl; tlog1 << files[i].name << " is not a correct savefile!" << std::endl;
continue; continue;
} }
allItems[i].mapHeader = new CMapHeader();
lf >> *(allItems[i].mapHeader) >> allItems[i].seldiff; lf >> *(allItems[i].mapHeader) >> allItems[i].seldiff;
allItems[i].filename = files[i].name; allItems[i].filename = files[i].name;
allItems[i].countPlayers(); allItems[i].countPlayers();

View File

@@ -175,6 +175,7 @@ void CClient::stop()
LOCPLINT->terminate_cond.setn(true); LOCPLINT->terminate_cond.setn(true);
LOCPLINT->pim->lock(); LOCPLINT->pim->lock();
endGame(); endGame();
tlog0 << "Client stopped." << std::endl;
} }
void CClient::save(const std::string & fname) void CClient::save(const std::string & fname)
@@ -195,12 +196,14 @@ void CClient::endGame()
GH.topInt()->deactivate(); GH.topInt()->deactivate();
GH.listInt.clear(); GH.listInt.clear();
GH.objsToBlit.clear(); GH.objsToBlit.clear();
tlog0 << "Removed GUI." << std::endl;
delete CGI->mh; delete CGI->mh;
CGI->mh = NULL; CGI->mh = NULL;
delete CGI->state; delete CGI->state;
CGI->state = NULL; CGI->state = NULL;
tlog0 << "Deleted mapHandler and gameState." << std::endl;
LOCPLINT = NULL; LOCPLINT = NULL;
while (!playerint.empty()) while (!playerint.empty())
@@ -213,13 +216,14 @@ void CClient::endGame()
{ {
delete cb; delete cb;
} }
tlog0 << "Deleted playerInts." << std::endl;
if (serv) if (serv)
{ {
tlog3 << "Connection has been requested to be closed.\n"; tlog0 << "Connection has been requested to be closed.\n";
boost::unique_lock<boost::mutex>(*serv->wmx); boost::unique_lock<boost::mutex>(*serv->wmx);
*serv << &CloseServer(); *serv << &CloseServer();
tlog3 << "Sent closing signal to the server\n"; tlog0 << "Sent closing signal to the server\n";
serv->close(); serv->close();
delete serv; delete serv;
@@ -228,6 +232,8 @@ void CClient::endGame()
} }
connectionHandler->join(); connectionHandler->join();
tlog0 << "Connection handler thread joined" << std::endl;
delete connectionHandler; delete connectionHandler;
connectionHandler = NULL; connectionHandler = NULL;
} }

View File

@@ -5065,4 +5065,4 @@ void MoraleLuckBox::set( bool morale, const CGHeroInstance *hero, int slot /*= -
for(int it=0; it < mrl.size(); it++) for(int it=0; it < mrl.size(); it++)
text += "\n" + mrl[it].second; text += "\n" + mrl[it].second;
} }
} }