Skip to content
Permalink
Browse files

Leave only the 'wants pressure' check in Simulation::Load for QRTZ/GL…

…AS/TUNG
  • Loading branch information...
LBPHacker committed May 7, 2019
1 parent 74b0d49 commit c193e88c2850f43edf2fc4e2fcbbb827790fa6b9
Showing with 15 additions and 7 deletions.
  1. +14 −1 src/client/GameSave.cpp
  2. +1 −6 src/simulation/Simulation.cpp
@@ -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:
@@ -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;
}
}

0 comments on commit c193e88

Please sign in to comment.
You can’t perform that action at this time.