aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/toon/path.cpp12
-rw-r--r--engines/toon/path.h4
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();