Re: [Freeciv-Dev] (PR#40431) [Patch] SDL-client: Use get_base_by_gui_type()

2008-08-13 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40431 

2008/8/12 Marko Lindqvist:

  Use get_base_by_gui_type() instead of hardcoded base type index.

 - Fixed compile


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/menu.c 
freeciv/client/gui-sdl/menu.c
--- freeciv/client/gui-sdl/menu.c   2008-08-13 15:42:16.0 +0300
+++ freeciv/client/gui-sdl/menu.c   2008-08-14 00:56:50.0 +0300
@@ -1005,6 +1005,7 @@
   struct tile *pTile = pUnit-tile;
   struct city *pCity = tile_city(pTile);
   struct terrain *pTerrain = tile_terrain(pTile);
+  struct base_type *pbase;
   
   if (!counter) {
local_show(ID_UNIT_ORDER_GOTO);
@@ -1160,7 +1161,8 @@
set_wflag(pOrder_Transform_Button, WF_HIDDEN);
   }
 
-  if (!pCity  can_unit_do_activity_base(pUnit, BASE_FORTRESS)) {
+  pbase = get_base_by_gui_type(BASE_GUI_FORTRESS, pUnit, pUnit-tile);
+  if (!pCity  pbase) {
local_show(ID_UNIT_ORDER_FORTRESS);
   } else {
local_hide(ID_UNIT_ORDER_FORTRESS);
@@ -1172,7 +1174,8 @@
local_hide(ID_UNIT_ORDER_FORTIFY);
   }
 
-  if (!pCity  can_unit_do_activity_base(pUnit, BASE_AIRBASE)) {
+  pbase = get_base_by_gui_type(BASE_GUI_AIRBASE, pUnit, pUnit-tile);
+  if (!pCity  pbase) {
local_show(ID_UNIT_ORDER_AIRBASE);
   } else {
local_hide(ID_UNIT_ORDER_AIRBASE);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40431) [Patch] SDL-client: Use get_base_by_gui_type()

2008-08-12 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40431 

 Use get_base_by_gui_type() instead of hardcoded base type index.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/menu.c 
freeciv/client/gui-sdl/menu.c
--- freeciv/client/gui-sdl/menu.c   2008-03-08 16:33:05.0 +0200
+++ freeciv/client/gui-sdl/menu.c   2008-08-12 16:29:38.0 +0300
@@ -1134,6 +1134,8 @@
  pOrder_Mine_Button-theme = pTheme-OPlantForest_Icon;

} else {
+ struct base_type *pbase;
+
  /* set Mining Icon */
  my_snprintf(cBuf, sizeof(cBuf),%s (%s) %d %s,
_(Build Mine), M, time , 
@@ -1160,7 +1162,8 @@
set_wflag(pOrder_Transform_Button, WF_HIDDEN);
   }
 
-  if (!pCity  can_unit_do_activity_base(pUnit, BASE_FORTRESS)) {
+  pbase = get_base_by_gui_type(BASE_GUI_FORTRESS, pUnit, pUnit-tile);
+  if (!pCity  pbase) {
local_show(ID_UNIT_ORDER_FORTRESS);
   } else {
local_hide(ID_UNIT_ORDER_FORTRESS);
@@ -1172,7 +1175,8 @@
local_hide(ID_UNIT_ORDER_FORTIFY);
   }
 
-  if (!pCity  can_unit_do_activity_base(pUnit, BASE_AIRBASE)) {
+  pbase = get_base_by_gui_type(BASE_GUI_AIRBASE, pUnit, pUnit-tile);
+  if (!pCity  pbase) {
local_show(ID_UNIT_ORDER_AIRBASE);
   } else {
local_hide(ID_UNIT_ORDER_AIRBASE);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev