On 1 February 2016 at 04:09, Robert Finch <robfi...@sympatico.ca> wrote: > Is there an easy way to get the trade-ability of a resource ? I’d like to > add an option to make a map more CivIII like. I don’t see where there’s a > structure reference like: > > ptile->resource->trade > 0 > > It looks to me like resource tradability is part of the ruleset for > different resource types. How do I get at the trade field in the ruleset > from a ptile ? > > > > Reviewing: On a Civ III map the tradable resources are clustered together > and there aren’t enough to go around. For instance with an eight player map > there are only about four to six units of a tradeable resource (50 to 75% of > the number of players). Because the resources are clustered access to the > resource becomes an issue of contention between the civs. > > Could resource riches be optionally assigned based on the number of players > ? > > > > Looking at add_resource() in mapgen.c it just adds the resource willy-nilly. > But not right next to each other. To create clustered resources the > probability of the resource on a tile is increased if there is a nearby tile > with the same resource (this applies to trade item only). I’d like to > iterate over the map a small number of times to cluster the trade resources.
There isn't trading of resources at the moment, though we're getting closer to some form of it (not sure if you can mimic civ3 behavior on a ruleset in the end). The resources are like civ/2 specials that just increase the tile output. By comparing S2_6 and TRUNK you may notice that Resources were just made sort of (tile) Extras. The separate [resource_???] sections from the ruleset are likely to disappear relatively soon (once I have time to work more on TRUNK again). At the same time I've made some development to trade routes. In TRUNK they now have "Goods" (types defined in game.ruleset) and direction properties. As ruleset format evolves it becomes possible to have trade routes to carry goods that are available only if there's suitable resource (or any other extra, or whatever requirement type) to a city that then gets effects based on that (effect with requirement of specific goods type). For your need to know if a resource is "tradeable" one, we could parse requirement lists of the goods. We have some support functionality for that, and we have similar constructs used, though it's a bit unreliable in respect to exotic rulesets (do you want to cluster "Teleports" just because some goods can only be moved via teleports -> require teleport). The other option is to leave it to ruleset author to decide what extras count as clusterables - codewise having it as completely separate feature from tradeability of a resource. I think I would prefer this approach. Make it a new extra_flag that affects map generator behavior - or not just a flag (bit) but an integer value about strength of the cluster-forming tendency. Note that ptile->resource does not necessarily refer to a currently valid resource, at least in code outside map generator. It's possible that it just stores the resource tile would have if it had suitable terrain (we are not destroying resources permanently when the terrain changes for some reason, but changing the terrain back can bring the resource back) After all these disclaimers, answer to your question: tile_resource(ptile)->output[O_TRADE] - ML _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev