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

[3.13] SDK Fix for grossly uneven trades

Discussion in 'Civ4 - Bug Reports' started by Bhruic, Oct 5, 2007.

  1. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    File: CvPlayerAI.cpp
    Function: CvPlayerAI::AI_bonusTrade
    Line: 6857
    Replace:
    Code:
    	if (isHuman())
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()))
    	{
    		return NO_DENIAL;
    	}
    
    	if (atWar(getTeam(), GET_PLAYER(ePlayer).getTeam()))
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_PLAYER(ePlayer).getTeam() == getTeam())
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_TEAM(getTeam()).AI_getWorstEnemy() == GET_PLAYER(ePlayer).getTeam())
    	{
    		return DENIAL_WORST_ENEMY;
    	}
    
    	if (!isHuman() && (AI_corporationBonusVal(eBonus) > 0))
    	{
    		return DENIAL_JOKING;
    	}
    
    	if (GET_PLAYER(ePlayer).getNumAvailableBonuses(eBonus) > 0 && GET_PLAYER(ePlayer).AI_corporationBonusVal(eBonus) <= 0)
    	{
    		return (GET_PLAYER(ePlayer).isHuman() ? DENIAL_JOKING : DENIAL_NO_GAIN);
    	}
    
    
    With:
    Code:
    	if (isHuman() && GET_PLAYER(ePlayer).isHuman())
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()))
    	{
    		return NO_DENIAL;
    	}
    
    	if (atWar(getTeam(), GET_PLAYER(ePlayer).getTeam()))
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_PLAYER(ePlayer).getTeam() == getTeam())
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_PLAYER(ePlayer).getNumAvailableBonuses(eBonus) > 0 && GET_PLAYER(ePlayer).AI_corporationBonusVal(eBonus) <= 0)
    	{
    		return (GET_PLAYER(ePlayer).isHuman() ? DENIAL_JOKING : DENIAL_NO_GAIN);
    	}
    
    	if (isHuman())
    	{
    		return NO_DENIAL;
    	}
    
    	if (GET_TEAM(getTeam()).AI_getWorstEnemy() == GET_PLAYER(ePlayer).getTeam())
    	{
    		return DENIAL_WORST_ENEMY;
    	}
    
    	if (AI_corporationBonusVal(eBonus) > 0)
    	{
    		return DENIAL_JOKING;
    	}
    
    (thanks to Nor Me for pointing out the need for a second "isHuman()" check)

    Bh
     
  2. CivAgamemnon

    CivAgamemnon King

    Joined:
    Jul 10, 2002
    Messages:
    813
    Location:
    Earth. Unfortunately.
    Thank you for your hard work, Bhruic. It does make me wonder about stuff; namely, if you can come up with a fix so fast, why can't Firaxis?
     
  3. Phristen

    Phristen Chieftain

    Joined:
    Aug 5, 2007
    Messages:
    29
    Perhaps they don't see it as a bug.
     
  4. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    That's actually entirely possible. When you think about it, why should you ever not have the option of offering the AI one of your resources? Even if they already have it, it's up to them to decline to accept it, you should still be able to offer it.

    With that being said, I think that ends up being too confusing for the human player. It'd be fine if the AI would ignore them when it's trying to balance trades, but it doesn't. That leads to more "management" for the human, which is generally a bad thing. So in my mind, even if not a "bug", per se, it's still a design decision that should be reversed.

    Bh
     

Share This Page