1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Terrain/Feature Impassable Bug?

Discussion in 'Civ4 - Unofficial Patches' started by TC01, Aug 27, 2009.

  1. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I don't know if this is a bug, or if it is intentional, but I ran into it and thought I'd post it here. This only shows up when you mod terrain impassability. (Since the only time vanilla BTS uses this is to make a unit unable to enter oceans, it doesn't appear normally). It happens in BTS 3.19. Anyway, I thought I'd post it here.

    When I make a unit unable to pass into a certain terrain, everything works fine. However, I can walk into a feature such as a forest even if that forest is on blocked terrain.

    I ran into this bug while modding Fall from Heaven 2 (a unit that was blocked from moving on non-Snow terrain could move into non-Snow tiles with Forests or other features on them.

    A quick test in Beyond the Sword unmodded revealed the same was true when I blocked the Lion from moving into Plains, allowing it to walk over forests on plains tiles.

    The code in CvUnit::canMoveInto that is responsible is below:

    Code:
    		if (pPlot->getFeatureType() != NO_FEATURE)
    		{
    			if (m_pUnitInfo->getFeatureImpassable(pPlot->getFeatureType()))
    			{
    				TechTypes eTech = (TechTypes)m_pUnitInfo->getFeaturePassableTech(pPlot->getFeatureType());
    				if (NO_TECH == eTech || !GET_TEAM(getTeam()).isHasTech(eTech))
    				{
    					if (DOMAIN_SEA != getDomainType() || pPlot->getTeam() != getTeam())  // sea units can enter impassable in own cultural borders
    					{
    						return false;
    					}
    				}
    			}
    		}
    		else
    		{
    			if (m_pUnitInfo->getTerrainImpassable(pPlot->getTerrainType()))
    			{
    				TechTypes eTech = (TechTypes)m_pUnitInfo->getTerrainPassableTech(pPlot->getTerrainType());
    				if (NO_TECH == eTech || !GET_TEAM(getTeam()).isHasTech(eTech))
    				{
    					if (DOMAIN_SEA != getDomainType() || pPlot->getTeam() != getTeam())  // sea units can enter impassable in own cultural borders
    					{
    						if (bIgnoreLoad || !canLoad(pPlot)) 
    						{ 
    							return false;
    						}
    					}
    				}
    			}
    		}
    	}
    If there is a feature on the plot, the game doesn't even check if you can pass the terrain. Either someone at Firaxis forgot a line of code or this was done by design.
     
  2. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    That is quite bizarre ... certainly fixing this isn't going to affect any BtS units as all of the features are either land based or impassable:

    Ice (impassable)
    Jungle
    Oasis
    Floodplains
    Forest
    Fallout

    Why would they have set things up with the feature check first? I can't think of any reason why it would be that way.
     
  3. MadmanAtW

    MadmanAtW Knight

    Joined:
    Apr 13, 2008
    Messages:
    579
    Location:
    San Leandro, CA
    This is a total stab in the dark, but could it be related to the fact that the feature is the more important aspect of a tile in circumstances where you get a movement bonus due to features? (By my lights, "double movement in woods" would still cause you to only be able to take one step onto a forest/hill, but in the game the double movement in the forests is more important than the extra cost for moving onto a hill.)
     
  4. TheDS

    TheDS Regular Riot

    Joined:
    Jan 18, 2002
    Messages:
    1,454
    Location:
    Daytona Beach
    I consider that an unintended feature, myself. Is a hill easier to climb just because it has trees on it? (Of course, having a 1 MP unit suddenly have 2 MP when it moves into a forest/hill first is just as wonky, so I guess it balances out.)
     
  5. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    I noticed this bug too, and it caused me to have to do a lot of extra work for my Mountains mod, getting around this. It would be nice to be fixed.

    Although to some this may be an unintended feature, I must say, to any modder, this is more of a nightmare...
     

Share This Page