Skip to content

Commit

Permalink
TSAGE: R2R - fix a crash in scene 1337. Remove useless checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Sep 29, 2014
1 parent 62b9891 commit 6eb3dc0
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions engines/tsage/ringworld2/ringworld2_scenes1.cpp
Expand Up @@ -5973,26 +5973,17 @@ void Scene1337::handlePlayer1() {
}

int count = -1;
int i;
for (i = 0; i <= 3; i++) {
for (int i = 0; i <= 3; i++) {
int tmpVal = isDelayCard(_gameBoardSide[1]._handCard[i]._cardId);
if (tmpVal != -1) {
int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3);

for (int j = 0; j <= 3; j++) {
//CHECKME: tmpVal or rndVal?
// FIXME: This is probably meant to be rndVal, but not clear...
if (tmpVal < 0 || tmpVal >= ARRAYSIZE(_gameBoardSide))
error("Scene1337::handlePlayer1() tmpVal:%d out of range 0 to %d", tmpVal, ARRAYSIZE(_gameBoardSide)-1);

if (tmpVal != 1) {
if ((_gameBoardSide[tmpVal]._delayCard._cardId == 0) && isAttackPossible(tmpVal, _gameBoardSide[1]._handCard[i]._cardId))
count = tmpVal;
if (rndVal != 1) {
if ((_gameBoardSide[rndVal]._delayCard._cardId == 0) && isAttackPossible(rndVal, _gameBoardSide[1]._handCard[i]._cardId))
count = rndVal;
}

if (count < 0 || count >= ARRAYSIZE(_gameBoardSide))
error("Scene1337::handlePlayer1() count:%d out of range 0 to %d", count, ARRAYSIZE(_gameBoardSide)-1);

if (count != -1) {
playDelayCard(&_gameBoardSide[1]._handCard[i], &_gameBoardSide[count]._delayCard);
return;
Expand Down

0 comments on commit 6eb3dc0

Please sign in to comment.