Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] Re: (PR#14639) Patch for SDL client
Home

[Freeciv-Dev] Re: (PR#14639) Patch for SDL client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#14639) Patch for SDL client
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Mon, 5 Dec 2005 17:23:46 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's a compile fix for current SVN trunk.


diff -urNbB -X devel/diff_ignore devel_distclean/client/gui-sdl/citydlg.c 
devel/client/gui-sdl/citydlg.c
--- devel_distclean/client/gui-sdl/citydlg.c    2005-11-29 17:51:46.000000000 
+0100
+++ devel/client/gui-sdl/citydlg.c      2005-12-06 01:52:12.000000000 +0100
@@ -3258,7 +3258,7 @@
     struct impr_type *pImpr =
        get_improvement_type(pCity->production.value);
 
-    if (pCity->production.value == get_building_for_effect( EFT_PROD_TO_GOLD)) 
{
+    if (impr_flag(pCity->production.value, IF_GOLD)) {
 
       if (pCityDlg->pBuy_Button
         && get_wstate(pCityDlg->pBuy_Button) != FC_WS_DISABLED) {
diff -urNbB -X devel/diff_ignore devel_distclean/client/gui-sdl/helpdlg.c 
devel/client/gui-sdl/helpdlg.c
--- devel_distclean/client/gui-sdl/helpdlg.c    2005-12-06 01:45:59.000000000 
+0100
+++ devel/client/gui-sdl/helpdlg.c      2005-12-06 02:16:25.000000000 +0100
@@ -73,15 +73,7 @@
   struct GUI *pDock;
 };
 
-static enum help {
-  HELP_TECH,
-  HELP_UNITS,
-  HELP_IMPR,
-  HELP_GOV,
-  HELP_TERRAINS,
-  HELP_TEXT,
-  HELP_LAST
-} current_help_dlg = HELP_LAST;
+enum help_page_type current_help_dlg = HELP_LAST;
 
 /* HACK: we use a static string for convenience. */
 static char long_buffer[64000];
@@ -193,7 +185,7 @@
   struct impr_type *pImpr_type;
   char buffer[64000];
   
-  if(current_help_dlg != IMPR)
+  if(current_help_dlg != HELP_IMPROVEMENT)
   {
     popdown_help_dialog();
   }
@@ -203,7 +195,7 @@
     SDL_Surface *pText, *pBack, *pTmp;
     SDL_Rect dst;
     
-    current_help_dlg = IMPR;
+    current_help_dlg = HELP_IMPROVEMENT;
     created = TRUE;
     pHelpDlg = MALLOC(sizeof(struct ADVANCED_DLG));
     pStore = MALLOC(sizeof(struct UNITS_BUTTONS));
@@ -334,7 +326,7 @@
   DownAdd(pBuf, pDock);
   pDock = pBuf;
   
-  if (!building_has_effect(impr, EFT_PROD_TO_GOLD))
+  if (!impr_flag(impr, IF_GOLD))
   {
     sprintf(buffer, "%s %d", N_("Cost:"), impr_build_shield_cost(impr));
     pBuf = create_iconlabel_from_chars(NULL,
@@ -464,7 +456,7 @@
   pBuf->size.y = pWindow->size.y + WINDOW_TILE_HIGH + adj_size(20);
   start_y = pBuf->size.y + pBuf->size.h + adj_size(10);
   
-  if (!building_has_effect(impr, EFT_PROD_TO_GOLD))
+  if (!impr_flag(impr, IF_GOLD))
   {
     pBuf = pBuf->prev;
     pBuf->size.x = pWindow->size.x + start_x;
@@ -550,7 +542,7 @@
   struct unit_type *pUnit;
   char *buffer = &long_buffer[0];
   
-  if(current_help_dlg != UNITS)
+  if(current_help_dlg != HELP_UNIT)
   {
     popdown_help_dialog();
   }
@@ -560,7 +552,7 @@
     SDL_Surface *pText, *pBack, *pTmp;
     SDL_Rect dst;
     
-    current_help_dlg = UNITS;
+    current_help_dlg = HELP_UNIT;
     created = TRUE;
     pHelpDlg = MALLOC(sizeof(struct ADVANCED_DLG));
     pStore = MALLOC(sizeof(struct UNITS_BUTTONS));
@@ -1850,7 +1842,7 @@
   bool created;
   int width = 0;
   
-  if(current_help_dlg != TECH)
+  if(current_help_dlg != HELP_TECH)
   {
     popdown_help_dialog();
   }
@@ -1858,7 +1850,7 @@
   if (!pHelpDlg)
   {
     created = TRUE;
-    current_help_dlg = TECH;
+    current_help_dlg = HELP_TECH;
     pHelpDlg = MALLOC(sizeof(struct ADVANCED_DLG));
     pStore = MALLOC(sizeof(struct TECHS_BUTTONS));
       
diff -urNbB -X devel/diff_ignore devel_distclean/client/gui-sdl/wldlg.c 
devel/client/gui-sdl/wldlg.c
--- devel_distclean/client/gui-sdl/wldlg.c      2005-11-29 17:51:46.000000000 
+0100
+++ devel/client/gui-sdl/wldlg.c        2005-12-06 01:52:13.000000000 +0100
@@ -455,6 +455,10 @@
  */
 static void remove_item_from_worklist(struct GUI *pItem)
 {
+  /* only one item (production) is left */
+  if (worklist_is_empty(pEditor->pCopy_WorkList))
+    return;
+        
   if(pItem->data.ptr) {
     /* correct "data" widget fiels */
     struct GUI *pBuf = pItem;
@@ -471,20 +475,6 @@
     /* remove widget from widget list */
     del_widget_from_vertical_scroll_widget_list(pEditor->pWork, pItem);
   } else {
-    /* change production ... */
-      if(worklist_is_empty(pEditor->pCopy_WorkList)) {
-        /* there is no worklist */
-      if(!(!pEditor->currently_building.is_unit &&
-         building_has_effect(pEditor->currently_building.value, 
EFT_PROD_TO_GOLD))) {        
-         /* change to capitalization */
-         int dummy;   
-        
change_production(cid_production(get_building_for_effect(EFT_PROD_TO_GOLD)));
-         copy_chars_to_string16(pItem->string16,
-           get_production_name(pEditor->pCity, 
cid_decode(cid_encode_building(get_building_for_effect(EFT_PROD_TO_GOLD))), 
&dummy));
-         
-        pItem->ID = MAX_ID - 
cid_encode_building(get_building_for_effect(EFT_PROD_TO_GOLD));
-        }
-      } else {
         /* change productions to first worklist element */
         struct GUI *pBuf = pItem->prev;
       change_production(pEditor->pCopy_WorkList->entries[0]);
@@ -498,9 +488,8 @@
           } while(pBuf != pEditor->pWork->pBeginActiveWidgetList);
         }
       }
-    }
 
-/* FIXME */
+/* FIXME: fix scrollbar code */
 #if 0    
   /* worklist_length(pEditor->pCopy_WorkList): without production */
   if (worklist_length(pEditor->pCopy_WorkList) <= 
pEditor->pWork->pScroll->active + 1) {
@@ -928,7 +917,7 @@
                                pEditor->currently_building, &cost);
 
   if (!pEditor->currently_building.is_unit
-     && (pEditor->currently_building.value == 
get_building_for_effect(EFT_PROD_TO_GOLD)))
+     && impr_flag(pEditor->currently_building.value, IF_GOLD))
   {
      my_snprintf(cBuf, sizeof(cBuf),
        _("%s\n%d gold per turn"), name, MAX(0, 
pEditor->pCity->surplus[O_SHIELD]));
@@ -1108,7 +1097,7 @@
     /* turns == progress */
     const char *name = get_production_name(pCity, pCity->production, &count);
     
-    if (!pCity->production.is_unit && (pCity->production.value == 
get_building_for_effect(EFT_PROD_TO_GOLD)))
+    if (!pCity->production.is_unit && impr_flag(pCity->production.value, 
IF_GOLD))
     {
       my_snprintf(cBuf, sizeof(cBuf),
        _("%s\n%d gold per turn"), name, MAX(0, pCity->surplus[O_SHIELD]));
@@ -1384,7 +1373,7 @@
       }
   
       if(pCity) {
-        if(imp != get_building_for_effect(EFT_PROD_TO_GOLD)) {
+        if(!impr_flag(imp, IF_GOLD)) {
           turns = city_turns_to_build(pCity, cid_production(imp), TRUE);
             
           if (turns == FC_INFINITY) {
@@ -1424,7 +1413,7 @@
         }
       } else {
         /* non city mode */
-        if(imp != get_building_for_effect(EFT_PROD_TO_GOLD)) {
+        if(!impr_flag(imp, IF_GOLD)) {
           if(state) {
             my_snprintf(cBuf, sizeof(cBuf), _("(%s)\n%d %s"),
                        state, impr_build_shield_cost(imp),
diff -urNbB -X devel/diff_ignore devel_distclean/client/include/helpdlg_g.h 
devel/client/include/helpdlg_g.h
--- devel_distclean/client/include/helpdlg_g.h  2005-10-17 01:09:26.000000000 
+0200
+++ devel/client/include/helpdlg_g.h    2005-12-06 02:11:39.000000000 +0100
@@ -15,7 +15,7 @@
 
 enum help_page_type { HELP_ANY, HELP_TEXT, HELP_UNIT, HELP_IMPROVEMENT,
                      HELP_WONDER, HELP_TECH, HELP_TERRAIN,
-                      HELP_GOVERNMENT };
+                      HELP_GOVERNMENT, HELP_LAST };
 
 void popup_help_dialog_string(const char *item);
 void popup_help_dialog_typed(const char *item, enum help_page_type);


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