On Sat, 3 Dec 2016 09:53:26 +0100
"Enrico Weigelt, metux IT consult" <[email protected]> wrote:
> could anyone please give me some insight, how GoodsType, AbstractGoods
> and Lists of AbstractGoods play together ?

"Some insight"... no problem.  Just do not ask for a "full
understanding"...

> I guess, GoodsType describes the existing types of goods,

GoodsType is a type of goods, e.g. tobacco.

> AbstractGoods represents a storage slot (eg. in city or on a ship).

Actually no, the Colony and Unit classes are instances of GoodsLocation
which wraps a GoodsContainer which does not store its contents in
AbstractGoods but in a java.util.Map, although some of its public
interface uses AbstractGoods for convenience.  AbstractGoods is a
{<GoodsType>, <amount>} tuple.  It is used in *many* different ways, and
the amount is sometimes usefully negative.

> What puzzles me most: why are List<AbstractGoods> at all ?

I recommend reading the code a bit more to appreciate how often we need
to consider collections of AbstractGoods.  You may also encounter Goods,
which are AbstractGoods with a Location, which also appear in Lists,
sometimes with non-unique GoodsTypes.

> AFAIK, the number of good types is strictly limited, so eg. in the
> cities we could easily use an fixed-size array, thus never having to
> iterate lists here.

You are mostly right here that there is an upper bound, but the lists are
usually short and thus both faster to traverse and smaller than a
usually mostly-empty array.

> Where are the producable goods on individual tiles coming from ?
> Is this individual to each tile or derived from the terrain type ?
> And how are the worker-type dependent values computed ? Is there some
> per-worker-type factor ?

Yes to all the above, and more.  The production rules are complex.  I
believe I understood them about three months ago when we were actively
working on them, but the detail is fading.  You are going to have to read
the code (see opening remark above).

Cheers,
Mike Pope

Attachment: pgpfTxsKD_Mbp.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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to