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

On 14/08/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>
>  It still does not compile. But there is patch somewhere in RT that
> should fix some of the older problems, so I'm avoiding duplicate work
> here.

 There was no usable patch for fixing those problems. So I had to
write it myself. With attached patch gui-win32 compiles.
 It has not adopted to new cursor code, but old one had to go.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-win32/graphics.c freeciv/client/gui-win32/graphics.c
--- freeciv/client/gui-win32/graphics.c	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/graphics.c	2007-08-15 01:56:51.000000000 +0300
@@ -90,8 +90,7 @@
   Load the cursors (mouse substitute sprites), including a goto cursor,
   an airdrop cursor, a nuke cursor, and a patrol cursor.
 **************************************************************************/
-void
-load_cursors(void)
+void load_cursors(void)
 {
   enum cursor_type cursor;
   ICONINFO ii;
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/mapview.c freeciv/client/gui-win32/mapview.c
--- freeciv/client/gui-win32/mapview.c	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/mapview.c	2007-08-15 02:01:01.000000000 +0300
@@ -201,6 +201,11 @@
   SetWindowText(unit_info_frame, get_unit_info_label_text1(punitlist));
   SetWindowText(unit_info_label, get_unit_info_label_text2(punitlist));
 
+  /* Cursor handling has changed a lot. New form is not yet implemented
+   * for gui-win32. Old code below is probably never needed again, but
+   * I left it here just in case. Remove when new implementation is in
+   * place. */
+#if 0
   switch (hover_state) {
     case HOVER_NONE:
       if (action_state == CURSOR_ACTION_SELECT) {
@@ -245,6 +250,7 @@
       cursor_type = CURSOR_PARADROP;
       break;
   }
+#endif
 
   do_mainwin_layout();
 }
@@ -258,6 +264,14 @@
 }
 
 /**************************************************************************
+  This function will change the current mouse cursor.
+**************************************************************************/
+void update_mouse_cursor(enum cursor_type new_cursor_type)
+{
+  /* PORT ME */
+}
+
+/**************************************************************************
 
 **************************************************************************/
 void update_turn_done_button(bool do_restore)
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/mapview.h freeciv/client/gui-win32/mapview.h
--- freeciv/client/gui-win32/mapview.h	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/mapview.h	2007-08-15 01:23:57.000000000 +0300
@@ -22,6 +22,7 @@
 void overview_expose(HDC hdc);
 void map_handle_hscroll(int pos);
 void map_handle_vscroll(int pos);
+void anim_cursor(float time);
 
 /* These values are stored in the mapview struct now. */
 #define map_view_x 	mapview.map_x0
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/menu.c freeciv/client/gui-win32/menu.c
--- freeciv/client/gui-win32/menu.c	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/menu.c	2007-08-15 01:27:04.000000000 +0300
@@ -1156,7 +1156,8 @@
 		     !unit_has_type_flag(punit, F_UNDISBANDABLE));
       my_enable_menu(menu, IDM_ORDERS_HOMECITY,
 		     can_unit_change_homecity(punit));
-      my_enable_menu(menu, IDM_ORDERS_LOAD, find_transporter_for_unit(punit));
+      my_enable_menu(menu, IDM_ORDERS_LOAD,
+                     find_transporter_for_unit(punit)->id);
       my_enable_menu(menu, IDM_ORDERS_UNLOAD,
 	(can_unit_unload(punit, game_find_unit_by_number(punit->transported_by))
 	 && can_unit_exist_at_tile(punit, punit->tile)) 
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/optiondlg.c freeciv/client/gui-win32/optiondlg.c
--- freeciv/client/gui-win32/optiondlg.c	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/optiondlg.c	2007-08-15 01:30:35.000000000 +0300
@@ -80,6 +80,9 @@
 	    }
 	  }
 	  break;
+        case COT_FONT:
+          /* FIXME: */
+          break;
 	}
       } client_options_iterate_end;
       DestroyWindow(dlg);
@@ -153,7 +156,10 @@
 	    (void *) fcwin_box_add_edit(vbox, "", 40, 0, 0, TRUE, TRUE, 0);
 	break;
       }
-    } 
+     case COT_FONT:
+       /* FIXME: */
+       break;
+    }
   } client_options_iterate_end;
   fcwin_box_add_box(hbox,vbox_labels,TRUE,TRUE,0);
   fcwin_box_add_box(hbox,vbox,TRUE,TRUE,0);
@@ -199,6 +205,9 @@
       } 
       SetWindowText((HWND)(o->p_gui_data), o->p_string_value);
       break;
+    case COT_FONT:
+      /* FIXME: */
+      break;
     }
   } client_options_iterate_end;
   fcwin_redo_layout(option_dialog);
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/pages.c freeciv/client/gui-win32/pages.c
--- freeciv/client/gui-win32/pages.c	2007-08-04 18:38:53.000000000 +0300
+++ freeciv/client/gui-win32/pages.c	2007-08-15 02:02:27.000000000 +0300
@@ -15,6 +15,8 @@
 #include <config.h>
 #endif
 
+#include "connectdlg_g.h"
+
 #include "pages.h"
 
 /**************************************************************************
@@ -48,7 +50,7 @@
   "default", and if the user changes this then set_ruleset() should be
   called.
 ****************************************************************************/
