Permalink
Browse files

fix ambient heat not loading in ctrl+c paste, fix pressure resetting …

…to 0 when loading saves without pressure
  • Loading branch information...
jacob1 committed Nov 24, 2017
1 parent 78fb27b commit 3529f6f4680bfcfd1b202b7d5be2d1801780214b
Showing with 26 additions and 17 deletions.
  1. +18 −14 src/client/GameSave.cpp
  2. +1 −0 src/client/GameSave.h
  3. +7 −3 src/simulation/Simulation.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
@@ -32,6 +32,7 @@ class GameSave
int blockWidth, blockHeight;
bool fromNewerVersion;
bool hasPressure;
bool hasAmbientHeat;
//Simulation data
@@ -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;
}
}

0 comments on commit 3529f6f

Please sign in to comment.