Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] win32 patch for city dialog production choice (PR#1284)
Home

[Freeciv-Dev] win32 patch for city dialog production choice (PR#1284)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] win32 patch for city dialog production choice (PR#1284)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Wed, 27 Feb 2002 03:24:42 -0800 (PST)

Andreas -

This patch should change the win32 code to use id_to_info_row to recover the texts that are to be put into the citydlg production selection choice.

Being a gnu/linux person, I can't test it. However, if it works (or you can get it to work) it should facilitate the change from showing "999" for the turns to build to "never" or "-".

I can't entirely figure out all of the string manipulation going on here (4 columnts of entries...it hurts my head), but if there are any extra features you'd added to what is basically the same code from id_to_info_row, they should go into that function instead.

jason
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.14
diff -u -r1.14 citydlg.c
--- client/gui-win32/citydlg.c  2002/02/25 15:24:56     1.14
+++ client/gui-win32/citydlg.c  2002/02/27 11:19:55
@@ -1159,66 +1159,19 @@
       lvi.mask=LVIF_TEXT;
       for(i=0; i<4; i++)
        row[i]=buf[i];
+       
       for(i=0, n=0; i<game.num_impr_types; i++)
-        
        if(can_build_improvement(pdialog->pcity, i)) {
-         if (i==B_CAPITAL) { /* Total & turns left meaningless on 
capitalization */
-           my_snprintf(buf[0], sizeof(buf[0]), get_improvement_type(i)->name);
-           buf[1][0]='\0';
-           my_snprintf(buf[2], sizeof(buf[2]), "--");
-           my_snprintf(buf[3], sizeof(buf[3]), "--");
-         } else {
-           turns = city_turns_to_build (pdialog->pcity, i, FALSE,TRUE);
-           my_snprintf(buf[0], sizeof(buf[0]), get_improvement_type(i)->name);
-            
-           /* from city.c get_impr_name_ex() */
-           if (wonder_replacement(pdialog->pcity, i))
-             {
-               my_snprintf(buf[1], sizeof(buf[1]), "*");
-             }
-           else
-             {
-               char *state = "";
-                
-               if (is_wonder(i))
-                 {
-                   state = _("Wonder");
-                   if (game.global_wonders[i]) state = _("Built");
-                   if (wonder_obsolete(i))     state = _("Obsolete");
-                 }
-               my_snprintf(buf[1], sizeof(buf[1]), state);
-             }
-         
-           my_snprintf(buf[2], sizeof(buf[2]), "%d",
-                       get_improvement_type(i)->build_cost);
-           my_snprintf(buf[3], sizeof(buf[3]), "%d",
-                       turns);
-         }
+         id_to_info_row(buf, sizeof(buf[0]), i, FALSE, pdialog->pcity);
          fcwin_listview_add_row(lv,n,4,row);
          pdialog->change_list_ids[n++]=i;
        }
+       
       pdialog->change_list_num_improvements=n;
       
       for(i=0; i<game.num_unit_types; i++)
        if(can_build_unit(pdialog->pcity, i)) {
-         struct unit_type *ptype;
-
-         turns = city_turns_to_build (pdialog->pcity, i, TRUE,TRUE);
-         my_snprintf(buf[0], sizeof(buf[0]), unit_name(i));
-         
-         /* from unit.h get_unit_name() */
-         ptype = get_unit_type(i);
-         if (ptype->fuel > 0)
-           my_snprintf(buf[1], sizeof(buf[1]), "%d/%d/%d(%d)",
-                       ptype->attack_strength, ptype->defense_strength,
-                       ptype->move_rate / 3, (ptype->move_rate / 3) * 
ptype->fuel);
-         else
-           my_snprintf(buf[1], sizeof(buf[1]), "%d/%d/%d",
-                       ptype->attack_strength, ptype->defense_strength,
-                       ptype->move_rate / 3);
-         my_snprintf(buf[2], sizeof(buf[2]), "%d", 
-                     get_unit_type(i)->build_cost);
-         my_snprintf(buf[3], sizeof(buf[3]), "%d", turns);
+         id_to_info_row(buf, sizeof(buf[0]), i, TRUE, pdialog->pcity);
          fcwin_listview_add_row(lv,n,4,row);
          pdialog->change_list_ids[n++]=i;
        }

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