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

"onlyai" command - game starts with no human players, only AI.

This commit is contained in:
Michał W. Urbańczyk
2009-08-07 23:17:12 +00:00
parent 0787b6a79b
commit 425791f27e

View File

@@ -69,6 +69,7 @@ std::queue<SDL_Event*> events;
boost::mutex eventsM;
TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM, *GEOR16;
static bool gOnlyAI = false;
void processCommand(const std::string &message, CClient *&client);
static void setScreenRes(int w, int h, int bpp, bool fullscreen);
@@ -201,6 +202,14 @@ int main(int argc, char** argv)
CPG->showMainMenu();
StartInfo *options = new StartInfo(CPG->runLoop());
if(gOnlyAI)
{
for (size_t i =0; i < options->playerInfos.size(); i++)
{
options->playerInfos[i].human = false;
}
}
if(screen->w != conf.cc.resx || screen->h != conf.cc.resy)
{
setScreenRes(conf.cc.resx,conf.cc.resy,conf.cc.bpp,conf.cc.fullscreen);
@@ -405,6 +414,10 @@ void processCommand(const std::string &message, CClient *&client)
*ptr = 666;
//disaster!
}
else if(cn == "onlyai")
{
gOnlyAI = true;
}
else if(client && client->serv && client->serv->connected) //send to server
{
PlayerMessage pm(LOCPLINT->playerID,message);