diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-10-12 17:38:12 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-10-12 17:38:12 -0300 |
| commit | b9124b049a47323cafa8807db4d501fb32a53297 (patch) | |
| tree | 0eb2778a68c5511a06632146c457ec7fee07f161 /src/cr.hh | |
| parent | 60531bf63e9d93535e6d7ea5201a708392e738f6 (diff) | |
| download | game-b9124b049a47323cafa8807db4d501fb32a53297.tar.gz game-b9124b049a47323cafa8807db4d501fb32a53297.zip | |
fix problem with outfit comparisons - fixes #39
Diffstat (limited to 'src/cr.hh')
| -rw-r--r-- | src/cr.hh | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -17,14 +17,18 @@ struct TPlayer; struct TOutfit{ int OutfitID; union{ - uint16 ObjectType; + int ObjectType; uint8 Colors[4]; - uint32 PackedData; }; constexpr bool operator==(const TOutfit &Other) const { + // IMPORTANT(fusion): We don't need to have special comparisson cases + // if all members of the union have the same size. This is not true + // otherwise when smaller active fields leave trailing bytes of the + // union filled with whatever data was there before. + STATIC_ASSERT(sizeof(this->ObjectType) == sizeof(this->Colors)); return this->OutfitID == Other.OutfitID - && this->PackedData == Other.PackedData; + && this->ObjectType == Other.ObjectType; } static constexpr TOutfit Invisible(void){ |
