Fix "missing custom elements" warnings when loading saves with RSST/RSSS; mark SNOW as carrying ctype as well
This commit is contained in:
parent
6de252eb34
commit
de345a85a1
@ -51,9 +51,17 @@ GameSave::GameSave(const std::vector<char> &data, bool newWantAuthors)
|
||||
void GameSave::MapPalette()
|
||||
{
|
||||
int partMap[PT_NUM];
|
||||
bool ignoreMissingErrors[PT_NUM];
|
||||
for(int i = 0; i < PT_NUM; i++)
|
||||
{
|
||||
partMap[i] = i;
|
||||
ignoreMissingErrors[i] = false;
|
||||
}
|
||||
if (version <= Version(98, 2))
|
||||
{
|
||||
ignoreMissingErrors[PT_SNOW] = true;
|
||||
ignoreMissingErrors[PT_RSST] = true;
|
||||
ignoreMissingErrors[PT_RSSS] = true;
|
||||
}
|
||||
|
||||
auto &sd = SimulationData::CRef();
|
||||
@ -90,12 +98,14 @@ void GameSave::MapPalette()
|
||||
}
|
||||
}
|
||||
}
|
||||
auto paletteLookup = [this, &partMap](int type) {
|
||||
auto paletteLookup = [this, &partMap](int type, bool ignoreMissingErrors) {
|
||||
if (type > 0 && type < PT_NUM)
|
||||
{
|
||||
auto carriedType = partMap[type];
|
||||
if (!carriedType) // type is not 0 so this shouldn't be 0 either
|
||||
{
|
||||
if (ignoreMissingErrors)
|
||||
return type;
|
||||
missingElements.ids.insert(type);
|
||||
}
|
||||
type = carriedType;
|
||||
@ -113,7 +123,7 @@ void GameSave::MapPalette()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
tempPart.type = paletteLookup(tempPart.type);
|
||||
tempPart.type = paletteLookup(tempPart.type, false);
|
||||
for (auto index : possiblyCarriesType)
|
||||
{
|
||||
if (elements[tempPart.type].CarriesTypeIn & (1U << index))
|
||||
@ -121,7 +131,7 @@ void GameSave::MapPalette()
|
||||
auto *prop = reinterpret_cast<int *>(reinterpret_cast<char *>(&tempPart) + properties[index].Offset);
|
||||
auto carriedType = *prop & int(pmapmask);
|
||||
auto extra = *prop >> pmapbits;
|
||||
carriedType = paletteLookup(carriedType);
|
||||
carriedType = paletteLookup(carriedType, ignoreMissingErrors[tempPart.type]);
|
||||
*prop = PMAP(extra, carriedType);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ void Element::Element_SNOW()
|
||||
Description = "Light particles. Created when ICE breaks under pressure.";
|
||||
|
||||
Properties = TYPE_PART|PROP_NEUTPASS;
|
||||
CarriesTypeIn = 1U << FIELD_CTYPE;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
|
Loading…
Reference in New Issue
Block a user