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


C++ pgettext函数代码示例

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


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

示例1: pgettext

void trapfunc::shotgun(int x, int y)
{
 g->add_msg(_("You trigger a shotgun trap!"));
 g->u.add_memorial_log(pgettext("memorial_male", "Triggered a shotgun trap."),
                       pgettext("memorial_female", "Triggered a shotgun trap."));
 int shots = (one_in(8) || one_in(20 - g->u.str_max) ? 2 : 1);
 if (g->m.tr_at(x, y) == tr_shotgun_1)
  shots = 1;
 if (rng(5, 50) > g->u.get_dodge()) {
  body_part hit = num_bp;
  switch (rng(1, 10)) {
   case  1: hit = bp_feet; break;
   case  2:
   case  3:
   case  4: hit = bp_legs; break;
   case  5:
   case  6:
   case  7:
   case  8:
   case  9: hit = bp_torso; break;
   case 10: hit = bp_head; break;
  }
  int side = random_side(hit);
  g->add_msg(_("Your %s is hit!"), body_part_name(hit, side).c_str());
  g->u.hit(NULL, hit, side, 0, rng(40 * shots, 60 * shots));
 } else
  g->add_msg(_("You dodge the shot!"));
 if (shots == 2 || g->m.tr_at(x, y) == tr_shotgun_1) {
  g->m.spawn_item(x, y, "shotgun_sawn");
  g->m.spawn_item(x, y, "string_6");
  g->m.remove_trap(x, y);
 } else
  g->m.add_trap(x, y, tr_shotgun_1);
}
开发者ID:noppa354,项目名称:Cataclysm-DDA,代码行数:34,代码来源:trapfunc.cpp

示例2: add_msg

void Creature::process_effects()
{
    for( auto it = effects.begin(); it != effects.end(); ++it ) {
        if( !it->second.is_permanent() ) {
            it->second.mod_duration( -1 );
            add_msg( m_debug, "Duration %d", it->second.get_duration() );
        }
    }
    for( auto it = effects.begin(); it != effects.end(); ) {
        if( !it->second.is_permanent() && it->second.get_duration() <= 0 ) {
            const effect_type *type = it->second.get_effect_type();
            if(type->get_remove_message() != "") {
                add_msg( type->lose_game_message_type(), _(type->get_remove_message().c_str()) );
            }
            g->u.add_memorial_log(
                pgettext("memorial_male", type->get_remove_memorial_log().c_str() ),
                pgettext("memorial_female", type->get_remove_memorial_log().c_str()) );
            const auto id = it->second.get_id();
            ++it;
            remove_effect( id );
        } else {
            ++it;
        }
    }
}
开发者ID:3721assistant,项目名称:Cataclysm-DDA,代码行数:25,代码来源:creature.cpp

示例3: matype_id

void activity_handlers::train_finish( player_activity *act, player *p )
{
    const Skill *skill = Skill::skill(act->name);
    if( skill == NULL ) {
        auto &mastyle = matype_id( act->name ).obj();
        // Trained martial arts,
        add_msg(m_good, _("You learn %s."), mastyle.name.c_str());
        //~ %s is martial art
        p->add_memorial_log(pgettext("memorial_male", "Learned %s."),
                            pgettext("memorial_female", "Learned %s."),
                            mastyle.name.c_str());
        p->add_martialart( mastyle.id );
    } else {
        int new_skill_level = p->skillLevel(skill) + 1;
        p->skillLevel(skill).level(new_skill_level);
        add_msg(m_good, _("You finish training %s to level %d."),
                skill->name().c_str(),
                new_skill_level);
        if( new_skill_level % 4 == 0 ) {
            //~ %d is skill level %s is skill name
            p->add_memorial_log(pgettext("memorial_male", "Reached skill level %1$d in %2$s."),
                                pgettext("memorial_female", "Reached skill level %1$d in %2$s."),
                                new_skill_level, skill->name().c_str());
        }
    }
    act->type = ACT_NULL;
}
开发者ID:tetronimo,项目名称:Cataclysm-DDA,代码行数:27,代码来源:activity_handlers.cpp

示例4: _

