summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 02:36:41 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 02:36:41 +0000
commitba5dc49d30d6ba465b01dbf3abc933250edcb6c6 (patch)
tree42f13fe5390c457ea7b32bfdab913fab93bb6d41
parent43112ecba9f1584360b4d5e79eee3f183792e544 (diff)
downloadmana-client-ba5dc49d30d6ba465b01dbf3abc933250edcb6c6.tar.gz
mana-client-ba5dc49d30d6ba465b01dbf3abc933250edcb6c6.tar.bz2
mana-client-ba5dc49d30d6ba465b01dbf3abc933250edcb6c6.tar.xz
mana-client-ba5dc49d30d6ba465b01dbf3abc933250edcb6c6.zip
Fix in calculating G cost in A* implementation.
-rwxr-xr-xGenDeb.sh2
-rw-r--r--src/graphic/graphic.cpp8
-rw-r--r--src/map.cpp2
3 files changed, 10 insertions, 2 deletions
diff --git a/GenDeb.sh b/GenDeb.sh
index a804bb6c..14b2a1f5 100755
--- a/GenDeb.sh
+++ b/GenDeb.sh
@@ -122,7 +122,7 @@ echo ' Ultramichy <celdron15@hotmail.com>' >>DEBIAN/control;
echo ' SimEdw <simon@crossnet.se>' >>DEBIAN/control;
echo ' Rotonen <j_orponen@hotmail.com>' >>DEBIAN/control;
echo ' Chetic <Chetic@gmail.com>' >>DEBIAN/control;
-echo ' HammerBear' >>DEBIAN/control
+echo ' HammerBear <bjorn@lindeijer.nl>' >>DEBIAN/control
echo ' Bertram' >>DEBIAN/control
echo ' .' >>DEBIAN/control;
echo ' Web Site: http://themanaworld.sourceforge.net/' >>DEBIAN/control;
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index da18b109..107c441f 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -502,6 +502,14 @@ void Engine::draw()
destRect.h = 8;
SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 255, 0, 0));
+ Tile *tile = tiledMap.getTile(debugPath->x, debugPath->y);
+
+ std::stringstream cost;
+ cost << tile->Fcost;
+ guiGraphics->_beginDraw();
+ guiGraphics->drawText(cost.str(), destRect.x - 12, destRect.y + 8);
+ guiGraphics->_endDraw();
+
// Move to the next node
PATH_NODE *temp = debugPath->next;
delete debugPath;
diff --git a/src/map.cpp b/src/map.cpp
index 597afa49..1e4cb3ba 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -263,7 +263,7 @@ PATH_NODE *Map::findPath(int startX, int startY, int destX, int destY)
// Calculate G cost for this route, 10 for moving straight and
// 14 for moving diagonal
- int Gcost = curr.tile->Gcost + (dx == 0 || dy == 0) ? 10 : 14;
+ int Gcost = curr.tile->Gcost + ((dx == 0 || dy == 0) ? 10 : 14);
if (newTile->whichList != onOpenList)
{