Author: cazfi Date: Sun Jan 11 16:30:28 2015 New Revision: 27621 URL: http://svn.gna.org/viewcvs/freeciv?rev=27621&view=rev Log: Cache extras providing defense bonus to a list of their own.
See patch #5664 Modified: branches/S2_6/client/packhand.c branches/S2_6/common/fc_types.h branches/S2_6/common/tile.c branches/S2_6/server/ruleset.c Modified: branches/S2_6/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/packhand.c?rev=27621&r1=27620&r2=27621&view=diff ============================================================================== --- branches/S2_6/client/packhand.c (original) +++ branches/S2_6/client/packhand.c Sun Jan 11 16:30:28 2015 @@ -3419,6 +3419,10 @@ pextra->removal_time_factor = p->removal_time_factor; pextra->defense_bonus = p->defense_bonus; + if (pextra->defense_bonus != 0) { + extra_to_caused_by_list(pextra, EC_DEFENSIVE); + } + pextra->native_to = p->native_to; pextra->flags = p->flags; Modified: branches/S2_6/common/fc_types.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/fc_types.h?rev=27621&r1=27620&r2=27621&view=diff ============================================================================== --- branches/S2_6/common/fc_types.h (original) +++ branches/S2_6/common/fc_types.h Sun Jan 11 16:30:28 2015 @@ -573,7 +573,8 @@ #include "specenum_gen.h" #define EC_NONE EC_COUNT #define EC_SPECIAL (EC_NONE + 1) -#define EC_LAST (EC_NONE + 2) +#define EC_DEFENSIVE (EC_NONE + 2) +#define EC_LAST (EC_NONE + 3) /* Used in the network protocol. */ #define SPECENUM_NAME extra_rmcause Modified: branches/S2_6/common/tile.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/tile.c?rev=27621&r1=27620&r2=27621&view=diff ============================================================================== --- branches/S2_6/common/tile.c (original) +++ branches/S2_6/common/tile.c Sun Jan 11 16:30:28 2015 @@ -244,12 +244,12 @@ { int bonus = 0; - extra_type_iterate(pextra) { + extra_type_by_cause_iterate(EC_DEFENSIVE, pextra) { if (tile_has_extra(ptile, pextra) && is_native_extra_to_uclass(pextra, pclass)) { bonus += pextra->defense_bonus; } - } extra_type_iterate_end; + } extra_type_by_cause_iterate_end; return bonus; } Modified: branches/S2_6/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/ruleset.c?rev=27621&r1=27620&r2=27621&view=diff ============================================================================== --- branches/S2_6/server/ruleset.c (original) +++ branches/S2_6/server/ruleset.c Sun Jan 11 16:30:28 2015 @@ -2861,6 +2861,9 @@ pextra->defense_bonus = secfile_lookup_int_default(file, 0, "%s.defense_bonus", section); + if (pextra->defense_bonus != 0) { + extra_to_caused_by_list(pextra, EC_DEFENSIVE); + } slist = secfile_lookup_str_vec(file, &nval, "%s.native_to", section); BV_CLR_ALL(pextra->native_to); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits