Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2000:
[Freeciv-Dev] [PATCH] Treasury contains internationalization refinement
Home

[Freeciv-Dev] [PATCH] Treasury contains internationalization refinement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] Treasury contains internationalization refinement
From: Markus Linnala <maage@xxxxxxxxx>
Date: 06 Jan 2000 20:57:47 +0200
Reply-to: Markus Linnala <maage@xxxxxxxxx>

Patch contains some indentation fixes too, as some of the
changed functions were not indented according to freeciv-style.

2000-01-06  Markus Linnala  <maage@xxxxxxxxx>

        * client/gui-xaw/repodlgs.c (activeunits_upgrade_callback)
        client/gui-xaw/dialogs.c (popup_bribe_dialog)   (popup_incite_dialog)
        client/gui-xaw/citydlg.c (buy_callback) (upgrade_callback)
        client/gui-gtk/repodlgs.c (activeunits_upgrade_callback)
        client/gui-gtk/dialogs.c (popup_bribe_dialog) (popup_incite_dialog)
        client/gui-gtk/citydlg.c (buy_callback) (upgrade_callback):
        "Treasury contains" refinement

-- 
//Markus

Index: citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.31
diff -u -u -r1.31 citydlg.c
--- citydlg.c   2000/01/02 11:55:24     1.31
+++ citydlg.c   2000/01/06 18:52:33
@@ -1444,7 +1444,7 @@
   struct city_dialog *pdialog;
   int value;
   char *name;
-  char buf[512];
+  char buf[512], buf2[512];
   
   pdialog=(struct city_dialog *)data;
 
@@ -1458,8 +1458,12 @@
 
   if(game.player_ptr->economic.gold>=value) {
     my_snprintf(buf, sizeof(buf),
-           _("Buy %s for %d gold?\nTreasury contains %d gold."), 
-           name, value, game.player_ptr->economic.gold);
+               _("Buy %s for %d gold?\n"), 
+               name, value);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
 
     popup_message_dialog(pdialog->shell, /*"buydialog"*/ _("Buy It!"), buf,
                         _("Yes"), buy_callback_yes, pdialog,
@@ -1467,8 +1471,12 @@
   }
   else {
     my_snprintf(buf, sizeof(buf),
-           _("%s costs %d gold.\nTreasury contains %d gold."), 
-           name, value, game.player_ptr->economic.gold);
+               _("%s costs %d gold.\n"), 
+               name, value);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
 
     popup_message_dialog(pdialog->shell, /*"buynodialog"*/ _("Buy It!"), buf,
                         _("Darn"), buy_callback_no, 0, 0);
