Skip to content

Commit

Permalink
Fix serialization of cUnit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Jan 20, 2024
1 parent fa61cec commit e149403
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/game/data/units/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,17 @@ class cUnit
{
// clang-format off
// See https://github.com/llvm/llvm-project/issues/44312
archive & NVP (data);
if (Archive::isWriter)
if constexpr (Archive::isWriter)
{
int id = iID;
archive & NVP (id); //const member. needs to be deserialized before calling constructor
archive & NVP (id); // const member. needs to be deserialized before calling constructor
storedUnitIds = ranges::Transform (storedUnits, [] (auto* unit) { return unit->getId(); });
}
else
{
storedUnitIds.clear();
}
archive & NVP (data);
archive & NVP (dir);
archive & NVP (storedUnitIds);
archive & NVP (detectedByPlayerList);
Expand Down

0 comments on commit e149403

Please sign in to comment.