Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Patch Review: DrawMap parameter: ignore sky
- - By Zapper [de] Date 2012-02-10 22:08
(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
Parent - - By Günther [de] Date 2012-02-11 18:02
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.
Reply
Parent - By Zapper [de] Date 2012-02-11 23:26
thx, changed and pushed
Parent - - By PeterW [gb] Date 2012-02-12 14:08
From the script's perspective, couldn't the parameter be replaced by doing (or not doing) FreeRect before?
Parent - - By Gurkenglas [de] Date 2012-02-12 14:29
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.
Reply
Parent - By Isilkor Date 2012-02-12 16:01

> why are you against [bool parameters]?


Because they don't explain what happens; DrawMap("Map", true) is less obvious than DrawMap("Map", DM_MergeLandscape)
Reply
Parent - By PeterW [gb] Date 2012-02-12 19:38
It's a design smell. "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.
Parent - By Zapper [de] Date 2012-02-12 20:45
Probably
PS: I  basically rather added the parameter for backwards compatibility. But I guess that's not needed here anyway.
Parent - - By Zapper [de] Date 2012-02-16 12:46
I guess I will make the additional parameter the default behaviour then
Parent - By Zapper [de] Date 2012-02-19 17:59
Done.
I removed the parameter from Draw*Map. But not from MapToLandscape, since that is used in other places, too and I was unsure what the results of a change there would be
Up Topic Development / Developer's Corner / Patch Review: DrawMap parameter: ignore sky

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill