SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.54k stars 492 forks source link

`GameObject` change undo/redo refactor to track different options #3085

Closed Vankata453 closed 4 weeks ago

Vankata453 commented 1 month ago

GameObject, instead of comparing all options against each other, now saves the state of and compares individual ones, so the change data is more memory-efficient.

This way of tracking object changes also allows for proper undo/redo tracking with multiple remote users (regarding the remote level editing concept, which branch these changes originate from).

TileMap tile changes are now saved in a way more memory-efficient way. Instead of saving the whole tiles array for each change, only the changed tiles are saved in a list of pairs (tile index, old/new tile ID).

tobbi commented 1 month ago

MacOS build failure:

In file included from /Users/runner/work/supertux/supertux/src/supertux/game_object_change.cpp:17:
/Users/runner/work/supertux/supertux/src/supertux/game_object_change.hpp:65:33: error: implicit instantiation of undefined template 'std::vector<GameObjectChange>'
  std::vector<GameObjectChange> objects;
                                ^
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/iosfwd:259:28: note: template is declared here
class _LIBCPP_TEMPLATE_VIS vector;

Windows build failure (maybe if the logs don't deceive me): https://github.com/SuperTux/supertux/actions/runs/11448138595/job/31851014184?pr=3085#step:6:4092