patchFreeciv - Patches: patch #3322, Resource requirements

Show feedback again

patch #3322: Resource requirements

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Sat Jun 16 11:53:46 2012  
Category: generalPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Planned Release: 2.5.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Tue Jun 19 21:26:34 2012, SVN revision 21341:

Added requirement type "Resource"

Requested by Jacob Nevins

See gna patch #3322

(Browse SVN revision 21341)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon Jun 18 03:11:26 2012, comment #7:

Wow! Thanks for your work.

Henkutsu <henkutsu_tama>
Mon Jun 18 00:28:57 2012, comment #6:

Untested patch

(file #15841)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun Jun 17 21:44:32 2012, comment #5:

> ; only lake fish
> reqs =
> { "type", "name", "range"
> "Terrain", "Lake (Fish)", "Adjacent"
> }

Do you plan to give city a bonus if it's adjacent to at least one Fish tile?
I think tile bonus (such as increase to food/shield/trade) applied to every applicable tile adjacent to city center is more like what you are after:

reqs =
{ "type", "name", "range"
"Resource", "Fish", "Local"
"Terrain", "Lake", "Local"
"CityTile", "Center", "Adjacent"

As range here for Resource and Terrain requirements is "Local" (the tile itself) it's guaranteed that it's the same tile fulfilling both requirements.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun Jun 17 10:13:25 2012, comment #4:

> it will match even if the terrain is in another square

See my comments to patch #3323.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun Jun 17 09:52:37 2012, comment #3:

Hm, I see what you're saying, but there's no reason it should be limited to a terrain+resource combination. You could reasonably require other combinations of properties on a single tile: terrain, resources, specials, roads, bases, a city, ...

e.g., Terrain(Mountains) + Resource(Gold) + Base(Gold mine).

So rather than calling this "Resource", I think it would be a new universal called something like "Tile" or "TileProperties". Its argument would have a mini expression language for specifying combinations of things (possibly with some disambiguation syntax for the case where, say, a special and a resource have the same name).

Off-hand, I don't see any reason in principle why such a thing couldn't be done; I think the most complicated aspect would be for those parts of the system that take apart requirements and try to analyse them, such as the AI (to work out how to meet them) and the on-line help.
I think those things suggest that the expression language should only be additive ("Lake AND Fish", but not "Plains AND NOT Road"), at least at first.
Covering all tile properties with this is unlikely to be much more work than just Terrain+Resources.

However... knowing how much effort we have available, I'm inclined to aim for the simple Resource universal first, because that should be easy and obvious, and gets you some capability before we get round to the complicated thing.

Jacob Nevins <jtn>
Project Administrator
Sun Jun 17 02:42:02 2012, comment #2:

I can see two ways in which you would want to search for a resource; Just for itself, and for it on a terrain. e.g.
; Voting governments have a senate that may prevent war

; any fish
reqs =
{ "type", "name", "range"
"Resource", "(Fish)", "Adjacent"

; only lake fish
reqs =
{ "type", "name", "range"
"Terrain", "Lake (Fish)", "Adjacent"

So which is more extensible? The first seems simpler but there is no way to get the information of the tile back. Putting a terrain req below it will match even if the terrain is in another square on any range other than CityCentre or Local (Am I correct on this?). As such, I recommend the second way. Even though it takes may take more reqs to define events, it seems a more powerful method.

Henkutsu <henkutsu_tama>
Sat Jun 16 12:12:09 2012, comment #1:

Thanks. It would really expand the possibilities of what can be done. One of the reasons I wanted to do this was so that I could lower the output of some specials unless an appropriate facility is built in the city (which may have a tech requirement).

Henkutsu <henkutsu_tama>
Sat Jun 16 11:53:46 2012, original submission:

Effects can specify requirements of terrain, specials, bases, and roads, but not resources (wheat, gold, etc).

This seems like an oversight that would be easy to fix.

Jacob Nevins <jtn>
Project Administrator


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #15841:  ResourceReq.diff added by cazfi (13kB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by henkutsu_tama (Posted a comment)
  • -unavailable- added by jtn (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Jun 19 21:26:50 2012cazfiStatusReady For Test=>Done
      Assigned toNone=>cazfi
    Mon Jun 18 00:28:57 2012cazfiAttached File-=>Added ResourceReq.diff, #15841
      StatusNone=>Ready For Test
      Planned Release=>2.5.0
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup