I call the same callback functions as the old code. But, you are right, the difference is that the old code implemented levelling as "lower / rise each tile on its own until it has the wanted height", whereas my code does all in one step.Roujin wrote:Did you think about what happens if terraforming fails for some reason (because there's some object in the way)?ic111 wrote:Hello,
I have finished version 2 of the more heightlevels patch.
What's new?
I rewrote the terraforming code. [details]
Currently if you level an area of land (actually the raising and lowering by the human player is also a form of leveling since raise-level and lower-level was coded by me and adapted to trunk), it will level the area "as best as possible", even if there's something in the way somewhere.
Just reading through your description, your new algorithm sounds like he would give out an error and not level anything at all, if there's some little object somewhere in the way. Is this true?
So, you are right, in the present version it will fail if there is a tile in the way that can't be rised or lowered. What I don't yet understand (I don't have much time today) is at which place you ignore the error coming from the tiles which cannot be rised or lowered.
Hm, I have to think about that. Maybe, the solution is calling terraform once for each tile and ignoring the errors like you seem to do at some place. But this would cost performance - e.g.if you try to level a mountain with a 4x4 plateau, for each tile on the plateu, a major part of the ridge would be recalculated.
I didn't notice that - I personally can live with an error if I do something partially impossible.