diff options
author | whiterandrek | 2018-05-21 13:57:01 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 8733e54cd413819f87cb470e6c645d1320a54bf2 (patch) | |
tree | f26d850ab3eebfe6e9fa9e0511e4c56cabf284c4 /engines | |
parent | 39ed15d2f700575ad68c638808f9cf07dc786ec1 (diff) | |
download | scummvm-rg350-8733e54cd413819f87cb470e6c645d1320a54bf2.tar.gz scummvm-rg350-8733e54cd413819f87cb470e6c645d1320a54bf2.tar.bz2 scummvm-rg350-8733e54cd413819f87cb470e6c645d1320a54bf2.zip |
PINK: remove the use of auto variables
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pink/archive.h | 8 | ||||
-rw-r--r-- | engines/pink/objects/actors/actor.cpp | 13 | ||||
-rw-r--r-- | engines/pink/objects/inventory.cpp | 11 | ||||
-rw-r--r-- | engines/pink/objects/pages/page.cpp | 15 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence.cpp | 2 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.cpp | 10 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_shortest_path.cpp | 4 |
7 files changed, 31 insertions, 32 deletions
diff --git a/engines/pink/archive.h b/engines/pink/archive.h index 6b74c145e6..f12c3e572d 100644 --- a/engines/pink/archive.h +++ b/engines/pink/archive.h @@ -143,10 +143,10 @@ inline Archive &operator<<(Archive &archive, Common::StringArray &array){ inline Archive &operator<<(Archive &archive, Common::StringMap &map){ archive.writeWORD(map.size()); - for (auto &pair : map) { - archive.writeString(pair._key); - archive.writeString(pair._value); - } + for (Common::StringMap::const_iterator it = map.begin(); it != map.end(); ++it) { + archive.writeString(it->_key); + archive.writeString(it->_value); + } return archive; } diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp index 3bfd1eb184..189e531c92 100644 --- a/engines/pink/objects/actors/actor.cpp +++ b/engines/pink/objects/actors/actor.cpp @@ -47,13 +47,12 @@ Sequencer *Actor::getSequencer() const { } Action *Actor::findAction(const Common::String &name) { - auto action = Common::find_if(_actions.begin(), _actions.end(), [&name] - (Action* action) { - return name == action->getName(); - }); - if (action == _actions.end()) - return nullptr; - return *action; + for (uint i = 0; i < _actions.size(); ++i) { + if (_actions[i]->getName() == name) { + return _actions[i]; + } + } + return nullptr; } GamePage *Actor::getPage() const { diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index 66dbd400c0..d62530c553 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -63,11 +63,12 @@ void InventoryMgr::deserialize(Archive &archive) { } InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) { - auto it = Common::find_if(_items.begin(), _items.end(), [&name] - (InventoryItem *item) { - return name == item->getName(); - });; - return it != _items.end() ? *it : nullptr; + for (uint i = 0; i < _items.size(); ++i) { + if (_items[i]->getName() == name) { + return _items[i]; + } + } + return nullptr; } void InventoryMgr::setLeadActor(LeadActor *lead) { diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp index f2b8bb4a93..9c923e2ebb 100644 --- a/engines/pink/objects/pages/page.cpp +++ b/engines/pink/objects/pages/page.cpp @@ -38,15 +38,12 @@ void Page::load(Archive &archive) { } Actor *Page::findActor(const Common::String &name) { - auto it = Common::find_if(_actors.begin(), _actors.end(), [&name] - (Actor *actor) { - return name == actor->getName(); - }); - - if (it == _actors.end()) - return nullptr; - - return *it; + for (uint i = 0; i < _actors.size(); ++i) { + if (_actors[i]->getName() == name) { + return _actors[i]; + } + } + return nullptr; } Sound *Page::loadSound(Common::String &fileName) { diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp index c41d225510..b2cc5e764d 100644 --- a/engines/pink/objects/sequences/sequence.cpp +++ b/engines/pink/objects/sequences/sequence.cpp @@ -153,7 +153,7 @@ void SequenceAudio::start(int unk) { Sequence::start(unk); int index = _context->getNextItemIndex(); if (index < _items.size()) { - auto leaderAudio = (SequenceItemLeaderAudio*) _items[index]; + SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index]; _sample = leaderAudio->getSample(); } } diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp index ed6cb39a1b..eb2ce5e204 100644 --- a/engines/pink/objects/walk/walk_mgr.cpp +++ b/engines/pink/objects/walk/walk_mgr.cpp @@ -41,10 +41,12 @@ void WalkMgr::deserialize(Pink::Archive &archive) { } WalkLocation *WalkMgr::findLocation(const Common::String &name) { - auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) { - return location->getName() == name; - }); - return (it != _locations.end()) ? *it : nullptr; + for (uint i = 0; i < _locations.size(); ++i) { + if (_locations[i]->getName() == name) { + return _locations[i]; + } + } + return nullptr; } void WalkMgr::toConsole() { diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp index 2148d4c0a8..ca07da9602 100644 --- a/engines/pink/objects/walk/walk_shortest_path.cpp +++ b/engines/pink/objects/walk/walk_shortest_path.cpp @@ -91,7 +91,7 @@ void WalkShortestPath::addLocationsToVisit() { double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) { double minLength = -1.0; - auto &neighbors = location->getNeigbors(); + Common::StringArray &neighbors = location->getNeigbors(); for (int i = 0; i < neighbors.size(); ++i) { WalkLocation *neighbor = _manager->findLocation(neighbors[i]); if (!isLocationVisited(neighbor)){ @@ -110,7 +110,7 @@ double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) { WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) { double minLength = -1.0; WalkLocation *nearest = nullptr; - auto neighbors = location->getNeigbors(); + Common::StringArray &neighbors = location->getNeigbors(); for (int i = 0; i < neighbors.size(); ++i) { WalkLocation *neighbor = _manager->findLocation(neighbors[i]); if (!isLocationVisited(neighbor)){ |