LAB: Rename the members of the CrumbData struct

This helps to distinguish them from the LabEngine variables
This commit is contained in:
Filippos Karapetis 2016-01-14 00:46:06 +02:00
parent cb0f7e8a92
commit 463f889447
4 changed files with 26 additions and 26 deletions

View File

@ -603,7 +603,7 @@ bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifie
bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualifier, Common::Point &curPos, uint16 &curInv, bool &forceDraw, uint16 code) { bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualifier, Common::Point &curPos, uint16 &curInv, bool &forceDraw, uint16 code) {
if ((getPlatform() == Common::kPlatformWindows) && (code == Common::KEYCODE_b)) { if ((getPlatform() == Common::kPlatformWindows) && (code == Common::KEYCODE_b)) {
// Start bread crumbs // Start bread crumbs
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_numCrumbs = 0; _numCrumbs = 0;
_droppingCrumbs = true; _droppingCrumbs = true;
mayShowCrumbIndicator(); mayShowCrumbIndicator();
@ -631,7 +631,7 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualif
_graphics->screenUpdate(); _graphics->screenUpdate();
} }
} else { } else {
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_droppingCrumbs = false; _droppingCrumbs = false;
// Need to hide indicator!!!! // Need to hide indicator!!!!
@ -788,13 +788,13 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
_followingCrumbs = false; _followingCrumbs = false;
_droppingCrumbs = false; _droppingCrumbs = false;
_numCrumbs = 0; _numCrumbs = 0;
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
} else { } else {
bool intersect = false; bool intersect = false;
for (int idx = 0; idx < _numCrumbs; idx++) { for (int idx = 0; idx < _numCrumbs; idx++) {
if (_breadCrumbs[idx]._roomNum == _roomNum) { if (_breadCrumbs[idx]._crumbRoomNum == _roomNum) {
_numCrumbs = idx + 1; _numCrumbs = idx + 1;
_breadCrumbs[_numCrumbs]._roomNum = 0; _breadCrumbs[_numCrumbs]._crumbRoomNum = 0;
intersect = true; intersect = true;
} }
} }
@ -805,8 +805,8 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]); memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]);
} }
_breadCrumbs[_numCrumbs]._roomNum = _roomNum; _breadCrumbs[_numCrumbs]._crumbRoomNum = _roomNum;
_breadCrumbs[_numCrumbs++]._direction = _direction; _breadCrumbs[_numCrumbs++]._crumbDirection = _direction;
} }
} }
} }
@ -905,7 +905,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
break; break;
case kButtonBreadCrumbs: case kButtonBreadCrumbs:
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_numCrumbs = 0; _numCrumbs = 0;
_droppingCrumbs = true; _droppingCrumbs = true;
mayShowCrumbIndicator(); mayShowCrumbIndicator();
@ -930,7 +930,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
_graphics->drawPanel(); _graphics->drawPanel();
drawRoomMessage(curInv, _closeDataPtr); drawRoomMessage(curInv, _closeDataPtr);
} else { } else {
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_droppingCrumbs = false; _droppingCrumbs = false;
// Need to hide indicator!!!! // Need to hide indicator!!!!
@ -1056,12 +1056,12 @@ MainButton LabEngine::followCrumbs() {
} }
if (!_isCrumbTurning) if (!_isCrumbTurning)
_breadCrumbs[_numCrumbs--]._roomNum = 0; _breadCrumbs[_numCrumbs--]._crumbRoomNum = 0;
// Is the current crumb this room? If not, logic error. // Is the current crumb this room? If not, logic error.
if (_roomNum != _breadCrumbs[_numCrumbs]._roomNum) { if (_roomNum != _breadCrumbs[_numCrumbs]._crumbRoomNum) {
_numCrumbs = 0; _numCrumbs = 0;
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_droppingCrumbs = false; _droppingCrumbs = false;
_followingCrumbs = false; _followingCrumbs = false;
return kButtonNone; return kButtonNone;
@ -1069,11 +1069,11 @@ MainButton LabEngine::followCrumbs() {
Direction exitDir; Direction exitDir;
// which direction is last crumb // which direction is last crumb
if (_breadCrumbs[_numCrumbs]._direction == kDirectionEast) if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionEast)
exitDir = kDirectionWest; exitDir = kDirectionWest;
else if (_breadCrumbs[_numCrumbs]._direction == kDirectionWest) else if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionWest)
exitDir = kDirectionEast; exitDir = kDirectionEast;
else if (_breadCrumbs[_numCrumbs]._direction == kDirectionNorth) else if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionNorth)
exitDir = kDirectionSouth; exitDir = kDirectionSouth;
else else
exitDir = kDirectionNorth; exitDir = kDirectionNorth;
@ -1082,7 +1082,7 @@ MainButton LabEngine::followCrumbs() {
if (_numCrumbs == 0) { if (_numCrumbs == 0) {
_isCrumbTurning = false; _isCrumbTurning = false;
_breadCrumbs[0]._roomNum = 0; _breadCrumbs[0]._crumbRoomNum = 0;
_droppingCrumbs = false; _droppingCrumbs = false;
_followingCrumbs = false; _followingCrumbs = false;
} else { } else {

View File

@ -55,8 +55,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_isHiRes = false; _isHiRes = false;
_roomNum = -1; _roomNum = -1;
for (int i = 0; i < MAX_CRUMBS; i++) { for (int i = 0; i < MAX_CRUMBS; i++) {
_breadCrumbs[i]._roomNum = 0; _breadCrumbs[i]._crumbRoomNum = 0;
_breadCrumbs[i]._direction = kDirectionNorth; _breadCrumbs[i]._crumbDirection = kDirectionNorth;
} }
_numCrumbs = 0; _numCrumbs = 0;

View File

@ -81,8 +81,8 @@ enum GameFeatures {
typedef Common::List<Button *> ButtonList; typedef Common::List<Button *> ButtonList;
struct CrumbData { struct CrumbData {
uint16 _roomNum; uint16 _crumbRoomNum;
uint16 _direction; uint16 _crumbDirection;
}; };
#define MAX_CRUMBS 128 #define MAX_CRUMBS 128

View File

@ -149,8 +149,8 @@ bool LabEngine::saveGame(int slot, const Common::String desc) {
// Breadcrumbs // Breadcrumbs
for (uint i = 0; i < MAX_CRUMBS; i++) { for (uint i = 0; i < MAX_CRUMBS; i++) {
file->writeUint16LE(_breadCrumbs[i]._roomNum); file->writeUint16LE(_breadCrumbs[i]._crumbRoomNum);
file->writeUint16LE(_breadCrumbs[i]._direction); file->writeUint16LE(_breadCrumbs[i]._crumbDirection);
} }
file->flush(); file->flush();
@ -186,15 +186,15 @@ bool LabEngine::loadGame(int slot) {
// Breadcrumbs // Breadcrumbs
for (int i = 0; i < MAX_CRUMBS; i++) { for (int i = 0; i < MAX_CRUMBS; i++) {
_breadCrumbs[i]._roomNum = file->readUint16LE(); _breadCrumbs[i]._crumbRoomNum = file->readUint16LE();
_breadCrumbs[i]._direction = file->readUint16LE(); _breadCrumbs[i]._crumbDirection = file->readUint16LE();
} }
_droppingCrumbs = (_breadCrumbs[0]._roomNum != 0); _droppingCrumbs = (_breadCrumbs[0]._crumbRoomNum != 0);
_followingCrumbs = false; _followingCrumbs = false;
for (int i = 0; i < MAX_CRUMBS; i++) { for (int i = 0; i < MAX_CRUMBS; i++) {
if (_breadCrumbs[i]._roomNum == 0) if (_breadCrumbs[i]._crumbRoomNum == 0)
break; break;
_numCrumbs = i; _numCrumbs = i;
} }