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


C++ dumb_ptr::is_mob方法代码示例

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


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

示例1: entity_warp

static
void entity_warp(dumb_ptr<block_list> target, map_local *destm, int destx, int desty)
{
    if (target->bl_type == BL::PC || target->bl_type == BL::MOB)
    {

        switch (target->bl_type)
        {
        case BL::PC:
        {
            dumb_ptr<map_session_data> character = target->is_player();
            clif_clearchar(character, BeingRemoveWhy::WARPED);
            map_delblock(character);
            character->bl_x = destx;
            character->bl_y = desty;
            character->bl_m = destm;

            pc_touch_all_relevant_npcs(character);

            // Note that touching NPCs may have triggered warping and thereby updated x and y:
            MapName map_name = character->bl_m->name_;

            // Warp part #1: update relevant data, interrupt trading etc.:
            pc_setpos(character, map_name, character->bl_x, character->bl_y, BeingRemoveWhy::GONE);
            // Warp part #2: now notify the client
            clif_changemap(character, map_name,
                           character->bl_x, character->bl_y);
            break;
        }
        case BL::MOB:
            target->bl_x = destx;
            target->bl_y = desty;
            target->bl_m = destm;
            clif_fixmobpos(target->is_mob());
            break;
        }
    }
}
开发者ID:monwarez-lof,项目名称:tmwa-current,代码行数:38,代码来源:magic-stmt.cpp

示例2: show_entity

static
FString show_entity(dumb_ptr<block_list> entity)
{
    switch (entity->bl_type)
    {
        case BL::PC:
            return entity->is_player()->status.name.to__actual();
        case BL::NPC:
            return entity->is_npc()->name;
        case BL::MOB:
            return entity->is_mob()->name;
        case BL::ITEM:
            assert (0 && "There is no way this code did what it was supposed to do!");
            /* Sorry about this one... */
            // WTF? item_data is a struct item, not a struct item_data
            // return ((struct item_data *) (&entity->is_item()->item_data))->name;
            abort();
        case BL::SPELL:
            return {"%invocation(ERROR:this-should-not-be-an-entity)"};
        default:
            return {"%unknown-entity"};
    }
}
开发者ID:Binford2000,项目名称:tmwa,代码行数:23,代码来源:magic-expr.cpp

示例3: ladmin_itemfrob_c2

static
void ladmin_itemfrob_c2(dumb_ptr<block_list> bl, ItemNameId source_id, ItemNameId dest_id)
{
#define IFIX(v) if (v == source_id) {v = dest_id; }
#define FIX(item) ladmin_itemfrob_fix_item(source_id, dest_id, &item)

    if (!bl)
        return;

    switch (bl->bl_type)
    {
        case BL::PC:
        {
            dumb_ptr<map_session_data> pc = bl->is_player();

            for (IOff0 j : IOff0::iter())
                IFIX(pc->status.inventory[j].nameid);
            // cart is no longer supported
            // IFIX(pc->status.weapon);
            IFIX(pc->status.shield);
            IFIX(pc->status.head_top);
            IFIX(pc->status.head_mid);
            IFIX(pc->status.head_bottom);

            Option<P<Storage>> stor_ = account2storage2(pc->status_key.account_id);
            if OPTION_IS_SOME(stor, stor_)
            {
                for (SOff0 j : SOff0::iter())
                    FIX(stor->storage_[j]);
            }

            for (IOff0 j : IOff0::iter())
            {
                P<struct item_data> item = TRY_UNWRAP(pc->inventory_data[j], continue);
                if (item->nameid == source_id)
                {
                    item->nameid = dest_id;
                    if (bool(item->equip))
                        pc_unequipitem(pc, j, CalcStatus::NOW);
                    item->nameid = dest_id;
                }
            }

            break;
        }

        case BL::MOB:
        {
            dumb_ptr<mob_data> mob = bl->is_mob();
            for (Item& itm : mob->lootitemv)
                FIX(itm);
            break;
        }

        case BL::ITEM:
        {
            dumb_ptr<flooritem_data> item = bl->is_item();
            FIX(item->item_data);
            break;
        }
    }
#undef FIX
#undef IFIX
}
开发者ID:Rosalila,项目名称:tswa,代码行数:64,代码来源:chrif.cpp


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