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


C++ CharName类代码示例

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


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

示例1: SerializeCharName

/// @copydoc Serializer::SerializeCharName()
void DirectDeserializer::SerializeCharName( CharName& rValue )
{
    if( m_bEndOfStream )
    {
        return;
    }

    size_t count = 0;
    ReadValue( count );
    if( m_bEndOfStream )
    {
        return;
    }

    if( !count )
    {
        rValue.Set( NULL );
        return;
    }

    ThreadLocalStackAllocator stackAllocator;

    size_t byteCount = sizeof( char ) * count;
    char* pNameString = static_cast< char* >( stackAllocator.Allocate( byteCount + sizeof( char ) ) );
    HELIUM_ASSERT( pNameString );
    ReadBytes( pNameString, byteCount );
    if( !m_bEndOfStream )
    {
        pNameString[ count ] = '\0';
        rValue.Set( pNameString );
    }

    stackAllocator.Free( pNameString );
}
开发者ID:euler0,项目名称:Helium,代码行数:35,代码来源:DirectDeserializer.cpp

示例2: mapif_parse_WisRequest

// Wisp/page request to send
static
void mapif_parse_WisRequest(int fd)
{
    static int wisid = 0;

    if (RFIFOW(fd, 2) - 52 <= 0)
    {                           // normaly, impossible, but who knows...
        PRINTF("inter: Wis message doesn't exist.\n");
        return;
    }

    CharName from = stringish<CharName>(RFIFO_STRING<24>(fd, 4));
    CharName to = stringish<CharName>(RFIFO_STRING<24>(fd, 28));

    // search if character exists before to ask all map-servers
    const mmo_charstatus *mcs = search_character(to);
    if (!mcs)
    {
        uint8_t buf[27];
        WBUFW(buf, 0) = 0x3802;
        WBUF_STRING(buf, 2, from.to__actual(), 24);
        WBUFB(buf, 26) = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
        mapif_send(fd, buf, 27);
        // Character exists. So, ask all map-servers
    }
    else
    {
        // to be sure of the correct name, rewrite it
        to = mcs->name;
        // if source is destination, don't ask other servers.
        if (from == to)
        {
            uint8_t buf[27];
            WBUFW(buf, 0) = 0x3802;
            WBUF_STRING(buf, 2, from.to__actual(), 24);
            WBUFB(buf, 26) = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
            mapif_send(fd, buf, 27);
        }
        else
        {
            struct WisData wd {};

            // Whether the failure of previous wisp/page transmission (timeout)
            check_ttl_wisdata();

            wd.id = ++wisid;
            wd.fd = fd;
            size_t len = RFIFOW(fd, 2) - 52;
            wd.src = from;
            wd.dst = to;
            wd.msg = RFIFO_STRING(fd, 52, len);
            wd.tick = gettick();
            wis_db.insert(wd.id, wd);
            mapif_wis_message(&wd);
        }
    }
}
开发者ID:Binford2000,项目名称:tmwa,代码行数:58,代码来源:inter.cpp

示例3: intif_party_checkconflict

// パーティ競合チェック要求
void intif_party_checkconflict(int party_id, int account_id, CharName nick)
{
    WFIFOW(char_fd, 0) = 0x3028;
    WFIFOL(char_fd, 2) = party_id;
    WFIFOL(char_fd, 6) = account_id;
    WFIFO_STRING(char_fd, 10, nick.to__actual(), 24);
    WFIFOSET(char_fd, 34);
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:9,代码来源:intif.cpp

示例4: mapif_party_leaved

// パーティ脱退通知
static
void mapif_party_leaved(int party_id, int account_id, CharName name)
{
    unsigned char buf[34];

    WBUFW(buf, 0) = 0x3824;
    WBUFL(buf, 2) = party_id;
    WBUFL(buf, 6) = account_id;
    WBUF_STRING(buf, 10, name.to__actual(), 24);
    mapif_sendall(buf, 34);
    PRINTF("int_party: party leaved %d %d %s\n", party_id, account_id, name);
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:13,代码来源:int_party.cpp

示例5: intif_wis_message_to_gm

// The transmission of GM only Wisp/Page from server to inter-server
void intif_wis_message_to_gm(CharName Wisp_name, int min_gm_level, ZString mes)
{
    size_t mes_len = mes.size() + 1;
    WFIFOW(char_fd, 0) = 0x3003;
    WFIFOW(char_fd, 2) = mes_len + 30;
    WFIFO_STRING(char_fd, 4, Wisp_name.to__actual(), 24);
    WFIFOW(char_fd, 28) = min_gm_level;
    WFIFO_STRING(char_fd, 30, mes, mes_len);
    WFIFOSET(char_fd, WFIFOW(char_fd, 2));

    if (battle_config.etc_log)
        PRINTF("intif_wis_message_to_gm: from: '%s', min level: %d, message: '%s'.\n",
                Wisp_name, min_gm_level, mes);
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:15,代码来源:intif.cpp

示例6: intif_wis_message

// The transmission of Wisp/Page to inter-server (player not found on this server)
void intif_wis_message(dumb_ptr<map_session_data> sd, CharName nick, ZString mes)
{
    nullpo_retv(sd);

    size_t mes_len = mes.size() + 1;
    WFIFOW(char_fd, 0) = 0x3001;
    WFIFOW(char_fd, 2) = mes_len + 52;
    WFIFO_STRING(char_fd, 4, sd->status.name.to__actual(), 24);
    WFIFO_STRING(char_fd, 28, nick.to__actual(), 24);
    WFIFO_STRING(char_fd, 52, mes, mes_len);
    WFIFOSET(char_fd, WFIFOW(char_fd, 2));

    if (battle_config.etc_log)
        PRINTF("intif_wis_message from %s to %s (message: '%s')\n",
                sd->status.name, nick, mes);
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:17,代码来源:intif.cpp

示例7: convert_for_printf

 friend
 VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); }
开发者ID:qiuhw,项目名称:tmwa,代码行数:2,代码来源:mmo.hpp

示例8:

 friend bool operator >= (const CharName& l, const CharName& r)
 { return l.to__canonical() >= r.to__canonical(); }
开发者ID:qiuhw,项目名称:tmwa,代码行数:2,代码来源:mmo.hpp


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