From ede25c19bcedb802f3b0a7a1a5dc20238277012c Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Sun, 28 Feb 2016 16:21:46 +0100 Subject: ADL: Rename some #defines and variables for clarity --- engines/adl/adl.cpp | 55 +++++++++++++++++++++++++------------------------- engines/adl/adl.h | 2 +- engines/adl/hires1.cpp | 26 ++++++++++++------------ 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index af71bba5c9..eaffbb5a8b 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -162,27 +162,27 @@ void AdlEngine::readCommands(Common::ReadStream &stream, Commands &commands) { } void AdlEngine::takeItem(byte noun) { - Common::Array::iterator it; + Common::Array::iterator item; - for (it = _inventory.begin(); it != _inventory.end(); ++it) { - if (it->noun != noun || it->room != _room) + for (item = _inventory.begin(); item != _inventory.end(); ++item) { + if (item->noun != noun || item->room != _room) continue; - if (it->state == IDI_ITEM_DOESNT_MOVE) { + if (item->state == IDI_ITEM_DOESNT_MOVE) { printEngineMessage(IDI_MSG_ITEM_DOESNT_MOVE); return; } - if (it->state == IDI_ITEM_MOVED) { - it->room = IDI_NONE; + if (item->state == IDI_ITEM_MOVED) { + item->room = IDI_NONE; return; } - Common::Array::const_iterator it2; - for (it2 = it->roomPictures.begin(); it->roomPictures.end(); ++it2) { - if (*it2 == _rooms[_room].curPicture) { - it->room = IDI_NONE; - it->state = IDI_ITEM_MOVED; + Common::Array::const_iterator pic; + for (pic = item->roomPictures.begin(); item->roomPictures.end(); ++pic) { + if (*pic == _rooms[_room].curPicture) { + item->room = IDI_NONE; + item->state = IDI_ITEM_MOVED; return; } } @@ -192,18 +192,17 @@ void AdlEngine::takeItem(byte noun) { } void AdlEngine::dropItem(byte noun) { - Common::Array::iterator it; + Common::Array::iterator item; - for (it = _inventory.begin(); it != _inventory.end(); ++it) { - if (it->noun != noun || it->room != IDI_NONE) + for (item = _inventory.begin(); item != _inventory.end(); ++item) { + if (item->noun != noun || item->room != IDI_NONE) continue; - it->room = _room; - it->state = IDI_ITEM_MOVED; + item->room = _room; + item->state = IDI_ITEM_MOVED; return; } - // Don't understand printEngineMessage(IDI_MSG_DONT_UNDERSTAND); } @@ -223,11 +222,11 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { offset += 3; break; case IDO_ACT_LIST_ITEMS: { - Common::Array::const_iterator it; + Common::Array::const_iterator item; - for (it = _inventory.begin(); it != _inventory.end(); ++it) - if (it->room == IDI_NONE) - printMessage(it->description); + for (item = _inventory.begin(); item != _inventory.end(); ++item) + if (item->room == IDI_NONE) + printMessage(item->description); ++offset; break; @@ -282,7 +281,7 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { printEngineMessage(IDI_MSG_THANKS_FOR_PLAYING); quitGame(); return; - case IDO_ACT_SET_ITEM_POS: { + case IDO_ACT_PLACE_ITEM: { byte item = command.script[offset + 1] - 1; _inventory[item].room = command.script[offset + 2]; _inventory[item].position.x = command.script[offset + 3]; @@ -384,20 +383,20 @@ bool AdlEngine::checkCommand(const Command &command, byte verb, byte noun) { } bool AdlEngine::doOneCommand(const Commands &commands, byte verb, byte noun) { - Commands::const_iterator it; + Commands::const_iterator cmd; - for (it = commands.begin(); it != commands.end(); ++it) - if (checkCommand(*it, verb, noun)) + for (cmd = commands.begin(); cmd != commands.end(); ++cmd) + if (checkCommand(*cmd, verb, noun)) return true; return false; } void AdlEngine::doAllCommands(const Commands &commands, byte verb, byte noun) { - Commands::const_iterator it; + Commands::const_iterator cmd; - for (it = commands.begin(); it != commands.end(); ++it) - checkCommand(*it, verb, noun); + for (cmd = commands.begin(); cmd != commands.end(); ++cmd) + checkCommand(*cmd, verb, noun); } void AdlEngine::clearScreen() { diff --git a/engines/adl/adl.h b/engines/adl/adl.h index e78d9ae6fd..02207d951e 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -94,7 +94,7 @@ enum EngineString { #define IDO_ACT_SAVE 0x0f #define IDO_ACT_LOAD 0x10 #define IDO_ACT_RESTART 0x11 -#define IDO_ACT_SET_ITEM_POS 0x12 +#define IDO_ACT_PLACE_ITEM 0x12 #define IDO_ACT_SET_ITEM_PIC 0x13 #define IDO_ACT_RESET_PIC 0x14 #define IDO_ACT_GO_NORTH 0x15 diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index 730f229198..dde8ed0fc7 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -218,34 +218,34 @@ void HiRes1Engine::drawPic(byte pic, byte xOffset, byte yOffset) { } void HiRes1Engine::drawItems() { - Common::Array::const_iterator it; + Common::Array::const_iterator item; uint dropped = 0; - for (it = _inventory.begin(); it != _inventory.end(); ++it) { - if (it->room != _room) + for (item = _inventory.begin(); item != _inventory.end(); ++item) { + if (item->room != _room) continue; - if (it->state == IDI_ITEM_MOVED) { + if (item->state == IDI_ITEM_MOVED) { if (_rooms[_room].picture == _rooms[_room].curPicture) { const Common::Point &p = _itemOffsets[dropped]; - if (it->isDrawing) - _display->drawRightAngles(_drawings[it->picture - 1], Common::Point(p.x, p.y), 0, 1, 0x7f); + if (item->isDrawing) + _display->drawRightAngles(_drawings[item->picture - 1], Common::Point(p.x, p.y), 0, 1, 0x7f); else - drawPic(it->picture, p.x, p.y); + drawPic(item->picture, p.x, p.y); ++dropped; } continue; } - Common::Array::const_iterator it2; + Common::Array::const_iterator pic; - for (it2 = it->roomPictures.begin(); it2 != it->roomPictures.end(); ++it2) { - if (*it2 == _rooms[_room].curPicture) { - if (it->isDrawing) - _display->drawRightAngles(_drawings[it->picture - 1], it->position, 0, 1, 0x7f); + for (pic = item->roomPictures.begin(); pic != item->roomPictures.end(); ++pic) { + if (*pic == _rooms[_room].curPicture) { + if (item->isDrawing) + _display->drawRightAngles(_drawings[item->picture - 1], item->position, 0, 1, 0x7f); else - drawPic(it->picture, it->position.x, it->position.y); + drawPic(item->picture, item->position.x, item->position.y); continue; } } -- cgit v1.2.3