mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
* Moved CConfigHandler from client to lib, CMake/Makefile need updating. I believe other projects besides client also need access to settings. (surprisingly there was a "server" category used only by client... and now VCAI.)
* It is possible to set the battle ai that'll be used by neutrals by typing in VCMI console: setBattleAI <AIName> VCAI also respects that setting and uses given AI as its battle back-end.
This commit is contained in:
@ -27,7 +27,7 @@
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "Graphics.h"
|
||||
#include "Client.h"
|
||||
#include "CConfigHandler.h"
|
||||
#include "../lib/CConfigHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
@ -595,6 +595,23 @@ void processCommand(const std::string &message)
|
||||
if(mxname == "pim" && LOCPLINT)
|
||||
LOCPLINT->pim->unlock();
|
||||
}
|
||||
else if(cn == "setBattleAI")
|
||||
{
|
||||
std::string fname;
|
||||
readed >> fname;
|
||||
tlog0 << "Will try loading that AI to see if it is correct name...\n";
|
||||
if(auto ai = CDynLibHandler::getNewBattleAI(fname)) //test that given AI is indeed available... heavy but it is easy to make a typo and break the game
|
||||
{
|
||||
delete ai;
|
||||
Settings neutralAI = settings.write["server"]["neutralAI"];
|
||||
neutralAI->String() = fname;
|
||||
tlog0 << "Setting changed, from now the battle ai will be " << fname << "!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
tlog3 << "Setting not changes, no such AI found!\n";
|
||||
}
|
||||
}
|
||||
else if(client && client->serv && client->serv->connected && LOCPLINT) //send to server
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
|
Reference in New Issue
Block a user