TC01
Deity
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:
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.
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.