void trapfunc::dissector( Creature *c, const tripoint &p )
{
    //~ the sound of a dissector dissecting
    sounds::sound( p, 10, _( "BRZZZAP!" ) );
    if( c != nullptr ) {
        c->add_msg_player_or_npc( m_bad, _( "Electrical beams emit from the floor and slice your flesh!" ),
                                  _( "Electrical beams emit from the floor and slice <npcname>s flesh!" ) );
        c->add_memorial_log( pgettext( "memorial_male", "Stepped into a dissector." ),
                             pgettext( "memorial_female", "Stepped into a dissector." ) );
        monster *z = dynamic_cast<monster *>( c );
        player *n = dynamic_cast<player *>( c );
        if( n != nullptr ) {
            n->deal_damage( nullptr, bp_head, damage_instance( DT_CUT, 15 ) );
            n->deal_damage( nullptr, bp_torso, damage_instance( DT_CUT, 20 ) );
            n->deal_damage( nullptr, bp_arm_r, damage_instance( DT_CUT, 12 ) );
            n->deal_damage( nullptr, bp_arm_l, damage_instance( DT_CUT, 12 ) );
            n->deal_damage( nullptr, bp_hand_r, damage_instance( DT_CUT, 10 ) );
            n->deal_damage( nullptr, bp_hand_l, damage_instance( DT_CUT, 10 ) );
            n->deal_damage( nullptr, bp_leg_r, damage_instance( DT_CUT, 12 ) );
            n->deal_damage( nullptr, bp_leg_r, damage_instance( DT_CUT, 12 ) );
            n->deal_damage( nullptr, bp_foot_l, damage_instance( DT_CUT, 10 ) );
            n->deal_damage( nullptr, bp_foot_r, damage_instance( DT_CUT, 10 ) );
        } else if( z != nullptr ) {
            z->apply_damage( nullptr, bp_torso, 60 );
            if( z->is_dead() ) {
                z->explode();
            }
        }
        c->check_dead_state();
    }
}
开发者ID:TheTypoMaster,项目名称:Cataclysm-DDA,代码行数:31,代码来源:trapfunc.cpp

示例5: add_msg

bool Creature::remove_effect(efftype_id eff_id, body_part bp)
{
    if (!has_effect(eff_id, bp)) {
        //Effect doesn't exist, so do nothing
        return false;
    }

    if (is_player()) {
        // Print the removal message and add the memorial log if needed
        if(effect_types[eff_id].get_remove_message() != "") {
            add_msg(effect_types[eff_id].lose_game_message_type(),
                         _(effect_types[eff_id].get_remove_message().c_str()));
        }
        add_memorial_log(pgettext("memorial_male",
                                       effect_types[eff_id].get_remove_memorial_log().c_str()),
                              pgettext("memorial_female",
                                       effect_types[eff_id].get_remove_memorial_log().c_str()));
    }

    // num_bp means remove all of a given effect id
    if (bp == num_bp) {
        effects.erase(eff_id);
    } else {
        effects[eff_id].erase(bp);
        // If there are no more effects of a given type remove the type map
        if (effects[eff_id].empty()) {
            effects.erase(eff_id);
        }
    }
    return true;
}
开发者ID:grimoire,项目名称:Cataclysm-DDA,代码行数:31,代码来源:creature.cpp

示例6: new_eff

/*
 * Effect-related methods
 */
void Creature::add_effect(efftype_id eff_id, int dur, int intensity, bool permanent)
{
    // check if we already have it
    auto found_effect = effects.find( eff_id );

    if (found_effect != effects.end()) {
        effect &e = found_effect->second;
        // if we do, mod the duration
        e.mod_duration(dur);
        // Adding a permanent effect makes it permanent
        if( e.is_permanent() ) {
            e.pause_effect();
        }
        if( e.get_intensity() + intensity <= e.get_max_intensity() ) {
            e.mod_intensity( intensity );
        }
    } else {
        // if we don't already have it then add a new one
        if (effect_types.find(eff_id) == effect_types.end()) {
            return;
        }
        effect new_eff(&effect_types[eff_id], dur, intensity, permanent);
        effects[eff_id] = new_eff;
        if (is_player()) { // only print the message if we didn't already have it
            add_msg( effect_types[eff_id].gain_game_message_type(),
                     effect_types[eff_id].get_apply_message().c_str() );
            g->u.add_memorial_log(pgettext("memorial_male",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()),
                                  pgettext("memorial_female",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()));
        }
    }
}
开发者ID:Krutchen,项目名称:Cataclysm-DDA,代码行数:36,代码来源:creature.cpp

示例7: _

