Map refresh(for terraform)

Galacticat42

Drifting through space, lost
Joined
May 8, 2008
Messages
1,234
Location
CA, USA
In my mod Advanced Missiles Mod, I am currently working with Lua to get fusion nukes to terraform the land. I can safely say that I can indeed terraform the tiles, and my lua prints out the terrain/plot types to the firetuner console to confirm this. My problem however is that the map doesn't update when terraforming is carried out and CvPlot::updateLayout (called as UpdateLayout()) has unforetunately not been added to the list of Lua callbacks. If any of the other advanced Lua coders could help me out here to get terraforming working, that would be terrific. I'll also give you credit where credit is due in my mod. If anyone is interested, I'll share what I have so far though I'm constantly changing how the terrain is terraformed(and might not even make any sense to people who don't know exactly what I'm doing).
 
Eureka! I just found a reference in the Lua Civ V wiki in modbuddy called RecalculateAreas() which is claims to Updates information about areas in the map, invalidates all regional data by resetting Area IDs (uses terrain information from plots) maybe this is the missing link. :please:

EDIT: nope, not it.
 
I'm very interested in this as well, since I'm hoping to add a bit of terraforming to my Alpha Centauri mod. Something like Desert, Tundra, and Coast tiles changing to Grassland, Hills changing to Plains, Plains changing to Hills, Grassland changing to Lakes or Coast as appropriate, changing a Lake to an Oasis, planting Forests, that sort of thing. I'm sure I'm not the only person who wants to figure this one out. You'd think the idea of "redraw the map" would be a pretty essential tool for developers, so I'd hope there's something in there that'll do what you want, even if it's not easy to find.

Actually, that makes me think: is it not changing the terrain at all, or just not changing the DISPLAYED terrain? That is, when you mouse over the tile afterward, does it give the new terrain type? (If so, I'd think that saving and reloading would redraw the map dynamically.)
 
Actually, that makes me think: is it not changing the terrain at all, or just not changing the DISPLAYED terrain? That is, when you mouse over the tile afterward, does it give the new terrain type? (If so, I'd think that saving and reloading would redraw the map dynamically.)

Yes, the mouse does show the new terrain type. I wanted to test the save/load method in my Stalingrad mod (I was working on a summer/winter map initially), but unfortunatly, the saves are broken by some changes in the mod. I suppose that will redraw the map, but I hope there will be another solution.
 
It's really bugging the crap out of me that the FeatureGenerator.lua is able to redraw plots if certain conditions are met. It's allowed to redraw mountainous plots if mountains aren't allowed near coasts. I've been looking at MapGenerator.lua and TerrainGenerator.lua all this time, and never thought to look at the FeatureGenerator.lua but hey, I found something and am gunna take advantage of the new info this lua file will give me and take that last stab and what may appear out of reach might be just close enough to get pricked and bleed. If not, this issue will easily be on the fast track to waiting on the DLL.
 
Just wanted to confirm that saving the game after changing a plot with SetTerrainType and then loading that savegame correctly displays the changed plot's new terrain type.
Not that it's an acceptable solution...

Edit: Hasn't somebody here hacked the DLL to lay bare additional DLL functions?
Could this person test whether calling the updateLayout function has the desired effect or alternatively drop me/us a PM explaining how to hack the DLL?
_____
rezaf
 
probably not it but hey why not throw this out there... is the terrain that gets changed within your line of sight?
 
probably not it but hey why not throw this out there... is the terrain that gets changed within your line of sight?

That is one thing that came to mind a few minutes ago when messing with firetuner. On the map tab is a button called reveal map/refresh map. When I hit edit for that button, it gave me a simple for loop that I could see did exactly that. It allowed the active player to see the entire map, later in that same loop was 3 little lines of code that made the entire map undiscovered to the active player then re-discovered to the active player. If we can save the tiles that are undiscovered and only refresh the tiles that have been discovered, this might solve the crisis.
 
Back
Top Bottom