本文整理汇总了C++中BinaryFile::ReadUnsignedInt方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryFile::ReadUnsignedInt方法的具体用法?C++ BinaryFile::ReadUnsignedInt怎么用?C++ BinaryFile::ReadUnsignedInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryFile
的用法示例。
在下文中一共展示了BinaryFile::ReadUnsignedInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPlayerData
void SavedFile::ReadPlayerData(BinaryFile& file)
{
for(std::vector<Player>::iterator it = players.begin(); it != players.end(); ++it)
{
it->ps = file.ReadUnsignedInt();
if(it->ps != PS_LOCKED)
{
it->name = file.ReadShortString();
it->nation = Nation(file.ReadUnsignedChar());
it->color = file.ReadUnsignedInt();
it->team = file.ReadUnsignedChar();
}
}
}
示例2: Load
/**
*
* @author OLiver
*/
bool Savegame::Load(BinaryFile& file, const bool load_players, const bool load_sgd)
{
// Signatur und Version einlesen
if(!ValidateFile(file, 8, SAVE_SIGNATURE, SAVE_VERSION))
{
LOG.lprintf("Savegame::Load: ERROR: File is not a valid RTTR savegame!\n");
return false;
}
// Zeitstempel
file.ReadRawData(&save_time, 8);
// Map-Name
file.ReadShortString(map_name);
// Anzahl Spieler
player_count = file.ReadUnsignedChar();
// Spielerzeug
if(load_players)
{
// Größe des Spielerblocks überspringen
file.Seek(4, SEEK_CUR);
ReadPlayerData(file);
}
else
{
// Überspringen
players = 0;
unsigned player_size = file.ReadUnsignedInt();
file.Seek(player_size, SEEK_CUR);
}
// GGS
ReadGGS(file);
// Start-GF
start_gf = file.ReadUnsignedInt();
if(load_sgd)
{
// Serialisiertes Spielzeug lesen
sgd.ReadFromFile(file);
}
return true;
}
示例3: Load
/**
*
* @author OLiver
*/
bool Savegame::Load(BinaryFile& file, const bool load_players, const bool load_sgd)
{
// Signatur und Version einlesen
if(!ValidateFile(file, sizeof(SAVE_SIGNATURE), SAVE_SIGNATURE, SAVE_VERSION))
return false;
// Zeitstempel
file.ReadRawData(&save_time, 8);
save_time = libendian::ConvertEndianess<false>::toNative(save_time);
// Map-Name
map_name = file.ReadShortString();
// Anzahl Spieler
SetPlayerCount(file.ReadUnsignedChar());
// Spielerzeug
if(load_players)
{
// Größe des Spielerblocks überspringen
file.Seek(4, SEEK_CUR);
ReadPlayerData(file);
}
else
{
// Überspringen
unsigned player_size = file.ReadUnsignedInt();
file.Seek(player_size, SEEK_CUR);
}
// GGS
ReadGGS(file);
// Start-GF
start_gf = file.ReadUnsignedInt();
if(load_sgd)
{
// Serialisiertes Spielzeug lesen
sgd.ReadFromFile(file);
}
return true;
}
示例4: ReadGGS
/**
* liest die GlobalGameSettings aus der Datei.
*
* @author OLiver
*/
void SavedFile::ReadGGS(BinaryFile& file)
{
unsigned length = file.ReadUnsignedInt();
boost::interprocess::unique_ptr<unsigned char, Deleter<unsigned char[]> > buffer(new unsigned char[length]);
file.ReadRawData(buffer.get(), length);
Serializer ser(buffer.get(), length);
ggs.Deserialize(ser);
}
示例5: ReadGGS
/**
* liest die GlobalGameSettings aus der Datei.
*
* @author OLiver
*/
void SavedFile::ReadGGS(BinaryFile& file)
{
unsigned length = file.ReadUnsignedInt();
unsigned char* buffer = new unsigned char[length];
file.ReadRawData(buffer, length);
Serializer ser(buffer, length);
ggs.Deserialize(&ser);
delete[] buffer;
}
示例6: ReadPlayerData
/**
*
* @author OLiver
*/
void SavedFile::ReadPlayerData(BinaryFile& file)
{
// ggf. wieder löschen
delete[] players;
players = new SavedFile::Player[player_count];
for(unsigned char i = 0; i < player_count; ++i)
{
players[i].ps = file.ReadUnsignedInt();
if(players[i].ps != PS_LOCKED)
{
file.ReadShortString(players[i].name);
players[i].nation = Nation(file.ReadUnsignedChar());
players[i].color = file.ReadUnsignedChar();
players[i].team = file.ReadUnsignedChar();
}
}
}
示例7: Load
bool Savegame::Load(BinaryFile& file, const bool load_players, const bool load_sgd)
{
// Signatur und Version einlesen
if(!ReadFileHeader(file))
return false;
// Zeitstempel
file.ReadRawData(&save_time, sizeof(save_time));
save_time = libendian::ConvertEndianess<false>::toNative(save_time);
// Map-Name
mapName = file.ReadShortString();
ReadPlayerData(file);
ReadGGS(file);
// Start-GF
start_gf = file.ReadUnsignedInt();
if(load_sgd)
sgd.ReadFromFile(file); // Serialisiertes Spielzeug lesen
return true;
}