• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ common::Serializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中common::Serializer的典型用法代码示例。如果您正苦于以下问题:C++ Serializer类的具体用法?C++ Serializer怎么用?C++ Serializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Serializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: syncTime

static void syncTime(Common::Serializer &s, TimeDate &t) {
	s.syncAsUint16LE(t.tm_year);
	s.syncAsByte(t.tm_mon);
	s.syncAsByte(t.tm_mday);
	s.syncAsByte(t.tm_hour);
	s.syncAsByte(t.tm_min);
	s.syncAsByte(t.tm_sec);
}
开发者ID:,项目名称:,代码行数:8,代码来源:


示例2: syncSoundList

static void syncSoundList(Common::Serializer &s) {
	for (int i = 0; i < 4; ++i) {
		SoundEntry &se = soundList[i];
		s.syncAsSint16LE(se.frameNum);
		s.syncAsUint16LE(se.frequency);
		s.syncAsSint16LE(se.volume);
	}
}
开发者ID:vladimir-zahradnik,项目名称:scummvm,代码行数:8,代码来源:saveload.cpp


示例3: syncAllActorsAlive

void syncAllActorsAlive(Common::Serializer &s) {
	for (int i = 0; i < MAX_SAVED_ALIVES; i++) {
		s.syncAsByte(actorInfo[i].bAlive);
		s.syncAsByte(actorInfo[i].tagged);
		s.syncAsByte(actorInfo[i].tType);
		s.syncAsUint32LE(actorInfo[i].hTag);
	}
}
开发者ID:,项目名称:,代码行数:8,代码来源:


示例4: syncSCdata

void syncSCdata(Common::Serializer &s) {
	s.syncAsUint32LE(HookScene.scene);
	s.syncAsSint32LE(HookScene.entry);
	s.syncAsSint32LE(HookScene.trans);

	s.syncAsUint32LE(DelayedScene.scene);
	s.syncAsSint32LE(DelayedScene.entry);
	s.syncAsSint32LE(DelayedScene.trans);
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:9,代码来源:tinsel.cpp


示例5: syncTimerInfo

/**
 * (Un)serialize the timer data for save/restore game.
 */
void syncTimerInfo(Common::Serializer &s) {
	for (int i = 0; i < MAX_TIMERS; i++) {
		s.syncAsSint32LE(timers[i].tno);
		s.syncAsSint32LE(timers[i].ticks);
		s.syncAsSint32LE(timers[i].secs);
		s.syncAsSint32LE(timers[i].delta);
		s.syncAsSint32LE(timers[i].frame);
	}
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例6: syncBackgroundTable

static void syncBackgroundTable(Common::Serializer &s) {
	// restore backgroundTable
	for (int i = 0; i < 8; i++) {
		if (s.isSaving() && (strlen(backgroundTable[i].name) > 8))
			warning("Saving a background resource that has too long a name");

		s.syncBytes((byte *)backgroundTable[i].name, 9);
		s.syncBytes((byte *)backgroundTable[i].extention, 6);
	}
}
开发者ID:33d,项目名称:scummvm,代码行数:10,代码来源:saveload.cpp


示例7: synchronize

void Scene::synchronize(Common::Serializer &s) {
	_action.synchronize(s);
	_rails.synchronize(s);
	_userInterface.synchronize(s);
	s.syncAsByte(_reloadSceneFlag);
	s.syncAsByte(_roomChanged);
	s.syncAsUint16LE(_nextSceneId);
	s.syncAsUint16LE(_priorSceneId);
	_dynamicHotspots.synchronize(s);
}
开发者ID:alexbevi,项目名称:scummvm,代码行数:10,代码来源:scene.cpp


示例8: synchronize

void UserInterface::synchronize(Common::Serializer &s) {
	InventoryObjects &invObjects = _vm->_game->_objects;

	if (s.isLoading()) {
		_selectedInvIndex = invObjects._inventoryList.empty() ? -1 : 0;
	}

	for (int i = 0; i < 8; ++i)
		s.syncAsSint16LE(_categoryIndexes[i]);
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:10,代码来源:user_interface.cpp


示例9:

void SaveLoad::sync<ScriptRegister::Script>(Common::Serializer &serializer, ScriptRegister::Script &var) {
	if (serializer.isSaving())
		if (var.chunk)
			var.line = var.chunk->getCurLine();

	serializer.syncAsUint32LE(var.line);

	if (serializer.isLoading())
		var.chunk = 0;
}
开发者ID:DrMcCoy,项目名称:OLDscummvm-darkseed2,代码行数:10,代码来源:script.cpp


示例10: syncCT

static void syncCT(Common::Serializer &s) {
	int v = (_vm->_polyStruct) ? 1 : 0;
	s.syncAsSint32LE(v);
	if (s.isLoading())
		_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : NULL;

	if (v == 0)
		// There is no further data to load or save
		return;

	s.syncAsSint16LE(numberOfWalkboxes);

	if (numberOfWalkboxes) {
		for (int i = 0; i < numberOfWalkboxes; ++i)
			s.syncAsSint16LE(walkboxColor[i]);
		for (int i = 0; i < numberOfWalkboxes; ++i)
			s.syncAsSint16LE(walkboxState[i]);
	}

	for (int i = 0; i < 10; i++) {
		v = 0;
		if (s.isSaving()) v = (persoTable[i]) ? 1 : 0;
		s.syncAsSint32LE(v);

		if (s.isLoading())
			// Set up the pointer for the next structure
			persoTable[i] = (v == 0) ? NULL : (persoStruct *)mallocAndZero(sizeof(persoStruct));

		if (v != 0)
			syncPerso(s, *persoTable[i]);
	}
}
开发者ID:33d,项目名称:scummvm,代码行数:32,代码来源:saveload.cpp


示例11: syncSaveGameHeader

static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
	s.syncAsUint32LE(hdr.id);
	s.syncAsUint32LE(hdr.size);
	s.syncAsUint32LE(hdr.ver);

	s.syncBytes((byte *)hdr.desc, SG_DESC_LEN);
	hdr.desc[SG_DESC_LEN - 1] = 0;

	syncTime(s, hdr.dateTime);

	int tmp = hdr.size - s.bytesSynced();

	// NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
	// as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
	// or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
	// deleted anyway. Refer to bug #3387551.
	bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);

	// Perform sanity check
	if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
		return false;

	if (tmp > 0) {
		// If there's header space left, handling syncing the Scn flag and game language
		s.syncAsByte(hdr.scnFlag);
		s.syncAsByte(hdr.language);
		tmp -= 2;

		if (_vm && s.isLoading()) {
			// If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language
			if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) ||
					(hdr.language != _vm->_config->_language))
				return false;
		}
	}

	// Handle the number of interpreter contexts that will be saved in the savegame
	if (tmp >= 2) {
		tmp -= 2;
		hdr.numInterpreters = NUM_INTERPRET;
		s.syncAsUint16LE(hdr.numInterpreters);
	} else {
		hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20;
	}

	// Skip over any extra bytes
	s.skip(tmp);
	return true;
}
开发者ID:,项目名称:,代码行数:49,代码来源:


