Leave only the 'wants pressure' check in Simulation::Load for QRTZ/GLAS/TUNG

This commit is contained in:
Tamás Bálint Misius 2019-05-07 21:15:41 +02:00
parent 74b0d49131
commit c193e88c28
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 15 additions and 7 deletions

View File

@ -1169,6 +1169,19 @@ void GameSave::readOPS(char * data, int dataLength)
pavg = partsData[i++];
pavg |= (((unsigned)partsData[i++]) << 8);
particles[newIndex].pavg[1] = (float)pavg;
switch (particles[newIndex].type)
{
// List of elements that save pavg with a multiplicative bias of 2**6
// (or not at all if pressure is not saved).
// If you change this list, change it in Simulation::Load and GameSave::serialiseOPS too!
case PT_QRTZ:
case PT_GLAS:
case PT_TUNG:
particles[newIndex].pavg[0] /= 64;
particles[newIndex].pavg[1] /= 64;
break;
}
}
//Particle specific parsing:
@ -2311,7 +2324,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
{
// List of elements that save pavg with a multiplicative bias of 2**6
// (or not at all if pressure is not saved).
// If you change this list, change it in Simulation::Load too!
// If you change this list, change it in Simulation::Load and GameSave::readOPS too!
case PT_QRTZ:
case PT_GLAS:
case PT_TUNG:

View File

@ -243,7 +243,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save, bool includePressure
// List of elements that load pavg with a multiplicative bias of 2**6
// (or not at all if pressure is not loaded).
// If you change this list, change it in GameSave::serialiseOPS too!
// If you change this list, change it in GameSave::serialiseOPS and GameSave::readOPS too!
case PT_QRTZ:
case PT_GLAS:
case PT_TUNG:
@ -252,11 +252,6 @@ int Simulation::Load(int fullX, int fullY, GameSave * save, bool includePressure
parts[i].pavg[0] = 0;
parts[i].pavg[1] = 0;
}
else
{
parts[i].pavg[0] /= 64;
parts[i].pavg[1] /= 64;
}
break;
}
}