indestructible roads?

soul_strut

Chieftain
Joined
Jun 3, 2007
Messages
12
is such an option possible? i been sifting through xml files but have found nothing of use.

i get so annoyed when the AI ruthlessly pillages every terrain improvement in sight. i think if a civilization is being invaded they should retain the advantage of having roads...railroads and every other improvement should be destructible, but not your basic road.

any help would be greatly appreciated.
 
It's not in XML, because the game considers roads as different than improvements(farms and such). You can change it in a SDK with a little work. I don't think there is any way to do it in Python.
 
Can you simply remove the pillage feature from the units?

I gather this would however go to the extreme :(
 
For sure this is possible in the SDK. This should work but I havn't tested it.
Just remove the ! from the following code. Which should (if I read this correct)

check if there are any improvements. if there are not it checks to see if there
are any routes. if there are routes but no improvements it will not allow pillage.

Code:
	if (!(m_pUnitInfo->isPillage()))
	{
		return false;
	}

	if (pPlot->isCity())
	{
		return false;
	}

	if (pPlot->getImprovementType() == NO_IMPROVEMENT)
	{
		if (!(pPlot->isRoute())) //CHANGE THIS TO REMOVE THE !
		{
			return false;
		}
	}
	else
	{
		if (GC.getImprovementInfo(pPlot->getImprovementType()).isPermanent())
		{
			return false;
		}
	}

I cant remember how pillage works exactly. eg Does it remove a road first even if there is an improvement to pillage or last?
if it removes the route first you maybe better off changing the following inside Pillage()
Code:
	else if (pPlot->isRoute())
	{
		eTempRoute = pPlot->getRouteType();
		pPlot->setRouteType(NO_ROUTE); // XXX downgrade rail??? // CHange NO_ROUTE to pPlot->getRouteType()
	}

This will allow the route to be destroyed but will replace it with itself.
Hope it helps.
 
Otherwise it would be possible in python the same sort of way

Code:
	def onUnitPillage(self, argsList):
		'Unit pillages a plot'
		pUnit, iImprovement, iRoute, iOwner = argsList
		iPlotX = pUnit.getX()
		iPlotY = pUnit.getY()
		pPlot = CyMap().plot(iPlotX, iPlotY)

The methods of interest are below. You would do the same sort of thing as above. Let the unit pillage the route but find out what route it pillaged and just recreate it again.

RouteType getRouteType()
int ()

VOID setRouteType(RouteType eNewValue)
void (int (RouteTypes) eNewValue)

I don't have the time to code this here. But if you are still havn't trouble let me know in this thread and I will post some python code for you.
 
It definitely pillages the improvement before the route. In the above code change, instead of removing the !, simply remove that inner if-test:

Code:
	if (pPlot->getImprovementType() == NO_IMPROVEMENT)
	{
//		if (!(pPlot->isRoute()))
//		{
			return false;
//		}
	}

This says, "If there is no improvement, you cannot pillage this tile. Period." Removing the ! might work, it might not. It allows you to pillage an unimproved and unrouted tile. I don't know what effect that would have (probably none).
 
Back
Top Bottom