mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
* fixed project files for RD configuration
* fixed crash when creature is casting Hypnosis (ie. exped Vampire Lords) * fixed crash when creature is casting Cure before attack (ie. exped Unicorns) * fixed crash when creature is summoning elemental (TODO fix it) * fixed crash when doing a bonus system operation with a hero liberated from prison (ie. entering town or battle) * fixed deadlock when StupidAI tried to assault the turrets * fixed never ending siege when StupidAI has to use catapult (no more deadlocks on AI-AI siege) * fixed deadlock when a hero received a level during another player's turn (ie. when he successfully defended) * AI can win the game by defeating all enemies if there is a specific victory condition applying only to human players * added options to help testing adventure map AI (--onlyAI, --autoSkip and --oneGoodAI). * many minor changes
This commit is contained in:
@@ -121,7 +121,7 @@ void CClient::waitForMoveAndSend(int color)
|
||||
assert(vstd::contains(battleints, color));
|
||||
BattleAction ba = battleints[color]->activeStack(gs->curB->getStack(gs->curB->activeStack, false));
|
||||
MakeAction temp_action(ba);
|
||||
*serv << &temp_action;
|
||||
serv->sendPackToServer(temp_action, color);
|
||||
return;
|
||||
}HANDLE_EXCEPTION
|
||||
tlog1 << "We should not be here!" << std::endl;
|
||||
@@ -169,7 +169,7 @@ void CClient::save(const std::string & fname)
|
||||
}
|
||||
|
||||
SaveGame save_game(fname);
|
||||
*serv << &save_game;
|
||||
serv->sendPackToServer((CPackForClient&)save_game, getCurrentPlayer());
|
||||
}
|
||||
|
||||
void CClient::endGame( bool closeConnection /*= true*/ )
|
||||
@@ -348,6 +348,7 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
}
|
||||
|
||||
int humanPlayers = 0;
|
||||
int sensibleAILimit = conf.cc.oneGoodAI ? 1 : GameConstants::PLAYER_LIMIT;
|
||||
for(std::map<int, PlayerSettings>::iterator it = gs->scenarioOps->playerInfos.begin();
|
||||
it != gs->scenarioOps->playerInfos.end(); ++it)//initializing interfaces for players
|
||||
{
|
||||
@@ -361,7 +362,13 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
CCallback *cb = new CCallback(gs,color,this);
|
||||
if(!it->second.human)
|
||||
{
|
||||
playerint[color] = static_cast<CGameInterface*>(CDynLibHandler::getNewAI(conf.cc.defaultPlayerAI));
|
||||
std::string AItoGive = conf.cc.defaultPlayerAI;
|
||||
if(!sensibleAILimit)
|
||||
AItoGive = "GeniusAI";
|
||||
else
|
||||
sensibleAILimit--;
|
||||
playerint[color] = static_cast<CGameInterface*>(CDynLibHandler::getNewAI(AItoGive));
|
||||
tlog1 << "Player " << (int)color << " will be lead by " << AItoGive << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -515,7 +522,7 @@ void CClient::stopConnection()
|
||||
tlog0 << "Connection has been requested to be closed.\n";
|
||||
boost::unique_lock<boost::mutex>(*serv->wmx);
|
||||
CloseServer close_server;
|
||||
*serv << &close_server;
|
||||
serv->sendPackToServer(close_server, 255);
|
||||
tlog0 << "Sent closing signal to the server\n";
|
||||
}
|
||||
|
||||
@@ -579,7 +586,7 @@ void CClient::commitPackage( CPackForClient *pack )
|
||||
CommitPackage cp;
|
||||
cp.freePack = false;
|
||||
cp.packToCommit = pack;
|
||||
*serv << &cp;
|
||||
serv->sendPackToServer(cp, 255);
|
||||
}
|
||||
|
||||
int CClient::getLocalPlayer() const
|
||||
@@ -605,7 +612,7 @@ void CClient::commenceTacticPhaseForInt(CBattleGameInterface *battleInt)
|
||||
if(gs && !!gs->curB && gs->curB->tacticDistance) //while awaiting for end of tactics phase, many things can happen (end of battle... or game)
|
||||
{
|
||||
MakeAction ma(BattleAction::makeEndOFTacticPhase(battleInt->playerID));
|
||||
serv->sendPack(ma);
|
||||
serv->sendPackToServer(ma, battleInt->playerID);
|
||||
}
|
||||
} HANDLE_EXCEPTION
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user