@@ -1505,7 +1513,7 @@
 void upgrade_callback(GtkWidget *w, gpointer data)
 {
   struct unit *punit;
-  char buf[512];
+  char buf[512], buf2[512];
   int ut1,ut2;
   int value;
 
@@ -1526,10 +1534,14 @@
       value=unit_upgrade_price(game.player_ptr, ut1, ut2);
 
       if(game.player_ptr->economic.gold>=value) {
-       my_snprintf(buf, sizeof(buf), _("Upgrade %s to %s for %d gold?\n"
-              "Treasury contains %d gold."),
-              unit_types[ut1].name, unit_types[ut2].name,
-              value, game.player_ptr->economic.gold);
+       my_snprintf(buf, sizeof(buf), 
+                   _("Upgrade %s to %s for %d gold?\n"),
+                   unit_types[ut1].name, unit_types[ut2].name, value);
+       my_snprintf(buf2, sizeof(buf2), 
+                   _("Treasury contains %d gold."),
+                   game.player_ptr->economic.gold);
+       mystrlcat(buf, buf2, sizeof(buf));
+
        popup_message_dialog(toplevel, 
                             /*"upgradedialog"*/_("Upgrade Obsolete Units"), 
buf,
                             _("Yes"),
@@ -1538,10 +1550,14 @@
                               unitupgrade_callback_no, 0,
                             NULL);
       } else {
-       my_snprintf(buf, sizeof(buf), _("Upgrading %s to %s costs %d gold.\n"
-              "Treasury contains %d gold."),
-              unit_types[ut1].name, unit_types[ut2].name,
-              value, game.player_ptr->economic.gold);
+       my_snprintf(buf, sizeof(buf), 
+                   _("Upgrading %s to %s costs %d gold.\n"),
+                   unit_types[ut1].name, unit_types[ut2].name,
+                   value);
+       my_snprintf(buf2, sizeof(buf2), 
+                   _("Treasury contains %d gold."),
+                   game.player_ptr->economic.gold);
+       mystrlcat(buf, buf2, sizeof(buf));
        popup_message_dialog(toplevel,
                             /*"upgradenodialog"*/_("Upgrade Unit!"), buf,
                             _("Darn"), unitupgrade_callback_no, 0,
Index: dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.32
diff -u -u -r1.32 dialogs.c
--- dialogs.c   2000/01/02 11:55:25     1.32
+++ dialogs.c   2000/01/06 18:52:33
@@ -394,23 +394,32 @@
 *****************************************************************/
 void popup_bribe_dialog(struct unit *punit)
 {
-  char buf[128];
+  char buf[128], buf2[128];
   
   if(game.player_ptr->economic.gold>=punit->bribe_cost) {
     my_snprintf(buf, sizeof(buf),
-               _("Bribe unit for %d gold?\nTreasury contains %d gold."), 
-               punit->bribe_cost, game.player_ptr->economic.gold);
+               _("Bribe unit for %d gold?\n"),
+               punit->bribe_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(toplevel, /*"diplomatbribedialog"*/_("Bribe Enemy 
Unit"), buf,
-                       _("Yes"), diplomat_bribe_yes_callback, 0,
-                       _("No"), diplomat_bribe_no_callback, 0, 0);
+                        _("Yes"), diplomat_bribe_yes_callback, 0,
+                        _("No"), diplomat_bribe_no_callback, 0, 0);
   } else {
     my_snprintf(buf, sizeof(buf),
-               _("Bribing the unit costs %d gold.\n"
-                 "Treasury contains %d gold."), 
-               punit->bribe_cost, game.player_ptr->economic.gold);
+               _("Bribing the unit costs %d gold.\n"),
+               punit->bribe_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(toplevel, /*"diplomatnogolddialog"*/_("Traitors 
Demand Too Much!"), buf,
-                       _("Darn"), diplomat_bribe_no_callback, 0, 
-                       0);
+                        _("Darn"), diplomat_bribe_no_callback, 0, 
+                        0);
   }
 }
 
@@ -913,24 +922,33 @@
 *****************************************************************/
 void popup_incite_dialog(struct city *pcity)
 {
-  char buf[128];
+  char buf[128], buf2[128];
 
   if(game.player_ptr->economic.gold>=pcity->incite_revolt_cost) {
     my_snprintf(buf, sizeof(buf),
-               _("Incite a revolt for %d gold?\nTreasury contains %d gold."), 
-               pcity->incite_revolt_cost, game.player_ptr->economic.gold);
-   diplomat_target_id = pcity->id;
-   popup_message_dialog(toplevel, /*"diplomatrevoltdialog"*/_("Incite a 
Revolt!"), buf,
-                      _("Yes"), diplomat_incite_yes_callback, 0,
-                      _("No"), diplomat_incite_no_callback, 0, 0);
+               _("Incite a revolt for %d gold?\n"), 
+               pcity->incite_revolt_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
+    diplomat_target_id = pcity->id;
+    popup_message_dialog(toplevel, /*"diplomatrevoltdialog"*/_("Incite a 
Revolt!"), buf,
+                        _("Yes"), diplomat_incite_yes_callback, 0,
+                        _("No"), diplomat_incite_no_callback, 0, 0);
   } else {
     my_snprintf(buf, sizeof(buf),
-               _("Inciting a revolt costs %d gold.\n"
-                 "Treasury contains %d gold."), 
-               pcity->incite_revolt_cost, game.player_ptr->economic.gold);
-   popup_message_dialog(toplevel, /*"diplomatnogolddialog"*/_("Traitors Demand 
Too Much!"), buf,
-                      _("Darn"), diplomat_incite_no_callback, 0, 
-                      0);
+               _("Inciting a revolt costs %d gold.\n"),
+               pcity->incite_revolt_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
+    popup_message_dialog(toplevel, /*"diplomatnogolddialog"*/_("Traitors 
Demand Too Much!"), buf,
+                        _("Darn"), diplomat_incite_no_callback, 0, 
+                        0);
   }
 }
 
Index: repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.23
diff -u -u -r1.23 repodlgs.c
--- repodlgs.c  2000/01/02 11:55:28     1.23
+++ repodlgs.c  2000/01/06 18:52:33
@@ -879,13 +879,13 @@
 *****************************************************************/
 void activeunits_upgrade_callback(GtkWidget *w, gpointer data)
 {
-  char buf[512];
+  char buf[512], buf2[512];
   int ut1,ut2;
   GList              *selection;
   gint                row;
 
   if ( !( selection = GTK_CLIST( activeunits_list )->selection ) )
-      return;
+    return;
 
   row = (gint)selection->data;
 
@@ -897,12 +897,15 @@
   ut2 = can_upgrade_unittype(game.player_ptr, activeunits_type[row]);
 
   my_snprintf(buf, sizeof(buf),
-         _("Upgrade as many %s to %s as possible for %d gold each?\n"
-           "Treasury contains %d gold."),
-         unit_types[ut1].name, unit_types[ut2].name,
-         unit_upgrade_price(game.player_ptr, ut1, ut2),
-         game.player_ptr->economic.gold);
-
+             _("Upgrade as many %s to %s as possible for %d gold each?\n"),
+             unit_types[ut1].name, unit_types[ut2].name,
+             unit_upgrade_price(game.player_ptr, ut1, ut2));
+  
+  my_snprintf(buf2, sizeof(buf2), 
+             _("Treasury contains %d gold."),
+             game.player_ptr->economic.gold);
+  mystrlcat(buf, buf2, sizeof(buf));
+  
   popup_message_dialog(toplevel, /*"upgradedialog"*/_("Upgrade Obsolete 
Units"), buf,
                       _("Yes"), upgrade_callback_yes, 
(gpointer)(activeunits_type[row]),
                       _("No"), upgrade_callback_no, 0, 0);
Index: citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.25
diff -u -u -r1.25 citydlg.c
--- citydlg.c   2000/01/02 11:55:30     1.25
+++ citydlg.c   2000/01/06 18:52:37
@@ -1890,7 +1890,7 @@
   struct city_dialog *pdialog;
   int value;
   char *name;
-  char buf[512];
+  char buf[512], buf2[512];
   
   pdialog=(struct city_dialog *)client_data;
 
@@ -1904,8 +1904,13 @@
  
   if(game.player_ptr->economic.gold>=value) {
     my_snprintf(buf, sizeof(buf),
-               _("Buy %s for %d gold?\nTreasury contains %d gold."), 
-               name, value, game.player_ptr->economic.gold);
+               _("Buy %s for %d gold?\n"),
+               name, value);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(pdialog->shell, "buydialog", buf,
                         buy_callback_yes, pdialog, 0,
                         buy_callback_no, 0, 0,
@@ -1913,8 +1918,13 @@
   }
   else {
     my_snprintf(buf, sizeof(buf),
-               _("%s costs %d gold.\nTreasury contains %d gold."), 
-               name, value, game.player_ptr->economic.gold);
+               _("%s costs %d gold.\n"),
+               name, value);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(pdialog->shell, "buynodialog", buf,
                         buy_callback_no, 0, 0,
                         NULL);
@@ -1952,7 +1962,7 @@
 void upgrade_callback(Widget w, XtPointer client_data, XtPointer call_data)
 {
   struct unit *punit;
-  char buf[512];
+  char buf[512], buf[512];
   int ut1,ut2;
   int value;
 
@@ -1967,30 +1977,38 @@
       my_snprintf(buf, sizeof(buf),
                  _("Sorry: cannot upgrade %s."), unit_types[ut1].name);
       popup_message_dialog(toplevel, "upgradenodialog", buf,
-                           unitupgrade_callback_no, 0, 0,
-                           NULL);
+                          unitupgrade_callback_no, 0, 0,
+                          NULL);
     } else {
       value=unit_upgrade_price(game.player_ptr, ut1, ut2);
 
       if(game.player_ptr->economic.gold>=value) {
-        my_snprintf(buf, sizeof(buf),
-                   _("Upgrade %s to %s for %d gold?\n"
-                     "Treasury contains %d gold."),
+       my_snprintf(buf, sizeof(buf),
+                   _("Upgrade %s to %s for %d gold?\n"),
                    unit_types[ut1].name, unit_types[ut2].name,
-                   value, game.player_ptr->economic.gold);
-        popup_message_dialog(toplevel, "upgradedialog", buf,
-                             unitupgrade_callback_yes, (XtPointer)(punit->id), 
0,
-                             unitupgrade_callback_no, 0, 0,
-                             NULL);
+                   value);
+       my_snprintf(buf2, sizeof(buf2), 
+                   _("Treasury contains %d gold."),
+                   game.player_ptr->economic.gold);
+       mystrlcat(buf, buf2, sizeof(buf));
+
+       popup_message_dialog(toplevel, "upgradedialog", buf,
+                            unitupgrade_callback_yes, (XtPointer)(punit->id), 
0,
+                            unitupgrade_callback_no, 0, 0,
+                            NULL);
       } else {
-        my_snprintf(buf, sizeof(buf),
-                   _("Upgrading %s to %s costs %d gold.\n"
-                     "Treasury contains %d gold."),
+       my_snprintf(buf, sizeof(buf),
+                   _("Upgrading %s to %s costs %d gold.\n"),
                    unit_types[ut1].name, unit_types[ut2].name,
-                   value, game.player_ptr->economic.gold);
-        popup_message_dialog(toplevel, "upgradenodialog", buf,
-                             unitupgrade_callback_no, 0, 0,
-                             NULL);
+                   value);
+       my_snprintf(buf2, sizeof(buf2), 
+                   _("Treasury contains %d gold."),
+                   game.player_ptr->economic.gold);
+       mystrlcat(buf, buf2, sizeof(buf));
+       
+       popup_message_dialog(toplevel, "upgradenodialog", buf,
+                            unitupgrade_callback_no, 0, 0,
+                            NULL);
       }
     }
     destroy_message_dialog(w);
Index: dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.32
diff -u -u -r1.32 dialogs.c
--- dialogs.c   2000/01/02 11:55:30     1.32
+++ dialogs.c   2000/01/06 18:52:37
@@ -419,22 +419,30 @@
 *****************************************************************/
 void popup_bribe_dialog(struct unit *punit)
 {
-  char buf[128];
+  char buf[128], buf2[128];
   
   if(game.player_ptr->economic.gold>=punit->bribe_cost) {
     my_snprintf(buf, sizeof(buf),
-               _("Bribe unit for %d gold?\n"
-                 "Treasury contains %d gold."), 
-               punit->bribe_cost, game.player_ptr->economic.gold);
+               _("Bribe unit for %d gold?\n"), 
+               punit->bribe_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(toplevel, "diplomatbribedialog", buf,
                         diplomat_bribe_yes_callback, 0, 0,
                         diplomat_bribe_no_callback, 0, 0,
                         NULL);
   } else {
     my_snprintf(buf, sizeof(buf),
-               _("Bribing the unit costs %d gold.\n"
-                 "Treasury contains %d gold."), 
-               punit->bribe_cost, game.player_ptr->economic.gold);
+               _("Bribing the unit costs %d gold.\n"), 
+               punit->bribe_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+
     popup_message_dialog(toplevel, "diplomatnogolddialog", buf,
                         diplomat_bribe_no_callback, 0, 0,
                         NULL);
@@ -953,26 +961,34 @@
 *****************************************************************/
 void popup_incite_dialog(struct city *pcity)
 {
-  char buf[128];
-
+  char buf[128], buf2[128];
+  
   if(game.player_ptr->economic.gold>=pcity->incite_revolt_cost) {
     my_snprintf(buf, sizeof(buf),
-               _("Incite a revolt for %d gold?\n"
-                 "Treasury contains %d gold."), 
-               pcity->incite_revolt_cost, game.player_ptr->economic.gold);
-   diplomat_target_id = pcity->id;
-   popup_message_dialog(toplevel, "diplomatrevoltdialog", buf,
-                       diplomat_incite_yes_callback, 0, 0,
-                       diplomat_incite_no_callback, 0, 0,
-                       NULL);
+               _("Incite a revolt for %d gold?\n"),
+               pcity->incite_revolt_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+    
+    diplomat_target_id = pcity->id;
+    popup_message_dialog(toplevel, "diplomatrevoltdialog", buf,
+                        diplomat_incite_yes_callback, 0, 0,
+                        diplomat_incite_no_callback, 0, 0,
+                        NULL);
   } else {
-   my_snprintf(buf, sizeof(buf),
-              _("Inciting a revolt costs %d gold.\n"
-                "Treasury contains %d gold."), 
-              pcity->incite_revolt_cost, game.player_ptr->economic.gold);
-   popup_message_dialog(toplevel, "diplomatnogolddialog", buf,
-                       diplomat_incite_no_callback, 0, 0,
-                       NULL);
+    my_snprintf(buf, sizeof(buf),
+               _("Inciting a revolt costs %d gold.\n"),
+               pcity->incite_revolt_cost);
+    my_snprintf(buf2, sizeof(buf2), 
+               _("Treasury contains %d gold."),
+               game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
+    
+    popup_message_dialog(toplevel, "diplomatnogolddialog", buf,
+                        diplomat_incite_no_callback, 0, 0,
+                        NULL);
   }
 }
 
Index: repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/repodlgs.c,v
retrieving revision 1.17
diff -u -u -r1.17 repodlgs.c
--- repodlgs.c  2000/01/02 11:55:33     1.17
+++ repodlgs.c  2000/01/06 18:52:37
@@ -990,7 +990,7 @@
 void activeunits_upgrade_callback(Widget w, XtPointer client_data, 
                         XtPointer call_data)
 {
-  char buf[512];
+  char buf[512], buf2[512];
   int ut1,ut2;
 
   XawListReturnStruct *ret;
@@ -1007,11 +1007,14 @@
                               activeunits_type[ret->list_index]);
 
     my_snprintf(buf, sizeof(buf),
-           _("Upgrade as many %s to %s as possible for %d gold each?\n"
-             "Treasury contains %d gold."),
-           unit_types[ut1].name, unit_types[ut2].name,
-           unit_upgrade_price(game.player_ptr, ut1, ut2),
-           game.player_ptr->economic.gold);
+               _("Upgrade as many %s to %s as possible for %d gold each?\n"),
+               unit_types[ut1].name, unit_types[ut2].name,
+               unit_upgrade_price(game.player_ptr, ut1, ut2))
+    
+      my_snprintf(buf2, sizeof(buf2), 
+                 _("Treasury contains %d gold."),
+                 game.player_ptr->economic.gold);
+    mystrlcat(buf, buf2, sizeof(buf));
 
     popup_message_dialog(toplevel, "upgradedialog", buf,
                         upgrade_callback_yes,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] [PATCH] Treasury contains internationalization refinement, Markus Linnala <=