(3bb643ab45ae) added parameter for DrawMap and DrawDefMap to retain old material if sky is drawn
Now you can draw parts of the map via script using DrawMap without breaking your old landscape. Basically the only change was disabling the clearing of the rectangle before drawing the map when the parameter is passed.
Anyone giving their blessing to that patch? :)
I hereby license the following file(s) under the CC-by license
Attachment: OpenClonk_rev3962_DrawMap_retainSky.patch (9k)
I hate those bool "also do (not do) that" parameters. MapToLandscape probably can't escape it, but at least MapToSurface can by moving the ClearBox8Only call to MapToLandscape. Documentation updates are missing. Looks good otherwise.
From the script's perspective, couldn't the parameter be replaced by doing (or not doing)
FreeRect
before?
I am indifferent to bool parameters (why are you against them?), but in my opinion they are definitely the thing to use when the alternative is having to add more lines to the code instead of being just able to insert a ,true.
Better make it a bitmask parameter though, in case we want to add more boolean parameters later.
Better make it a bitmask parameter though, in case we want to add more boolean parameters later.
> why are you against [bool parameters]?
Because they don't explain what happens;
DrawMap("Map", true)
is less obvious than DrawMap("Map", DM_MergeLandscape)
It's a design smell. "
Maybe in future one might want to clear only a part of the rectangle in question? If we change it now, we get that flexibility without extra cost.
a.doBla(); a.doBlub(a,b,c,d)
" is better than "a.doBlub(a,b,c,d,true)
" - because it documents better what is happening and because it is easier to extend the code with some doBla
-specific parameters.Maybe in future one might want to clear only a part of the rectangle in question? If we change it now, we get that flexibility without extra cost.
Probably
PS: I basically rather added the parameter for backwards compatibility. But I guess that's not needed here anyway.
PS: I basically rather added the parameter for backwards compatibility. But I guess that's not needed here anyway.
I guess I will make the additional parameter the default behaviour then
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill