From 3c10632e789b5fc900a8e83d596a388e71be8387 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Sat, 17 Dec 2011 14:05:50 +0000 Subject: [PATCH] Fixed Segmentation fault caused by Tile collision being out of bounds. --- Data/Media/Maps/map2 | 61 --------------------------------------- src/Unuk/Game.cpp | 2 +- src/libUnuk/Character.cpp | 4 +-- src/libUnuk/Map.cpp | 2 -- 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 Data/Media/Maps/map2 diff --git a/Data/Media/Maps/map2 b/Data/Media/Maps/map2 deleted file mode 100644 index cb63eef..0000000 --- a/Data/Media/Maps/map2 +++ /dev/null @@ -1,61 +0,0 @@ - - - -grass -false - -null -false - -100 - -null -0 -0 - - - -grass -false - -null -false - -100 - -null -0 -0 - - - - - -rock -false - -null -false - -100 - -null -0 -0 - - - -snow -true - -null -false - -100 - -null -0 -0 - - - diff --git a/src/Unuk/Game.cpp b/src/Unuk/Game.cpp index 005663f..dc70638 100644 --- a/src/Unuk/Game.cpp +++ b/src/Unuk/Game.cpp @@ -161,8 +161,8 @@ void Game::Render(void) { } else { m_ingameMenu.Render(); } + SDL_Flip(screen); - //SDL_Flip(screen); } void Game::LoadSavegame(const string savegameIDArg) { diff --git a/src/libUnuk/Character.cpp b/src/libUnuk/Character.cpp index 27bcdca..ab881a2 100644 --- a/src/libUnuk/Character.cpp +++ b/src/libUnuk/Character.cpp @@ -169,8 +169,8 @@ bool Character::CheckTileCollisions(void) { } bool Character::CheckEntityCollisions(void) { - for(int i = -2; i < 3; i++) { - for(int j = -2; j < 3; j++) { + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { if(map->GetEntitySolidity(tileX + i, tileY + j)) { if(CheckCollisionXY(x, y, w, h, map->GetEntityX(tileX + i, tileY + j), map->GetEntityY(tileX + i, tileY + j), diff --git a/src/libUnuk/Map.cpp b/src/libUnuk/Map.cpp index b4b8047..57a5143 100644 --- a/src/libUnuk/Map.cpp +++ b/src/libUnuk/Map.cpp @@ -23,8 +23,6 @@ void Map::Load(const string filename) { TiXmlElement* tileElem = NULL; TiXmlElement* dataElem = NULL; - // We will set x and y positions to zero for now, as we - // are going to set them withing the XML file. x = -1; y = -1;