std::vector<std::string> Messages::dialog::filter_help_text( int width )
{
    const auto &help_fmt = _(
                               "Format is [[TYPE]:]TEXT. The values for TYPE are: %s\n"
                               "Examples:\n"
                               "  good:mutation\n"
                               "  :you pick up: 1\n"
                               "  crash!\n"
                           );
    std::stringstream type_text;
    const auto &type_list = msg_type_and_names();
    for( auto it = type_list.begin(); it != type_list.end(); ++it ) {
        // Skip m_debug outside debug mode (but allow searching for it)
        if( debug_mode || it->first != m_debug ) {
            const auto &col_name = get_all_colors().get_name( msgtype_to_color( it->first ) );
            auto next_it = std::next( it );
            // Skip m_debug outside debug mode
            if( !debug_mode && next_it != type_list.end() && next_it->first == m_debug ) {
                next_it = std::next( next_it );
            }
            if( next_it != type_list.end() ) {
                //~ the 2nd %s is a type name, this is used to format a list of type names
                type_text << string_format( pgettext( "message log", "<color_%s>%s</color>, " ),
                                            col_name, pgettext( "message type", it->second ) );
            } else {
                //~ the 2nd %s is a type name, this is used to format the last type name in a list of type names
                type_text << string_format( pgettext( "message log", "<color_%s>%s</color>." ),
                                            col_name, pgettext( "message type", it->second ) );
            }
        }
    }
    return foldstring( string_format( help_fmt, type_text.str() ), width );
}
开发者ID:CleverRaven,项目名称:Cataclysm-DDA,代码行数:33,代码来源:messages.cpp

示例8: pgettext

void trapfunc::board( Creature *c, const tripoint& )
{
    // tiny animals don't trigger spiked boards, they can squeeze between the nails
    if( c != nullptr && c->get_size() == MS_TINY ) {
        return;
    }
    if( c != nullptr ) {
        c->add_memorial_log( pgettext( "memorial_male", "Stepped on a spiked board." ),
                             pgettext( "memorial_female", "Stepped on a spiked board." ) );
        c->add_msg_player_or_npc( m_bad, _( "You step on a spiked board!" ),
                                  _( "<npcname> steps on a spiked board!" ) );
        monster *z = dynamic_cast<monster *>( c );
        player *n = dynamic_cast<player *>( c );
        if( z != nullptr ) {
            z->moves -= 80;
            z->apply_damage( nullptr, bp_foot_l, rng( 3, 5 ) );
            z->apply_damage( nullptr, bp_foot_r, rng( 3, 5 ) );
        } else {
            c->deal_damage( nullptr, bp_foot_l, damage_instance( DT_CUT, rng( 6, 10 ) ) );
            c->deal_damage( nullptr, bp_foot_r, damage_instance( DT_CUT, rng( 6, 10 ) ) );
            if( ( n->has_trait( "INFRESIST" ) ) && ( one_in( 256 ) ) ) {
                n->add_effect( "tetanus", 1, num_bp, true );
            } else if( ( !n->has_trait( "INFIMMUNE" ) || !n->has_trait( "INFRESIST" ) ) && ( one_in( 35 ) ) ) {
                n->add_effect( "tetanus", 1, num_bp, true );
            }
        }
        c->check_dead_state();
    }
}
开发者ID:TheTypoMaster,项目名称:Cataclysm-DDA,代码行数:29,代码来源:trapfunc.cpp

示例9: is_id_functor

void Creature::add_effect(efftype_id eff_id, int dur)
{
    // check if we already have it
    std::vector<effect>::iterator first_eff =
        std::find_if(effects.begin(), effects.end(), is_id_functor(eff_id));

    if (first_eff != effects.end()) {
        // if we do, mod the duration
        first_eff->mod_duration(dur);
    } else {
        // if we don't already have it then add a new one
        if (effect_types.find(eff_id) == effect_types.end()) {
            return;
        }
        effect new_eff(&effect_types[eff_id], dur);
        effects.push_back(new_eff);
        if (is_player()) { // only print the message if we didn't already have it
            g->add_msg_string(effect_types[eff_id].get_apply_message());
            g->u.add_memorial_log(pgettext("memorial_male",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()),
                                  pgettext("memorial_female",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()));
        }
    }
}
开发者ID:Octavianuspg,项目名称:Cataclysm-DDA,代码行数:25,代码来源:creature.cpp

示例10: _

std::string faction::describe() const
{
    std::string ret = _( desc.c_str() );
    ret = ret + "\n\n" + string_format( _( "%1$s have the ultimate goal of %2$s." ), _( name.c_str() ),
                                        pgettext( "faction_goal", facgoal_data[goal].name.c_str() ) );
    if( job2 == FACJOB_NULL ) {
        ret += string_format( _( " Their primary concern is %s." ),
                              pgettext( "faction_job", facjob_data[job1].name.c_str() ) );
    } else {
        ret += string_format( _( " Their primary concern is %1$s, but they are also involved in %2$s." ),
                              pgettext( "faction_job", facjob_data[job1].name.c_str() ),
                              pgettext( "faction_job", facjob_data[job2].name.c_str() ) );
    }
    if( values == 0 ) {
        return ret;
    }
    std::vector<faction_value> vals;
    vals.reserve( NUM_FACVALS );
    for( int i = 0; i < NUM_FACVALS; i++ ) {
        vals.push_back( faction_value( i ) );
    }
    const std::string known_vals = enumerate_as_string( vals.begin(),
    vals.end(), [ this ]( const faction_value val ) {
        return has_value( val ) ? pgettext( "faction_value", facval_data[val].name.c_str() ) : "";
    } );
    if( !known_vals.empty() ) {
        ret += _( " They are known for " ) + known_vals + ".";
    }
    return ret;
}
开发者ID:Barhandar,项目名称:Cataclysm-DDA,代码行数:30,代码来源:faction.cpp

