Author: jtn Date: Mon Apr 27 11:13:23 2015 New Revision: 28905 URL: http://svn.gna.org/viewcvs/freeciv?rev=28905&view=rev Log: Give rulesets control over the amount of territory a city can permanently claim for a nation.
See gna patch #6036. Modified: trunk/common/game.h trunk/common/packets.def trunk/data/alien/game.ruleset trunk/data/civ1/game.ruleset trunk/data/civ2/game.ruleset trunk/data/civ2civ3/game.ruleset trunk/data/classic/game.ruleset trunk/data/experimental/game.ruleset trunk/data/helpdata.txt trunk/data/multiplayer/game.ruleset trunk/data/stub/game.ruleset trunk/server/maphand.c trunk/server/ruleset.c trunk/tools/ruledit/rulesave.c Modified: trunk/common/game.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/game.h?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/common/game.h (original) +++ trunk/common/game.h Mon Apr 27 11:13:23 2015 @@ -668,6 +668,10 @@ #define RS_MIN_BORDER_SIZE_EFFECT 0 #define RS_MAX_BORDER_SIZE_EFFECT 100 +#define RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT 0 +#define RS_MIN_BORDER_RADIUS_SQ_CITY_PERMANENT (-CITY_MAP_MAX_RADIUS_SQ) +#define RS_MAX_BORDER_RADIUS_SQ_CITY_PERMANENT 401 /* city radius 20 */ + #define RS_DEFAULT_INCITE_BASE_COST 1000 #define RS_MIN_INCITE_BASE_COST 0 #define RS_MAX_INCITE_BASE_COST RS_MAX_VALUE Modified: trunk/common/packets.def URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/common/packets.def (original) +++ trunk/common/packets.def Mon Apr 27 11:13:23 2015 @@ -434,6 +434,7 @@ UINT8 base_tech_cost; UINT16 border_city_radius_sq; UINT8 border_size_effect; + SINT16 border_city_permanent_radius_sq; BORDERS_MODE borders; UINT32 base_bribe_cost; UINT32 culture_vic_points; Modified: trunk/data/alien/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/alien/game.ruleset (original) +++ trunk/data/alien/game.ruleset Mon Apr 27 11:13:23 2015 @@ -345,6 +345,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/civ1/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/civ1/game.ruleset (original) +++ trunk/data/civ1/game.ruleset Mon Apr 27 11:13:23 2015 @@ -331,6 +331,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/civ2/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/civ2/game.ruleset (original) +++ trunk/data/civ2/game.ruleset Mon Apr 27 11:13:23 2015 @@ -383,6 +383,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/civ2civ3/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/civ2civ3/game.ruleset (original) +++ trunk/data/civ2civ3/game.ruleset Mon Apr 27 11:13:23 2015 @@ -442,6 +442,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/classic/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/classic/game.ruleset (original) +++ trunk/data/classic/game.ruleset Mon Apr 27 11:13:23 2015 @@ -414,6 +414,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/experimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/experimental/game.ruleset (original) +++ trunk/data/experimental/game.ruleset Mon Apr 27 11:13:23 2015 @@ -432,6 +432,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/helpdata.txt URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/helpdata.txt?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/helpdata.txt (original) +++ trunk/data/helpdata.txt Mon Apr 27 11:13:23 2015 @@ -426,11 +426,12 @@ diplomatic pact between nations (see the section on Diplomacy).\ "), _("\ Founding a city establishes a claim on an area of land around the \ -city. Once claimed, a tile that can be directly worked by a city can \ -not change ownership unless the city does (or is destroyed). However, \ -the ownership of land that is out of range of any city can change \ -depending on factors such as the relative size of nearby nations' \ -cities.\ +city. In the classic ruleset, once claimed, a tile that can be directly \ +worked by a city can not change ownership unless the city does (or is \ +destroyed). However, the ownership of land that is out of range of any \ +city can change depending on factors such as the relative size of nearby \ +nations' cities. Other rulesets may differ in which, if any, tiles are \ +permanently claimed by a city.\ "), _("\ Normally borders extend into water only for tiles adjacent to a city; \ beyond that, only narrow inlets and inland lakes can usually be \ Modified: trunk/data/multiplayer/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/multiplayer/game.ruleset (original) +++ trunk/data/multiplayer/game.ruleset Mon Apr 27 11:13:23 2015 @@ -398,6 +398,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 1 + +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 [research] ; Method of calculating technology costs Modified: trunk/data/stub/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/game.ruleset?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/data/stub/game.ruleset (original) +++ trunk/data/stub/game.ruleset Mon Apr 27 11:13:23 2015 @@ -199,6 +199,16 @@ ; Border radius square increased by this amount / point of city size size_effect = 0 +; Difference between city workable area and area permanently claimed by +; city (these tiles cannot be stolen by stronger border sources). +; 0 means exactly city workable area is immune to border stealing. +; Negative value means outer workable tiles can be stolen; highly negative +; value (more than max city radius_sq) means any workable tile can be stolen. +; If City_Radius_Sq is variable, so is the set of locked tiles; this is +; a squared value, so the radius of the ring of tiles which are workable +; but not locked (or vice versa) varies but the area is constant. +radius_sq_city_permanent = 0 + [research] ; Method of calculating technology costs ; "Civ I|II" - Civ (I|II) style. Every new tech add researchcost to Modified: trunk/server/maphand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/maphand.c?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/server/maphand.c (original) +++ trunk/server/maphand.c Mon Apr 27 11:13:23 2015 @@ -2009,9 +2009,10 @@ map_distance_vector(&city_x, &city_y, ccity->tile, dtile); - if (is_valid_city_coords(city_map_radius_sq_get(ccity), - CITY_REL2ABS(city_x), CITY_REL2ABS(city_y))) { - /* Tile is within squared city radius */ + if (map_vector_to_sq_distance(city_x, city_y) + <= city_map_radius_sq_get(ccity) + + game.info.border_city_permanent_radius_sq) { + /* Tile is within region permanently claimed by city */ continue; } } Modified: trunk/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/server/ruleset.c (original) +++ trunk/server/ruleset.c Mon Apr 27 11:13:23 2015 @@ -5357,6 +5357,13 @@ RS_MIN_BORDER_SIZE_EFFECT, RS_MAX_BORDER_SIZE_EFFECT, "borders.size_effect"); + + game.info.border_city_permanent_radius_sq + = secfile_lookup_int_default_min_max(file, + RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT, + RS_MIN_BORDER_RADIUS_SQ_CITY_PERMANENT, + RS_MAX_BORDER_RADIUS_SQ_CITY_PERMANENT, + "borders.radius_sq_city_permanent"); /* section: research */ tus_text = secfile_lookup_str_default(file, RS_DEFAULT_TECH_COST_STYLE, Modified: trunk/tools/ruledit/rulesave.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=28905&r1=28904&r2=28905&view=diff ============================================================================== --- trunk/tools/ruledit/rulesave.c (original) +++ trunk/tools/ruledit/rulesave.c Mon Apr 27 11:13:23 2015 @@ -862,6 +862,9 @@ save_default_int(sfile, game.info.border_size_effect, RS_DEFAULT_BORDER_SIZE_EFFECT, "borders.size_effect", NULL); + save_default_int(sfile, game.info.border_city_permanent_radius_sq, + RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT, + "borders.radius_sq_city_permanent", NULL); secfile_insert_str(sfile, tech_cost_style_name(game.info.tech_cost_style), "research.tech_cost_style"); save_default_int(sfile, game.info.base_tech_cost, _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits