diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 0fe17cd0e..4b71939d8 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -16,22 +16,24 @@ extern "C" #include "hmap.h" } -GameSave::GameSave(GameSave & save) : -waterEEnabled(save.waterEEnabled), -legacyEnable(save.legacyEnable), -gravityEnable(save.gravityEnable), -aheatEnable(save.aheatEnable), -paused(save.paused), -gravityMode(save.gravityMode), -airMode(save.airMode), -edgeMode(save.edgeMode), -signs(save.signs), -palette(save.palette), -expanded(save.expanded), -hasOriginalData(save.hasOriginalData), -originalData(save.originalData) +GameSave::GameSave(GameSave & save): + waterEEnabled(save.waterEEnabled), + legacyEnable(save.legacyEnable), + gravityEnable(save.gravityEnable), + aheatEnable(save.aheatEnable), + paused(save.paused), + gravityMode(save.gravityMode), + airMode(save.airMode), + edgeMode(save.edgeMode), + signs(save.signs), + palette(save.palette), + expanded(save.expanded), + hasOriginalData(save.hasOriginalData), + originalData(save.originalData) { InitData(); + hasPressure = save.hasPressure; + hasAmbientHeat = save.hasAmbientHeat; if (save.expanded) { setSize(save.blockWidth, save.blockHeight); @@ -149,6 +151,7 @@ void GameSave::InitData() velocityY = NULL; ambientHeat = NULL; fromNewerVersion = false; + hasPressure = false; hasAmbientHeat = false; authors.clear(); } @@ -843,6 +846,7 @@ void GameSave::readOPS(char * data, int dataLength) pressure[blockY+y][blockX+x] = ((i+(i2<<8))/128.0f)-256; } } + hasPressure = true; } //Read vx data diff --git a/src/client/GameSave.h b/src/client/GameSave.h index 487111754..860cd6c9e 100644 --- a/src/client/GameSave.h +++ b/src/client/GameSave.h @@ -32,6 +32,7 @@ public: int blockWidth, blockHeight; bool fromNewerVersion; + bool hasPressure; bool hasAmbientHeat; //Simulation data diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 77978fa44..d8e4b3e15 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -245,9 +245,12 @@ int Simulation::Load(int fullX, int fullY, GameSave * save, bool includePressure } if (includePressure) { - pv[saveBlockY+blockY][saveBlockX+blockX] = save->pressure[saveBlockY][saveBlockX]; - vx[saveBlockY+blockY][saveBlockX+blockX] = save->velocityX[saveBlockY][saveBlockX]; - vy[saveBlockY+blockY][saveBlockX+blockX] = save->velocityY[saveBlockY][saveBlockX]; + if (save->hasPressure) + { + pv[saveBlockY+blockY][saveBlockX+blockX] = save->pressure[saveBlockY][saveBlockX]; + vx[saveBlockY+blockY][saveBlockX+blockX] = save->velocityX[saveBlockY][saveBlockX]; + vy[saveBlockY+blockY][saveBlockX+blockX] = save->velocityY[saveBlockY][saveBlockX]; + } if (save->hasAmbientHeat) hv[saveBlockY+blockY][saveBlockX+blockX] = save->ambientHeat[saveBlockY][saveBlockX]; } @@ -387,6 +390,7 @@ GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2, bool i newSave->velocityX[saveBlockY][saveBlockX] = vx[saveBlockY+blockY][saveBlockX+blockX]; newSave->velocityY[saveBlockY][saveBlockX] = vy[saveBlockY+blockY][saveBlockX+blockX]; newSave->ambientHeat[saveBlockY][saveBlockX] = hv[saveBlockY+blockY][saveBlockX+blockX]; + newSave->hasPressure = true; newSave->hasAmbientHeat = true; } }