Skip to content

Commit

Permalink
Support building purpose values encoded as an array
Browse files Browse the repository at this point in the history
Some 3rd-party buildings encode the building purpose property value as
an Uint8 array containing one item.
  • Loading branch information
0xC0000054 committed May 23, 2024
1 parent 6d2207d commit dc47072
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/GrowifyOccupantFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
////////////////////////////////////////////////////////////////////////////

#include "GrowifyOccupantFilter.h"
#include "DebugUtil.h"
#include "cIGZVariant.h"
#include "cISC4Occupant.h"
#include "cISCProperty.h"
Expand Down Expand Up @@ -57,6 +58,16 @@ namespace
purposeType = static_cast<SC4BuildingPurposeType>(data->GetValUint8());
result = true;
}
else if (type == cIGZVariant::Type::Uint8Array)
{
uint32_t count = data->GetCount();

if (count == 1)
{
purposeType = static_cast<SC4BuildingPurposeType>(*data->RefUint8());
result = true;
}
}
}
}
}
Expand Down

0 comments on commit dc47072

Please sign in to comment.