Fix some cases of bogus missing element warnings

Namely, the ones caused by element numbers already invalid at the time of saving. This makes it impossible to intentionally have invalid element numbers in the low bits of properties listed in CarriesTypeIn, but these bits are considered to be under TPT's control anyway, so this is ok.
This commit is contained in:
Tamás Bálint Misius 2025-01-15 19:02:47 +01:00
parent 2b0ee9392c
commit 09ba266165
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -2206,8 +2206,15 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
{
if (elements[part.type].CarriesTypeIn & (1U << index))
{
auto *prop = reinterpret_cast<const int *>(reinterpret_cast<const char *>(&part) + properties[index].Offset);
paletteSet.insert(TYP(*prop));
auto *prop = reinterpret_cast<int *>(reinterpret_cast<char *>(&part) + properties[index].Offset);
if (sd.IsElement(TYP(*prop)))
{
paletteSet.insert(TYP(*prop));
}
else
{
*prop = PMAP(ID(*prop), 0);
}
}
}