I hate the barbarians that get spawned from ice. Using python, it's a real mess to override the barbarian creation routines, since you have to rewrite everything.
Using the SDK, however, it looks possible:
In CvGame.cpp:
There's also an occurence for cities, but I've never been annoyed by barbarian polar cities so I don't care about these.
There's also an occurence for animals, but polar bears are ok with me.
So if I replace getNumOwnedTiles by getNumNotIceUnownedTiles, I'll be happy.
(Well, not really, since looking for terrain in an area would require me to loop through the whole map everytime, thus I've got a small quadratic here, which stinks, but it's probably not going to slow down the game that much? Otherwise I'd have to rewrite the whole mess or cache the number of ice/not ice tiles... But performance tuning will wait.)
Except how do I get the terrain type?
getTerrainType returns that thing:
What's that horror? An enum which is likely cast into a short. Mmmm... typedef anyone? What's the enum for?
Anyway, I can get the TerrainInfo by getTerrainInfo(). So I just have to retrieve the "Ice" information from that.
To that end, the best would be to mod the terrain files to add a tag to the ice terrain, (and maybe to desert? though deserts should spawn horse archers), and add the code to read it.
I'm becoming too lazy to do that. I'm afraid it'll soon become a mess to merge this small change with changes to terrain files and the CvGame.cpp is also a big thing and I dislike the MS compiler enough that I'd rather not download it.
But, well, it's possible. Does anyone else feel like doing it? Or using it if it gets done?
Using the SDK, however, it looks possible:
In CvGame.cpp:
Code:
iNeededBarbs = ((pLoopArea->getNumUnownedTiles() / iDivisor) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER)); // XXX eventually need to measure how many barbs of eBarbUnitAI we have in this area...
There's also an occurence for animals, but polar bears are ok with me.
So if I replace getNumOwnedTiles by getNumNotIceUnownedTiles, I'll be happy.
(Well, not really, since looking for terrain in an area would require me to loop through the whole map everytime, thus I've got a small quadratic here, which stinks, but it's probably not going to slow down the game that much? Otherwise I'd have to rewrite the whole mess or cache the number of ice/not ice tiles... But performance tuning will wait.)
Except how do I get the terrain type?
getTerrainType returns that thing:
Code:
enum DllExport TerrainTypes { NO_TERRAIN = -1, };
Anyway, I can get the TerrainInfo by getTerrainInfo(). So I just have to retrieve the "Ice" information from that.
To that end, the best would be to mod the terrain files to add a tag to the ice terrain, (and maybe to desert? though deserts should spawn horse archers), and add the code to read it.
I'm becoming too lazy to do that. I'm afraid it'll soon become a mess to merge this small change with changes to terrain files and the CvGame.cpp is also a big thing and I dislike the MS compiler enough that I'd rather not download it.
But, well, it's possible. Does anyone else feel like doing it? Or using it if it gets done?
Comment