Re: [Freeciv-Dev] (PR#39557) AutoReply: Compile fails

2007-08-13 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39557 

 Fix gui-sdl compile errors. Already committed.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/repodlgs.c freeciv/client/gui-sdl/repodlgs.c
--- freeciv/client/gui-sdl/repodlgs.c	2007-08-13 20:51:07.0 +0300
+++ freeciv/client/gui-sdl/repodlgs.c	2007-08-13 23:27:14.0 +0300
@@ -107,7 +107,6 @@
   city_list_iterate(game.player_ptr-cities, pCity) {
 if (VUT_UTYPE == pCity-production.kind) {
   struct unit_type *pUnitType = pCity-production.value.utype;
-  (unitarray[utype_index(pUnitType)].building_count)++;
   (total-building_count)++;
   entries[utype_index(pUnitType)].soonest_completions =
 	MIN(entries[utype_index(pUnitType)].soonest_completions,
@@ -165,7 +164,7 @@
 static int popup_upgrade_unit_callback(struct widget *pWidget)
 {
   if (Main.event.button.button == SDL_BUTTON_LEFT) {
-struct unit_type ut1;
+struct unit_type *ut1;
 struct unit_type *ut2;
 int value;
 char cBuf[128];
@@ -174,13 +173,13 @@
 SDL_Surface *pText;
 SDL_Rect dst;
 SDL_Rect area;
-
-ut1.index = MAX_ID - pWidget-ID;
-
+
+ut1 = utype_by_number(MAX_ID - pWidget-ID);
+
 if (pUnits_Upg_Dlg) {
   return 1;
 }
-CHECK_UNIT_TYPE(ut1);
+CHECK_UNIT_TYPE(ut1);
 
 set_wstate(pWidget, FC_WS_NORMAL);
 pSellected_Widget = NULL;
@@ -189,13 +188,13 @@
 
 pUnits_Upg_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));
   
-ut2 = can_upgrade_unittype(game.player_ptr, ut1);
-value = unit_upgrade_price(game.player_ptr, ut1, ut2);
+ut2 = can_upgrade_unittype(game.player_ptr, ut1);
+value = unit_upgrade_price(game.player_ptr, ut1, ut2);
 
 my_snprintf(cBuf, sizeof(cBuf),
   _(Upgrade as many %s to %s as possible for %d gold each?\n
 Treasury contains %d gold.),
-  utype_name_translation(ut1),
+  utype_name_translation(ut1),
   utype_name_translation(ut2),
   value, game.player_ptr-economic.gold);

@@ -888,7 +887,8 @@
   pBuf = pWidget;
   if ((units[utype_index(i)].active_count  0) || (units[utype_index(i)].building_count  0)) {
 if (utype_number(i) == MAX_ID - pBuf-ID) {
-UPD:	  upgrade = can_upgrade_unittype(game.player_ptr, i)-index;
+UPD:
+  upgrade = utype_index(can_upgrade_unittype(game.player_ptr, i));
 	  pBuf = pBuf-prev;
 	  if(upgrade) {
 	pBuf-string16-fgcol = *get_game_colorRGB(COLOR_THEME_UNITUPGRADE_TEXT);
@@ -2005,7 +2005,7 @@
 for (i = 0; i  entries_used; i++) {
   struct improvement_entry *p = entries[i];
   struct impr_type *pImprove = p-type;
-	
+
   pSurf = crop_rect_from_surface(pBackground, NULL);
   
   my_snprintf(cBuf, sizeof(cBuf), %s, improvement_name_translation(pImprove));
@@ -2071,9 +2071,9 @@
 		(WF_RESTORE_BACKGROUND|WF_FREE_THEME|WF_FREE_DATA));
   
   set_wstate(pBuf, FC_WS_NORMAL);
-  
+
   pBuf-data.cont = fc_calloc(1, sizeof(struct CONTAINER));
-  pBuf-data.cont-id0 = p-type;
+  pBuf-data.cont-id0 = improvement_index(p-type);
   pBuf-data.cont-id1 = p-count;
   pBuf-action = popup_sell_impv_callback;
   
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/wldlg.c freeciv/client/gui-sdl/wldlg.c
--- freeciv/client/gui-sdl/wldlg.c	2007-08-13 20:51:07.0 +0300
+++ freeciv/client/gui-sdl/wldlg.c	2007-08-13 23:37:37.0 +0300
@@ -203,8 +203,8 @@
   
   /* Deny adding currently building Impr/Wonder Target */ 
   if (pEditor-pCity
-VUT_IMPROVEMENT == prod.kind
-are_universals_equal(prod, pEditor-currently_building) {
+   VUT_IMPROVEMENT == prod.kind
+   are_universals_equal(prod, pEditor-currently_building)) {
 return;
   }
   
@@ -298,7 +298,7 @@
 if (is_wonder(one.value.building)) {
   return is_wonder(two.value.building);
 }
-return (one.value.building == two.value.building;
+return one.value.building == two.value.building;
   }
   return FALSE;
 }
@@ -668,7 +668,7 @@
 			utype_name_translation(pWorkList-entries[count].value.utype),
 			adj_font(10)),
 		(WF_RESTORE_BACKGROUND|WF_FREE_DATA));
-	pBuf-ID = MAX_ID - cid_encode_unit(pWorkList-entries[count].value.utype));
+	pBuf-ID = MAX_ID - cid_encode_unit(pWorkList-entries[count].value.utype);
   } else {
 	pBuf = create_iconlabel(NULL, pWidget-dst,
 		create_str16_from_char(
@@ -676,7 +676,7 @@
 pWorkList-entries[count].value.building),
 			adj_font(10)),
 		(WF_RESTORE_BACKGROUND|WF_FREE_DATA));
-	pBuf-ID = MAX_ID - cid_encode_building(pWorkList-entries[count].value);
+	pBuf-ID = MAX_ID - cid_encode_building(pWorkList-entries[count].value.building);
   }
   
   pBuf-string16-style |= SF_CENTER;
@@ -766,13 +766,13 @@
 	create_str16_from_char(utype_name_translation(target.value.utype),
    adj_font(10)),
    (WF_RESTORE_BACKGROUND|WF_FREE_DATA));
-	  pBuf-ID = MAX_ID - B_LAST - target.value;
+	  pBuf-ID = MAX_ID - B_LAST - 

Re: [Freeciv-Dev] (PR#39557) AutoReply: Compile fails

2007-08-13 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39557 

 This already committed patch fixes some of the current compilation
errors. Server and gui-gtk compile. Several errors were fixed from
gui-sdl, but some were not trivial to fix and I wanted to commit at
least server/gui-gtk part ASAP.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/citydlg_common.h freeciv/client/citydlg_common.h
--- freeciv/client/citydlg_common.h	2007-08-13 20:51:08.0 +0300
+++ freeciv/client/citydlg_common.h	2007-08-13 22:31:12.0 +0300
@@ -20,6 +20,7 @@
 #include fc_types.h
 
 struct canvas;
+struct worklist;
 
 enum citizen_category {
   CITIZEN_HAPPY,
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/citydlg.c freeciv/client/gui-sdl/citydlg.c
--- freeciv/client/gui-sdl/citydlg.c	2007-08-13 20:51:07.0 +0300
+++ freeciv/client/gui-sdl/citydlg.c	2007-08-13 22:33:30.0 +0300
@@ -3510,7 +3510,6 @@
   struct widget *pAdd_Dock, *pBuf, *pLast;
   SDL_Surface *pLogo = NULL;
   SDL_String16 *pStr = NULL;
-  struct impr_type *pImpr = NULL;
   struct player *pOwner = city_owner(pCity);
   int prev_y = 0;
 
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/dialogs.c freeciv/client/gui-sdl/dialogs.c
--- freeciv/client/gui-sdl/dialogs.c	2007-08-09 21:49:47.0 +0300
+++ freeciv/client/gui-sdl/dialogs.c	2007-08-13 22:35:24.0 +0300
@@ -1568,7 +1568,7 @@
   create_active_iconlabel(pBuf, pWindow-dst, pStr,
 	cBuf, unit_help_callback);
   set_wstate(pBuf , FC_WS_NORMAL);
-  add_to_gui_list(MAX_ID - pUnitType-index, pBuf);
+  add_to_gui_list(MAX_ID - utype_index(pUnitType), pBuf);
 
   area.w = MAX(area.w, pBuf-size.w);
   units_h += pBuf-size.h;
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/helpdlg.c freeciv/client/gui-sdl/helpdlg.c
--- freeciv/client/gui-sdl/helpdlg.c	2007-08-13 20:51:07.0 +0300
+++ freeciv/client/gui-sdl/helpdlg.c	2007-08-13 22:37:39.0 +0300
@@ -634,7 +634,7 @@
 
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf-action = change_unit_callback;
-  add_to_gui_list(MAX_ID - type-index, pBuf);
+  add_to_gui_list(MAX_ID - utype_index(type), pBuf);
   
   if (++h  10)
   {
@@ -792,7 +792,7 @@
 	  utype_name_translation(utype),
 	  adj_font(12), WF_RESTORE_BACKGROUND);
 pBuf-string16-fgcol = *get_tech_color(advance_number(utype-require_advance));
-pBuf-ID = MAX_ID - pUnitType-obsoleted_by-index;
+pBuf-ID = MAX_ID - utype_index(pUnitType-obsoleted_by);
 pBuf-action = change_unit_callback;
 set_wstate(pBuf, FC_WS_NORMAL);
   }
@@ -1163,7 +1163,7 @@
   }
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf-action = change_unit_callback;
-  pBuf-ID = MAX_ID - un-index;
+  pBuf-ID = MAX_ID - utype_index(un);
   DownAdd(pBuf, pDock);
   pDock = pBuf;
   unit_count++;
diff -Nurd -X.diff_ignore freeciv/client/tilespec.h freeciv/client/tilespec.h
--- freeciv/client/tilespec.h	2007-08-13 20:51:08.0 +0300
+++ freeciv/client/tilespec.h	2007-08-13 22:34:06.0 +0300
@@ -26,6 +26,7 @@
 struct sprite;			/* opaque; gui-dep */
 
 struct base_type;
+struct resource;
 
 /* Create the sprite_vector type. */
 #define SPECVEC_TAG sprite
diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h
--- freeciv/common/effects.h	2007-08-13 20:51:04.0 +0300
+++ freeciv/common/effects.h	2007-08-13 22:28:55.0 +0300
@@ -18,6 +18,8 @@
 
 #include connection.h
 
+struct requirement;
+
 /* Type of effects. (Used in effect.type field)
  * These must correspond to effect_type_names[] in effects.c. */
 enum effect_type {
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev