本文整理汇总了C++中common::Serializer::getVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::getVersion方法的具体用法?C++ Serializer::getVersion怎么用?C++ Serializer::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::getVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveLoadWithSerializer
void Player_AD::saveLoadWithSerializer(Common::Serializer &s) {
Common::StackLock lock(_mutex);
if (s.getVersion() < VER(95)) {
IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL);
dummyImuse->saveLoadIMuse(s, _vm, false);
delete dummyImuse;
return;
}
if (s.getVersion() >= VER(96)) {
int32 res[4] = {
_musicResource, _sfx[0].resource, _sfx[1].resource, _sfx[2].resource
};
// The first thing we save is a list of sound resources being played
// at the moment.
s.syncArray(res, 4, Common::Serializer::Sint32LE);
// If we are loading start the music again at this point.
if (s.isLoading()) {
if (res[0] != -1) {
startSound(res[0]);
}
}
uint32 musicOffset = _curOffset;
s.syncAsSint32LE(_engineMusicTimer, VER(96));
s.syncAsUint32LE(_musicTimer, VER(96));
s.syncAsUint32LE(_internalMusicTimer, VER(96));
s.syncAsUint32LE(_curOffset, VER(96));
s.syncAsUint32LE(_nextEventTimer, VER(96));
// We seek back to the old music position.
if (s.isLoading()) {
SWAP(musicOffset, _curOffset);
musicSeekTo(musicOffset);
}
// Finally start up the SFX. This makes sure that they are not
// accidently stopped while seeking to the old music position.
if (s.isLoading()) {
for (int i = 1; i < ARRAYSIZE(res); ++i) {
if (res[i] != -1) {
startSound(res[i]);
}
}
}
}
}
示例2: synchronize
void Nim::synchronize(Common::Serializer &sz) {
if (sz.isLoading() && sz.getVersion() < 2)
return;
sz.syncAsByte(_playedNim);
}