Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] [PATCH] is_normal_tile function
Home

[Freeciv-Dev] [PATCH] is_normal_tile function

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] is_normal_tile function
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Wed, 15 Aug 2001 16:14:32 -0400

The attached patch introduces a new function, is_normal_tile, that
behaves as you would expect it.  It does not change any existing code to
use the new function - there's a _lot_ of places where it should be
used, and some of them would no doubt be controversial.  Easier to worry
about that once the function's already in CVS.

jason
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.79
diff -u -r1.79 map.c
--- common/map.c        2001/08/14 14:31:19     1.79
+++ common/map.c        2001/08/15 20:10:43
@@ -1298,6 +1298,14 @@
   return 0 <= y && y < map.ysize;
 }
 
+/***************************************************************
+Returns TRUE iff the (x, y) coordinates are in canonical form.
+***************************************************************/
+int is_normal_tile(int x, int y)
+{
+  return 0 <= y && y < map.ysize && 0 <= x && x < map.xsize;
+}
+
 /**************************************************************************
 Normalizes the map position. Returns TRUE if it is valid, false otherwise.
 **************************************************************************/
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.85
diff -u -r1.85 map.h
--- common/map.h        2001/08/14 14:31:19     1.85
+++ common/map.h        2001/08/15 20:10:44
@@ -214,6 +214,7 @@
 enum known_type tile_is_known(int x, int y);
 int check_coords(int *x, int *y);
 int is_real_tile(int x, int y);
+int is_normal_tile(int x, int y);
 int normalize_map_pos(int *x, int *y);
 void rand_neighbour(int x0, int y0, int *x, int *y);
 

[Prev in Thread] Current Thread [Next in Thread]