1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

change town events to vector + use getDefaultAllowed for spells

This commit is contained in:
godric3
2024-07-16 21:16:26 +02:00
parent c212b1bf36
commit fa3fef8a0f
5 changed files with 18 additions and 30 deletions

View File

@@ -3413,7 +3413,7 @@ void CGameHandler::handleTimeEvents()
void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
{
town->events.sort(evntCmp);
std::sort(town->events.begin(), town->events.end(), evntCmp);
while(town->events.size() && town->events.front().firstOccurrence == gs->day)
{
PlayerColor player = town->tempOwner;
@@ -3474,7 +3474,7 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
if (ev.nextOccurrence)
{
town->events.pop_front();
town->events.erase(town->events.begin());
ev.firstOccurrence += ev.nextOccurrence;
auto it = town->events.begin();
@@ -3484,7 +3484,7 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
}
else
{
town->events.pop_front();
town->events.erase(town->events.begin());
}
}