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

Contact between allies will no longer break simturns

This commit is contained in:
Ivan Savenko 2024-05-19 20:13:42 +00:00
parent e04c662bc9
commit 215b279ea8
2 changed files with 10 additions and 0 deletions

View File

@ -32,11 +32,14 @@ struct DLL_LINKAGE SimturnsInfo
int optionalTurns = 0;
/// If set to true, human and 1 AI can act at the same time
bool allowHumanWithAI = false;
/// If set to true, allied players can play simultaneously even after contacting each other
bool ignoreAlliedContacts = true;
bool operator == (const SimturnsInfo & other) const
{
return requiredTurns == other.requiredTurns &&
optionalTurns == other.optionalTurns &&
ignoreAlliedContacts == other.ignoreAlliedContacts &&
allowHumanWithAI == other.allowHumanWithAI;
}
@ -46,6 +49,10 @@ struct DLL_LINKAGE SimturnsInfo
h & requiredTurns;
h & optionalTurns;
h & allowHumanWithAI;
static_assert(Handler::Version::RELEASE_143 < Handler::Version::CURRENT, "Please add ignoreAlliedContacts to serialization for 1.6");
// disabled to allow multiplayer compatibility between 1.5.2 and 1.5.1
// h & ignoreAlliedContacts
}
};

View File

@ -189,6 +189,9 @@ bool TurnOrderProcessor::computeCanActSimultaneously(PlayerColor active, PlayerC
if (gameHandler->getDate(Date::DAY) > simturnsTurnsMaxLimit())
return false;
if (gameHandler->getStartInfo()->simturnsInfo.ignoreAlliedContacts && activeInfo->team == waitingInfo->team)
return true;
if (playersInContact(active, waiting))
return false;