<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40279 >
2008/6/15 Marko Lindqvist: > > Attached patch adds 'disabled' field to military base definitions. > Disabled bases cannot be built. Logix reversed. Now the field is called 'buildable'. This is not temporary version like previous version. In the future bases may be divided to those placed in editor only and to buildable ones. - ML
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c --- freeciv/common/base.c 2007-11-27 21:57:32.000000000 +0200 +++ freeciv/common/base.c 2008-06-17 14:24:34.000000000 +0300 @@ -108,6 +108,11 @@ return FALSE; } + if (!pbase->buildable) { + /* Base type not buildable. */ + return FALSE; + } + return are_reqs_active(unit_owner(punit), NULL, NULL, ptile, unit_type(punit), NULL, NULL, &pbase->reqs, RPT_CERTAIN); diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h --- freeciv/common/base.h 2007-08-06 16:41:57.000000000 +0300 +++ freeciv/common/base.h 2008-06-17 14:23:31.000000000 +0300 @@ -47,6 +47,7 @@ struct base_type { Base_type_id item_number; + bool buildable; struct name_translation name; char graphic_str[MAX_LEN_NAME]; char graphic_alt[MAX_LEN_NAME]; diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset --- freeciv/data/civ1/terrain.ruleset 2008-06-14 18:24:47.000000000 +0300 +++ freeciv/data/civ1/terrain.ruleset 2008-06-17 14:26:25.000000000 +0300 @@ -1729,6 +1729,7 @@ ; [fortress] and [airbase]. ; ; name = Name of the base type. +; buildable = Can base be built? Defaults to true ; graphic = tag specifing preferred graphic ; graphic_alt = tag for alternate garphic if preferred graphic is not ; present. Can use eg "-" for no alternate graphic. @@ -1764,12 +1765,15 @@ [airbase] name = _("Airbase") +buildable = 0 graphic = "base.airbase" graphic_alt = "-" activity_gfx = "unit.airbase" reqs = { "type", "name", "range" - "Tech", "Never", "Player" + "Tech", "Radio", "Player" + "TerrainClass", "Land", "Local" + "UnitFlag", "Airbase", "Local" } gui_type = "Airbase" build_time = 3 diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset --- freeciv/data/civ2/terrain.ruleset 2008-06-14 18:24:47.000000000 +0300 +++ freeciv/data/civ2/terrain.ruleset 2008-06-17 14:26:01.000000000 +0300 @@ -1766,6 +1766,7 @@ ; [fortress] and [airbase]. ; ; name = Name of the base type. +; buildable = Can base be built? Defaults to true ; graphic = tag specifing preferred graphic ; graphic_alt = tag for alternate garphic if preferred graphic is not ; present. Can use eg "-" for no alternate graphic. diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset --- freeciv/data/default/terrain.ruleset 2008-06-14 18:24:47.000000000 +0300 +++ freeciv/data/default/terrain.ruleset 2008-06-17 14:25:39.000000000 +0300 @@ -1883,6 +1883,7 @@ ; [fortress] and [airbase]. ; ; name = Name of the base type. +; buildable = Can base be built? Defaults to true ; graphic = tag specifing preferred graphic ; graphic_alt = tag for alternate garphic if preferred graphic is not ; present. Can use eg "-" for no alternate graphic. diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c --- freeciv/server/ruleset.c 2008-05-06 03:59:25.000000000 +0300 +++ freeciv/server/ruleset.c 2008-06-17 14:24:55.000000000 +0300 @@ -1954,6 +1954,9 @@ section = "unknown"; } + pbase->buildable = secfile_lookup_bool_default(file, TRUE, + "%s.buildable", section); + sz_strlcpy(pbase->graphic_str, secfile_lookup_str_default(file, "-", "%s.graphic", section)); sz_strlcpy(pbase->graphic_alt,
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev