Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2490) unification of get_citizen_sprite
Home

[Freeciv-Dev] (PR#2490) unification of get_citizen_sprite

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2490) unification of get_citizen_sprite
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 23:41:04 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This is a very small function, and easy to unify, thus making future
changes to this code easier.

All access to the sprite should go through this function.  But that's a
separate issue.

This function should IMO go into graphics_common, not mapview_common. 
Are there any objections to this?

jason


? client/diff
Index: client//mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.21
diff -u -r1.21 mapview_common.c
--- client//mapview_common.c    2002/11/29 10:01:58     1.21
+++ client//mapview_common.c    2002/12/05 07:35:35
@@ -28,6 +28,15 @@
 #include "tilespec.h"
 
 /**************************************************************************
+  Return a sprite for the given citizen.
+**************************************************************************/
+struct Sprite *get_citizen_sprite(int citizen)
+{
+  citizen = CLIP(0, citizen, NUM_TILES_CITIZEN - 1);
+  return sprites.citizen[citizen];
+}
+
+/**************************************************************************
  Refreshes a single tile on the map canvas.
 **************************************************************************/
 void refresh_tile_mapcanvas(int x, int y, bool write_to_screen)
Index: client//mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.16
diff -u -r1.16 mapview_common.h
--- client//mapview_common.h    2002/11/29 10:01:58     1.16
+++ client//mapview_common.h    2002/12/05 07:35:35
@@ -114,6 +114,8 @@
   D_MB_LR = D_M_L | D_M_R | D_B_L | D_B_R
 };
 
+struct Sprite *get_citizen_sprite(int citizen);
+
 void refresh_tile_mapcanvas(int x, int y, bool write_to_screen);
 enum color_std get_grid_color(int x1, int y1, int x2, int y2);
 
Index: client//gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.140
diff -u -r1.140 mapview.c
--- client//gui-gtk/mapview.c   2002/11/30 20:04:19     1.140
+++ client//gui-gtk/mapview.c   2002/12/05 07:35:35
@@ -451,17 +451,6 @@
   return sprites.citizen[frame]->pixmap;
 }
 
-
-/**************************************************************************
-...
-**************************************************************************/
-SPRITE *get_citizen_sprite(int frame)
-{
-  frame = CLIP(0, frame, NUM_TILES_CITIZEN-1);
-  return sprites.citizen[frame];
-}
-
-
 /**************************************************************************
 ...
 **************************************************************************/
Index: client//gui-gtk/mapview.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.h,v
retrieving revision 1.13
diff -u -r1.13 mapview.h
--- client//gui-gtk/mapview.h   2002/11/15 09:24:51     1.13
+++ client//gui-gtk/mapview.h   2002/12/05 07:35:35
@@ -27,7 +27,6 @@
 
 GdkPixmap *get_thumb_pixmap(int onoff);
 GdkPixmap *get_citizen_pixmap(int frame);
-SPRITE *get_citizen_sprite(int frame);
 
 gint overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev);
 gint map_canvas_expose(GtkWidget *w, GdkEventExpose *ev);
Index: client//gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.28
diff -u -r1.28 mapview.c
--- client//gui-gtk-2.0/mapview.c       2002/11/30 20:06:49     1.28
+++ client//gui-gtk-2.0/mapview.c       2002/12/05 07:35:35
@@ -450,17 +450,6 @@
   return sprites.citizen[frame]->pixmap;
 }
 
-
-/**************************************************************************
-...
-**************************************************************************/
-SPRITE *get_citizen_sprite(int frame)
-{
-  frame = CLIP(0, frame, NUM_TILES_CITIZEN-1);
-  return sprites.citizen[frame];
-}
-
-
 /**************************************************************************
 ...
 **************************************************************************/
Index: client//gui-gtk-2.0/mapview.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.h,v
retrieving revision 1.4
diff -u -r1.4 mapview.h
--- client//gui-gtk-2.0/mapview.h       2002/11/15 09:24:52     1.4
+++ client//gui-gtk-2.0/mapview.h       2002/12/05 07:35:35
@@ -27,7 +27,6 @@
 
 GdkPixmap *get_thumb_pixmap(int onoff);
 GdkPixmap *get_citizen_pixmap(int frame);
-SPRITE *get_citizen_sprite(int frame);
 
 gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer 
data);
 gboolean map_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer data);
Index: client//gui-mui/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/graphics.c,v
retrieving revision 1.27
diff -u -r1.27 graphics.c
--- client//gui-mui/graphics.c  2002/11/14 09:14:56     1.27
+++ client//gui-mui/graphics.c  2002/12/05 07:35:36
@@ -389,14 +389,6 @@
 }
 
 /****************************************************************
- Returns a cititen sprite
-*****************************************************************/
-struct Sprite *get_citizen_sprite(int frame)
-{
-  return sprites.citizen[CLIP(0, frame, NUM_TILES_CITIZEN - 1)];
-}
-
-/****************************************************************
  Returns a thumb sprite
 *****************************************************************/
 struct Sprite *get_thumb_sprite(int onoff)
Index: client//gui-mui/graphics.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/graphics.h,v
retrieving revision 1.8
diff -u -r1.8 graphics.h
--- client//gui-mui/graphics.h  2002/11/26 12:01:11     1.8
+++ client//gui-mui/graphics.h  2002/12/05 07:35:36
@@ -58,7 +58,6 @@
 extern void put_city_output_tile(struct RastPort *rp,
        int food, int shield, int trade, int offx, int offy, int x_tile, int 
y_tile);
 
-extern struct Sprite *get_citizen_sprite(int frame);
 extern struct Sprite *get_thumb_sprite(int onoff);
 
 extern int load_all_sprites(void);
Index: client//gui-win32/graphics.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/graphics.h,v
retrieving revision 1.4
diff -u -r1.4 graphics.h
--- client//gui-win32/graphics.h        2002/04/02 19:27:56     1.4
+++ client//gui-win32/graphics.h        2002/12/05 07:35:36
@@ -47,7 +47,6 @@
 void draw_fog_part(HDC hdc,int x, int y,int w, int h,
                   int xsrc, int ysrc);
 
-SPRITE *get_citizen_sprite(int frame);
 extern HBITMAP BITMAP2HBITMAP(BITMAP *bmp);
 extern SPRITE *intro_gfx_sprite;
 extern SPRITE *radar_gfx_sprite;
Index: client//gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.41
diff -u -r1.41 mapview.c
--- client//gui-win32/mapview.c 2002/11/29 10:01:58     1.41
+++ client//gui-win32/mapview.c 2002/12/05 07:35:36
@@ -425,15 +425,6 @@
 /**************************************************************************
 
 **************************************************************************/
-SPRITE *get_citizen_sprite(int frame)
-{
-  frame = CLIP(0, frame, NUM_TILES_CITIZEN-1);
-  return sprites.citizen[frame];
-}           
-
-/**************************************************************************
-
-**************************************************************************/
 static void draw_rates(HDC hdc)
 {
   int d;

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