[Scummvm-cvs-logs] scummvm master -> 0c7fcff8a3fa10fc9bedcf0ac299809f9a140632

Strangerke Strangerke at scummvm.org
Wed Jun 13 16:29:17 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0c7fcff8a3 HUGO: Use Common::Point in pathfinding


Commit: 0c7fcff8a3fa10fc9bedcf0ac299809f9a140632
    https://github.com/scummvm/scummvm/commit/0c7fcff8a3fa10fc9bedcf0ac299809f9a140632
Author: Strangerke (strangerke at scummvm.org)
Date: 2012-06-13T07:28:47-07:00

Commit Message:
HUGO: Use Common::Point in pathfinding

Changed paths:
    engines/hugo/route.cpp
    engines/hugo/route.h



diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 7f63cca..873cb58 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 b20ac77..53b0dd0 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






More information about the Scummvm-git-logs mailing list