Many times a function will set a single block multiple times, resulting in weirdness with the undo function, cos it only replaces the last instance, which causes issues.
Now I can off the bat think of a solution, which is similar to the one I used in shapes.scl, which is basically for set_blockto only set the points, and then for add_to_historyto actually set them all.
Benefits of this system:
Gets rid of this issue
It's exactly as fast as previous solution for functions which only set 1 position every time, and faster for functions which set the same position multiple times because set_block doesn't get called so very often.
Doesn't require any changes to any existing code to implement (except for obviously set_block and add_to_history functions)
Disadvantages (I can only see 1 atm, but I'm sure more will pop up):
If someone called set_block and inadvertently forgot to call add_to_history, that position would only be set later, another time that add_to_history is called.
Many times a function will set a single block multiple times, resulting in weirdness with the undo function, cos it only replaces the last instance, which causes issues. Now I can off the bat think of a solution, which is similar to the one I used in
shapes.scl
, which is basically forset_block
to only set the points, and then foradd_to_history
to actually set them all.Benefits of this system:
set_block
doesn't get called so very often.set_block
andadd_to_history
functions)Disadvantages (I can only see 1 atm, but I'm sure more will pop up):
set_block
and inadvertently forgot to calladd_to_history
, that position would only be set later, another time thatadd_to_history
is called.