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


C++ disp_name函数代码示例

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


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

示例1: add_msg

int monster::deal_projectile_attack(Creature *source, double missed_by,
                                    const projectile& proj, dealt_damage_instance &dealt_dam) {
    bool u_see_mon = g->u_see(this);
    if (has_flag(MF_HARDTOSHOOT) && !one_in(10 - 10 * (.8 - missed_by)) && // Maxes out at 50% chance with perfect hit
            !proj.wide) {
        if (u_see_mon)
            add_msg(_("The shot passes through %s without hitting."),
            disp_name().c_str());
        return 0;
    }
    // Not HARDTOSHOOT
    // if it's a headshot with no head, make it not a headshot
    if (missed_by < 0.2 && has_flag(MF_NOHEAD)) {
        missed_by = 0.2;
    }
    mdefense mdf;
     if(!is_hallucination() && source != NULL)
        {
        (mdf.*type->sp_defense)(this, &proj);
        }

    // whip has a chance to scare wildlife
    if(proj.proj_effects.count("WHIP") && type->in_category("WILDLIFE") && one_in(3)) {
            add_effect("run", rng(3, 5));
    }

    return Creature::deal_projectile_attack(source, missed_by, proj, dealt_dam);
}
开发者ID:SlewedQuasar890,项目名称:Cataclysm-DDA,代码行数:28,代码来源:monster.cpp

示例2: handle_notification

static void handle_notification(void *arg)
{
    struct lmp_endpoint *ep = arg;
    errval_t err;

    do { // consume messages
        struct lmp_recv_msg msg = LMP_RECV_MSG_INIT;
        err = lmp_endpoint_recv(ep, &msg.buf, NULL);

        if (err_is_ok(err)) {
            if(msg.buf.msglen == 1) {
                domainid_t domid = msg.words[0];

                // XXX: This is done by spawnd now
                if (domid != 0) {
                    debug_printf("Dispatcher with domain ID %"PRIuDOMAINID" exited\n",
                                 domid);
                }
            } else if(msg.buf.msglen == sizeof(struct RAM) / sizeof(uintptr_t) + 1) {
#ifndef __arm__
                //defined(__x86_64__) || defined(__i386__)
                union rammsg {
                    uintptr_t msgwords[LMP_MSG_LENGTH];
                    struct RAM ram;
                } *u;
                u = (union rammsg *)&msg.words;

                /* printf("%s.%d: RAM cap deleted, base = %" PRIxGENPADDR ", bits = %u\n", */
                /*        disp_name(), disp_get_core_id(), ram->base, ram->bits); */

                err = reclaim_memory(u->ram.base, u->ram.bits);
                if(err_is_fail(err)) {
                    DEBUG_ERR(err, "reclaim_memory");
                }
#else
                /* XXX: Disabling memory reclamation on ARM. I
                 * couldn't get the compiler to accept the above code
                 * due to strict aliasing restrictions. I do believe
                 * though that the above is according to the C99
                 * spec. Please help fix it, so that it can be
                 * enabled.
                 */
#endif
            } else {
                printf("%s: Unknown kernel notification of length %zu received\n",
                       disp_name(), msg.buf.msglen);
            }
        } else if (err_no(err) != LIB_ERR_NO_LMP_MSG) {
            DEBUG_ERR(err, "unexpected error from lmp_endpoint_recv");
        }
    } while(err_is_ok(err));

    // re-register
    struct event_closure cl = {
        .handler = handle_notification,
        .arg = arg,
    };
    err = lmp_endpoint_register(ep, get_default_waitset(), cl);
    assert(err_is_ok(err));
}
开发者ID:achreto,项目名称:barrelfish,代码行数:60,代码来源:domain.c

示例3: disp_default

void disp_default(Instruction ins, Emulator *emul)
{
	disp_name(ins);

	printf(" ");
	
	disp_regs_and_imm(ins);
}
开发者ID:HackLinux,项目名称:ARM-emulator,代码行数:8,代码来源:display_ins.c

示例4: va_start

