eglaysher / rlvm

RealLive clone for Linux and OSX
http://rlvm.net
GNU General Public License v3.0
152 stars 26 forks source link

Saving while a gloss is open creates weirdness on load #3

Closed eglaysher closed 13 years ago

eglaysher commented 13 years ago

Text will start writing to the gloss window instead.

Reported as part of Issue #2

eglaysher commented 13 years ago

The bug is half fixed by saving the savable state in the TextSystem at the time of Savepoint(). This means the correct window is focused when we restore.

The text window is empty on restore, though. It looks like the first thing rlvm does is print out the string (' ' x 200) on restore. The problem is probably that we aren't cloning all state on save. Between the Savepoint() and the actual save operation, memory has probably been changed.

eglaysher commented 13 years ago

Memory saved to disk should be memory at the state of the last Savepoint().

The weird behaviour with restoring a game where the current line has a gloss comes from rlBabel writing to the string variable that's used to strout() while waiting for a click to match against the gloss region. If we hit a Savepoint(), we should later save the memory at the time of that Savepoint() to disk.

Keep a list of original values next to the main memory bank, copying original data to the list before modifying it. We can just clear this list at the next Savepoint(), and can use it to recreate the data we need to save to disk in that less common case.

Also adds unit tests to exercise this complex new behaviour.

Closed by 95da2fb2a514882468b72e59ee6e7170cf427612