diff options
author | Eugene Sandulenko | 2017-12-08 23:57:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-12-08 23:57:48 +0100 |
commit | 6d59ecdd41f5ddc1d689540abb65013343bf994d (patch) | |
tree | 21a42f1392224c4aed97ed1bef1f584efca2ab52 /engines/fullpipe/utils.cpp | |
parent | 7724e51936fc006a48ded3efd28b9caf20c5bc7e (diff) | |
download | scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.tar.gz scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.tar.bz2 scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.zip |
FULLPIPE: Load gameobj.h
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 |