On Sat, 28 Jan 2017 17:26:46 +0100
"Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net> wrote:
> I've seen that modifiers are sometimes collected in lists, sometimes in
> sets. Is there a special reason behind that ?

Historical accident/inconsistency between developers.

> Are there cases where duplicate modifiers need to be filtered out,
> or could we just use lists anywhere ?
> (eg. Unit::getMissionaryTradeModifiers())

I doubt anyone knows.
 
> Also, I'm wondering, why sometimes lists are sorted, while in other
> cases they are not. Isn't the sorting always required for applying
> (so additions and multiplications remain in the correct order)

Sorting is now only required at the point the modifier is applied or for
display purposes.  Modifier application used to involve some very brittle
special case code until we made a sustained effort to define a sorting
order, allowing the current sort+apply-incrementally algorithm.
Flexibility is required as there are almost certainly more Col1
incompatibilities in combat.
 
> I'm also thinking about compound modifiers - for example Building's
> poduction modifiers are union of several lists (building, colony,
> etc, etc). That could be an own modifer type that calculates from
> the individual lists.

I doubt this is useful, and note that you have not provided evidence that
this solves a problem.  You will need a mechanism to recalculate the
compound modifier when one of the underlying modifiers changes, which is
asking for bugs due to forgetting one or more special cases --- years
after it was introduced we are still uncertain all the analogous
cases with the production cache have been caught.  Also the individual
modifiers will still be needed for display purposes so you will not be
saving memory.

Cheers,
Mike Pope

Attachment: pgp43c6qIV62_.pgp
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to