diff options
author | Andrei Prykhodko | 2018-07-01 10:12:20 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-07-01 10:36:06 +0300 |
commit | 95c7dcce904274ef4ac36b5d2d108c34cdbca168 (patch) | |
tree | 89b5ab687b31c89103496a6e7b3a9426cb0d15d8 /engines/pink | |
parent | 0fefa96897f0889c0874290567ab4a9a2d42351f (diff) | |
download | scummvm-rg350-95c7dcce904274ef4ac36b5d2d108c34cdbca168.tar.gz scummvm-rg350-95c7dcce904274ef4ac36b5d2d108c34cdbca168.tar.bz2 scummvm-rg350-95c7dcce904274ef4ac36b5d2d108c34cdbca168.zip |
PINK: added calculation of countries and domains indexes
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/pda_mgr.cpp | 22 | ||||
-rw-r--r-- | engines/pink/pda_mgr.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp index 947ebcc573..0877b0b556 100644 --- a/engines/pink/pda_mgr.cpp +++ b/engines/pink/pda_mgr.cpp @@ -201,6 +201,7 @@ void PDAMgr::initPerilButtons() { domainButton->setAction(kInactiveAction); updateWheels(); } else { + calculateIndexes(); navigatorButton->setAction(kIdleAction); if (isDomain(_page->getName())) domainButton->setAction(kInactiveAction); @@ -240,4 +241,25 @@ void PDAMgr::updateLocator() { locator->setAction(g_countries[_countryIndex]); } +void PDAMgr::calculateIndexes() { + Common::String country = Common::String::format("%.3s", _page->getName().c_str()); + for (uint i = 0; i < 6; ++i) { + if (country == g_countries[i]) { + _countryIndex = i; + break; + } + } + + Common::String domain = _page->getName(); + domain.erase(0, 3); + if (domain.size() >= 4) + domain.erase(3); + for (uint i = 0; i < 8; ++i) { + if (domain == g_domains[i]) { + _domainIndex = i; + break; + } + } +} + } // End of namespace Pink diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h index 92ebcf165f..afcae1ba53 100644 --- a/engines/pink/pda_mgr.h +++ b/engines/pink/pda_mgr.h @@ -68,6 +68,8 @@ private: void updateWheels(bool playSfx = 0); void updateLocator(); + void calculateIndexes(); + static bool isNavigate(const Common::String &name); static bool isDomain(const Common::String &name); |