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


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

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


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

示例1: WritePlayerData

void SavedFile::WritePlayerData(BinaryFile& file)
{
    // Spielerdaten
    for(std::vector<Player>::const_iterator it = players.begin(); it != players.end(); ++it)
    {
        file.WriteUnsignedInt(it->ps);

        if(it->ps != PS_LOCKED)
        {
            file.WriteShortString(it->name);
            file.WriteUnsignedChar(it->nation);
            file.WriteUnsignedInt(it->color);
            file.WriteUnsignedChar(it->team);
        }
    }
}
开发者ID:jonathan-reisdorf,项目名称:s25client,代码行数:16,代码来源:GameSavedFile.cpp

示例2: WritePlayerData

/**
 *
 *  @author OLiver
 */
void SavedFile::WritePlayerData(BinaryFile& file)
{
    // Spielerdaten
    for(unsigned char i = 0; i < player_count; ++i)
    {
        file.WriteUnsignedInt(players[i].ps);

        if(players[i].ps != PS_LOCKED)
        {
            file.WriteShortString(players[i].name);
            file.WriteUnsignedChar(players[i].nation);
            file.WriteUnsignedChar(players[i].color);
            file.WriteUnsignedChar(players[i].team);
        }
    }
}
开发者ID:lweberk,项目名称:s25client,代码行数:20,代码来源:GameSavedFile.cpp

示例3: Save

/**
 *
 *  @author OLiver
 */
bool Savegame::Save(BinaryFile& file)
{
    // Versionszeug schreiben
    WriteVersion(file, 8, SAVE_SIGNATURE, SAVE_VERSION);

    // Timestamp der Aufzeichnung
    unser_time_t tmpTime = libendian::ConvertEndianess<false>::fromNative(save_time);
    file.WriteRawData(&tmpTime, 8);

    // Mapname
    file.WriteShortString(map_name);

    // Anzahl Spieler
    file.WriteUnsignedChar(GetPlayerCount());

    // Größe der Spielerdaten (später ausfüllen)
    unsigned players_size = 0;
    unsigned players_pos = file.Tell();
    file.WriteUnsignedInt(players_size);

    // Spielerdaten
    WritePlayerData(file);

    // Wieder zurückspringen und Größe des Spielerblocks eintragen
    unsigned new_pos = file.Tell();
    file.Seek(players_pos, SEEK_SET);
    file.WriteUnsignedInt(new_pos - players_pos - 4);
    file.Seek(new_pos, SEEK_SET);

    // GGS
    WriteGGS(file);

    // Start-GF
    file.WriteUnsignedInt(start_gf);

    // Serialisiertes Spielzeug reinschreiben
    sgd.WriteToFile(file);

    return true;
}
开发者ID:gattschardo,项目名称:s25client,代码行数:44,代码来源:GameSavegame.cpp

示例4: Save

bool Savegame::Save(BinaryFile& file)
{
    // Versionszeug schreiben
    WriteFileHeader(file);

    // Timestamp der Aufzeichnung
    unser_time_t tmpTime = libendian::ConvertEndianess<false>::fromNative(save_time);
    file.WriteRawData(&tmpTime, sizeof(tmpTime));

    // Mapname
    file.WriteShortString(mapName);

    WritePlayerData(file);
    WriteGGS(file);

    // Start-GF
    file.WriteUnsignedInt(start_gf);

    // Serialisiertes Spielzeug reinschreiben
    sgd.WriteToFile(file);

    return true;
}
开发者ID:vader1986,项目名称:s25client,代码行数:23,代码来源:Savegame.cpp


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