summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-24 19:12:48 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-24 19:12:48 (GMT)
commit0939494747908bb702f24598e883c3d1f70e3710 (patch)
tree3477ed2cb7e995fa3c94880acee49bdd2232eaca /src
parentf138e10917b1bcdd7d270997312e8d672c182c3a (diff)
downloadpowder-0939494747908bb702f24598e883c3d1f70e3710.zip
powder-0939494747908bb702f24598e883c3d1f70e3710.tar.gz
fix problems found with valgrind with shifting stamps and saving
Diffstat (limited to 'src')
-rw-r--r--src/client/Client.cpp6
-rw-r--r--src/client/GameSave.cpp14
-rw-r--r--src/search/Thumbnail.cpp4
-rw-r--r--src/simulation/Simulation.cpp10
4 files changed, 21 insertions, 13 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp
index 8a82515..d694f45 100644
--- a/src/client/Client.cpp
+++ b/src/client/Client.cpp
@@ -877,7 +877,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
{
if(strncmp((const char *)data, "OK", 2)!=0)
{
- if(gameData) free(gameData);
+ if(gameData) delete[] gameData;
lastError = std::string((const char *)data);
free(data);
return RequestFailure;
@@ -898,14 +898,14 @@ RequestStatus Client::UploadSave(SaveInfo & save)
}
}
free(data);
- if(gameData) free(gameData);
+ if(gameData) delete[] gameData;
return RequestOkay;
}
else if(data)
{
free(data);
}
- if(gameData) free(gameData);
+ if(gameData) delete[] gameData;
return RequestFailure;
}
diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp
index 791069d..af8bbf2 100644
--- a/src/client/GameSave.cpp
+++ b/src/client/GameSave.cpp
@@ -366,7 +366,7 @@ void GameSave::Transform(matrix2d transform, vector2d translate)
signs[i].x = nx;
signs[i].y = ny;
}
- for (i=0; i<NPART; i++)
+ for (i=0; i<particlesCount; i++)
{
if (!particles[i].type) continue;
pos = v2d_new(particles[i].x, particles[i].y);
@@ -410,13 +410,13 @@ void GameSave::Transform(matrix2d transform, vector2d translate)
blockWidth = newBlockWidth;
blockHeight = newBlockHeight;
- delete blockMap;
- delete fanVelX;
- delete fanVelY;
+ delete[] blockMap;
+ delete[] fanVelX;
+ delete[] fanVelY;
- delete blockMapPtr;
- delete fanVelXPtr;
- delete fanVelYPtr;
+ delete[] blockMapPtr;
+ delete[] fanVelXPtr;
+ delete[] fanVelYPtr;
blockMap = blockMapNew;
fanVelX = fanVelXNew;
diff --git a/src/search/Thumbnail.cpp b/src/search/Thumbnail.cpp
index 81ea8e9..5ef1b26 100644
--- a/src/search/Thumbnail.cpp
+++ b/src/search/Thumbnail.cpp
@@ -69,12 +69,12 @@ void Thumbnail::Resize(ui::Point newSize)
Data = Graphics::resample_img(thumbData, Size.X, Size.Y, Size.X * scaleFactor, Size.Y * scaleFactor);
Size.X *= scaleFactor;
Size.Y *= scaleFactor;
- delete thumbData;
+ delete[] thumbData;
}
}
Thumbnail::~Thumbnail()
{
if(Data)
- delete Data;
+ delete[] Data;
}
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 2314c5c..f9783c9 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -4839,7 +4839,8 @@ Simulation::Simulation():
lighting_recreate(0),
force_stacking_check(0),
ISWIRE(0),
- VINE_MODE(0)
+ VINE_MODE(0),
+ gravWallChanged(false)
{
int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1};
int tportal_ry[] = {-1,-1,-1, 0, 1, 1, 1, 0};
@@ -4917,6 +4918,13 @@ Simulation::Simulation():
memcpy(gmenu, golMenuT, sizeof(gol_menu) * golMenuCount);
free(golMenuT);
+ Element_STKM::STKM_init_legs(this, &player, 0);
+ player.spwn = 1;
+ player.elem = PT_DUST;
+ Element_STKM::STKM_init_legs(this, &player2, 0);
+ player2.spwn = 1;
+ player2.elem = PT_DUST;
+
init_can_move();
clear_sim();