Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate stealing code #36596

Merged
merged 9 commits into from
Jan 2, 2020
43 changes: 12 additions & 31 deletions src/pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,12 +858,6 @@ void Pickup::pick_up( const tripoint &p, int min, from_where get_items_from )
wprintw( w_pickup, " - " );
}
std::string item_name;
std::string stolen;
bool stealing = false;
if( !this_item.is_owned_by( g->u, true ) ) {
stolen = "<color_light_red>!</color>";
stealing = true;
}
if( stacked_here[true_it].front()->is_money() ) {
//Count charges
// TODO: transition to the item_location system used for the inventory
Expand All @@ -882,38 +876,25 @@ void Pickup::pick_up( const tripoint &p, int min, from_where get_items_from )
it != stacked_here[true_it].end() && c > 0; ++it, --c ) {
charges += ( *it )->charges;
}
if( stealing ) {
item_name = string_format( "%s %s", stolen,
stacked_here[true_it].front()->display_money( getitem[true_it].count, charges_total, charges ) );
} else {
item_name = stacked_here[true_it].front()->display_money( getitem[true_it].count, charges_total,
charges );
}
item_name = stacked_here[true_it].front()->display_money( getitem[true_it].count, charges_total,
charges );
}
} else {
if( stealing ) {
item_name = string_format( "%s %s", stolen,
this_item.display_name( stacked_here[true_it].size() ) );
} else {
item_name = this_item.display_name( stacked_here[true_it].size() );
}
item_name = this_item.display_name( stacked_here[true_it].size() );
}
if( stacked_here[true_it].size() > 1 ) {
if( stealing ) {
item_name = string_format( "%s %d %s", stolen, stacked_here[true_it].size(), item_name );
} else {
item_name = string_format( "%d %s", stacked_here[true_it].size(), item_name );
}
item_name = string_format( "%d %s", stacked_here[true_it].size(), item_name );
}
if( get_option<bool>( "ITEM_SYMBOLS" ) ) {
if( stealing ) {
item_name = string_format( "%s %s %s", stolen, this_item.symbol().c_str(),
item_name.c_str() );
} else {
item_name = string_format( "%s %s", this_item.symbol().c_str(),
item_name );
}
item_name = string_format( "%s %s", this_item.symbol().c_str(),
item_name );
}

// if the item does not belong to your fraction then add the stolen symbol
if( !this_item.is_owned_by( g->u, true ) ) {
item_name = string_format( "<color_light_red>!</color> %s", item_name );
}

trim_and_print( w_pickup, point( 6, 1 + ( cur_it % maxitems ) ), pickupW - 4, icolor,
item_name );
}
Expand Down