示例12: synchronize

void ActionSavedFields::synchronize(Common::Serializer &s) {
	s.syncAsByte(_commandError);
	s.syncAsSint16LE(_commandSource);
	s.syncAsSint16LE(_command);
	s.syncAsSint16LE(_mainObject);
	s.syncAsSint16LE(_secondObject);
	s.syncAsSint16LE(_mainObjectSource);
	s.syncAsSint16LE(_secondObjectSource);
	s.syncAsSint16LE(_articleNumber);
	s.syncAsSint16LE(_lookFlag);
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:11,代码来源:action.cpp


示例13: syncSongs

static void syncSongs(Common::Serializer &s) {
	int size = 0;

	if (songLoaded) {
		// TODO: implement
		s.syncAsByte(size);
		if (s.isLoading()) {
			saveVar1 = size;
			if (saveVar1)
				s.syncBytes(saveVar2, saveVar1);
		}
	} else {
		s.syncAsByte(size);
	}
}
开发者ID:33d,项目名称:scummvm,代码行数:15,代码来源:saveload.cpp


示例14: synchronize

void StopWalkers::synchronize(Common::Serializer &s) {
	StopWalkerEntry rec;
	int count = size();
	s.syncAsUint16LE(count);

	if (s.isLoading()) {
		clear();
		for (int idx = 0; idx < count; ++idx) {
			rec.synchronize(s);
			push(rec);
		}
	} else {
		for (int idx = 0; idx < count; ++idx)
			(*this)[idx].synchronize(s);
	}
}
开发者ID:Cruel,项目名称:scummvm,代码行数:16,代码来源:player.cpp


示例15: saveLoadWithSerializer

//////////////////////////////////////////////////////////////////////////
// Savegame
//////////////////////////////////////////////////////////////////////////
void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
	Common::StackLock locker(_mutex);

	s.syncAsUint32LE(_state);
	s.syncAsUint32LE(_currentType);

	// Compute the number of entries to save
	uint32 numEntries = count();
	s.syncAsUint32LE(numEntries);

	// Save or load each entry data
	if (s.isSaving()) {
		for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
			(*i)->saveLoadWithSerializer(s);
	} else {
		warning("[Sound::saveLoadWithSerializer] Loading not implemented");
		s.skip(numEntries * 64);
	}
}
开发者ID:singron,项目名称:scummvm,代码行数:22,代码来源:queue.cpp


