Fixed Segmentation fault caused by Tile collision being out of bounds.
This commit is contained in:
parent
389eac4ee7
commit
3c10632e78
@ -1,61 +0,0 @@
|
||||
<map>
|
||||
<line>
|
||||
<tile>
|
||||
<tileTexture>grass</tileTexture>
|
||||
<solidTile>false</solidTile>
|
||||
|
||||
<entityTexture>null</entityTexture>
|
||||
<solidEntity>false</solidEntity>
|
||||
|
||||
<zLevel>100</zLevel>
|
||||
|
||||
<mapTransition>null</mapTransition>
|
||||
<mapTransX>0</mapTransX>
|
||||
<mapTransY>0</mapTransY>
|
||||
</tile>
|
||||
|
||||
<tile>
|
||||
<tileTexture>grass</tileTexture>
|
||||
<solidTile>false</solidTile>
|
||||
|
||||
<entityTexture>null</entityTexture>
|
||||
<solidEntity>false</solidEntity>
|
||||
|
||||
<zLevel>100</zLevel>
|
||||
|
||||
<mapTransition>null</mapTransition>
|
||||
<mapTransX>0</mapTransX>
|
||||
<mapTransY>0</mapTransY>
|
||||
</tile>
|
||||
</line>
|
||||
|
||||
<line>
|
||||
<tile>
|
||||
<tileTexture>rock</tileTexture>
|
||||
<solidTile>false</solidTile>
|
||||
|
||||
<entityTexture>null</entityTexture>
|
||||
<solidEntity>false</solidEntity>
|
||||
|
||||
<zLevel>100</zLevel>
|
||||
|
||||
<mapTransition>null</mapTransition>
|
||||
<mapTransX>0</mapTransX>
|
||||
<mapTransY>0</mapTransY>
|
||||
</tile>
|
||||
|
||||
<tile>
|
||||
<tileTexture>snow</tileTexture>
|
||||
<solidTile>true</solidTile>
|
||||
|
||||
<entityTexture>null</entityTexture>
|
||||
<solidEntity>false</solidEntity>
|
||||
|
||||
<zLevel>100</zLevel>
|
||||
|
||||
<mapTransition>null</mapTransition>
|
||||
<mapTransX>0</mapTransX>
|
||||
<mapTransY>0</mapTransY>
|
||||
</tile>
|
||||
</line>
|
||||
</map>
|
@ -161,8 +161,8 @@ void Game::Render(void) {
|
||||
} else {
|
||||
m_ingameMenu.Render();
|
||||
}
|
||||
|
||||
SDL_Flip(screen);
|
||||
//SDL_Flip(screen);
|
||||
}
|
||||
|
||||
void Game::LoadSavegame(const string savegameIDArg) {
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user