diff options
author | Andrew Kurushin | 2005-01-06 21:57:10 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-01-06 21:57:10 +0000 |
commit | 59a93737dbd9b0f60f8545b0a0a23ceb75c03ab7 (patch) | |
tree | a1b9698eee5b0e765c591c6d93069e824d565366 /saga/actor.h | |
parent | 5b19a79b46eb80a91fe8c27874f069eca67a9da8 (diff) | |
download | scummvm-rg350-59a93737dbd9b0f60f8545b0a0a23ceb75c03ab7.tar.gz scummvm-rg350-59a93737dbd9b0f60f8545b0a0a23ceb75c03ab7.tar.bz2 scummvm-rg350-59a93737dbd9b0f60f8545b0a0a23ceb75c03ab7.zip |
non tile mode full actor path finding - preview
svn-id: r16464
Diffstat (limited to 'saga/actor.h')
-rw-r--r-- | saga/actor.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/saga/actor.h b/saga/actor.h index bb2323d1eb..8c5fff49e6 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -52,9 +52,6 @@ namespace Saga { #define ACTOR_SPEECH_STRING_MAX 16 // speech const #define ACTOR_SPEECH_ACTORS_MAX 8 -#define PATH_NODE_MAX 100 -#define PATH_LIST_MAX 500 - #define PATH_NODE_EMPTY -1 @@ -130,8 +127,7 @@ struct PathDirectionData { typedef SortedList<PathDirectionData> PathDirectionList; struct PathNode { - int x; - int y; + Point point; int link; }; @@ -356,16 +352,37 @@ private: Rect _barrierList[ACTOR_BARRIERS_MAX]; int _barrierCount; int *_pathCell; - int _pathCellCount; + int _xCellCount; int _yCellCount; Rect _pathRect; - Point _pathList[PATH_LIST_MAX]; + + Point *_pathList; int _pathListIndex; - PathNode _pathNodeList[PATH_NODE_MAX]; - PathNode _newPathNodeList[PATH_NODE_MAX]; - int _pathNodeIndex; + int _pathListAlloced; + void addPathListPoint(const Point &point) { + ++_pathListIndex; + if (_pathListIndex >= _pathListAlloced) { + _pathListAlloced += 100; + _pathList = (Point*) realloc(_pathList, _pathListAlloced * sizeof(*_pathList)); + + } + _pathList[_pathListIndex] = point; + } + + int _pathNodeListIndex; + int _pathNodeListAlloced; + PathNode *_pathNodeList; + PathNode *_newPathNodeList; + void addPathNodeListPoint(const Point &point) { + ++_pathNodeListIndex; + if (_pathNodeListIndex >= _pathNodeListAlloced) { + _pathNodeListAlloced += 100; + _pathNodeList = (PathNode*) realloc(_pathNodeList, _pathNodeListAlloced * sizeof(*_pathNodeList)); + } + _pathNodeList[_pathNodeListIndex].point = point; + } public: //path debug - use with care struct DebugPoint { |