How to make mountains passable? (Vanilla 1.61)

Caesium

Radiant!
Joined
Jan 14, 2006
Messages
526
Hi!

Another interesting question:

How to make mountains passable during the game?

I gave my workers the ability to walk over mountains and to build roads on mountains. But the roads weren't passable, because mountains aren't passable.
So I tried following code, that worked in 1.51:

PHP:
pPlot.setPlotType(PlotTypes.PLOT_HILLS, true, true)
iPEAKID = gc.getInfoTypeForString("TERRAIN_PEAK")
pPlot.setTerrainType(iPEAKID, true, true)
pPlot.setFeatureType(-1,0)
But the mountains changed to a lake.

Is there anybody who solved a similar problem?
 
Let me just get this straight: you're trying to make it so that worker units can freely move into peaks so that they can build roads, and that all other units can only go into those plots with peaks if a worker has first built a road there?
 
Exactly as you described it, Gerikes.
And, if someone pillages the road, the mountain is only passable for workers then.
 
Caesium said:
Exactly as you described it, Gerikes.
And, if someone pillages the road, the mountain is only passable for workers then.

Probably should take a look at CvUnit::canMoveInto

Code:
bool CvUnit::canMoveInto(const CvPlot* pPlot, bool bAttack, bool bDeclareWar, bool bIgnoreLoad) const
{
	TeamTypes ePlotTeam;

	FAssertMsg(pPlot != NULL, "Plot is not assigned a valid value");

	if (atPlot(pPlot))
	{
		return false;
	}

	[B]if (pPlot->isImpassable())
	{
		if (!canMoveImpassable())
		{
			return false;
		}
	}[/B]

So, your first step is probably to make worker units as canMoveImpassable units by changing their XML. Then, make sure that, through XML, roads can be built into terrains with peaks in them (I'm not sure if this is available by default or not).

Finally, you'll probably have to change the emboldened section so that instead of just checking for if the plot is impassable, check that it's impassable and also that it doesn't have a route (road, railroad) on it.
 
Back
Top Bottom