Re: [Freeciv-Dev] (PR#39559) [Patch] Fix gui-win32 compile (or parts of it)

2007-08-26 Thread Marko Lindqvist

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

 This patch makes S2_1 gui-win32 to compile with -Werror. At least one
bug is crushed: pointer to group name was passed to
is_nation_in_group() instead of pointer to group.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-win32/dialogs.c freeciv/client/gui-win32/dialogs.c
--- freeciv/client/gui-win32/dialogs.c	2007-08-10 17:16:19.0 +0300
+++ freeciv/client/gui-win32/dialogs.c	2007-08-26 23:49:14.0 +0300
@@ -104,8 +104,10 @@
 static HWND races_dlg;
 struct player *races_player;
 static HWND races_listview;
+/*
 static HWND races_class;
 static HWND races_legend;
+*/
 int visible_nations[MAX_NUM_ITEMS];
 int selected_leader_sex;
 int selected_style;
@@ -282,12 +284,13 @@
 **/
 static void update_nation_info()
 {
+/*
   int i;
   char buf[255];
   struct nation_type *nation = nation_by_number(selected_nation);
  
   buf[0] = '\0';
-/*
+
   for (i = 0; i < nation->num_groups; i++) {
 sz_strlcat(buf, nation->groups[i]->name);
 if (i != nation->num_groups - 1) {
@@ -456,16 +459,6 @@
   return 0;
 }
 
-
-/
-...
-*/
-static int cmp_func(const void * a_p, const void * b_p)
-{
-  return strcmp(nation_name_translation(nation_by_number((*(int *)a_p)-ID_RACESDLG_NATION_BASE)),
-nation_name_translation(nation_by_number((*(int *)b_p)-ID_RACESDLG_NATION_BASE)));
-}
-
 /
 ...
 */
@@ -483,11 +476,13 @@
   continue;
 }
 
-if (group != NULL && !is_nation_in_group(pnation, group->name)) {
+if (group != NULL && !is_nation_in_group(pnation, group)) {
   continue;
 }
 
-strings[0] = nation_name_translation(pnation);
+/* FIXME: fcwin_listview_add_row() should be fixed to handle
+ *const strings. Now we just cast const away */
+strings[0] = (char *) nation_name_translation(pnation);
 
 fcwin_listview_add_row(listview, pnation->index, 1, strings);
 visible_nations[n++] = pnation->index;
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/gui_main.c freeciv/client/gui-win32/gui_main.c
--- freeciv/client/gui-win32/gui_main.c	2007-08-22 03:26:25.0 +0300
+++ freeciv/client/gui-win32/gui_main.c	2007-08-26 23:51:36.0 +0300
@@ -712,8 +712,6 @@
   return TRUE;
 }
 
-extern void anim_cursor(float time);
-
 /**
 
 **/
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/happiness.c freeciv/client/gui-win32/happiness.c
--- freeciv/client/gui-win32/happiness.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/client/gui-win32/happiness.c	2007-08-26 23:50:07.0 +0300
@@ -241,7 +241,6 @@
   char buf[512], *bptr = buf;
   int nleft = sizeof(buf);
   struct city *pcity = pdialog->pcity;
-  struct government *g = government_of_city(pcity);
   int mlmax = get_city_bonus(pcity, EFT_MARTIAL_LAW_MAX);
   int uhcfac = get_player_bonus(city_owner(pcity), EFT_UNHAPPY_FACTOR);
 
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/mapview.h freeciv/client/gui-win32/mapview.h
--- freeciv/client/gui-win32/mapview.h	2007-03-05 19:14:32.0 +0200
+++ freeciv/client/gui-win32/mapview.h	2007-08-26 23:51:26.0 +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/repodlgs.c freeciv/client/gui-win32/repodlgs.c
--- freeciv/client/gui-win32/repodlgs.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/client/gui-win32/repodlgs.c	2007-08-26 23:54:38.0 +0300
@@ -565,7 +565,8 @@
 	  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,
+			  utype_name_translation(ut1),
+  utype_name_translation(ut2),
 			  unit_upgrade_price(game.player_ptr, ut1, ut2),
 			  game.player_ptr->economic.gold);
 
@@ -576,7 +577,7 @@
    (void *)(activeunits_type[sel]),
    _("No"), upgrade_callback_no, 0, 0);
 	}   
-	  break;	
+	  break;
 	}
   break;
 default:
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39559) [Patch] Fix gui-win32 compile (or parts of it)

2007-08-14 Thread Marko Lindqvist

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.0 +0300
+++ freeciv/client/gui-win32/graphics.c	2007-08-15 01:56:51.0 +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.0 +0300
+++ freeciv/client/gui-win32/mapview.c	2007-08-15 02:01:01.0 +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.0 +0300
+++ freeciv/client/gui-win32/mapview.h	2007-08-15 01:23:57.0 +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.0 +0300
+++ freeciv/client/gui-win32/menu.c	2007-08-15 01:27:04.0 +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.0 +0300
+++ freeciv/client/gui-win32/optiondlg.c	2007-08-15 01:30:35.0 +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.0 +0300
+++ freeciv/client/gui-win32/pages.c	2007-08-15 02:02:27.0 +0300
@@ -15,6 +15,8 @@
 #include 
 #endif
 
+#include "connectdlg_g.h"
+
 #include "pages.h"
 
 /***