Skip to content

Commit

Permalink
Leave only the 'wants pressure' check in Simulation::Load for QRTZ/GL…
Browse files Browse the repository at this point in the history
…AS/TUNG
  • Loading branch information
LBPHacker committed May 7, 2019
1 parent 74b0d49 commit c193e88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 14 additions & 1 deletion src/client/GameSave.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 1 addition & 6 deletions src/simulation/Simulation.cpp
Expand Up @@ -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:
Expand All @@ -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;
}
}
Expand Down

0 comments on commit c193e88

Please sign in to comment.