mirror of https://github.com/stella-emu/stella.git
Minor updates to rewind:
- comments are now more in line with what actually happens when adding a state - changed Serializer::reset() to Serializer::rewind(), to more accurately indicate what it does
This commit is contained in:
parent
90be9bb607
commit
a79ccf400f
|
@ -42,7 +42,8 @@
|
|||
|
||||
In the case of methods which wrap the C++ 'splice()' method, the
|
||||
semantics of splice are followed wrt invalid/out-of-range/etc
|
||||
iterators. See the applicable documentation for such behaviour.
|
||||
iterators. See the applicable C++ STL documentation for such
|
||||
behaviour.
|
||||
|
||||
@author Stephen Anthony
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ bool RewindManager::addState(const string& message)
|
|||
RewindState& state = myStateList.current();
|
||||
Serializer& s = state.data;
|
||||
|
||||
s.reset(); // rewind Serializer internal buffers
|
||||
s.rewind(); // rewind Serializer internal buffers
|
||||
if(myStateManager.saveState(s) && myOSystem.console().tia().saveDisplay(s))
|
||||
{
|
||||
state.message = message;
|
||||
|
@ -70,7 +70,7 @@ bool RewindManager::rewindState()
|
|||
string message = getMessage(state);
|
||||
cerr << "rewind " << state.count << endl;
|
||||
|
||||
s.reset(); // rewind Serializer internal buffers
|
||||
s.rewind(); // rewind Serializer internal buffers
|
||||
myStateManager.loadState(s);
|
||||
myOSystem.console().tia().loadDisplay(s);
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ class StateManager;
|
|||
Unwinding involves moving the internal iterator forwards in time (towards
|
||||
the end of the list).
|
||||
|
||||
Any time a new state is added, the internal iterator moves back to the
|
||||
insertion point of the data (the end of the list).
|
||||
Any time a new state is added, all states from the current iterator position
|
||||
to the end of the list (aka, all future states) are removed, and the internal
|
||||
iterator moves to the insertion point of the data (the end of the list).
|
||||
|
||||
@author Stephen Anthony
|
||||
*/
|
||||
|
|
|
@ -466,7 +466,7 @@ void CartridgeCTY::saveScore(uInt8 index)
|
|||
memcpy(scoreRAM + (index << 6) + 4, myRAM+4, 60);
|
||||
|
||||
// Save score RAM
|
||||
serializer.reset();
|
||||
serializer.rewind();
|
||||
try
|
||||
{
|
||||
serializer.putByteArray(scoreRAM, 256);
|
||||
|
|
|
@ -35,7 +35,7 @@ Serializer::Serializer(const string& filename, bool readonly)
|
|||
{
|
||||
myStream = std::move(str);
|
||||
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
||||
reset();
|
||||
rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ Serializer::Serializer(const string& filename, bool readonly)
|
|||
{
|
||||
myStream = std::move(str);
|
||||
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
||||
reset();
|
||||
rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,12 +73,12 @@ Serializer::Serializer()
|
|||
{
|
||||
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
||||
putBool(true);
|
||||
reset();
|
||||
rewind();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Serializer::reset()
|
||||
void Serializer::rewind()
|
||||
{
|
||||
myStream->clear();
|
||||
myStream->seekg(ios_base::beg);
|
||||
|
|
|
@ -59,7 +59,7 @@ class Serializer
|
|||
/**
|
||||
Resets the read/write location to the beginning of the stream.
|
||||
*/
|
||||
void reset();
|
||||
void rewind();
|
||||
|
||||
/**
|
||||
Reads a byte value (unsigned 8-bit) from the current input stream.
|
||||
|
|
Loading…
Reference in New Issue