示例16: synchronize

void DynamicHotspots::synchronize(Common::Serializer &s) {
	int count = _entries.size();
	s.syncAsSint16LE(count);

	// The MIN in the below loop is a workaround to fix earlier savegame
	// loading accidentally adding new dynamic hotspots to the fixed list
	for (int i = 0; i < count; ++i) {
		_entries[MIN(i, (int)_entries.size() - 1)].synchronize(s);
	}
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:10,代码来源:hotspots.cpp


示例17: saveLoadWithSerializer

void Sprite::saveLoadWithSerializer(Common::Serializer &ser) {
	ser.syncAsSint16LE(pos.x);
	ser.syncAsSint16LE(pos.y);
	ser.syncAsUint16LE(drawPriority);
	ser.syncAsUint16LE(drawPriority2);
	ser.syncString(field8);
	// Note: bitmap must be reloaded
	ser.syncAsUint16LE(drawMode);
	ser.syncAsUint16LE(textColor);
	ser.syncAsUint16LE(bitmapChanged);
	ser.syncAsUint16LE(rect2Valid);
	ser.syncAsUint16LE(isOnScreen);
	ser.syncAsUint16LE(field16);
	serializeRect(lastDrawRect, ser);
	serializeRect(drawRect, ser);
	serializeRect(rectangle2, ser);
	ser.syncAsSint16LE(drawX);
	ser.syncAsSint16LE(drawY);
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:19,代码来源:sprite.cpp


示例18: syncLocation

bool BuriedEngine::syncLocation(Common::Serializer &s, Location &location) {
    s.syncAsSint16LE(location.timeZone);
    s.syncAsSint16LE(location.environment);
    s.syncAsSint16LE(location.node);
    s.syncAsSint16LE(location.facing);
    s.syncAsSint16LE(location.orientation);
    s.syncAsSint16LE(location.depth);
    return s.bytesSynced() == 12;
}
开发者ID:project-cabal,项目名称:cabal,代码行数:9,代码来源:saveload.cpp


示例19: syncBitFlags

void SavesManager::syncBitFlags(Common::Serializer &s, bool *startP, bool *endP) {
	byte data = 0;

	int bitCounter = 0;
	for (bool *p = startP; p <= endP; ++p, bitCounter = (bitCounter + 1) % 8) {
		if (p == endP || bitCounter == 0) {
			if (p != endP || s.isSaving())
				s.syncAsByte(data);
			if (p == endP)
				break;

			if (s.isSaving())
				data = 0;
		}

		if (s.isLoading())
			*p = (data >> bitCounter) != 0;
		else if (*p)
			data |= 1 << bitCounter;
	}
开发者ID:peterkohaut,项目名称:scummvm,代码行数:20,代码来源:saves.cpp


示例20: sync

bool SaveHeader::sync(Common::Serializer &sz) {
	const uint32 SAVE_MAGIC_NUMBER = MKTAG('M', 'O', 'J', 'B');
	const uint32 SAVE_FILE_VERSION = 1;

	if (sz.isLoading()) {
		uint32 magic = 0;
		sz.syncAsUint32BE(magic);
		if (magic != SAVE_MAGIC_NUMBER) {
			warning("Invalid save");
			return false;
		}
	} else {
		uint32 magic = SAVE_MAGIC_NUMBER;
		sz.syncAsUint32BE(magic);
	}

	sz.syncVersion(SAVE_FILE_VERSION);
	sz.syncString(_description);

	return true;
}
开发者ID:angstsmurf,项目名称:scummvm,代码行数:21,代码来源:mutationofjb.cpp



注:本文中的common::Serializer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ common::Stream类代码示例发布时间:2022-05-31
下一篇:
C++ common::SeekableReadStream类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap