本文整理汇总了C++中FArchive::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::Read方法的具体用法?C++ FArchive::Read怎么用?C++ FArchive::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::Read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadCompatibleUserInfo
void ReadCompatibleUserInfo(FArchive &arc, userinfo_t &info)
{
char netname[MAXPLAYERNAME + 1];
BYTE team;
int aimdist, color, colorset, skin, gender;
bool neverswitch;
//fixed_t movebob, stillbob; These were never serialized!
//int playerclass; "
info.Reset();
arc.Read(&netname, sizeof(netname));
arc << team << aimdist << color << skin << gender << neverswitch << colorset;
*static_cast<FStringCVar *>(info[NAME_Name]) = netname;
*static_cast<FIntCVar *>(info[NAME_Team]) = team;
*static_cast<FFloatCVar *>(info[NAME_Autoaim]) = (float)aimdist / ANGLE_1;
*static_cast<FIntCVar *>(info[NAME_Skin]) = skin;
*static_cast<FIntCVar *>(info[NAME_Gender]) = gender;
*static_cast<FBoolCVar *>(info[NAME_NeverSwitchOnPickup]) = neverswitch;
*static_cast<FIntCVar *>(info[NAME_ColorSet]) = colorset;
UCVarValue val;
val.Int = color;
static_cast<FColorCVar *>(info[NAME_Color])->SetGenericRep(val, CVAR_Int);
}
示例2: Serialize
void FLZOMemFile::Serialize (FArchive &arc)
{
if (arc.IsStoring ())
{
if (m_ImplodedBuffer == NULL)
{
I_Error ("FLZOMemFile must be imploded before storing\n");
// Q: How do we get here without closing FLZOMemFile first?
Close ();
}
arc.Write (LZOSig, 4);
DWORD sizes[2];
sizes[0] = ((DWORD *)m_ImplodedBuffer)[0];
sizes[1] = ((DWORD *)m_ImplodedBuffer)[1];
SWAP_DWORD (sizes[0]);
SWAP_DWORD (sizes[1]);
arc.Write (m_ImplodedBuffer, (sizes[0] ? sizes[0] : sizes[1])+8);
}
else
{
Close ();
m_Mode = EReading;
char sig[4];
DWORD sizes[2];
arc.Read (sig, 4);
if (sig[0] != LZOSig[0] || sig[1] != LZOSig[1] || sig[2] != LZOSig[2] || sig[3] != LZOSig[3])
I_Error ("Expected to extract an LZO-compressed file\n");
arc >> sizes[0] >> sizes[1];
DWORD len = sizes[0] == 0 ? sizes[1] : sizes[0];
m_Buffer = (BYTE *)Malloc (len+8);
SWAP_DWORD (sizes[0]);
SWAP_DWORD (sizes[1]);
((DWORD *)m_Buffer)[0] = sizes[0];
((DWORD *)m_Buffer)[1] = sizes[1];
arc.Read (m_Buffer+8, len);
m_ImplodedBuffer = m_Buffer;
m_Buffer = NULL;
m_Mode = EWriting;
}
}
示例3: G_SerializeHub
static void G_SerializeHub(FArchive & arc)
{
int i=hubdata.Size();
arc << i;
if (i>0)
{
if (arc.IsStoring()) arc.Write(&hubdata[0], i * sizeof(wbstartstruct_t));
else
{
hubdata.Resize(i);
arc.Read(&hubdata[0], i * sizeof(wbstartstruct_t));
}
}
else hubdata.Clear();
}
示例4: Serialize
void FRemapTable::Serialize(FArchive &arc)
{
int n = NumEntries;
arc << NumEntries;
if (arc.IsStoring())
{
arc.Write (Remap, NumEntries);
}
else
{
if (n != NumEntries)
{
Free();
Alloc(NumEntries);
}
arc.Read (Remap, NumEntries);
}
for (int j = 0; j < NumEntries; ++j)
{
arc << Palette[j];
}
}