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


C++ MessageIn::readUInt16方法代码示例

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


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

示例1: processTradeItemAdd

void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
{
    const int amount = msg.readInt32("amount");
    const int type = msg.readInt16("type");
    const uint8_t identify = msg.readUInt8("identify");
    msg.readUInt8("attribute");
    const uint8_t refine = msg.readUInt8("refine");
    int cards[maxCards];
    for (int f = 0; f < maxCards; f++)
        cards[f] = msg.readUInt16("card");

    if (tradeWindow)
    {
        if (type == 0)
        {
            tradeWindow->setMoney(amount);
        }
        else
        {
            tradeWindow->addItem2(type,
                ItemType::Unknown,
                cards,
                4,
                false,
                amount,
                refine,
                ItemColor_one,
                fromBool(identify, Identified),
                Damaged_false,
                Favorite_false,
                Equipm_false);
        }
    }
}
开发者ID:dreamsxin,项目名称:ManaPlus,代码行数:34,代码来源:traderecv.cpp

示例2: processReadMail

void MailRecv::processReadMail(Net::MessageIn &msg)
{
    const int sz = msg.readInt16("len") - 101;
    MailMessage *const mail = new MailMessage;
    mail->id = msg.readInt32("message id");
    mail->title = msg.readString(40, "title");
    mail->sender = msg.readString(24, "sender name");
    msg.readInt32("unused");
    mail->money = msg.readInt32("money");
    mail->itemAmount = msg.readInt32("item amount");
    mail->itemId = msg.readInt16("item id");
    mail->itemType = msg.readInt16("item type");
    mail->itemIdentify = msg.readUInt8("identify");
    mail->itemAttribute = msg.readUInt8("attribute");
    mail->itemRefine = msg.readUInt8("refine");
    for (int f = 0; f < maxCards; f ++)
        mail->card[f] = msg.readUInt16("card");
    const int msgLen = msg.readUInt8("msg len");
    if (msgLen != sz)
        logger->log("error: wrong message size");
    mail->text = msg.readString(sz, "message");
    msg.readUInt8("zero");
    mail->strTime = timeToStr(mail->time);
    mailWindow->showMessage(mail);
}
开发者ID:dreamsxin,项目名称:ManaPlus,代码行数:25,代码来源:mailrecv.cpp

示例3: processAuctionResults

void AuctionRecv::processAuctionResults(Net::MessageIn &msg)
{
    UNIMPLEMENTEDPACKET;
    msg.readInt16("len");
    msg.readInt32("pages");
    const int itemCount = msg.readInt32("items count");
    for (int f = 0; f < itemCount; f ++)
    {
        msg.readInt32("auction id");
        msg.readString(24, "seller name");
        msg.readInt16("item id");  // here item always 16 bit
        msg.readInt32("auction type");
        msg.readInt16("item amount");  // always 1
        msg.readUInt8("identify");
        msg.readUInt8("attribute");
        msg.readUInt8("refine");
        for (int d = 0; d < maxCards; d ++)
            msg.readUInt16("card");  // here item always 16 bit
        msg.readInt32("price");
        msg.readInt32("buy now");
        msg.readString(24, "buyer name");
        msg.readInt32("timestamp");
        // +++ need use ItemColorManager for color
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:25,代码来源:auctionrecv.cpp


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