aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-06-13 16:28:47 +0200
committerStrangerke2012-06-13 16:28:47 +0200
commit0c7fcff8a3fa10fc9bedcf0ac299809f9a140632 (patch)
tree486cb8b0eda88f14e7818af2952ddf0c5747683a
parentd3929bd4bc4dbd0f7f2b57000be757e6bc7706e8 (diff)
downloadscummvm-rg350-0c7fcff8a3fa10fc9bedcf0ac299809f9a140632.tar.gz
scummvm-rg350-0c7fcff8a3fa10fc9bedcf0ac299809f9a140632.tar.bz2
scummvm-rg350-0c7fcff8a3fa10fc9bedcf0ac299809f9a140632.zip
HUGO: Use Common::Point in pathfinding
-rw-r--r--engines/hugo/route.cpp6
-rw-r--r--engines/hugo/route.h11
2 files changed, 7 insertions, 10 deletions
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 7f63ccac3b..873cb587af 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -298,7 +298,7 @@ void Route::segment(int16 x, int16 y) {
* Create and return ptr to new node. Initialize with previous node.
* Returns 0 if MAX_NODES exceeded
*/
-Point *Route::newNode() {
+Common::Point *Route::newNode() {
debugC(1, kDebugRoute, "newNode");
_routeListIndex++;
@@ -373,7 +373,7 @@ bool Route::findRoute(const int16 cx, const int16 cy) {
_segment[_segmentNumb]._x2 = herox2;
_segmentNumb++;
- Point *routeNode; // Ptr to route node
+ Common::Point *routeNode; // Ptr to route node
// Look in segments[] for straight lines from destination to hero
for (i = 0, _routeListIndex = 0; i < _segmentNumb - 1; i++) {
if ((routeNode = newNode()) == 0) // New node for new segment
@@ -435,7 +435,7 @@ void Route::processRoute() {
// Current hero position
int16 herox = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1;
int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2;
- Point *routeNode = &_route[_routeIndex];
+ Common::Point *routeNode = &_route[_routeIndex];
// Arrived at node?
if (abs(herox - routeNode->x) < kStepDx + 1 && abs(heroy - routeNode->y) < kStepDy) {
diff --git a/engines/hugo/route.h b/engines/hugo/route.h
index b20ac771d7..53b0dd0f88 100644
--- a/engines/hugo/route.h
+++ b/engines/hugo/route.h
@@ -30,6 +30,8 @@
#ifndef HUGO_ROUTE_H
#define HUGO_ROUTE_H
+#include "common/rect.h"
+
namespace Hugo {
/**
@@ -37,11 +39,6 @@ namespace Hugo {
*/
enum go_t {kRouteSpace, kRouteExit, kRouteLook, kRouteGet};
-struct Point {
- int x;
- int y;
-};
-
struct segment_t { // Search segment
int16 _y; // y position
int16 _x1, _x2; // Range of segment
@@ -75,7 +72,7 @@ private:
byte _boundaryMap[kYPix][kXPix]; // Boundary byte map
segment_t _segment[kMaxSeg]; // List of points in fill-path
- Point _route[kMaxNodes]; // List of nodes in route (global)
+ Common::Point _route[kMaxNodes]; // List of nodes in route (global)
int16 _segmentNumb; // Count number of segments
int16 _routeListIndex; // Index into route list
int16 _destX;
@@ -87,7 +84,7 @@ private:
void segment(int16 x, int16 y);
bool findRoute(const int16 cx, const int16 cy);
- Point *newNode();
+ Common::Point *newNode();
};
} // End of namespace Hugo