Author: cazfi
Date: Sat Aug 15 20:21:09 2015
New Revision: 29527

URL: http://svn.gna.org/viewcvs/freeciv?rev=29527&view=rev
Log:
Include current production to city worklist items count shown in sdl/2 clients.

See bug #23770

Modified:
    branches/S2_6/client/gui-sdl/wldlg.c
    branches/S2_6/client/gui-sdl2/wldlg.c

Modified: branches/S2_6/client/gui-sdl/wldlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/wldlg.c?rev=29527&r1=29526&r2=29527&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl/wldlg.c        (original)
+++ branches/S2_6/client/gui-sdl/wldlg.c        Sat Aug 15 20:21:09 2015
@@ -961,16 +961,24 @@
   widget_mark_dirty(pEditor->pProduction_Progres);
 }
 
-
-/* update and redraw worklist length counter in worklist editor */
+/**************************************************************************
+  Update and redraw worklist length counter in worklist editor
+**************************************************************************/
 static void refresh_worklist_count_label(void)
 {
   char cBuf[64];
   SDL_Rect area;
+  int external_entries;
+
+  if (pEditor->pCity != NULL) {
+    external_entries = 1; /* Current production */
+  } else {
+    external_entries = 0;
+  }
 
   /* TRANS: length of worklist */
   fc_snprintf(cBuf, sizeof(cBuf), _("( %d entries )"),
-                               worklist_length(&pEditor->worklist_copy));
+              worklist_length(&pEditor->worklist_copy) + external_entries);
   copy_chars_to_string16(pEditor->pWorkList_Counter->string16, cBuf);
 
   widget_undraw(pEditor->pWorkList_Counter);
@@ -1020,7 +1028,8 @@
   bool advanced_tech;
   bool can_build, can_eventually_build;
   SDL_Rect area;
-  
+  int external_entries;
+
   if (pEditor) {
     return;
   }
@@ -1065,14 +1074,16 @@
   pEditor->pEndWidgetList = pWindow;
 
   area = pWindow->area;
-  
+
   /* ---------------- */
   if (pCity) {
     fc_snprintf(cBuf, sizeof(cBuf), _("Worklist of\n%s"), city_name(pCity));
+    external_entries = 1; /* Current production */
   } else {
     fc_snprintf(cBuf, sizeof(cBuf), "%s", global_worklist_name(pGWL));
-  }
-    
+    external_entries = 0;
+  }
+
   pStr = create_str16_from_char(cBuf, adj_font(12));
   pStr->style |= (TTF_STYLE_BOLD|SF_CENTER);
   
@@ -1083,7 +1094,7 @@
 
   /* TRANS: length of worklist */
   fc_snprintf(cBuf, sizeof(cBuf), _("( %d entries )"),
-              worklist_length(&pEditor->worklist_copy));
+              worklist_length(&pEditor->worklist_copy) + external_entries);
   pStr = create_str16_from_char(cBuf, adj_font(10));
   pStr->bgcol = (SDL_Color) {0, 0, 0, 0};
   pBuf = create_iconlabel(NULL, pWindow->dst, pStr, WF_RESTORE_BACKGROUND);

Modified: branches/S2_6/client/gui-sdl2/wldlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/wldlg.c?rev=29527&r1=29526&r2=29527&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/wldlg.c       (original)
+++ branches/S2_6/client/gui-sdl2/wldlg.c       Sat Aug 15 20:21:09 2015
@@ -964,15 +964,24 @@
   widget_mark_dirty(pEditor->pProduction_Progres);
 }
 
-/* update and redraw worklist length counter in worklist editor */
+/**************************************************************************
+  Update and redraw worklist length counter in worklist editor
+**************************************************************************/
 static void refresh_worklist_count_label(void)
 {
   char cBuf[64];
   SDL_Rect area;
+  int external_entries;
+
+  if (pEditor->pCity != NULL) {
+    external_entries = 1; /* Current production */
+  } else {
+    external_entries = 0;
+  }
 
   /* TRANS: length of worklist */
   fc_snprintf(cBuf, sizeof(cBuf), _("( %d entries )"),
-              worklist_length(&pEditor->worklist_copy));
+              worklist_length(&pEditor->worklist_copy) + external_entries);
   copy_chars_to_utf8_str(pEditor->pWorkList_Counter->string_utf8, cBuf);
 
   widget_undraw(pEditor->pWorkList_Counter);
@@ -1019,6 +1028,7 @@
   bool advanced_tech;
   bool can_build, can_eventually_build;
   SDL_Rect area;
+  int external_entries;
 
   if (pEditor) {
     return;
@@ -1069,8 +1079,10 @@
   /* ---------------- */
   if (pCity) {
     fc_snprintf(cbuf, sizeof(cbuf), _("Worklist of\n%s"), city_name(pCity));
+    external_entries = 1; /* Current production */
   } else {
     fc_snprintf(cbuf, sizeof(cbuf), "%s", global_worklist_name(pGWL));
+    external_entries = 0;
   }
 
   pstr = create_utf8_from_char(cbuf, adj_font(12));
@@ -1083,7 +1095,7 @@
 
   /* TRANS: length of worklist */
   fc_snprintf(cbuf, sizeof(cbuf), _("( %d entries )"),
-              worklist_length(&pEditor->worklist_copy));
+              worklist_length(&pEditor->worklist_copy) + external_entries);
   pstr = create_utf8_from_char(cbuf, adj_font(10));
   pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
   pBuf = create_iconlabel(NULL, pWindow->dst, pstr, WF_RESTORE_BACKGROUND);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to