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


C++ BinaryFile::ReadShortString方法代码示例

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


在下文中一共展示了BinaryFile::ReadShortString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
        }
    }
}
开发者ID:jonathan-reisdorf,项目名称:s25client,代码行数:15,代码来源:GameSavedFile.cpp

示例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;
}
开发者ID:jhkl,项目名称:s25client,代码行数:52,代码来源:GameSavegame.cpp

示例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;
}
开发者ID:gattschardo,项目名称:s25client,代码行数:49,代码来源:GameSavegame.cpp

示例4: 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();
        }
    }
}
开发者ID:lweberk,项目名称:s25client,代码行数:23,代码来源:GameSavedFile.cpp

示例5: 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;
}
开发者ID:vader1986,项目名称:s25client,代码行数:24,代码来源:Savegame.cpp


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