View Full Version : Strange TerrainImpassable TERRAIN_HILL did not work


Manifold
Jan 12, 2010, 11:46 AM
Did anyone noticed, that this did not work:

<TerrainImpassables>
<TerrainImpassable>
<TerrainType>TERRAIN_HILL</TerrainType>
<bTerrainImpassable>1</bTerrainImpassable>
</TerrainImpassable>
</TerrainImpassables>

Very strange - or is it my mistake?

CyberChrist
Jan 12, 2010, 12:30 PM
Hills are handled differently (like Peaks) and I don't think you can make them impassable for individual units without at least some Python coding (I'd strongly suggest SDK for this though).

Willem
Jan 12, 2010, 07:29 PM
Hills aren't a specific terrain type like Mountains so that usage won't work with them. The only thing that command will work for is the base terrains like Grassland, Plains etc. Mountains are a base terrain, that's why they function as they do. Hills aren't.

Afforess
Jan 12, 2010, 07:41 PM
Did anyone noticed, that this did not work:

<TerrainImpassables>
<TerrainImpassable>
<TerrainType>TERRAIN_HILL</TerrainType>
<bTerrainImpassable>1</bTerrainImpassable>
</TerrainImpassable>
</TerrainImpassables>

Very strange - or is it my mistake?

I had to do some sheninagins in the SDK for this normal list to work in the XML. It's because Hills and Peaks and actually PlotTypes, not Terrain Types, and are listed as Terrain Types purely for the civilopedia's sake.

Manifold
Jan 13, 2010, 03:59 AM
I had to do some sheninagins in the SDK for this normal list to work in the XML. It's because Hills and Peaks and actually PlotTypes, not Terrain Types, and are listed as Terrain Types purely for the civilopedia's sake.

Maybe i can take a look. Where do i find your work.
But meentime i solved the problem by creating a new "terrain" and give it to the hills, that seems simple and looks great; just unfortunately is there now a new terrain-entry in the pedia.

Afforess
Jan 13, 2010, 07:29 AM
Maybe i can take a look. Where do i find your work.
But meentime i solved the problem by creating a new "terrain" and give it to the hills, that seems simple and looks great; just unfortunately is there now a new terrain-entry in the pedia.

If you are up to creating a custom dll and editing the SDK (Being able to make SDK changes is very liberating... :mischief:), then I can tell you what to change to make that XML work.

In CvUnit, search for this line:
if (m_pUnitInfo->getTerrainImpassable(pPlot->getTerrainType()))

Replace it with this new code:
bool bPeak = false;
bool bHill = false;
if (m_pUnitInfo->getTerrainImpassable(GC.getInfoTypeForString("TERRAIN_HILL")))
bHill = true;
if (m_pUnitInfo->getTerrainImpassable(GC.getInfoTypeForString("TERRAIN_PEAK")))
bPeak = true;
if (m_pUnitInfo->getTerrainImpassable(pPlot->getTerrainType()) || (pPlot->isPeak() && bPeak) || (pPlot->isHills() && bHill))

After you compile,
putting TERRAIN_PEAK or TERRAIN_HILL will work in the XML, at least for that code. I think there are still other places Terrains will need fixing.

Manifold
Jan 13, 2010, 08:04 AM
Thank you very much, but

After you compile,
putting TERRAIN_PEAK or TERRAIN_HILL will work in the XML, at least for that code. I think there are still other places Terrains will need fixing.

sounds :crazyeye: For now i will use the russian method: Who cares the pedia? The main thing is, it works.:D

However thank you, i will keep this in mind.

Afforess
Jan 13, 2010, 10:12 AM
Who cares the pedia?
IMHO, Aesthetics are everything, but if you like your way better, great. :p

The_J
Jan 13, 2010, 10:17 AM
Hiding the new terrain by hardcoding it in the python should not be so difficult...

Manifold
Jan 13, 2010, 11:21 AM
Admittedly my method is some practical. Usually i just use Aesthetics to get the GREAT_LIBRARY.

Ok, Aesthetics, so i have the choice between

After you compile, putting TERRAIN_PEAK or TERRAIN_HILL will work in the XML, at least for that code. I think there are still other places Terrains will need fixing.:confused:

and

Hiding the new terrain by hardcoding it in the python should not be so difficult...:crazyeye: