<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39553 >

attached patch fixes gui-sdl compilation
Index: client/gui-sdl/citydlg.c
===================================================================
--- client/gui-sdl/citydlg.c	(revision 13297)
+++ client/gui-sdl/citydlg.c	(working copy)
@@ -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;
     
Index: client/gui-sdl/dialogs.c
===================================================================
--- client/gui-sdl/dialogs.c	(revision 13297)
+++ client/gui-sdl/dialogs.c	(working copy)
@@ -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_number(pUnitType), pBuf);
     
       area.w = MAX(area.w, pBuf->size.w);
       units_h += pBuf->size.h;
Index: client/gui-sdl/helpdlg.c
===================================================================
--- client/gui-sdl/helpdlg.c	(revision 13297)
+++ client/gui-sdl/helpdlg.c	(working copy)
@@ -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_number(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_number(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_number(un);
       DownAdd(pBuf, pDock);
       pDock = pBuf;
       unit_count++;
Index: client/gui-sdl/repodlgs.c
===================================================================
--- client/gui-sdl/repodlgs.c	(revision 13297)
+++ client/gui-sdl/repodlgs.c	(working copy)
@@ -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,
@@ -175,7 +174,7 @@
     SDL_Rect dst;
     SDL_Rect area;
     
-    ut1.index = MAX_ID - pWidget->ID;
+    ut1.item_number = MAX_ID - pWidget->ID;
     
     if (pUnits_Upg_Dlg) {
       return 1;
@@ -888,7 +887,7 @@
       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 = (can_upgrade_unittype(game.player_ptr, i) != NULL);
 	  pBuf = pBuf->prev;
 	  if(upgrade) {
 	    pBuf->string16->fgcol = *get_game_colorRGB(COLOR_THEME_UNITUPGRADE_TEXT);
@@ -2073,7 +2072,7 @@
       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_number(p->type);
       pBuf->data.cont->id1 = p->count;
       pBuf->action = popup_sell_impv_callback;
       
Index: client/gui-sdl/wldlg.c
===================================================================
--- client/gui-sdl/wldlg.c	(revision 13297)
+++ client/gui-sdl/wldlg.c	(working copy)
@@ -204,7 +204,7 @@
   /* Deny adding currently building Impr/Wonder Target */ 
   if (pEditor->pCity
    && VUT_IMPROVEMENT == prod.kind
-   && are_universals_equal(&prod, &pEditor->currently_building) {
+   && 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 - utype_number(target.value.utype);
         } else {
 	  pBuf = create_iconlabel(NULL, pWidget->dst,
 	    create_str16_from_char(city_improvement_name_translation(pEditor->pCity, target.value.building),
 				   adj_font(10)),
 				   (WF_RESTORE_BACKGROUND|WF_FREE_DATA));
-	  pBuf->ID = MAX_ID - target.value;
+	  pBuf->ID = MAX_ID - utype_number(target.value.utype);
         }
         pBuf->string16->style |= SF_CENTER;
         set_wstate(pBuf, FC_WS_NORMAL);
@@ -1191,7 +1191,7 @@
     if(VUT_UTYPE == prod.kind) {
       pStr = create_str16_from_char(utype_name_translation(prod.value.utype), adj_font(10));
     } else {
-      pStr = create_str16_from_char(city_improvement_name_translation(pCity, prod.value), adj_font(10));
+      pStr = create_str16_from_char(city_improvement_name_translation(pCity, prod.value.building), adj_font(10));
     }
     pStr->style |= SF_CENTER;
     pBuf = create_iconlabel(NULL, pWindow->dst, pStr,
@@ -1352,7 +1352,7 @@
   
       if(pCity) {
         if(!improvement_has_flag(pImprove, IF_GOLD)) {
-          turns = city_turns_to_build(pCity, cid_production(improvement_number(pImprove)), TRUE);
+          turns = city_turns_to_build(pCity, cid_production(cid_encode_building(pImprove)), TRUE);
             
           if (turns == FC_INFINITY) {
 	    if(state) {
@@ -1480,9 +1480,7 @@
       pText_Name = create_text_surf_smaller_that_w(pStr, pIcon->w - 4);
   
       if (pCity) {
-        /* FIXME: under the current definition of cid_decode, the following
-         * line yields an improvement, not a unit_type */
-        turns = city_turns_to_build(pCity, cid_production(un->index), TRUE);
+        turns = city_turns_to_build(pCity, cid_production(cid_encode_unit(un)), TRUE);
         if (turns == FC_INFINITY) {
           my_snprintf(cBuf, sizeof(cBuf),
 		    _("(%d/%d/%d)\n%d/%d %s\nnever"),
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to