Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10119) merge put_unit and put_unit_full
Home

[Freeciv-Dev] (PR#10119) merge put_unit and put_unit_full

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10119) merge put_unit and put_unit_full
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Sep 2004 20:38:52 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch merges put_unit and put_unit_full.  The final function is 
called put_unit() but has the semantics of the original put_unit_full(). 
  (There was no use for the original put_unit.  It was a holdover from 
when partial tile drawing was done.)

This simplification is a first step toward extending the mapview 
interface.  Future functions may include put_city and put_terrain.

jason

? drawn_sprites.diff
? ftwl.diff
? settler_recursion_crash
? client/tilespec.diff
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.144
diff -u -r1.144 mapview_common.c
--- client/mapview_common.c     13 Sep 2004 23:13:11 -0000      1.144
+++ client/mapview_common.c     15 Sep 2004 03:37:56 -0000
@@ -756,21 +756,14 @@
 
 /**************************************************************************
   Draw the given unit onto the canvas store at the given location.
-
-  unit_offset_x, unit_offset_y, unit_width, unit_height are used
-  in iso-view to draw only part of the tile.  Non-iso view should use
-  put_unit_full instead.
-**************************************************************************/
-void put_unit(struct unit *punit, bool stacked, bool backdrop,
-             struct canvas *pcanvas,
-             int canvas_x, int canvas_y,
-             int unit_offset_x, int unit_offset_y,
-             int unit_width, int unit_height)
+**************************************************************************/
+void put_unit(struct unit *punit,
+             struct canvas *pcanvas, int canvas_x, int canvas_y)
 {
   struct drawn_sprite drawn_sprites[40];
   bool solid_bg;
   int count = fill_unit_sprite_array(drawn_sprites, punit, &solid_bg,
-                                    stacked, backdrop);
+                                    FALSE, TRUE);
   int i;
 
   if (!is_isometric && solid_bg) {
@@ -784,24 +777,12 @@
       int ox = drawn_sprites[i].offset_x, oy = drawn_sprites[i].offset_y;
 
       /* units are never fogged */
-      canvas_put_sprite(pcanvas, canvas_x + ox, canvas_y + oy,
-                       drawn_sprites[i].sprite,
-                       unit_offset_x - ox, unit_offset_y - oy,
-                       unit_width, unit_height);
+      canvas_put_sprite_full(pcanvas, canvas_x + ox, canvas_y + oy,
+                            drawn_sprites[i].sprite);
     }
   }
 }
 
