[Freeciv-Dev] Re: (PR#8595) add city_building_present() to climisc
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8595 >
James Canete wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8595 >
>
> This patch adds a new wrapper function to climisc,
> city_building_present(), which matches the parameters to its fellow
> functions city_can_build_impr_or_unit(), city_unit_supported(), and
> city_unit_present().
>
> This is so a TestCityFunc variable can be set to city_building_present()
> instead of city_got_building() which has the wrong parameters. Some
> cleanup of win32 has been included as well.
I made some changes.
- Removed the unrelated gui-win32 bits.
- Added support for gtk and gtk2 clients.
- Added comment.
In a later patch TestCityFunc should also be moved into climisc.
jason
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.132
diff -u -r1.132 climisc.c
--- client/climisc.c 23 Apr 2004 22:58:05 -0000 1.132
+++ client/climisc.c 26 Apr 2004 16:10:25 -0000
@@ -532,6 +532,19 @@
return FALSE;
}
+/****************************************************************************
+ A TestCityFunc to tell whether the item is a building and is present.
+****************************************************************************/
+bool city_building_present(struct city *pcity, cid cid)
+{
+ if (!cid_is_unit(cid)) {
+ int impr_type = cid_id(cid);
+
+ return city_got_building(pcity, impr_type);
+ }
+ return FALSE;
+}
+
/**************************************************************************
Helper for name_and_sort_items.
**************************************************************************/
Index: client/climisc.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.h,v
retrieving revision 1.48
diff -u -r1.48 climisc.h
--- client/climisc.h 23 Apr 2004 22:58:05 -0000 1.48
+++ client/climisc.h 26 Apr 2004 16:10:25 -0000
@@ -76,6 +76,7 @@
bool city_can_build_impr_or_unit(struct city *pcity, cid cid);
bool city_unit_supported(struct city *pcity, cid cid);
bool city_unit_present(struct city *pcity, cid cid);
+bool city_building_present(struct city *pcity, cid cid);
struct item {
cid cid;
Index: client/gui-gtk/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v
retrieving revision 1.84
diff -u -r1.84 cityrep.c
--- client/gui-gtk/cityrep.c 14 Feb 2004 02:21:25 -0000 1.84
+++ client/gui-gtk/cityrep.c 26 Apr 2004 16:10:25 -0000
@@ -920,8 +920,7 @@
TRUE, FALSE, city_unit_present, FALSE);
append_impr_or_unit_to_menu(menu, _("Improvements in City"), FALSE, TRUE,
- FALSE, TRUE, (TestCityFunc)city_got_building,
- FALSE);
+ FALSE, TRUE, city_building_present, FALSE);
append_impr_or_unit_to_menu(menu, _("Available Improvements"), FALSE, TRUE,
FALSE, FALSE, city_can_build_impr_or_unit,
Index: client/gui-gtk-2.0/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/cityrep.c,v
retrieving revision 1.56
diff -u -r1.56 cityrep.c
--- client/gui-gtk-2.0/cityrep.c 31 Mar 2004 22:03:45 -0000 1.56
+++ client/gui-gtk-2.0/cityrep.c 26 Apr 2004 16:10:27 -0000
@@ -1622,11 +1622,11 @@
G_CALLBACK(select_impr_or_unit_callback), -1);
append_impr_or_unit_to_menu_item(GTK_MENU_ITEM(select_built_improvements_item),
FALSE, FALSE, CO_NONE,
- (TestCityFunc) city_got_building,
+ city_building_present,
G_CALLBACK(select_impr_or_unit_callback), -1);
append_impr_or_unit_to_menu_item(GTK_MENU_ITEM(select_built_wonders_item),
FALSE, TRUE, CO_NONE,
- (TestCityFunc) city_got_building,
+ city_building_present,
G_CALLBACK(select_impr_or_unit_callback), -1);
append_impr_or_unit_to_menu_item(GTK_MENU_ITEM(select_improvements_item),
Index: client/gui-win32/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/cityrep.c,v
retrieving revision 1.28
diff -u -r1.28 cityrep.c
--- client/gui-win32/cityrep.c 23 Apr 2004 22:58:06 -0000 1.28
+++ client/gui-win32/cityrep.c 26 Apr 2004 16:10:27 -0000
@@ -470,7 +470,7 @@
AppendMenu(popup,MF_POPUP,(UINT)submenu,_("Improvements in City"));
max_improvement_id=ID_IMPROVEMENTS_POPUP_BASE;
append_impr_or_unit_to_menu(submenu, FALSE, TRUE, FALSE,
- (TestCityFunc*)city_got_building,
+ city_building_present,
&cityids,selcount,
&max_improvement_id);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: (PR#8595) add city_building_present() to climisc,
Jason Short <=
|
|