diff options
author | Bastien Bouclet | 2016-11-05 12:39:51 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | efcf38f95f14272efd8ace91747a45bd53c74b57 (patch) | |
tree | 24dd9fd1c89ac06b84addd07da5efbee88f697e1 /engines/mohawk/riven_stack.cpp | |
parent | c04edb8f54f6e44079b389263428719c0b3c562c (diff) | |
download | scummvm-rg350-efcf38f95f14272efd8ace91747a45bd53c74b57.tar.gz scummvm-rg350-efcf38f95f14272efd8ace91747a45bd53c74b57.tar.bz2 scummvm-rg350-efcf38f95f14272efd8ace91747a45bd53c74b57.zip |
MOHAWK: Factor out stack name-id mapping
Diffstat (limited to 'engines/mohawk/riven_stack.cpp')
-rw-r--r-- | engines/mohawk/riven_stack.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp index 225e699591..ab79b788f4 100644 --- a/engines/mohawk/riven_stack.cpp +++ b/engines/mohawk/riven_stack.cpp @@ -136,7 +136,7 @@ uint32 RivenStack::getCardGlobalId(uint16 cardId) const { void RivenStack::dump() const { debug("= Stack ="); debug("id: %d", _id); - debug("name: %s", _vm->getStackName(_id).c_str()); + debug("name: %s", RivenStacks::getName(_id)); debugN("\n"); for (uint i = 0; i < _cardIdMap.size(); i++) { @@ -291,4 +291,35 @@ int16 RivenNameList::getNameId(const Common::String &name) const { return -1; } +namespace RivenStacks { +static const char *names[] = { + "<unknown>", + "ospit", + "pspit", + "rspit", + "tspit", + "bspit", + "gspit", + "jspit", + "aspit" +}; + +const char *getName(uint16 stackId) { + // Sanity check. + assert(stackId < ARRAYSIZE(names)); + + return names[stackId]; +} + +uint16 getId(const char *stackName) { + for (byte i = 0; i < ARRAYSIZE(names); i++) { + if (scumm_stricmp(stackName, names[i]) == 0) { + return i; + } + } + + return kStackUnknown; +} +} // End of namespace RivenStacks + } // End of namespace Mohawk |