aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorStrangerke2013-12-14 23:36:04 +0100
committerStrangerke2013-12-14 23:36:04 +0100
commitdd7b3a09c7783824161d28477a1e9247686821d9 (patch)
tree8b6ee7a91e42069808070cb6680f420e13e2bcd7 /engines/tsage
parent4b53cb3dd86bf35a5312774119cbd214b2e23b5e (diff)
downloadscummvm-rg350-dd7b3a09c7783824161d28477a1e9247686821d9.tar.gz
scummvm-rg350-dd7b3a09c7783824161d28477a1e9247686821d9.tar.bz2
scummvm-rg350-dd7b3a09c7783824161d28477a1e9247686821d9.zip
TSAGE: R2R - Refactoring in handlePlayer3(), some renaming, fix a bug in handlePlayer3()
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp71
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h4
2 files changed, 24 insertions, 51 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index be5c9100fa..3c42d5fa24 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -4697,7 +4697,7 @@ bool Scene1337::subC264B(int cardId) {
}
}
-bool Scene1337::subC2687(int cardId) {
+bool Scene1337::isStopConstructionCard(int cardId) {
switch (cardId) {
case 11:
// No break on purpose
@@ -5814,7 +5814,7 @@ void Scene1337::handlePlayer0() {
if (!flag) {
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[0]._outpostStation[j]._cardId == 1) && (!subC2687(_gameBoardSide[0]._delayCard._cardId))) {
+ if ((_gameBoardSide[0]._outpostStation[j]._cardId == 1) && !isStopConstructionCard(_gameBoardSide[0]._delayCard._cardId)) {
int stationCount = 0;
for (int k = 0; k <= 7; k++) {
if ((_gameBoardSide[0]._outpostStation[k]._cardId > 1) && (_gameBoardSide[0]._outpostStation[k]._cardId <= 9)) {
@@ -5837,7 +5837,7 @@ void Scene1337::handlePlayer0() {
if (tmpVal != -1) {
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[0]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[0]._delayCard._cardId))) {
+ if ((_gameBoardSide[0]._outpostStation[i]._cardId == 0) && !isStopConstructionCard(_gameBoardSide[0]._delayCard._cardId)) {
playPlatformCard(&_gameBoardSide[0]._handCard[tmpVal], &_gameBoardSide[0]._outpostStation[i]);
return;
}
@@ -6001,7 +6001,7 @@ void Scene1337::handlePlayer1() {
break;
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[1]._outpostStation[j]._cardId == 1) && !subC2687(_gameBoardSide[1]._delayCard._cardId)) {
+ if ((_gameBoardSide[1]._outpostStation[j]._cardId == 1) && !isStopConstructionCard(_gameBoardSide[1]._delayCard._cardId)) {
int stationCount = 0;
for (int k = 0; k <= 7; k++) {
if ((_gameBoardSide[1]._outpostStation[k]._cardId > 1) && (_gameBoardSide[1]._outpostStation[k]._cardId <= 9))
@@ -6020,7 +6020,7 @@ void Scene1337::handlePlayer1() {
int normalCardId = findNormalCardInHand(1);
if (normalCardId != -1) {
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[1]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[1]._delayCard._cardId))) {
+ if ((_gameBoardSide[1]._outpostStation[i]._cardId == 0) && !isStopConstructionCard(_gameBoardSide[1]._delayCard._cardId)) {
playPlatformCard(&_gameBoardSide[1]._handCard[normalCardId], &_gameBoardSide[1]._outpostStation[i]);
return;
}
@@ -6124,8 +6124,6 @@ void Scene1337::handlePlayer1() {
}
void Scene1337::handlePlayer3() {
- bool found = true;
-
if (_gameBoardSide[3]._delayCard._cardId != 0) {
switch (_gameBoardSide[3]._delayCard._cardId) {
case 10:
@@ -6144,74 +6142,50 @@ void Scene1337::handlePlayer3() {
// No break on purpose
case 21:
discardCard(&_gameBoardSide[3]._delayCard);
- found = false;
break;
default:
- found = false;
int i;
for (i = 0; i <= 3; i++) {
if (checkAntiDelayCard(_gameBoardSide[3]._delayCard._cardId, _gameBoardSide[3]._handCard[i]._cardId)) {
- found = true;
- break;
+ playAntiDelayCard(&_gameBoardSide[3]._handCard[i], &_gameBoardSide[3]._delayCard);
+ return;
}
}
-
- if (found) {
- found = false;
- playAntiDelayCard(&_gameBoardSide[3]._handCard[i], &_gameBoardSide[3]._delayCard);
- }
break;
}
}
- if (!found)
- return;
-
int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
if (_gameBoardSide[3]._handCard[randIndx]._cardId == 1) {
- found = false;
-
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[3]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[3]._delayCard._cardId))) {
+ if ((_gameBoardSide[3]._outpostStation[i]._cardId == 0) && !isStopConstructionCard(_gameBoardSide[3]._delayCard._cardId)) {
playPlatformCard(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[3]._outpostStation[i]);
- found = true;
- break;
+ return;
}
}
-
- if (found) {
- return;
- }
} else if (_gameBoardSide[3]._handCard[randIndx]._cardId <= 9) {
- found = false;
-
for (int i = 0; i <= 7; i++) {
if (_gameBoardSide[3]._outpostStation[i]._cardId == _gameBoardSide[3]._handCard[randIndx]._cardId) {
- found = true;
- break;
+ discardCard(&_gameBoardSide[3]._handCard[randIndx]);
+ return;
}
}
- if (!found) {
- for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[3]._outpostStation[i]._cardId == 1) && (!subC2687(_gameBoardSide[3]._delayCard._cardId))) {
- int stationCount = 0;
- for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[3]._outpostStation[j]._cardId > 1) && (_gameBoardSide[3]._outpostStation[j]._cardId <= 9))
- ++stationCount;
- }
+ for (int i = 0; i <= 7; i++) {
+ if ((_gameBoardSide[3]._outpostStation[i]._cardId == 1) && !isStopConstructionCard(_gameBoardSide[3]._delayCard._cardId)) {
+ int stationCount = 0;
+ for (int j = 0; j <= 7; j++) {
+ if ((_gameBoardSide[3]._outpostStation[j]._cardId > 1) && (_gameBoardSide[3]._outpostStation[j]._cardId <= 9))
+ ++stationCount;
+ }
- if (stationCount == 7)
- _winnerId = 3;
+ if (stationCount == 7)
+ _winnerId = 3;
- playStationCard(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[3]._outpostStation[i]);
- found = true;
- break;
- }
- }
- if (found)
+ playStationCard(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[3]._outpostStation[i]);
return;
+ }
}
} else if (_gameBoardSide[3]._handCard[randIndx]._cardId == 13) {
int tmpVal = getPlayerWithOutpost(3);
@@ -6222,7 +6196,6 @@ void Scene1337::handlePlayer3() {
}
} else if (_gameBoardSide[3]._handCard[randIndx]._cardId == 25) {
int tmpVal = -1;
- found = false;
int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
for (int i = 0; i <= 3; i++) {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index 6ec25a84b7..003ce46412 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -334,7 +334,7 @@ public:
void handleNextTurn();
void subC2586();
bool subC264B(int cardId);
- bool subC2687(int cardId);
+ bool isStopConstructionCard(int cardId);
int subC26CB(int playerId, int handCardId);
int findNormalCardInHand(int playerId);
int findCard13InHand(int playerId);
@@ -347,7 +347,7 @@ public:
bool subC32B1(int victimId, int cardId);
int getPlayerWithOutpost(int playerId);
bool checkAntiDelayCard(int delayCardId, int cardId);
- void playStationCard(Card *subObj1, Card *subObj2);
+ void playStationCard(Card *station, Card *platform);
void playDelayCard(Card *card, Card *dest);
void playPlatformCard(Card *card, Card *dest);
void playAntiDelayCard(Card *card, Card *dest);