-void gui_set_rulesets(char rulesets[][64], int ruleset_count)
+void gui_set_rulesets(int num_rulesets, char **rulesets)
 {
   /* PORTME */
 }
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/repodlgs.c freeciv/client/gui-win32/repodlgs.c
--- freeciv/client/gui-win32/repodlgs.c	2007-08-13 20:51:06.000000000 +0300
+++ freeciv/client/gui-win32/repodlgs.c	2007-08-15 01:47:48.000000000 +0300
@@ -563,8 +563,9 @@
 	      my_snprintf(buf, sizeof(buf),
 			  _("Upgrade as many %s to %s as possible for %d gold each?\n"
 			    "Treasury contains %d gold."),
-			  ut1->name, ut2->name,
-			  unit_upgrade_price(game.player_ptr, ut1, ut2),
+			  utype_name_translation(ut1),
+                          utype_name_translation(ut2),
+                          unit_upgrade_price(game.player_ptr, ut1, ut2),
 			  game.player_ptr->economic.gold);    
 
 	      popup_message_dialog(NULL, 
@@ -616,17 +617,30 @@
     }
 
     memset(unitarray, '\0', sizeof(unitarray));
-    unit_list_iterate(game.player_ptr->units, punit) {
-      Unit_type_id uti = utype_index(unit_type(punit));
-      (unitarray[uti].active_count)++;
-      if (punit->homecity) {
-        unitarray[uti].upkeep_shield += punit->upkeep[O_SHIELD];
-        unitarray[uti].upkeep_food += punit->upkeep[O_FOOD];
-	/* TODO: gold upkeep */
-      }
-    }
 
-    unit_list_iterate_end;
+   city_list_iterate(game.player_ptr->cities, pcity) {
+      int free_upkeep[O_COUNT];
+
+      output_type_iterate(o) {
+        free_upkeep[o] = get_city_output_bonus(pcity, get_output_type(o),
+                                               EFT_UNIT_UPKEEP_FREE_PER_CITY);
+      } output_type_iterate_end;
+
+      unit_list_iterate(game.player_ptr->units, punit) {
+        int upkeep_cost[O_COUNT];
+        Unit_type_id uti = utype_index(unit_type(punit));
+
+        city_unit_upkeep(punit, upkeep_cost, free_upkeep);
+        (unitarray[uti].active_count)++;
+        if (punit->homecity) {
+          /* TODO: upkeep for generic output types. */
+          unitarray[uti].upkeep_shield += upkeep_cost[O_SHIELD];
+          unitarray[uti].upkeep_food += upkeep_cost[O_FOOD];
+        }
+      } unit_list_iterate_end;
+   } city_list_iterate_end;
+
+
     city_list_iterate(game.player_ptr->cities,pcity) {
       if (VUT_UTYPE == pcity->production.kind) {
         struct unit_type *punittype = pcity->production.value.utype;
@@ -637,27 +651,29 @@
 
     k = 0;
     memset(&unittotals, '\0', sizeof(unittotals));
-    unit_type_iterate(i) {
-      if ((unitarray[i->index].active_count > 0)
-	  || (unitarray[i->index].building_count > 0)) {
-        can = (can_upgrade_unittype(game.player_ptr, i) != NULL);
-        my_snprintf(buf[0], sizeof(buf[0]), "%s", utype_name_translation(i));
+    unit_type_iterate(putype) {
+      int index = utype_index(putype);
+      if ((unitarray[index].active_count > 0)
+	  || (unitarray[index].building_count > 0)) {
+        can = (can_upgrade_unittype(game.player_ptr, putype) != NULL);
+        my_snprintf(buf[0], sizeof(buf[0]), "%s",
+                    utype_name_translation(putype));
         my_snprintf(buf[1], sizeof(buf[1]), "%c", can ? '*': '-');
         my_snprintf(buf[2], sizeof(buf[2]), "%3d",
-				   unitarray[i->index].building_count);
+                    unitarray[index].building_count);
         my_snprintf(buf[3], sizeof(buf[3]), "%3d",
-				   unitarray[i->index].active_count);
+                    unitarray[index].active_count);
         my_snprintf(buf[4], sizeof(buf[4]), "%3d",
-				   unitarray[i->index].upkeep_shield);
+                    unitarray[index].upkeep_shield);
         my_snprintf(buf[5], sizeof(buf[5]), "%3d",
-				   unitarray[i->index].upkeep_food);
+				   unitarray[index].upkeep_food);
 	fcwin_listview_add_row(lv,k,AU_COL,row);
-        activeunits_type[k]=(unitarray[i->index].active_count > 0) ? i : NULL;
+        activeunits_type[k]=(unitarray[index].active_count > 0) ? putype : NULL;
         k++;
-        unittotals.active_count += unitarray[i->index].active_count;
-        unittotals.upkeep_shield += unitarray[i->index].upkeep_shield;
-        unittotals.upkeep_food += unitarray[i->index].upkeep_food;
-        unittotals.building_count += unitarray[i->index].building_count;
+        unittotals.active_count += unitarray[index].active_count;
+        unittotals.upkeep_shield += unitarray[index].upkeep_shield;
+        unittotals.upkeep_food += unitarray[index].upkeep_food;
+        unittotals.building_count += unitarray[index].building_count;
       }
     } unit_type_iterate_end;
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to