-/**************************************************************************
-  Draw the given unit onto the canvas store at the given location.
-**************************************************************************/
-void put_unit_full(struct unit *punit, struct canvas *pcanvas,
-                  int canvas_x, int canvas_y)
-{
-  put_unit(punit, FALSE, TRUE, pcanvas, canvas_x, canvas_y,
-          0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
-}
-
 /****************************************************************************
   Draw food, shield, and trade output values on the tile.
 
@@ -1937,7 +1918,7 @@
                  UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 
       /* Draw */
-      put_unit_full(punit, mapview_canvas.store, new_x, new_y);
+      put_unit(punit, mapview_canvas.store, new_x, new_y);
       dirty_rect(new_x, new_y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 
       /* Flush. */
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.74
diff -u -r1.74 mapview_common.h
--- client/mapview_common.h     3 Sep 2004 04:22:36 -0000       1.74
+++ client/mapview_common.h     15 Sep 2004 03:37:56 -0000
@@ -140,13 +140,8 @@
 bool tile_visible_mapcanvas(int map_x, int map_y);
 bool tile_visible_and_not_on_border_mapcanvas(int map_x, int map_y);
 
-void put_unit(struct unit *punit, bool stacked, bool backdrop,
-             struct canvas *pcanvas,
-             int canvas_x, int canvas_y,
-             int unit_offset_x, int unit_offset_y,
-             int unit_width, int unit_height);
-void put_unit_full(struct unit *punit, struct canvas *pcanvas,
-                  int canvas_x, int canvas_y);
+void put_unit(struct unit *punit,
+             struct canvas *pcanvas, int canvas_x, int canvas_y);
 
 void put_city_tile_output(struct city *pcity, int city_x, int city_y,
                          struct canvas *pcanvas,
Index: client/gui-ftwl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/mapview.c,v
retrieving revision 1.2
diff -u -r1.2 mapview.c
--- client/gui-ftwl/mapview.c   14 Sep 2004 22:35:24 -0000      1.2
+++ client/gui-ftwl/mapview.c   15 Sep 2004 03:37:57 -0000
@@ -628,7 +628,7 @@
   store->osda = result;
   store->widget = NULL;
 
-  put_unit_full(punit, store, 0, 0);
+  put_unit(punit, store, 0, 0);
 
   free(store);
   return result;
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.229
diff -u -r1.229 mapview.c
--- client/gui-gtk/mapview.c    26 Jul 2004 04:05:59 -0000      1.229
+++ client/gui-gtk/mapview.c    15 Sep 2004 03:37:57 -0000
@@ -570,7 +570,7 @@
 {
   struct canvas canvas_store = {NULL, p};
 
-  put_unit_full(punit, &canvas_store, 0, 0);
+  put_unit(punit, &canvas_store, 0, 0);
 
   gtk_pixcomm_changed(GTK_PIXCOMM(p));
 }
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.71
diff -u -r1.71 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        10 Sep 2004 21:20:52 -0000      1.71
+++ client/gui-gtk-2.0/dialogs.c        15 Sep 2004 03:37:57 -0000
@@ -1358,7 +1358,7 @@
     struct canvas canvas_store = {.type = CANVAS_PIXBUF, .v.pixbuf = pix};
 
     gdk_pixbuf_fill(pix, 0x00000000);
-    put_unit_full(punit, &canvas_store, 0, 0);
+    put_unit(punit, &canvas_store, 0, 0);
   }
 
   gtk_tree_store_append(unit_select_store, it, parent);
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.135
diff -u -r1.135 mapview.c
--- client/gui-gtk-2.0/mapview.c        26 Jul 2004 04:05:59 -0000      1.135
+++ client/gui-gtk-2.0/mapview.c        15 Sep 2004 03:37:57 -0000
@@ -586,7 +586,7 @@
   gtk_pixcomm_freeze(p);
   gtk_pixcomm_clear(p);
 
-  put_unit_full(punit, &canvas_store, 0, 0);
+  put_unit(punit, &canvas_store, 0, 0);
 
   gtk_pixcomm_thaw(p);
 }
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.82
diff -u -r1.82 citydlg.c
--- client/gui-win32/citydlg.c  13 Sep 2004 15:54:50 -0000      1.82
+++ client/gui-win32/citydlg.c  15 Sep 2004 03:37:58 -0000
@@ -327,7 +327,7 @@
       rc.right=rc.left+NORMAL_TILE_WIDTH;
       rc.bottom=rc.top+SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
       
FillRect(hdc,&rc,(HBRUSH)GetClassLong(pdialog->mainwindow,GCL_HBRBACKGROUND));
-      put_unit_full(punit,&canvas_store,
+      put_unit(punit,&canvas_store,
                    pdialog->pop_x+i*(SMALL_TILE_WIDTH+NORMAL_TILE_WIDTH),
                    pdialog->present_y); 
       pdialog->present_unit_ids[i]=punit->id;       
@@ -384,7 +384,7 @@
       rc.right=rc.left+NORMAL_TILE_WIDTH;
       rc.bottom=rc.top+SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
       
FillRect(hdc,&rc,(HBRUSH)GetClassLong(pdialog->mainwindow,GCL_HBRBACKGROUND));
-      put_unit_full(punit,&canvas_store,
+      put_unit(punit,&canvas_store,
                    pdialog->pop_x+i*(SMALL_TILE_WIDTH+NORMAL_TILE_WIDTH),
                    pdialog->supported_y);
       put_unit_city_overlays(punit, &store,
Index: client/gui-win32/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/dialogs.c,v
retrieving revision 1.52
diff -u -r1.52 dialogs.c
--- client/gui-win32/dialogs.c  10 Sep 2004 21:20:52 -0000      1.52
+++ client/gui-win32/dialogs.c  15 Sep 2004 03:37:58 -0000
@@ -796,7 +796,7 @@
       SelectObject(unitsel_dc,unit_select_bitmaps[i]);
       BitBlt(unitsel_dc,0,0,UNIT_TILE_WIDTH,UNIT_TILE_HEIGHT,NULL,
             0,0,WHITENESS);
-      put_unit_full(punit,&canvas_store,0,0);
+      put_unit(punit,&canvas_store,0,0);
       unit_select_but[i]=CreateWindow("BUTTON",NULL,
                                      WS_CHILD | WS_VISIBLE | BS_BITMAP,
                                      (i/r)*max_width,
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.121
diff -u -r1.121 citydlg.c
--- client/gui-xaw/citydlg.c    13 Sep 2004 15:54:50 -0000      1.121
+++ client/gui-xaw/citydlg.c    15 Sep 2004 03:37:58 -0000
@@ -1688,7 +1688,7 @@
       continue;
 
     XawPixcommClear(pixcomm); /* STG */
-    put_unit_full(punit, &store, 0, 0);
+    put_unit(punit, &store, 0, 0);
     put_unit_pixmap_city_overlays(punit,
                                  XawPixcommPixmap(pixcomm));
 
@@ -1752,7 +1752,7 @@
       continue;
 
     XawPixcommClear(pixcomm); /* STG */
-    put_unit_full(punit, &store, 0, 0);
+    put_unit(punit, &store, 0, 0);
 
     xaw_expose_now(pixcomm);
 
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.100
diff -u -r1.100 dialogs.c
--- client/gui-xaw/dialogs.c    10 Sep 2004 21:20:52 -0000      1.100
+++ client/gui-xaw/dialogs.c    15 Sep 2004 03:37:58 -0000
@@ -1526,7 +1526,7 @@
     XFillRectangle(display, unit_select_pixmaps[i], fill_bg_gc,
                   0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
     store.pixmap = unit_select_pixmaps[i];
-    put_unit_full(punit, &store, 0, 0);
+    put_unit(punit, &store, 0, 0);
 
     nargs=0;
     XtSetArg(args[nargs], XtNbitmap, (XtArgVal)unit_select_pixmaps[i]);nargs++;
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.93
diff -u -r1.93 gui_main.c
--- client/gui-xaw/gui_main.c   6 Sep 2004 17:13:07 -0000       1.93
+++ client/gui-xaw/gui_main.c   15 Sep 2004 03:37:58 -0000
@@ -840,7 +840,7 @@
   if (punit) {
     struct canvas store = {XawPixcommPixmap(w)};
 
-    put_unit_full(punit, &store, 0, 0);
+    put_unit(punit, &store, 0, 0);
     xaw_expose_now(w);
   }
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10119) merge put_unit and put_unit_full, Jason Short <=