diff options
Diffstat (limited to 'engines/fullpipe/utils.cpp')
-rw-r--r-- | engines/fullpipe/utils.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index f3f07b0514..c1cf912de6 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -546,4 +546,43 @@ byte *transCyrillic(const Common::String &str) { return tmp; } +void FullpipeEngine::loadGameObjH() { + Common::File file; + + if (!file.open("gameobj.h")) + return; + + while(true) { + Common::String s = file.readLine(); + + if (file.eos()) + break; + + if (!s.hasPrefix("#define ")) { + warning("Bad read: <%s>", s.c_str()); + continue; + } + + int cnt = 0; + const char *ptr = &s.c_str()[8]; // Skip '#define '' + + while (*ptr && *ptr != ' ') { + cnt++; + ptr++; + } + + Common::String val(&s.c_str()[8], cnt); + int key = strtol(ptr, NULL, 10); + + _gameObjH[(uint16)key] = val; + } +} + +Common::String FullpipeEngine::gameIdToStr(uint16 id) { + if (_gameObjH.contains(id)) + return _gameObjH[id]; + + return Common::String::format("%d", id); +} + } // End of namespace Fullpipe |