本文整理汇总了C++中player::i_rem方法的典型用法代码示例。如果您正苦于以下问题:C++ player::i_rem方法的具体用法?C++ player::i_rem怎么用?C++ player::i_rem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类player
的用法示例。
在下文中一共展示了player::i_rem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
std::list<item> obtain_activity_items( player_activity &act, player &p )
{
std::list<item> res;
auto items = reorder_for_dropping( p, convert_to_indexes( act ) );
debug_drop_list( items );
while( !items.empty() && ( p.is_npc() || p.moves > 0 || items.front().consumed_moves == 0 ) ) {
const auto &ait = items.front();
p.mod_moves( -ait.consumed_moves );
if( p.is_worn( *ait.it ) ) {
p.takeoff( *ait.it, &res );
} else if( ait.it->count_by_charges() ) {
res.push_back( p.reduce_charges( const_cast<item *>( ait.it ), ait.count ) );
} else {
res.push_back( p.i_rem( ait.it ) );
}
items.pop_front();
}
// Avoid tumbling to the ground. Unload cleanly.
const units::volume excessive_volume = p.volume_carried() - p.volume_capacity();
if( excessive_volume > 0_ml ) {
const auto excess = p.inv.remove_randomly_by_volume( excessive_volume );
res.insert( res.begin(), excess.begin(), excess.end() );
}
// Load anything that remains (if any) into the activity
act.values.clear();
if( !items.empty() ) {
for( const auto &drop : convert_to_indexes( p, items ) ) {
act.values.push_back( drop.first );
act.values.push_back( drop.second );
}
}
// And cancel if its empty. If its not, we modified in place and we will continue
// to resolve the drop next turn. This is different from the pickup logic which
// creates a brand new activity every turn and cancels the old activity
if( act.values.empty() ) {
p.cancel_activity();
}
return res;
}
示例2: while
std::list<item> obtain_activity_items( player_activity &act, player &p )
{
std::list<item> res;
auto items = reorder_for_dropping( p, convert_to_indexes( act ) );
debug_drop_list( items );
while( !items.empty() && ( p.is_npc() || p.moves > 0 || items.front().consumed_moves == 0 ) ) {
const auto &ait = items.front();
p.mod_moves( -ait.consumed_moves );
if( p.is_worn( *ait.it ) ) {
p.takeoff( *ait.it, &res );
} else if( ait.it->count_by_charges() ) {
res.push_back( p.reduce_charges( const_cast<item *>( ait.it ), ait.count ) );
} else {
res.push_back( p.i_rem( ait.it ) );
}
items.pop_front();
}
// Avoid tumbling to the ground. Unload cleanly.
const units::volume excessive_volume = p.volume_carried() - p.volume_capacity();
if( excessive_volume > 0 ) {
const auto excess = p.inv.remove_randomly_by_volume( excessive_volume );
res.insert( res.begin(), excess.begin(), excess.end() );
}
// Load anything that remains (if any) into the activity
act.values.clear();
if( !items.empty() ) {
for( const auto &drop : convert_to_indexes( p, items ) ) {
act.values.push_back( drop.first );
act.values.push_back( drop.second );
}
}
// And either cancel if it's empty, or restart if it's not.
if( act.values.empty() ) {
p.cancel_activity();
} else {
p.assign_activity( act );
}
return res;
}
示例3: remove_dropping_items
void inventory_drop_selector::remove_dropping_items( player &dummy ) const
{
std::map<item *, int> dummy_dropping;
for( const auto &elem : dropping ) {
dummy_dropping[&dummy.i_at( u.get_item_position( elem.first ) )] = elem.second;
}
for( auto &elem : dummy_dropping ) {
if( elem.first->count_by_charges() ) {
elem.first->mod_charges( -elem.second );
} else {
const int pos = dummy.get_item_position( elem.first );
for( int i = 0; i < elem.second; ++i ) {
dummy.i_rem( pos );
}
}
}
}
示例4: mutation_effect
//.........这里部分代码省略.........
// so no HP bonus from the ST above/beyond that from Large
for (int i = 0; i < num_hp_parts; i++) {
p.hp_max[i] -= 6;
}
// And there goes your clothing; by now you shouldn't need it anymore
g->add_msg(_("You rip out of your clothing!"));
destroy = true;
bps.push_back(bp_torso);
bps.push_back(bp_legs);
bps.push_back(bp_arms);
bps.push_back(bp_hands);
bps.push_back(bp_head);
bps.push_back(bp_feet);
} else if (mut == "HUGE_OK") {
p.str_max += 4;
p.recalc_hp();
// Good-Huge still can't fit places but its heart's healthy enough for
// going arond being Huge, so you get the HP
} else if (mut == "STR_UP") {
p.str_max ++;
p.recalc_hp();
} else if (mut == "STR_UP_2") {
p.str_max += 2;
p.recalc_hp();
} else if (mut == "STR_UP_3") {
p.str_max += 4;
p.recalc_hp();
} else if (mut == "STR_UP_4") {
p.str_max += 7;
p.recalc_hp();
} else if (mut == "DEX_UP") {
p.dex_max ++;
} else if (mut == "DEX_UP_2") {
p.dex_max += 2;
} else if (mut == "DEX_UP_3") {
p.dex_max += 4;
} else if (mut == "DEX_UP_4") {
p.dex_max += 7;
} else if (mut == "INT_UP") {
p.int_max ++;
} else if (mut == "INT_UP_2") {
p.int_max += 2;
} else if (mut == "INT_UP_3") {
p.int_max += 4;
} else if (mut == "INT_UP_4") {
p.int_max += 7;
} else if (mut == "PER_UP") {
p.per_max ++;
} else if (mut == "PER_UP_2") {
p.per_max += 2;
} else if (mut == "PER_UP_3") {
p.per_max += 4;
} else if (mut == "PER_UP_4") {
p.per_max += 7;
}
for (int i = 0; i < p.worn.size(); i++) {
for (int j = 0; j < bps.size(); j++) {
if ((dynamic_cast<it_armor*>(p.worn[i].type))->covers & mfb(bps[j])) {
if (destroy) {
if (is_u) {
g->add_msg(_("Your %s is destroyed!"), p.worn[i].tname().c_str());
}
p.worn.erase(p.worn.begin() + i);
}
else {
if (is_u) {
g->add_msg(_("Your %s is pushed off."), p.worn[i].tname().c_str());
}
int pos = player::worn_position_to_index(i);
g->m.add_item_or_charges(p.posx, p.posy, p.worn[i]);
p.takeoff(pos, true);
p.i_rem(pos);
}
// Reset to the start of the vector
i = 0;
}
}
}
}
示例5: move_item
void move_item( player &p, int pos, inventory_location from, inventory_location to )
{
switch( from ) {
case GROUND:
switch( to ) {
case GROUND:
default:
FAIL( "unimplemented" );
break;
case INVENTORY:
pick_up_from_feet( p, pos );
break;
case WORN:
wear_from_feet( p, pos );
break;
case WIELDED_OR_WORN:
if( p.weapon.is_null() ) {
wield_from_feet( p, pos );
} else {
// since we can only wield one item, wear the item instead
wear_from_feet( p, pos );
}
break;
}
break;
case INVENTORY:
switch( to ) {
case GROUND:
drop_at_feet( p, pos );
break;
case INVENTORY:
default:
FAIL( "unimplemented" );
break;
case WORN:
p.wear( pos, false );
break;
case WIELDED_OR_WORN:
if( p.weapon.is_null() ) {
p.wield( p.i_at( pos ) );
} else {
// since we can only wield one item, wear the item instead
p.wear( pos, false );
}
break;
}
break;
case WORN:
switch( to ) {
case GROUND:
drop_at_feet( p, -2 - pos );
break;
case INVENTORY:
p.takeoff( -2 - pos );
break;
case WORN:
case WIELDED_OR_WORN:
default:
FAIL( "unimplemented" );
break;
}
break;
case WIELDED_OR_WORN:
switch( to ) {
case GROUND:
drop_at_feet( p, -1 - pos );
if( pos == 0 && !p.worn.empty() ) {
// wield the first worn item
p.wield( p.i_at( -2 ) );
}
break;
case INVENTORY:
if( pos == 0 ) {
p.i_add( p.i_rem( -1 ) );
} else {
p.takeoff( -1 - pos );
}
if( pos == 0 && !p.worn.empty() ) {
// wield the first worn item
p.wield( p.i_at( -2 ) );
}
break;
case WORN:
case WIELDED_OR_WORN:
default:
FAIL( "unimplemented" );
break;
}
break;
default:
FAIL( "unimplemented" );
break;
}
}
示例6: mutation_effect
//.........这里部分代码省略.........
// Destroy footwear
case PF_HOOVES:
destroy = true;
bps.push_back(bp_feet);
break;
// Destroy torsowear
case PF_SHELL:
destroy = true;
bps.push_back(bp_torso);
break;
// Push off all helmets
case PF_HORNS_CURLED:
case PF_CHITIN3:
bps.push_back(bp_head);
break;
// Push off non-cloth helmets
case PF_HORNS_POINTED:
case PF_ANTENNAE:
case PF_ANTLERS:
bps.push_back(bp_head);
break;
case PF_STR_UP:
p.str_max ++;
p.recalc_hp();
break;
case PF_STR_UP_2:
p.str_max += 2;
p.recalc_hp();
break;
case PF_STR_UP_3:
p.str_max += 4;
p.recalc_hp();
break;
case PF_STR_UP_4:
p.str_max += 7;
p.recalc_hp();
break;
case PF_DEX_UP:
p.dex_max ++;
break;
case PF_DEX_UP_2:
p.dex_max += 2;
break;
case PF_DEX_UP_3:
p.dex_max += 4;
break;
case PF_DEX_UP_4:
p.dex_max += 7;
break;
case PF_INT_UP:
p.int_max ++;
break;
case PF_INT_UP_2:
p.int_max += 2;
break;
case PF_INT_UP_3:
p.int_max += 4;
break;
case PF_INT_UP_4:
p.int_max += 7;
break;
case PF_PER_UP:
p.per_max ++;
break;
case PF_PER_UP_2:
p.per_max += 2;
break;
case PF_PER_UP_3:
p.per_max += 4;
break;
case PF_PER_UP_4:
p.per_max += 7;
break;
}
for (int i = 0; i < p.worn.size(); i++) {
for (int j = 0; j < bps.size(); j++) {
if ((dynamic_cast<it_armor*>(p.worn[i].type))->covers & mfb(bps[j])) {
if (destroy) {
if (is_u)
g->add_msg("Your %s is destroyed!", p.worn[i].tname().c_str());
p.worn.erase(p.worn.begin() + i);
} else {
if (is_u)
g->add_msg("Your %s is pushed off.", p.worn[i].tname().c_str());
char tmp_invlet = p.worn[i].invlet;
g->m.add_item(p.posx, p.posy, p.worn[i]);
p.takeoff( g, p.worn[i].invlet, true );
p.i_rem( tmp_invlet );
}
// Reset to the start of the vector
i = 0;
}
}
}
}
示例7: mutation_effect
//.........这里部分代码省略.........
} else if (mut == "STR_UP_4") {
p.str_max += 7;
p.recalc_hp();
} else if (mut == "STR_ALPHA") {
if (p.str_max <= 7) {
p.str_max = 11;
}
else {
p.str_max = 15;
}
p.recalc_hp();
} else if (mut == "DEX_UP") {
p.dex_max ++;
} else if (mut == "DEX_UP_2") {
p.dex_max += 2;
} else if (mut == "DEX_UP_3") {
p.dex_max += 4;
} else if (mut == "DEX_UP_4") {
p.dex_max += 7;
} else if (mut == "DEX_ALPHA") {
if (p.dex_max <= 7) {
p.dex_max = 11;
}
else {
p.dex_max = 15;
}
} else if (mut == "INT_UP") {
p.int_max ++;
} else if (mut == "INT_UP_2") {
p.int_max += 2;
} else if (mut == "INT_UP_3") {
p.int_max += 4;
} else if (mut == "INT_UP_4") {
p.int_max += 7;
} else if (mut == "INT_ALPHA") {
if (p.int_max <= 7) {
p.int_max = 11;
}
else {
p.int_max = 15;
}
} else if (mut == "PER_UP") {
p.per_max ++;
} else if (mut == "PER_UP_2") {
p.per_max += 2;
} else if (mut == "PER_UP_3") {
p.per_max += 4;
} else if (mut == "PER_UP_4") {
p.per_max += 7;
} else if (mut == "PER_ALPHA") {
if (p.per_max <= 7) {
p.per_max = 11;
}
else {
p.per_max = 15;
}
}
std::string mutation_safe = "OVERSIZE";
for (int i = 0; i < p.worn.size(); i++) {
for (int j = 0; j < bps.size(); j++) {
if ( ((dynamic_cast<it_armor*>(p.worn[i].type))->covers & mfb(bps[j])) &&
(!(p.worn[i].has_flag(mutation_safe))) ) {
if (destroy) {
if (is_u) {
g->add_msg(_("Your %s is destroyed!"), p.worn[i].tname().c_str());
}
p.worn.erase(p.worn.begin() + i);
}
else {
if (is_u) {
g->add_msg(_("Your %s is pushed off."), p.worn[i].tname().c_str());
}
int pos = player::worn_position_to_index(i);
g->m.add_item_or_charges(p.posx, p.posy, p.worn[i]);
p.i_rem(pos);
}
// Reset to the start of the vector
i = 0;
}
}
}
}
示例8: mutation_effect
//.........这里部分代码省略.........
destroy = true;
bps.push_back(bp_mouth);
} else if (mut == "HOOVES") {
// Destroy footwear
destroy = true;
bps.push_back(bp_feet);
} else if (mut == "SHELL") {
// Destroy torsowear
destroy = true;
bps.push_back(bp_torso);
} else if (mut == "HORNS_CURLED" || mut == "CHITIN3") {
// Push off all helmets
bps.push_back(bp_head);
} else if (mut == "HORNS_POINTED" || mut == "ANTENNAE" || mut == "ANTLERS") {
// Push off non-cloth helmets
bps.push_back(bp_head);
} else if (mut == "STR_UP") {
p.str_max ++;
p.recalc_hp();
} else if (mut == "STR_UP_2") {
p.str_max += 2;
p.recalc_hp();
} else if (mut == "STR_UP_3") {
p.str_max += 4;
p.recalc_hp();
} else if (mut == "STR_UP_4") {
p.str_max += 7;
p.recalc_hp();
} else if (mut == "DEX_UP") {
p.dex_max ++;
} else if (mut == "DEX_UP_2") {
p.dex_max += 2;
} else if (mut == "DEX_UP_3") {
p.dex_max += 4;
} else if (mut == "DEX_UP_4") {
p.dex_max += 7;
} else if (mut == "INT_UP") {
p.int_max ++;
} else if (mut == "INT_UP_2") {
p.int_max += 2;
} else if (mut == "INT_UP_3") {
p.int_max += 4;
} else if (mut == "INT_UP_4") {
p.int_max += 7;
} else if (mut == "PER_UP") {
p.per_max ++;
} else if (mut == "PER_UP_2") {
p.per_max += 2;
} else if (mut == "PER_UP_3") {
p.per_max += 4;
} else if (mut == "PER_UP_4") {
p.per_max += 7;
}
for (int i = 0; i < p.worn.size(); i++) {
for (int j = 0; j < bps.size(); j++) {
if ((dynamic_cast<it_armor*>(p.worn[i].type))->covers & mfb(bps[j])) {
if (destroy) {
if (is_u) {
g->add_msg(_("Your %s is destroyed!"), p.worn[i].tname().c_str());
}
p.worn.erase(p.worn.begin() + i);
} else {
if (is_u) {
g->add_msg(_("Your %s is pushed off."), p.worn[i].tname().c_str());
}
char tmp_invlet = p.worn[i].invlet;
g->m.add_item(p.posx, p.posy, p.worn[i]);
p.takeoff( g, p.worn[i].invlet, true );
p.i_rem( tmp_invlet );
}
// Reset to the start of the vector
i = 0;
}
}
}
}