示例11: is_id_functor

void Creature::add_effect(efftype_id eff_id, int dur, int intensity, bool permanent)
{
    // check if we already have it
    std::vector<effect>::iterator first_eff =
        std::find_if(effects.begin(), effects.end(), is_id_functor(eff_id));

    if (first_eff != effects.end()) {
        // if we do, mod the duration
        first_eff->mod_duration(dur);
        // Adding a permanent effect makes it permanent
        if (first_eff->is_permanent()) {
            first_eff->pause_effect();
        }
        if (first_eff->get_intensity() + intensity <= first_eff->get_max_intensity()) {
            first_eff->mod_intensity(intensity);
        }
    } else {
        // if we don't already have it then add a new one
        if (effect_types.find(eff_id) == effect_types.end()) {
            return;
        }
        effect new_eff(&effect_types[eff_id], dur, intensity, permanent);
        effects.push_back(new_eff);
        if (is_player()) { // only print the message if we didn't already have it
            add_msg(effect_types[eff_id].gain_game_message_type(), effect_types[eff_id].get_apply_message().c_str());
            g->u.add_memorial_log(pgettext("memorial_male",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()),
                                  pgettext("memorial_female",
                                           effect_types[eff_id].get_apply_memorial_log().c_str()));
        }
    }
}
开发者ID:Devanon,项目名称:Cataclysm-DDA,代码行数:32,代码来源:creature.cpp

示例12: debugmsg

bool player::install_bionics(it_bionic *type)
{
    if (type == NULL) {
        debugmsg("Tried to install NULL bionic");
        return false;
    }
    if (bionics.count(type->id) == 0) {
        popup("invalid / unknown bionic id %s", type->id.c_str());
        return false;
    }
    if (has_bionic(type->id)) {
        if (!(type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII")) {
            popup(_("You have already installed this bionic."));
            return false;
        }
    }
    int chance_of_success = bionic_manip_cos(int_cur,
                            skillLevel("electronics"),
                            skillLevel("firstaid"),
                            skillLevel("mechanics"),
                            type->difficulty);

    if (!query_yn(
            _("WARNING: %i percent chance of genetic damage, blood loss, or damage to existing bionics! Install anyway?"),
            100 - chance_of_success)) {
        return false;
    }
    int pow_up = 0;
    if (type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII") {
        pow_up = BATTERY_AMOUNT;
        if (type->id == "bio_power_storage_mkII") {
            pow_up = 250;
        }
    }

    practice( "electronics", int((100 - chance_of_success) * 1.5) );
    practice( "firstaid", int((100 - chance_of_success) * 1.0) );
    practice( "mechanics", int((100 - chance_of_success) * 0.5) );
    int success = chance_of_success - rng(1, 100);
    if (success > 0) {
        add_memorial_log(pgettext("memorial_male", "Installed bionic: %s."),
                         pgettext("memorial_female", "Installed bionic: %s."),
                         bionics[type->id]->name.c_str());
        if (pow_up) {
            max_power_level += pow_up;
            add_msg_if_player(m_good, _("Increased storage capacity by %i"), pow_up);
        } else {
            add_msg(m_good, _("Successfully installed %s."), bionics[type->id]->name.c_str());
            add_bionic(type->id);
        }
    } else {
        add_memorial_log(pgettext("memorial_male", "Installed bionic: %s."),
                         pgettext("memorial_female", "Installed bionic: %s."),
                         bionics[type->id]->name.c_str());
        bionics_install_failure(this, type, success);
    }
    g->refresh_all();
    return true;
}
开发者ID:MisterTea,项目名称:Cataclysm-DDA,代码行数:59,代码来源:bionics.cpp

示例13: _

void trapfunc::telepad(int x, int y)
{
    //~ the sound of a telepad functioning
    g->sound(x, y, 6, _("vvrrrRRMM*POP!*"));
    g->add_msg(_("The air shimmers around you..."));
    g->u.add_memorial_log(pgettext("memorial_male", "Triggered a teleport trap."),
                          pgettext("memorial_female", "Triggered a teleport trap."));
    g->teleport();
}
开发者ID:noppa354,项目名称:Cataclysm-DDA,代码行数:9,代码来源:trapfunc.cpp


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