Browse Source

Clean up path.cpp

pull/25/head
Anders Jenbo 8 years ago committed by Dennis Duda
parent
commit
4e2ea5d312
  1. 23
      Source/path.cpp

23
Source/path.cpp

@ -119,10 +119,10 @@ int __fastcall FindPath(BOOL (__fastcall *PosOk)(int, int, int), int PosOkArg, i
/* heuristic, estimated cost from (sx,sy) to (dx,dy) */ /* heuristic, estimated cost from (sx,sy) to (dx,dy) */
int __fastcall path_get_h_cost(int sx, int sy, int dx, int dy) int __fastcall path_get_h_cost(int sx, int sy, int dx, int dy)
{ {
int y; // esi int y;
int delta_x; // edi int delta_x;
int delta_y; // eax int delta_y;
int min_delta; // ecx int min_delta;
y = sy; y = sy;
delta_x = abs(sx - dx); delta_x = abs(sx - dx);
@ -147,7 +147,7 @@ int __fastcall path_get_h_cost(int sx, int sy, int dx, int dy)
*/ */
int __fastcall path_check_equal(PATHNODE *pPath, int dx, int dy) int __fastcall path_check_equal(PATHNODE *pPath, int dx, int dy)
{ {
int result; // [esp-4h] [ebp-4h] int result;
if ( pPath->x == dx || pPath->y == dy ) if ( pPath->x == dx || pPath->y == dy )
result = 2; result = 2;
@ -161,15 +161,16 @@ int __fastcall path_check_equal(PATHNODE *pPath, int dx, int dy)
*/ */
PATHNODE *__cdecl GetNextPath() PATHNODE *__cdecl GetNextPath()
{ {
PATHNODE *result; // eax PATHNODE *result;
result = path_2_nodes->NextNode; result = path_2_nodes->NextNode;
if ( result ) if ( !result ) {
{ return result;
path_2_nodes->NextNode = result->NextNode;
result->NextNode = pnode_ptr->NextNode;
pnode_ptr->NextNode = result;
} }
path_2_nodes->NextNode = result->NextNode;
result->NextNode = pnode_ptr->NextNode;
pnode_ptr->NextNode = result;
return result; return result;
} }

Loading…
Cancel
Save