1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Players affected by event is now stored as std::set instead of bitmask

This commit is contained in:
Ivan Savenko
2024-08-12 10:36:49 +00:00
parent 5c7c4a7810
commit 5523e08cb7
7 changed files with 57 additions and 13 deletions

View File

@@ -36,7 +36,7 @@ public:
std::string name;
MetaString message;
TResources resources;
ui8 players; // affected players, bit field?
std::set<PlayerColor> players;
bool humanAffected;
bool computerAffected;
ui32 firstOccurrence;
@@ -48,7 +48,18 @@ public:
h & name;
h & message;
h & resources;
h & players;
if (h.version >= Handler::Version::EVENTS_PLAYER_SET)
{
h & players;
}
else
{
ui8 playersMask = 0;
h & playersMask;
for (int i = 0; i < 8; ++i)
if ((playersMask & (1 << i)) != 0)
players.insert(PlayerColor(i));
}
h & humanAffected;
h & computerAffected;
h & firstOccurrence;