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

diff -ru freeciv-2.1.8/client/gui-gtk-2.0/repodlgs.c 
/home/person/src/freeciv-2.1.8/client/gui-gtk-2.0/repodlgs.c
--- freeciv-2.1.8/client/gui-gtk-2.0/repodlgs.c 2008-11-30 12:53:30.000000000 
+0000
+++ /home/person/src/freeciv-2.1.8/client/gui-gtk-2.0/repodlgs.c        
2008-12-31 01:24:36.000000000 +0000
@@ -118,6 +118,8 @@
 
 #define NUM_SCORE_COLS 14                
 
+int * upkeep_ptr;
+
 /******************************************************************/
 static GtkWidget *settable_options_dialog_shell;
 
@@ -1178,7 +1180,11 @@
 {
   struct repoinfo {
     int active_count;
+#if 0
     int upkeep[O_COUNT];
+#else
+    int upkeep[0x20];
+#endif
     int building_count;
   };
 
@@ -1201,7 +1207,12 @@
       (unitarray[unit_type(punit)->index].active_count)++;
       if (punit->homecity) {
        output_type_iterate(o) {
+#if 0
          unitarray[unit_type(punit)->index].upkeep[o] += punit->upkeep[o];
+#else
+         upkeep_ptr = &(unitarray[unit_type(punit)->index].upkeep);
+         *(upkeep_ptr + o) += punit->upkeep[o];
+#endif
        } output_type_iterate_end;
       }
     } unit_list_iterate_end;
@@ -1218,6 +1229,9 @@
       Unit_type_id uti = punittype->index;
       if (unitarray[uti].active_count > 0
          || unitarray[uti].building_count > 0) {
+#if 1
+       upkeep_ptr = &(unitarray[uti].upkeep);
+#endif
        can = (can_upgrade_unittype(game.player_ptr, punittype) != NULL);
        
         gtk_list_store_append(activeunits_store, &it);
@@ -1225,9 +1239,15 @@
                1, can,
                2, unitarray[uti].building_count,
                3, unitarray[uti].active_count,
+#if 0
                4, unitarray[uti].upkeep[O_SHIELD],
                5, unitarray[uti].upkeep[O_FOOD],
                6, unitarray[uti].upkeep[O_GOLD],
+#else
+               4, *(upkeep_ptr + O_SHIELD),
+               5, *(upkeep_ptr + O_FOOD),
+               6, *(upkeep_ptr + O_GOLD),
+#endif
                7, TRUE,
                8, ((unitarray[uti].active_count > 0)
                    ? uti : U_LAST),
@@ -1240,20 +1260,37 @@
        k++;
        unittotals.active_count += unitarray[uti].active_count;
        output_type_iterate(o) {
+         #if 0
          unittotals.upkeep[o] += unitarray[uti].upkeep[o];
+         #else
+         int * upkeep_ptr2;
+
+         upkeep_ptr = &(unittotals.upkeep);
+         upkeep_ptr2 = &(unitarray[uti].upkeep);
+         *(upkeep_ptr + o) += *(upkeep_ptr2 + o);
+         #endif
        } output_type_iterate_end;
        unittotals.building_count += unitarray[uti].building_count;
       }
     } unit_type_iterate_end;
 
     gtk_list_store_append(activeunits_store, &it);
+#if 1
+    upkeep_ptr = &(unittotals.upkeep);
+#endif
     gtk_list_store_set(activeunits_store, &it,
            1, FALSE,
            2, unittotals.building_count,
            3, unittotals.active_count,
+#if 0
            4, unittotals.upkeep[O_SHIELD],
            5, unittotals.upkeep[O_FOOD],
            6, unittotals.upkeep[O_GOLD],
+#else
+           4, *(upkeep_ptr + O_SHIELD),
+           5, *(upkeep_ptr + O_FOOD),
+           6, *(upkeep_ptr + O_GOLD),
+#endif
            7, FALSE,
            8, U_LAST, -1);
     g_value_init(&value, G_TYPE_STRING);
diff -ru freeciv-2.1.8/client/helpdata.c 
/home/person/src/freeciv-2.1.8/client/helpdata.c
--- freeciv-2.1.8/client/helpdata.c     2008-11-30 12:54:04.000000000 +0000
+++ /home/person/src/freeciv-2.1.8/client/helpdata.c    2008-12-31 
01:29:53.000000000 +0000
@@ -239,7 +239,7 @@
   /* FIXME: show other data like range and survives. */
 #define COREQ_APPEND(s)                                                        
    \
   (coreq_buf[0] != '\0'                                                        
    \
-   ? cat_snprintf(coreq_buf, sizeof(coreq_buf), Q_("?clistmore:, %s"), (s))  \
+   ? (void)cat_snprintf(coreq_buf, sizeof(coreq_buf), Q_("?clistmore:, %s"), 
(s)) \
    : sz_strlcpy(coreq_buf, (s)))
 
 

Hello,

This email contains a patch that allows version 2.1.8 of FreeCiv to compile
under the 11/08 version (the latest I believe) version of the Sun Studio
Community Edition compiler.  The patch seems to produce working executables
on the AMD64 version of OpenSUSE 11.1 with the compiler mentioned above.
The changes are all minor ones which have to do with differences in
implementation of the C99 standard between the Sun Studio compiler and gcc.

Also, I noticed that there are several clients there, but the only one that
I have changed is the gtk 2.0 one.  If there is interest, I suppose I could
change the others.

Thank you,
James McClain
Hello,

This email contains a patch that allows version 2.1.8 of FreeCiv to compile under the 11/08 version (the latest I believe) version of the Sun Studio Community Edition compiler.  The patch seems to produce working executables on the AMD64 version of OpenSUSE 11.1 with the compiler mentioned above.  The changes are all minor ones which have to do with differences in implementation of the C99 standard between the Sun Studio compiler and gcc.

Also, I noticed that there are several clients there, but the only one that I have changed is the gtk 2.0 one.  If there is interest, I suppose I could change the others.

Thank you,
James McClain
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to