void monster::add_msg_if_npc(game_message_type type, const char *msg, ...) const
{
    va_list ap;
    va_start(ap, msg);
    std::string processed_npc_string = vstring_format(msg, ap);
    processed_npc_string = replace_with_npc_name(processed_npc_string, disp_name());
    add_msg(type, processed_npc_string.c_str());
    va_end(ap);
}
开发者ID:reverieAlice,项目名称:Cataclysm-DDA,代码行数:9,代码来源:monster.cpp

示例5: disp_pop_push

void disp_pop_push(Instruction ins, Emulator *emul)
{

	disp_name(ins);
	printf(" ");

	printf("{");

	if(ins.reg.size > 0)
		disp_regs(ins.reg);

	printf("}");
}
开发者ID:HackLinux,项目名称:ARM-emulator,代码行数:13,代码来源:display_ins.c

示例6: disp_not_decoded

void disp_not_decoded(Instruction ins)
{
	printf("\n");
	disp_name(ins);
	// printf("\n");
	// printf("  name_in: %s\tname_out: %s\n", ins.name_in, ins.name_out);
	// printf("  mask: %8x\topcode: %8x\n", ins.mask, ins.opcode);
	// printf("\n  reg ");
	// disp_plgtab(ins.reg);
	// printf("\n  imm ");
	// disp_plgtab(ins.imm);
	// printf("\n  ext ");
	// disp_plgtab(ins.ext);
}
开发者ID:HackLinux,项目名称:ARM-emulator,代码行数:14,代码来源:display_ins.c

示例7: xeon_phi_manager_client_register

/**
 * \brief registers the Xeon Phi driver card with the Xeon Phi Manager
 *
 * \param svc_iref  iref of the own exported Xeon Phi driver interface
 * \param id        returns the assigned Xeon Phi card ID
 * \param num       returns the size of the cards array
 * \param irefs     returns array of irefs to the other cards
 *
 * NOTE: this is a blocking function. The function will only return after
 *       the Xeon Phi manager connection has been fully established and the
 *       registration protocol has been executed.
 *
 * \returns SYS_ERR_OK on success
 *          errval on failure
 */
