• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ disp_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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)
            Messages::player_messages.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);
        }
    return Creature::deal_projectile_attack(source, missed_by, proj, dealt_dam);
}
开发者ID:Rayvien,项目名称:Cataclysm-DDA,代码行数:22,代码来源:monster.cpp


示例17: mod_moves

void monster::melee_attack(Creature &target, bool, matec_id) {
    mod_moves(-100);
    if (type->melee_dice == 0) { // We don't attack, so just return
        return;
    }
    add_effect("hit_by_player", 3); // Make us a valid target for a few turns

    if (has_flag(MF_HIT_AND_RUN)) {
        add_effect("run", 4);
    }

    bool u_see_me = g->u_see(this);

    body_part bp_hit;
    //int highest_hit = 0;
    int hitstat = type->melee_skill;
    int hitroll = dice(hitstat,10);

    damage_instance damage;
    if(!is_hallucination()) {
        if (type->melee_dice > 0) {
            damage.add_damage(DT_BASH,
                    dice(type->melee_dice,type->melee_sides));
        }
        if (type->melee_cut > 0) {
            damage.add_damage(DT_CUT, type->melee_cut);
        }
    }

    /* TODO: height-related bodypart selection
    //If the player is knocked down or the monster can fly, any body part is a valid target
    if(target.is_on_ground() || has_flag(MF_FLIES)){
        highest_hit = 20;
    }
    else {
        switch (type->size) {
        case MS_TINY:
            highest_hit = 3;
        break;
        case MS_SMALL:
            highest_hit = 12;
        break;
        case MS_MEDIUM:
            highest_hit = 20;
        break;
        case MS_LARGE:
            highest_hit = 28;
        break;
        case MS_HUGE:
            highest_hit = 35;
        break;
        }
        if (digging()){
            highest_hit -= 8;
        }
        if (highest_hit <= 1){
            highest_hit = 2;
        }
    }

    if (highest_hit > 20){
        highest_hit = 20;
    }

    int bp_rand = rng(0, highest_hit - 1);
    if (bp_rand <=  2){
        bp_hit = bp_legs;
    } else if (bp_rand <= 10){
        bp_hit = bp_torso;
    } else if (bp_rand <= 14){
        bp_hit = bp_arms;
    } else if (bp_rand <= 16){
        bp_hit = bp_mouth;
    } else if (bp_rand == 18){
        bp_hit = bp_eyes;
    } else{
        bp_hit = bp_head;
    }
    */

    dealt_damage_instance dealt_dam;
    int hitspread = target.deal_melee_attack(this, hitroll);
    if (hitspread >= 0) {
        target.deal_melee_hit(this, hitspread, false, damage, dealt_dam);
    }
    bp_hit = dealt_dam.bp_hit;

    if (hitspread < 0) { // a miss
        // TODO: characters practice dodge when a hit misses 'em
        if (target.is_player()) {
            if (u_see_me) {
                add_msg(_("You dodge %1$s."), disp_name().c_str());
            } else {
                add_msg(_("You dodge an attack from an unseen source."));
            }
        } else {
            if (u_see_me) {
                add_msg(_("The %1$s dodges %2$s attack."), name().c_str(),
                            target.disp_name(true).c_str());
            }
//.........这里部分代码省略.........
开发者ID:SlewedQuasar890,项目名称:Cataclysm-DDA,代码行数:101,代码来源:monster.cpp


示例18: lwip_init_ex

/**
 * Perform Sanity check of user-configurable values, and initialize all modules.
 *
 * \param card_name Name of service implementing ethernet driver
 * \param queueid Queueid which is allocated to this application
 * \param opt_waitset Optional pointer to waitset to be used by LWIP
 * \param opt_mutex Optional pointer to mutex to protect multi-threaded domains
 *
 * \returns True iff init completes
 */
bool lwip_init_ex(const char *card_name, uint64_t queueid,
                  struct waitset *opt_waitset, struct thread_mutex *opt_mutex)
{
    printf("lwip_init_ex: starting......................\n");
    DEBUGPRINTPS("LWIP_other: Inside lwip_init\n");
    static bool run_once;

    if (run_once) {
        return false;
    }
    run_once = true;

    if (opt_waitset == NULL) {
        printf("#### %s Going ahead with default wait-set\n", disp_name());
        lwip_waitset = get_default_waitset();
    } else {
        printf("#### %s Going ahead with non-default wait-set\n", disp_name());
//        lwip_waitset = get_default_waitset();
        lwip_waitset = opt_waitset;
    }

    if (opt_mutex != NULL) {
        lwip_mutex = opt_mutex;
    }

    /* Sanity check user-configurable values */
    lwip_sanity_check();
    DEBUGPRINTPS("LWIP: lwip_init: done with sanity check\n");
    printf("LWIP: done with sanity check\n");
    /* Modules initialization */
    char port_manager_name[MAX_NET_SERVICE_NAME_LEN];

    snprintf(port_manager_name, sizeof(port_manager_name), "%s%s",
             card_name, NET_PORTS_MNG_SUFFIX);

    // Connecting to the port_manager_service
    idc_connect_port_manager_service(port_manager_name);


    if (is_ctl != 1) {
        // connecting to ARP lookup service
        // Doing this before everything else so that we know all needed
        // services are up and running.
        char ARP_service_name[MAX_NET_SERVICE_NAME_LEN];
        snprintf(ARP_service_name, sizeof(ARP_service_name), "%s%s",
             card_name, NET_ARP_LOOKUP_SUFFIX);
        idc_connect_ARP_lookup_service(ARP_service_name);
    }

    DEBUGPRINTPS("LWIP: lwip_init: done with connection setup\n");
    printf("LWIP: done with connection setup\n");
    remaining_lwip_initialization((char *) card_name, queueid);

    if (is_ctl != 1) {
        DEBUGPRINTPS("getting IP from ARP service\n");
        printf("LWIP: getting IP from ARP service\n");
        idc_get_ip_from_ARP_lookup();
    }

    // Register timers... (TCP only)
    // FIXME: These timers should be added only when first TCP connection
    // is requested and not when networking is started!!!!
    static struct periodic_event tcp_timer;
    errval_t err = periodic_event_create(&tcp_timer, lwip_waitset,
                                         TCP_TMR_INTERVAL * 1000,
                                         MKCLOSURE((void (*)(void *))
                                                   call_tcp_tmr, NULL));
    assert(err_is_ok(err));

    // FIXME: I am not sure if this should be in the codepath for both
    // is_ctl and non-is_ctl.  Specially becasuse non is_ctl is anyways
    // adding one interface with idc_get_ip* call.

    // Bring interface up
    struct ip_addr ipaddr, netmask, gw;

    ip_addr_set(&ipaddr, IP_ADDR_ANY);
    ip_addr_set(&netmask, IP_ADDR_ANY);
    ip_addr_set(&gw, IP_ADDR_ANY);
    struct netif *n = netif_add(&netif, &ipaddr, &netmask, &gw,
                                NULL, bfeth_init, ethernet_input);

    assert(n != NULL);
    extern bool lwip_init_done;
    lwip_init_done = true;

    printf("lwip_init_ex: done......................\n");
    return true;
}
开发者ID:Karamax,项目名称:arrakis,代码行数:99,代码来源:init.c


示例19: remaining_lwip_initialization

static void remaining_lwip_initialization(char *card_name, uint64_t queueid)
{
    nb = netbench_alloc("app", RECORDED_EVENTS_COUNT);
    //asq: connect to the NIC driver, before doing anything else
    idc_connect_to_driver(card_name, queueid);
    DEBUGPRINTPS("Connected to driver [%s]\n", card_name);
    stats_init();
    sys_init();
    DEBUGPRINTPS("remaining_lwip_init: allocating pbuf memory\n");
#ifdef CONFIG_QEMU_NETWORK
    printf("#### Networking with small amount of memory #####\n");
#endif // CONFIG_QEMU_NETWORK
    printf("#### [%u:%"PRIuDOMAINID":%s] [%s] [%d] MEM_SIZE[%d], "
            "PBUF_POOL_SIZE[%d], MEMP_MAX[%d],  RECEIVE_BUFFERS[%d] qid[%"PRIu64"]####\n",
       disp_get_core_id(), disp_get_domain_id(), disp_name(),
       MEM_CONF_LOC, is_ctl, MEM_SIZE, PBUF_POOL_SIZE, MEMP_MAX,
       RECEIVE_BUFFERS, queueid);

    memp_init();                // 0'st buffer

    DEBUGPRINTPS("remaining_lwip_init: allocating memory for sending\n");
    mem_init();                 // 1'th buffer
    DEBUGPRINTPS("remaining_lwip_init: done with memroy allocation\n");

    DEBUGPRINTPS("LWIP: lwip_starting\n");
    netif_init();
#if LWIP_SOCKET
    lwip_socket_init();
#endif                          /* LWIP_SOCKET */
    ip_init();
    DEBUGPRINTPS("r_lwip_init: done ip_init\n");
#if LWIP_ARP
    etharp_init();
#endif                          /* LWIP_ARP */
#if LWIP_RAW
    raw_init();
#endif                          /* LWIP_RAW */
#if LWIP_UDP
    udp_init();
    DEBUGPRINTPS("r_lwip_init: done udp_init\n");
#endif                          /* LWIP_UDP */
#if LWIP_TCP
    tcp_init();
    DEBUGPRINTPS("r_lwip_init: done tcp_init\n");
#endif                          /* LWIP_TCP */
#if LWIP_SNMP
    snmp_init();
    DEBUGPRINTPS("r_lwip_init: done snmp_init\n");
#endif                          /* LWIP_SNMP */
#if LWIP_AUTOIP
    autoip_init();
    DEBUGPRINTPS("r_lwip_init: done autoip_init\n");
#endif                          /* LWIP_AUTOIP */
#if LWIP_IGMP
    igmp_init();
    DEBUGPRINTPS("r_lwip_init: done igmp_init\n");
#endif                          /* LWIP_IGMP */
    DEBUGPRINTPS("r_lwip_init: done2 igmp_init\n");
#if LWIP_DNS
    DEBUGPRINTPS("r_lwip_init: starting DNS_init\n");
    dns_init();
    DEBUGPRINTPS("r_lwip_init: done DNS_init\n");
#endif                          /* LWIP_DNS */
    DEBUGPRINTPS("LWIP: lwip_started\n");
}
开发者ID:Karamax,项目名称:arrakis,代码行数:65,代码来源:init.c


示例20: mod_moves

void monster::melee_attack(Creature &target, bool, matec_id) {
    mod_moves(-100);
    if (type->melee_dice == 0) { // We don't attack, so just return
        return;
    }
    add_effect("hit_by_player", 3); // Make us a valid target for a few turns

    if (has_flag(MF_HIT_AND_RUN)) {
        add_effect("run", 4);
    }

    bool u_see_me = g->u_see(this);

    body_part bp_hit;
    //int highest_hit = 0;

    damage_instance damage;
    if(!is_hallucination()) {
        if (type->melee_dice > 0) {
            damage.add_damage(DT_BASH,
                    dice(type->melee_dice,type->melee_sides));
        }
        if (type->melee_cut > 0) {
            damage.add_damage(DT_CUT, type->melee_cut);
        }
    }

    dealt_damage_instance dealt_dam;
    int hitspread = target.deal_melee_attack(this, hit_roll());
    if (hitspread >= 0) {
        target.deal_melee_hit(this, hitspread, false, damage, dealt_dam);
    }
    bp_hit = dealt_dam.bp_hit;

    if (hitspread < 0) { // a miss
        // TODO: characters practice dodge when a hit misses 'em
        if (target.is_player()) {
            if (u_see_me) {
                add_msg(_("You dodge %s."), disp_name().c_str());
            } else {
                add_msg(_("You dodge an attack from an unseen source."));
            }
        } else {
            if (u_see_me) {
                add_msg(_("The %1$s dodges %2$s attack."), name().c_str(),
                            target.disp_name(true).c_str());
            }
        }
    //Hallucinations always produce messages but never actually deal damage
    } else if (is_hallucination() || dealt_dam.total_damage() > 0) {
        if (target.is_player()) {
            if (u_see_me) {
                //~ 1$s is attacker name, 2$s is bodypart name in accusative.
                add_msg(m_bad, _("The %1$s hits your %2$s."), name().c_str(),
                        body_part_name_accusative(bp_hit).c_str());
            } else {
                //~ %s is bodypart name in accusative.
                add_msg(m_bad, _("Something hits your %s."),
                        body_part_name_accusative(bp_hit).c_str());
            }
        } else {
            if (u_see_me) {
                //~ 1$s is attacker name, 2$s is target name, 3$s is bodypart name in accusative.
                add_msg(_("The %1$s hits %2$s %3$s."), name().c_str(),
                            target.disp_name(true).c_str(),
                            body_part_name_accusative(bp_hit).c_str());
            }
        }
    } else {
        if (target.is_player()) {
            if (u_see_me) {
                //~ 1$s is attacker name, 2$s is bodypart name in accusative, 3$s is armor name
                add_msg(_("The %1$s hits your %2$s, but your %3$s protects you."), name().c_str(),
                        body_part_name_accusative(bp_hit).c_str(), target.skin_name().c_str());
            } else {
                //~ 1$s is bodypart name in accusative, 2$s is armor name.
                add_msg(_("Something hits your %1$s, but your %2$s protects you."),
                        body_part_name_accusative(bp_hit).c_str(), target.skin_name().c_str());
            }
        } else {
            if (u_see_me) {
                //~ $1s is monster name, %2$s is that monster target name,
                //~ $3s is target bodypart name in accusative, 4$s is target armor name.
                add_msg(_("The %1$s hits %2$s %3$s but is stopped by %2$s %4$s."), name().c_str(),
                            target.disp_name(true).c_str(),
                            body_part_name_accusative(bp_hit).c_str(),
                            target.skin_name().c_str());
            }
        }
    }

    if (is_hallucination()) {
        if(one_in(7)) {
            die( nullptr );
        }
        return;
    }

    // Adjust anger/morale of same-species monsters, if appropriate
    int anger_adjust = 0, morale_adjust = 0;
//.........这里部分代码省略.........
开发者ID:donhayes,项目名称:Cataclysm-DDA,代码行数:101,代码来源:monster.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ disp_str函数代码示例发布时间:2022-05-30
下一篇:
C++ disp函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap