mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Map and town events are now processed on start of player turn instead of
on start of new day, in line with H3
This commit is contained in:
@ -52,14 +52,32 @@ CMapEvent::CMapEvent()
|
||||
|
||||
}
|
||||
|
||||
bool CMapEvent::earlierThan(const CMapEvent & other) const
|
||||
bool CMapEvent::occursToday(int currentDay) const
|
||||
{
|
||||
return firstOccurrence < other.firstOccurrence;
|
||||
if (currentDay == firstOccurrence + 1)
|
||||
return true;
|
||||
|
||||
if (nextOccurrence == 0)
|
||||
return false;
|
||||
|
||||
if (currentDay < firstOccurrence)
|
||||
return false;
|
||||
|
||||
return (currentDay - firstOccurrence - 1) % nextOccurrence == 0;
|
||||
}
|
||||
|
||||
bool CMapEvent::earlierThanOrEqual(const CMapEvent & other) const
|
||||
bool CMapEvent::affectsPlayer(PlayerColor color, bool isHuman) const
|
||||
{
|
||||
return firstOccurrence <= other.firstOccurrence;
|
||||
if (players.count(color) == 0)
|
||||
return false;
|
||||
|
||||
if (!isHuman && !computerAffected)
|
||||
return false;
|
||||
|
||||
if (isHuman && !humanAffected)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMapEvent::serializeJson(JsonSerializeFormat & handler)
|
||||
|
Reference in New Issue
Block a user