From 5531cf9fd503c3e74b8a32f6b12f2243bac68c06 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Jun 2015 21:07:50 -0400 Subject: SHERLOCK: Refactored walk data block to e a proper structure --- engines/sherlock/people.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'engines/sherlock/people.cpp') diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index c108d333b9..349be671a4 100644 --- a/engines/sherlock/people.cpp +++ b/engines/sherlock/people.cpp @@ -124,11 +124,10 @@ void Person::goAllTheWay() { if (i == -1) i = scene._walkDirectory[_destZone][_srcZone]; - int count = scene._walkData[i]; - ++i; + const WalkArray &points = scene._walkPoints[i]; // See how many points there are between the src and dest zones - if (!count || count == -1) { + if (!points._pointsCount || points._pointsCount == -1) { // There are none, so just walk to the new zone setWalking(); } else { @@ -137,14 +136,11 @@ void Person::goAllTheWay() { _walkTo.clear(); if (scene._walkDirectory[_srcZone][_destZone] != -1) { - i += 3 * (count - 1); - for (int idx = 0; idx < count; ++idx, i -= 3) { - _walkTo.push(Common::Point(READ_LE_UINT16(&scene._walkData[i]), - scene._walkData[i + 2])); - } + for (int idx = (int)points.size() - 1; idx >= 0; --idx) + _walkTo.push(points[idx]); } else { - for (int idx = 0; idx < count; ++idx, i += 3) { - _walkTo.push(Common::Point(READ_LE_UINT16(&scene._walkData[i]), scene._walkData[i + 2])); + for (int idx = 0; idx < (int)points.size(); ++idx) { + _walkTo.push(points[idx]); } } -- cgit v1.2.3