当前位置: 首页>>代码示例>>C++>>正文


C++ FSerializer::EndArray方法代码示例

本文整理汇总了C++中FSerializer::EndArray方法的典型用法代码示例。如果您正苦于以下问题:C++ FSerializer::EndArray方法的具体用法?C++ FSerializer::EndArray怎么用?C++ FSerializer::EndArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSerializer的用法示例。


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

示例1: StaticReadRNGState

void FRandom::StaticReadRNGState(FSerializer &arc)
{
	FRandom *rng;

	arc("rngseed", rngseed);

	// Call StaticClearRandom in order to ensure that SFMT is initialized
	FRandom::StaticClearRandom ();

	if (arc.BeginArray("rngs"))
	{
		int count = arc.ArraySize();

		for (int i = 0; i < count; i++)
		{
			if (arc.BeginObject(nullptr))
			{
				uint32_t crc;
				arc("crc", crc);

				for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
				{
					if (rng->NameCRC == crc)
					{
						arc("index", rng->idx)
							.Array("u", rng->sfmt.u, SFMT::N32);
						break;
					}
				}
				arc.EndObject();
			}
		}
		arc.EndArray();
	}
}
开发者ID:Blzut3,项目名称:gzdoom,代码行数:35,代码来源:m_random.cpp

示例2: StaticWriteRNGState

void FRandom::StaticWriteRNGState (FSerializer &arc)
{
	FRandom *rng;

	arc("rngseed", rngseed);

	if (arc.BeginArray("rngs"))
	{
		for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
		{
			// Only write those RNGs that have names
			if (rng->NameCRC != 0)
			{
				if (arc.BeginObject(nullptr))
				{
					arc("crc", rng->NameCRC)
						("index", rng->idx)
						.Array("u", rng->sfmt.u, SFMT::N32)
						.EndObject();
				}
			}
		}
		arc.EndArray();
	}
}
开发者ID:Blzut3,项目名称:gzdoom,代码行数:25,代码来源:m_random.cpp

示例3: G_ReadVisited

void G_ReadVisited(FSerializer &arc)
{
	if (arc.BeginArray("visited"))
	{
		for (int s = arc.ArraySize(); s > 0; s--)
		{
			FString str;
			arc(nullptr, str);
			auto i = FindLevelInfo(str);
			if (i != nullptr) i->flags |= LEVEL_VISITED;
		}
		arc.EndArray();
	}

	arc.Array("randomclasses", SinglePlayerClass, MAXPLAYERS);

	if (arc.BeginObject("playerclasses"))
	{
		for (int i = 0; i < MAXPLAYERS; ++i)
		{
			FString key;
			key.Format("%d", i);
			arc(key, players[i].cls);
		}
		arc.EndObject();
	}
}
开发者ID:floverdevel,项目名称:zdoom,代码行数:27,代码来源:g_level.cpp

示例4: G_WriteVisited

void G_WriteVisited(FSerializer &arc)
{
	if (arc.BeginArray("visited"))
	{
		// Write out which levels have been visited
		for (auto & wi : wadlevelinfos)
		{
			if (wi.flags & LEVEL_VISITED)
			{
				arc.AddString(nullptr, wi.MapName);
			}
		}
		arc.EndArray();
	}

	// Store player classes to be used when spawning a random class
	if (multiplayer)
	{
		arc.Array("randomclasses", SinglePlayerClass, MAXPLAYERS);
	}

	if (arc.BeginObject("playerclasses"))
	{
		for (int i = 0; i < MAXPLAYERS; ++i)
		{
			if (playeringame[i])
			{
				FString key;
				key.Format("%d", i);
				arc(key, players[i].cls);
			}
		}
		arc.EndObject();
	}
}
开发者ID:floverdevel,项目名称:zdoom,代码行数:35,代码来源:g_level.cpp

示例5: StaticSerializeTranslations

void FRemapTable::StaticSerializeTranslations(FSerializer &arc)
{
	if (arc.BeginArray("translations"))
	{
		// Does this level have custom translations?
		FRemapTable *trans;
		int w;
		if (arc.isWriting())
		{
			for (unsigned int i = 0; i < translationtables[TRANSLATION_LevelScripted].Size(); ++i)
			{
				trans = translationtables[TRANSLATION_LevelScripted][i];
				if (trans != NULL && !trans->IsIdentity())
				{
					if (arc.BeginObject(nullptr))
					{
						arc("index", i);
						trans->Serialize(arc);
						arc.EndObject();
					}
				}
			}
		}
		else
		{
			while (arc.BeginObject(nullptr))
			{
				arc("index", w);
				trans = translationtables[TRANSLATION_LevelScripted].GetVal(w);
				if (trans == NULL)
				{
					trans = new FRemapTable;
					translationtables[TRANSLATION_LevelScripted].SetVal(w, trans);
				}
				trans->Serialize(arc);
				arc.EndObject();
			}
		}
		arc.EndArray();
	}
}
开发者ID:emileb,项目名称:gzdoom,代码行数:41,代码来源:r_translate.cpp

示例6: P_SerializePlayers

void P_SerializePlayers(FSerializer &arc, bool skipload)
{
	int numPlayers, numPlayersNow;
	int i;

	// Count the number of players present right now.
	for (numPlayersNow = 0, i = 0; i < MAXPLAYERS; ++i)
	{
		if (playeringame[i])
		{
			++numPlayersNow;
		}
	}

	if (arc.isWriting())
	{
		// Record the number of players in this save.
		arc("numplayers", numPlayersNow);
		if (arc.BeginArray("players"))
		{
			// Record each player's name, followed by their data.
			for (i = 0; i < MAXPLAYERS; ++i)
			{
				if (playeringame[i])
				{
					if (arc.BeginObject(nullptr))
					{
						const char *n = players[i].userinfo.GetName();
						arc.StringPtr("playername", n);
						players[i].Serialize(arc);
						arc.EndObject();
					}
				}
			}
			arc.EndArray();
		}
	}
	else
	{
		arc("numplayers", numPlayers);

		if (arc.BeginArray("players"))
		{
			// If there is only one player in the game, they go to the
			// first player present, no matter what their name.
			if (numPlayers == 1)
			{
				ReadOnePlayer(arc, skipload);
			}
			else
			{
				ReadMultiplePlayers(arc, numPlayers, numPlayersNow, skipload);
			}
			arc.EndArray();
		}
		if (!skipload && numPlayersNow > numPlayers)
		{
			SpawnExtraPlayers();
		}
		// Redo pitch limits, since the spawned player has them at 0.
		players[consoleplayer].SendPitchLimits();
	}
}
开发者ID:XaserAcheron,项目名称:zdoom,代码行数:63,代码来源:p_saveg.cpp


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