本文整理汇总了C++中FSerializer::BeginArray方法的典型用法代码示例。如果您正苦于以下问题:C++ FSerializer::BeginArray方法的具体用法?C++ FSerializer::BeginArray怎么用?C++ FSerializer::BeginArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSerializer
的用法示例。
在下文中一共展示了FSerializer::BeginArray方法的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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}