1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Possible issue when an AI chooses the best promotion for his unit

Discussion in 'Civ4 - Bug Reports' started by ViterboKnight, Sep 26, 2008.

  1. ViterboKnight

    ViterboKnight King

    Joined:
    Feb 6, 2006
    Messages:
    786
    BTS 3.17. I'm not sure if it's an issue of BTS, or if it's been introduced with the last patch.

    In the SDK, class CvUnitAI, function AI_promotionValue.
    It uses the iValue variable to store the total through the whole function, and the iTemp variable to partial results in each section.
    However, when it considers FirstStrikes and ChanceFirstStrikes, it computes a value
    Code:
    		iTemp *= 8;
    		iExtra = getExtraChanceFirstStrikes() + getExtraFirstStrikes() * 2;
    		iTemp *= 100 + iExtra * 15;
    		iTemp /= 100;
    
    but the it DOESN'T add it to iValue, so this has NO EFFECT on the final decision.

    It should be something like that:
    Code:
    		iTemp *= 8;
    		iExtra = getExtraChanceFirstStrikes() + getExtraFirstStrikes() * 2;
    		iTemp *= 100 + iExtra * 15;
    		iTemp /= 100;
    		iValue += iTemp;
    
     
  2. Dresden

    Dresden Emperor

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    Interesting. That wasn't from the latest patch as the code is the same (with iTemp essentially useless in that block) in 3.13 as well (both official and bhruic).
     

Share This Page