aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/walk
diff options
context:
space:
mode:
authorwhiterandrek2018-04-27 17:08:48 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit9f8356e52e25b11d0e842728d2134d5c32e22e3b (patch)
treecd4086b97c9dbd750a58920d41610302ff32d28a /engines/pink/objects/walk
parent888f5b668fb4d06e38b0dc581b24ab37f5a1852e (diff)
downloadscummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.tar.gz
scummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.tar.bz2
scummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.zip
PINK: fixed Inventory onClick method and other bugfixes
Diffstat (limited to 'engines/pink/objects/walk')
-rw-r--r--engines/pink/objects/walk/walk_mgr.cpp5
-rw-r--r--engines/pink/objects/walk/walk_shortest_path.cpp5
2 files changed, 4 insertions, 6 deletions
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 0cacbd07f6..b87429d616 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -44,10 +44,7 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) {
auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) {
return location->getName() == name;
});
- if (it == _locations.end())
- return nullptr;
-
- return *it;
+ return (it != _locations.end()) ? *it : 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 77562e81cb..4c6f84a154 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -142,9 +142,9 @@ double WalkShortestPath::getWeight(WalkLocation *location) {
bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
for (int i = 0; i < _visited.size(); ++i) {
if (_visited[i] == location)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
void WalkShortestPath::remove(WalkLocation *location) {
@@ -152,6 +152,7 @@ void WalkShortestPath::remove(WalkLocation *location) {
if (_locations[i] == location){
_locations.remove_at(i);
_weight.remove_at(i);
+ break;
}
}
}