diff options
author | D G Turner | 2012-06-07 08:36:12 +0100 |
---|---|---|
committer | D G Turner | 2012-06-07 08:39:38 +0100 |
commit | dd558510dc60b61d9f960c7f49e8bc0327d8115b (patch) | |
tree | 537648c2c92855f072d9e964c124e4443bf83cc6 /engines | |
parent | e73f93e565fc0074da66429fd59db25114f84c12 (diff) | |
download | scummvm-rg350-dd558510dc60b61d9f960c7f49e8bc0327d8115b.tar.gz scummvm-rg350-dd558510dc60b61d9f960c7f49e8bc0327d8115b.tar.bz2 scummvm-rg350-dd558510dc60b61d9f960c7f49e8bc0327d8115b.zip |
TOON: Move PathFindingHeap API to use int16 for x,y coordinates.
The internal x,y point representation was already changed to int16
anyway, so this just harmonises this with the external API (and with
Common::Point which uses int16).
Diffstat (limited to 'engines')
-rw-r--r-- | engines/toon/path.cpp | 12 | ||||
-rw-r--r-- | engines/toon/path.h | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp index 2dd5fc45e2..540290d823 100644 --- a/engines/toon/path.cpp +++ b/engines/toon/path.cpp @@ -60,7 +60,7 @@ void PathFindingHeap::clear() { memset(_data, 0, sizeof(HeapDataGrid) * _size); } -void PathFindingHeap::push(int32 x, int32 y, int32 weight) { +void PathFindingHeap::push(int16 x, int16 y, int32 weight) { debugC(2, kDebugPath, "push(%d, %d, %d)", x, y, weight); if (_count == _size) { @@ -87,7 +87,7 @@ void PathFindingHeap::push(int32 x, int32 y, int32 weight) { int32 lMax = _count-1; int32 lT = 0; - while (1) { + while (true) { if (lMax <= 0) break; lT = (lMax-1) / 2; @@ -104,7 +104,7 @@ void PathFindingHeap::push(int32 x, int32 y, int32 weight) { } } -void PathFindingHeap::pop(int32 *x, int32 *y, int32 *weight) { +void PathFindingHeap::pop(int16 *x, int16 *y, int32 *weight) { debugC(2, kDebugPath, "pop(x, y, weight)"); if (!_count) { @@ -123,7 +123,7 @@ void PathFindingHeap::pop(int32 *x, int32 *y, int32 *weight) { int32 lMin = 0; int32 lT = 0; - while (1) { + while (true) { lT = (lMin << 1) + 1; if (lT < _count) { if (lT < _count-1) { @@ -315,7 +315,9 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { while (_heap->getCount()) { wei = 0; - _heap->pop(&curX, &curY, &curWeight); + int16 tempCurX, tempCurY; + _heap->pop(&tempCurX, &tempCurY, &curWeight); + curX = tempCurX, curY = tempCurY; // FIXME - Bodge to match heap->pop types int curNode = curX + curY * _width; int32 endX = MIN<int32>(curX + 1, _width - 1); diff --git a/engines/toon/path.h b/engines/toon/path.h index 2de58064f0..df2b2e94be 100644 --- a/engines/toon/path.h +++ b/engines/toon/path.h @@ -38,8 +38,8 @@ public: PathFindingHeap(); ~PathFindingHeap(); - void push(int32 x, int32 y, int32 weight); - void pop(int32 *x, int32 *y, int32 *weight); + void push(int16 x, int16 y, int32 weight); + void pop(int16 *x, int16 *y, int32 *weight); void init(int32 size); void clear(); void unload(); |