diff options
| author | jacob1 <jfu614@gmail.com> | 2013-02-24 16:50:20 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-02-24 16:50:20 (GMT) |
| commit | 7379a6b5ba65ff106ec5656bdeb3a9707e9fac62 (patch) | |
| tree | 9dc702b7d3ec3bbe2b57ddb5d290cf19ae424b38 /src | |
| parent | 6b1e99a73169550e8bcb4c29ff105dde83924cea (diff) | |
| download | powder-7379a6b5ba65ff106ec5656bdeb3a9707e9fac62.zip powder-7379a6b5ba65ff106ec5656bdeb3a9707e9fac62.tar.gz | |
fix crash when hovering the mouse over invalid wall types
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/GameSave.cpp | 6 | ||||
| -rw-r--r-- | src/game/GameController.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index d3ada65..791069d 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -740,6 +740,9 @@ void GameSave::readOPS(char * data, int dataLength) fanVelX[blockY+y][blockX+x] = (fanData[j++]-127.0f)/64.0f; fanVelY[blockY+y][blockX+x] = (fanData[j++]-127.0f)/64.0f; } + + if (blockMap[y][x] < 0 || blockMap[y][x] >= UI_WALLCOUNT) + blockMap[y][x] = 0; } } } @@ -1195,6 +1198,9 @@ void GameSave::readPSv(char * data, int dataLength) blockMap[y][x]=WL_GRAV; else if (blockMap[y][x]==O_WL_ALLOWENERGY) blockMap[y][x]=WL_ALLOWENERGY; + + if (blockMap[y][x] < 0 || blockMap[y][x] >= UI_WALLCOUNT) + blockMap[y][x] = 0; } p++; diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 9e7978b..c866805 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -1298,7 +1298,7 @@ std::string GameController::ElementResolve(int type) std::string GameController::WallName(int type) { - if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0) + if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0 && type < UI_WALLCOUNT) return std::string(gameModel->GetSimulation()->wtypes[type].name); else return ""; |
