[Freeciv-Dev] Re: [Patch] Change MAPSTEP macro (PR#2123)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Raimar, I'd like to apply this change - it makes using it the way Greg
wants to much easier.
But, having MAPSTEP be a wrapper for DIRSTEP was your plan, and I won't
undo that without your approval.
jason
Gregory Berkolaiko wrote:
This change will allow to increment (x,y) in the given direction without
setting up dummy variables, like in
{
int dummy_x, dummy_y;
MAPSTEP(dummy_x, dummy_y, x, y, dir);
x = dummy_x;
y = dummy_y;
}
G.
------------------------------------------------------------------------
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.130
diff -u -r1.130 map.h
--- common/map.h 2002/09/10 13:30:56 1.130
+++ common/map.h 2002/10/01 17:51:25
@@ -231,9 +231,8 @@
* (dest_x, dest_y) is set to the new map position.
*/
#define MAPSTEP(dest_x, dest_y, src_x, src_y, dir) \
-( DIRSTEP(dest_x, dest_y, dir), \
- (dest_x) += (src_x), \
- (dest_y) += (src_y), \
+( (dest_x) = (src_x) + DIR_DX[(dir)], \
+ (dest_y) = (src_y) + DIR_DY[(dir)], \
normalize_map_pos(&(dest_x), &(dest_y)))
struct city *map_get_city(int x, int y);
|
|