• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

SDK Request : Remaining Features at City-Build

Vadus

pretend the impossible
Joined
Nov 23, 2003
Messages
374
Location
Northern Germany
Hi,

snafusmith created some planets here, which would perfectly fit into my space mod. These planets, stars, etc exist as map-features, because it is the easiest way to place some custom objects on the map (since the Civ4 default meshes for hills and mountains are not used). Unfortunately these features disappear, after a city is built on the same tile. I think, this is handled by the SDK.
Could a SDK-expert have a look into the SDK, if this "functionality" can be swiched off ?
 
Hi,

snafusmith created some planets here, which would perfectly fit into my space mod. These planets, stars, etc exist as map-features, because it is the easiest way to place some custom objects on the map (since the Civ4 default meshes for hills and mountains are not used). Unfortunately these features disappear, after a city is built on the same tile. I think, this is handled by the SDK.
Could a SDK-expert have a look into the SDK, if this "functionality" can be swiched off ?

The code is in CvCity.cpp, in the function CvCity::init

Code:
	if (pPlot->getFeatureType() != NO_FEATURE)
	{
		pPlot->setFeatureType(NO_FEATURE);
	}

This would have to be commented out and the DLL recompiled. It would be a quick fix. Are you using Vanilla or Warlords?

Edit:

BTW, if editting the SDK is out of reach, you might be able to at the beginning of the game make a python structure to stores what features are on what plots, and in the city creation event function, put the feature back onto the plot (since this function is called after the SDK removes the feature). You'd probably also have to keep that structure up to date, which may be tricky to get perfect.
 
Even better would be a <bPreserveUnderCities> tag added to features to allow individualized control. I had just been thinking of doing something along these lines to make a change in CCCP optional, LunarMongoose made a mod that made FloodPlains remain after a city is founded but its hard coded and I'm going to switch it to this XML control. My CCCP DLL is intended for building mods, its a compilation of popular DLL modifications that can act as a foundation for a wide variety of mods. Its currently Warlords only and I'll probably move to the new expansion when it comes out, though the WL version would remain for those who want to use it. I would highly recommend getting WL even if you don't use my DLL, the better AI in the latest patch was great.
 
The code is in CvCity.cpp, in the function CvCity::init

Code:
	if (pPlot->getFeatureType() != NO_FEATURE)
	{
		pPlot->setFeatureType(NO_FEATURE);
	}

This would have to be commented out and the DLL recompiled. It would be a quick fix. Are you using Vanilla or Warlords?

Hi, I've tested this. I tried to build a city on a forest, and the forest remained on that tile, but unfortunately the graphic of the forest still disappears right after I presst the city build button ! :sad:
But keeping a feature's graphic under a city is big concern..

Anyone knows, where to change the line of code, that the feature graphic remains at city build ??

See at the picture, I have a city on a barren planet ( plains ) and forest but without the forest graphic


EDIT : even after I tried out the according python solution I got the same. A tile with a city with a forest on it but no forest graphic.. hopefully, this is not an engine-functionality
 

Attachments

  • cityOnForest.png
    cityOnForest.png
    271.6 KB · Views: 70
Hi, I've tested this. I tried to build a city on a forest, and the forest remained on that tile, but unfortunately the graphic of the forest still disappears right after I presst the city build button ! :sad:
But keeping a feature's graphic under a city is big concern..

Anyone knows, where to change the line of code, that the feature graphic remains at city build ??

See at the picture, I have a city on a barren planet ( plains ) and forest but without the forest graphic


EDIT : even after I tried out the according python solution I got the same. A tile with a city with a forest on it but no forest graphic.. hopefully, this is not an engine-functionality

In Misc\Civ4DetailsManager.xml, there should be a value called CITY_TREECUT_SCALE. I think what that does is it looks at all the trees within that scale around the plot graphically and "cuts" them out. As it is, the number is 1, so everything in a one-plot radius (i.e. that plot) is cut. If you did 2 you would cut trees outside of the plot as well (although if it's a "circle" or a "square" I don't know). So, I believe if you switch that number from 1.0 to 0.0, you wouldn't have the trees get cut.

This might not be the only thing needing changing, but I just remembered seeing it while going through the files.
 
You are a genius !! That is the totally right setting ! :goodjob:

So you all, who want to have remaining features on cities :

change in the Misc\Civ4DetailsManager.xml the setting CITY_TREECUT_SCALE to 0.0

and download for Civ4 1.6.1 the dll file : http://www.vadus.de/civ/4/spacemod/CvGameCoreDLL.zip

look here, nice eeh :cool:
 

Attachments

  • cityOnForest2.png
    cityOnForest2.png
    413.3 KB · Views: 99
You are a genius !! That is the totally right setting ! :goodjob:

So you all, who want to have remaining features on cities :

change in the Misc\Civ4DetailsManager.xml the setting CITY_TREECUT_SCALE to 0.0

and download for Civ4 1.6.1 the dll file : http://www.vadus.de/civ/4/spacemod/CvGameCoreDLL.zip

look here, nice eeh :cool:

Man, now I wish I had transfered my work on this project to my laptop before I left home...
 
Back
Top Bottom