Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9483) rewrite is_move_cardinal
Home

[Freeciv-Dev] (PR#9483) rewrite is_move_cardinal

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9483) rewrite is_move_cardinal
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jul 2004 22:17:34 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9483 >

This patch rewrites is_move_cardinal to use DIR_IS_CARDINAL.  This 
allows it to work properly for hex maps (otherwise some movement on 
rivers takes a full MP).

This is independent from PR#9482 (but shows that some bugs are still out 
there).

jason

Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.181
diff -u -r1.181 map.c
--- common/map.c        20 Jul 2004 16:04:56 -0000      1.181
+++ common/map.c        23 Jul 2004 05:16:45 -0000
@@ -1790,12 +1790,8 @@
 **************************************************************************/
 bool is_move_cardinal(int start_x, int start_y, int end_x, int end_y)
 {
-  int diff_x, diff_y;
-
-  assert(is_tiles_adjacent(start_x, start_y, end_x, end_y));
-
-  map_distance_vector(&diff_x, &diff_y, start_x, start_y, end_x, end_y);
-  return (diff_x == 0) || (diff_y == 0);
+  return DIR_IS_CARDINAL(get_direction_for_step(start_x, start_y,
+                                               end_x, end_y));
 }
 
 /****************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9483) rewrite is_move_cardinal, Jason Short <=