errval_t xeon_phi_manager_client_register(iref_t svc_iref,
                                          uint8_t *id,
                                          uint8_t *num,
                                          iref_t **irefs)
{
    errval_t err, msgerr;

    if (strcmp(disp_name(), "xeon_phi") != 0) {
        USER_PANIC("client register called on non xeon phi driver");
        return -1;
    }

    if (conn_state >= XPM_STATE_REGISTER_OK) {
        return SYS_ERR_OK;
    }

    DEBUG_XPMC("Registration with Xeon Phi Manager service.\n");

    err = xpm_bind();
    if (err_is_fail(err)) {
        return err;
    }

    xpm_reg_data.svc_iref = svc_iref;

    xeon_phi_manager_cards_t cards;

    err = xpm_rpc_client.vtbl.register_driver(&xpm_rpc_client, svc_iref, id,
                                              &cards, &msgerr);
    if (err_is_fail(err)) {
        return err;
    }

    if (err_is_fail(msgerr)) {
        return msgerr;
    }
    conn_state = XPM_STATE_REGISTER_OK;

    iref_t *cardiref =calloc(cards.num, sizeof(iref_t));
    assert(cardiref);
    for(uint32_t i = 0; i < cards.num; ++i) {
        cardiref[i] = ((iref_t *)&cards.card0)[i];
    }
    *irefs = cardiref;
    *num = cards.num;

    return SYS_ERR_OK;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:63,代码来源:xeon_phi_manager_client.c

示例8: rng

int monster::deal_melee_attack(Creature *source, int hitroll, bool crit,
                               const damage_instance& d, dealt_damage_instance &dealt_dam) {
    if (has_flag(MF_ELECTRIC)) { // shockers electrocute melee attackers
        if (source != NULL && source->is_player() &&
                !g->u.wearing_something_on(bp_hands) &&
                (g->u.weapon.conductive() || g->u.unarmed_attack())
                ) {
            damage_instance shock;
            shock.add_damage(DT_ELECTRIC, rng(0,1));
            source->deal_damage(this, bp_arms, 1, shock);
            g->add_msg_if_player(source, _("Contact with %s shocks you!"),
                    disp_name().c_str());
        }
    }
    return Creature::deal_melee_attack(source, hitroll, crit, d, dealt_dam);
}
开发者ID:JedrekD,项目名称:Cataclysm-DDA,代码行数:16,代码来源:monster.cpp

示例9: select_body_part

void Creature::deal_melee_hit(Creature *source, int hit_spread, bool critical_hit,
                              const damage_instance &dam, dealt_damage_instance &dealt_dam)
{
    damage_instance d = dam; // copy, since we will mutate in block_hit

    body_part bp_hit = select_body_part(source, hit_spread);
    block_hit(source, bp_hit, d);

    // Bashing crit
    if (critical_hit) {
        int turns_stunned = (d.type_damage(DT_BASH) + hit_spread) / 20;
        if (turns_stunned > 6) {
            turns_stunned = 6;
        }
        if (turns_stunned > 0) {
            add_effect("stunned", turns_stunned);
        }
    }

    // Stabbing effects
    int stab_moves = rng(d.type_damage(DT_STAB) / 2, d.type_damage(DT_STAB) * 1.5);
    if (critical_hit) {
        stab_moves *= 1.5;
    }
    if (stab_moves >= 150) {
        if (is_player() && (!g->u.has_trait("LEG_TENT_BRACE") || g->u.footwear_factor() == 1 ||
                            (g->u.footwear_factor() == .5 && one_in(2))) ) {
            // can the player force their self to the ground? probably not.
            source->add_msg_if_npc( m_bad, _("<npcname> forces you to the ground!"));
        } else {
            source->add_msg_player_or_npc( m_good, _("You force %s to the ground!"),
                                           _("<npcname> forces %s to the ground!"),
                                           disp_name().c_str() );
        }
        if (!g->u.has_trait("LEG_TENT_BRACE") || g->u.footwear_factor() == 1 ||
            (g->u.footwear_factor() == .5 && one_in(2))) {
            add_effect("downed", 1);
            mod_moves(-stab_moves / 2);
        }
    } else {
        mod_moves(-stab_moves);
    }

    on_gethit(source, bp_hit, d); // trigger on-gethit events
    dealt_dam = deal_damage(source, bp_hit, d);
    dealt_dam.bp_hit = bp_hit;
}
开发者ID:Abbysynth,项目名称:Cataclysm-DDA,代码行数:47,代码来源:creature.cpp

示例10: spawn_symval_lookup_idx

/**
 * \brief looks up the symbol by a given index
 *
 * \param idx       the index of the symbol to look up
 * \param ret_name  returns the name of the symbol
 * \param ret_addr  returns the address of the symbol
 *
 * \returns SYS_ERR_OK on success
 *          errval on failure
 */
errval_t spawn_symval_lookup_idx(uint32_t idx,
                                 char **ret_name,
                                 genvaddr_t *ret_addr)
{
    if (symvals) {
        if (symvals[idx].addr != 0) {
            if (ret_name) {
                *ret_name = symvals[idx].name;
            }
            if (ret_addr) {
                *ret_addr = symvals[idx].addr;
            }
        }
    }

    return spawn_symval_lookup(disp_name(), idx, ret_name, ret_addr);
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:27,代码来源:spawn_omp.c

示例11: disp_name

int monster::deal_projectile_attack(Creature *source, double missed_by,
                                    const projectile& proj, dealt_damage_instance &dealt_dam) {
    bool u_see_mon = g->u_see(this);
    if (has_flag(MF_HARDTOSHOOT) && !one_in(10 - 10 * (.8 - missed_by)) && // Maxes out at 50% chance with perfect hit
            !proj.wide) {
        if (u_see_mon)
            g->add_msg(_("The shot passes through the %s without hitting."),
            disp_name().c_str());
        return 0;
    } 
    // Not HARDTOSHOOT
    // if it's a headshot with no head, make it not a headshot
    if (missed_by < 0.2 && has_flag(MF_NOHEAD)) {
        missed_by = 0.2;
    }
    return Creature::deal_projectile_attack(source, missed_by, proj, dealt_dam);
}
开发者ID:JedrekD,项目名称:Cataclysm-DDA,代码行数:17,代码来源:monster.cpp

示例12: va_start

void monster::add_msg_if_npc(game_message_type type, const char *msg, ...)
{
    va_list ap;
    va_start(ap, msg);
    std::string processed_npc_string = vstring_format(msg, ap);
    // These strings contain the substring <npcname>,
    // if present replace it with the actual monster name.
    size_t offset = processed_npc_string.find("<npcname>");
    if (offset != std::string::npos) {
        processed_npc_string.replace(offset, 9, disp_name());
        if (offset == 0 && !processed_npc_string.empty()) {
            capitalize_letter(processed_npc_string, 0);
        }
    }
    add_msg(type, processed_npc_string.c_str());
    va_end(ap);
}
开发者ID:SlewedQuasar890,项目名称:Cataclysm-DDA,代码行数:17,代码来源:monster.cpp

示例13: disp_ldr

void disp_ldr(Instruction ins, Emulator *emul)
{
	disp_name(ins);
	printf(" ");

	disp_reg_name(ins.reg.plages[0]);

	printf(", [");
	disp_reg_name(ins.reg.plages[1]);

	if(ins.imm.size > 0 && ins.imm.plages->value > 0)
	{
		printf(", ");
		disp_imm(ins.imm);
	}

	printf("]");

}
开发者ID:HackLinux,项目名称:ARM-emulator,代码行数:19,代码来源:display_ins.c

示例14: disp_sub_sp

void disp_sub_sp(Instruction ins, Emulator *emul)
{
	disp_name(ins);

	printf(" ");


	if(ins.reg.size > 0)
		disp_regs(ins.reg);
	else
		printf("sp");


	printf(", sp");

	if(ins.imm.size > 0)
	{
		printf(", ");
		disp_imm(ins.imm);
	}
}
开发者ID:HackLinux,项目名称:ARM-emulator,代码行数:21,代码来源:display_ins.c

示例15: select_body_part

void Creature::deal_melee_hit( Creature *source, int hit_spread, bool critical_hit,
                               const damage_instance &dam, dealt_damage_instance &dealt_dam )
{
    damage_instance d = dam; // copy, since we will mutate in block_hit

    body_part bp_hit = select_body_part(source, hit_spread);
    block_hit(source, bp_hit, d);

    // Bashing critical
    if( critical_hit && !is_immune_effect( effect_stunned ) ) {
        if( d.type_damage(DT_BASH) * hit_spread > get_hp_max() ) {
            add_effect( effect_stunned, 1_turns ); // 1 turn is enough
        }
    }

    // Stabbing effects
    int stab_moves = rng( d.type_damage(DT_STAB) / 2,
                          d.type_damage(DT_STAB) * 1.5 );
    if (critical_hit) {
        stab_moves *= 1.5;
    }
    if( stab_moves >= 150 && !is_immune_effect( effect_downed ) ) {
        if( is_player() ) {
            source->add_msg_if_npc( m_bad, _("<npcname> forces you to the ground!"));
        } else {
            source->add_msg_player_or_npc( m_good, _("You force %s to the ground!"),
                                           _("<npcname> forces %s to the ground!"),
                                           disp_name().c_str() );
        }

        add_effect( effect_downed, 1_turns );
        mod_moves(-stab_moves / 2);
    } else {
        mod_moves(-stab_moves);
    }

    on_hit( source, bp_hit ); // trigger on-gethit events
    dealt_dam = deal_damage(source, bp_hit, d);
    dealt_dam.bp_hit = bp_hit;
}
开发者ID:ProfoundDarkness,项目名称:Cataclysm-DDA,代码行数:40,代码来源:creature.cpp


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