1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed CID 1366403

This commit is contained in:
AlexVinS 2016-11-28 02:01:07 +03:00
parent bf3f94a106
commit 9094c99759

View File

@ -70,7 +70,7 @@ namespace bfs = boost::filesystem;
std::string NAME_AFFIX = "client";
std::string NAME = GameConstants::VCMI_VERSION + std::string(" (") + NAME_AFFIX + ')'; //application name
CGuiHandler GH;
static CClient *client=nullptr;
static CClient *client = nullptr;
int preferredDriverIndex = -1;
SDL_Window * mainWindow = nullptr;
@ -619,17 +619,22 @@ void processCommand(const std::string &message)
}
else if(cn=="save")
{
if(!client)
{
std::cout << "Game in not active";
return;
}
std::string fname;
readed >> fname;
client->save(fname);
}
else if(cn=="load")
{
// TODO: this code should end the running game and manage to call startGame instead
std::string fname;
readed >> fname;
client->loadGame(fname);
}
// else if(cn=="load")
// {
// // TODO: this code should end the running game and manage to call startGame instead
// std::string fname;
// readed >> fname;
// client->loadGame(fname);
// }
else if(message=="get txt")
{
std::cout << "Command accepted.\t";
@ -832,6 +837,11 @@ void processCommand(const std::string &message)
else if(cn == "gosolo")
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
if(!client)
{
std::cout << "Game in not active";
return;
}
PlayerColor color;
if(session["aiSolo"].Bool())
{
@ -866,6 +876,11 @@ void processCommand(const std::string &message)
boost::to_lower(colorName);
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
if(!client)
{
std::cout << "Game in not active";
return;
}
PlayerColor color;
if(LOCPLINT)
color = LOCPLINT->playerID;
@ -1245,7 +1260,7 @@ void startGame(StartInfo * options, CConnection *serv/* = nullptr*/)
}
}
client = new CClient;
client = new CClient();
CPlayerInterface::howManyPeople = 0;
switch(options->mode) //new game
{
@ -1264,7 +1279,7 @@ void startGame(StartInfo * options, CConnection *serv/* = nullptr*/)
break;
}
client->connectionHandler = new boost::thread(&CClient::run, client);
client->connectionHandler = new boost::thread(&CClient::run, client);
}
void endGame()