Terrain feature bug: "Fresh Water"

Discussion in 'Civ4 - Creation & Customization' started by Padmewan, Jun 5, 2006.

  1. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    I really shouldn't call this a bug as it's something outside intended use, but I found that if you insert, via Python, a terrain feature that provides "fresh water" (e.g. an Oasis), you will NOT get the effects of irrigation.

    * The main map will show an adjacent, "irrigated" farm as generating, e.g., 3 food.
    * Zooming into the city shows that same tile generating not 3 but rather only 2 food.
    * The city's granary bar shows a total amount of food that equals the unirrigated (lower) value.

    The reason why this arises for us is that one of our improvements inserts a "fresh water" terrain feature that's part of our game's terraforming mechanism. Has anyone else run into this? Any thoughts on where this discrepancy might be handles in the SDK? (Where are per-tile yields calculated in the C++ ? I can go looking tonight, but if anyone knows offhand it would give me a head start...)
     
  2. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    OK, it seems that either the game periodically "sweeps" for irrigation (but not every turn), or when irrigation is added, it has to be through cultural borders and not diagonally? Here's the setup:
    Code:
    XFX
    I*#
    X#X
    
    * = city
    X = not in culture
    # = in culture
    F = Fresh Water feature
    I = Irrigated improvement

    I noticed that in this setup, tile "I" does not get the irrigation bonus. (Note: I'm using Chalid's slower cultural expansion mod) However:

    Code:
    IF#
    I*#
    ###
    
    in this setup, where the total tiles controled is 9, both "I" tiles now get irrigation.

    I haven't done enough testing to see if this was a coincidence or not. I thought that irrigation should spread diagonally... very weird. More testing needed, and a followup when I find out more...
     
  3. PolishAssassin

    PolishAssassin Prime Minister of Death

    Joined:
    Jul 26, 2003
    Messages:
    272
    Location:
    Indianapolis
    that is weird....let me know if there's anything i can do
     
  4. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    One of our team figured out that this happens when the Hothouse ("farm") is built BEFORE the Aerator. (The Aerator inserts a feature that is considered "fresh water"). However, if the Hothouse is built AFTER the Aerator, the right amount of food shows up in the city view and food count.

    Apparently, the amount of food generated by the improvement is calculated once and then not recalculated. Not sure why this is the case, because I know that in vanilla Civ4, I've built a chain of farms using irrigation, then if I cut the chain somewhere in the middle, the end of the chain loses the irrigation bonus. I suppose chained irrigation is handled in a different part of the code than the initial check for fresh water.

    PolishAssassin, if you can do SDK work and are interested in examining this further, I'd be very grateful!
     
  5. PolishAssassin

    PolishAssassin Prime Minister of Death

    Joined:
    Jul 26, 2003
    Messages:
    272
    Location:
    Indianapolis
    eh sorry, it's all Greek to me. however i find this plight to be very interesting so if you can, keep me posted on the endeavour
     

Share This Page