Author: cazfi Date: Sat Mar 7 08:02:12 2015 New Revision: 28433 URL: http://svn.gna.org/viewcvs/freeciv?rev=28433&view=rev Log: Added apperance_chance for extras, used to control spontaneous appearance.
See patch #5888 Modified: trunk/common/extras.h trunk/data/alien/terrain.ruleset trunk/data/civ1/terrain.ruleset trunk/data/civ2/terrain.ruleset trunk/data/civ2civ3/terrain.ruleset trunk/data/classic/terrain.ruleset trunk/data/experimental/terrain.ruleset trunk/data/multiplayer/terrain.ruleset trunk/data/stub/terrain.ruleset trunk/fc_version trunk/server/ruleset.c trunk/server/ruleset.h trunk/server/srv_main.c trunk/tools/ruledit/rulesave.c Modified: trunk/common/extras.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/extras.h?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/common/extras.h (original) +++ trunk/common/extras.h Sat Mar 7 08:02:12 2015 @@ -84,6 +84,7 @@ int removal_time_factor; int defense_bonus; + int appearance_chance; bv_unit_classes native_to; Modified: trunk/data/alien/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/alien/terrain.ruleset (original) +++ trunk/data/alien/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -606,6 +606,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/civ1/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/civ1/terrain.ruleset (original) +++ trunk/data/civ1/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -763,6 +763,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/civ2/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/civ2/terrain.ruleset (original) +++ trunk/data/civ2/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -869,6 +869,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/civ2civ3/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/civ2civ3/terrain.ruleset (original) +++ trunk/data/civ2civ3/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -1048,6 +1048,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/classic/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/classic/terrain.ruleset (original) +++ trunk/data/classic/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -1048,6 +1048,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/experimental/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/experimental/terrain.ruleset (original) +++ trunk/data/experimental/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -1024,6 +1024,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/multiplayer/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/multiplayer/terrain.ruleset (original) +++ trunk/data/multiplayer/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -1022,6 +1022,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/data/stub/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/terrain.ruleset?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/data/stub/terrain.ruleset (original) +++ trunk/data/stub/terrain.ruleset Sat Mar 7 08:02:12 2015 @@ -319,6 +319,10 @@ ; multiplied by this value (default 1) ; defense_bonus = Percent added to defense when tile has the extra ; (default none) +; appearance_chance = If extra has cause "Spontaneous" and other requirements +; for its appearance are fulfilled, this tells how big +; chance it has to appear each turn. The chance is 1/1000 +; times this value. ; native_to = List of unit classes that are considered to ; be inside the extra when they are on same tile ; conflicts = List of extras that cannot be on the same tile. Modified: trunk/fc_version URL: http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/fc_version (original) +++ trunk/fc_version Sat Mar 7 08:02:12 2015 @@ -54,7 +54,7 @@ # - Avoid adding a new mandatory capability to the development branch for # as long as possible. We want to maintain network compatibility with # the stable branch for as long as possible. -NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Mar.05" +NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Mar.07" NETWORK_CAPSTRING_OPTIONAL="" FREECIV_DISTRIBUTOR="" Modified: trunk/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/server/ruleset.c (original) +++ trunk/server/ruleset.c Sat Mar 7 08:02:12 2015 @@ -2864,9 +2864,13 @@ pextra->defense_bonus = secfile_lookup_int_default(file, 0, "%s.defense_bonus", section); - if (pextra->defense_bonus != 0) { + if (pextra->defense_bonus != 0) { extra_to_caused_by_list(pextra, EC_DEFENSIVE); } + + pextra->appearance_chance = secfile_lookup_int_default(file, RS_DEFAULT_EXTRA_APPEARANCE, + "%s.appearance_chance", + section); slist = secfile_lookup_str_vec(file, &nval, "%s.native_to", section); BV_CLR_ALL(pextra->native_to); Modified: trunk/server/ruleset.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.h?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/server/ruleset.h (original) +++ trunk/server/ruleset.h Sat Mar 7 08:02:12 2015 @@ -77,6 +77,8 @@ #define RS_DEFAULT_CULTURE_VIC_LEAD 300 #define RS_DEFAULT_CULTURE_MIGRATION_PCT 50 +#define RS_DEFAULT_EXTRA_APPEARANCE 15 + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: trunk/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/server/srv_main.c (original) +++ trunk/server/srv_main.c Sat Mar 7 08:02:12 2015 @@ -1278,15 +1278,7 @@ extra_type_by_cause_iterate(EC_SPONTANEOUS, pextra) { whole_map_iterate(src_tile) { if (tile_has_extra(src_tile, pextra) - /* Each spreading extra has a 1,5% chance of spreading each - * turn. This extra spreading speed makes it relatively rare - * but not unheard of. */ - /* TODO: Put probability that an extra will spread in an - * effect ("Extra_Spread_Pm") on the source tile. - * With a cache of what extra types that has any chance of - * spreading at all it could replace the EF_APPEARS extra flag - * without killing performance. */ - && fc_rand(1000) < 15) { + && fc_rand(1000) < pextra->appearance_chance) { struct tile *tgt_tile; /* Select tile to spread to. */ Modified: trunk/tools/ruledit/rulesave.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=28433&r1=28432&r2=28433&view=diff ============================================================================== --- trunk/tools/ruledit/rulesave.c (original) +++ trunk/tools/ruledit/rulesave.c Sat Mar 7 08:02:12 2015 @@ -1780,6 +1780,10 @@ if (pextra->defense_bonus != 0) { secfile_insert_int(sfile, pextra->defense_bonus, "%s.defense_bonus", path); } + if (is_extra_caused_by(pextra, EC_SPONTANEOUS) + && pextra->appearance_chance != RS_DEFAULT_EXTRA_APPEARANCE) { + secfile_insert_int(sfile, pextra->appearance_chance, "%s.appearance_chance", path); + } set_count = 0; unit_class_iterate(puc) { _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits