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 raw string item constructor #79056

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4375,7 +4375,7 @@ void harvest_activity_actor::finish( player_activity &act, Character &who )
const int roll = std::min<int>( entry.max, std::round( rng_float( min_num, max_num ) ) );
got_anything = roll > 0;
for( int i = 0; i < roll; i++ ) {
iexamine_helper::handle_harvest( who, entry.drop, false );
iexamine_helper::handle_harvest( who, itype_id( entry.drop ), false );
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ static const itype_id itype_battery( "battery" );
static const itype_id itype_burnt_out_bionic( "burnt_out_bionic" );
static const itype_id itype_muscle( "muscle" );
static const itype_id itype_pseudo_magazine( "pseudo_magazine" );
static const itype_id itype_pseudo_magazine_mod( "pseudo_magazine_mod" );

static const json_character_flag json_flag_ASOCIAL1( "ASOCIAL1" );
static const json_character_flag json_flag_ASOCIAL2( "ASOCIAL2" );
Expand Down Expand Up @@ -2412,7 +2413,7 @@ struct weldrig_hack {
return null_item_reference();
}
pseudo.set_flag( STATIC( flag_id( "PSEUDO" ) ) );
item mag_mod( "pseudo_magazine_mod" );
item mag_mod( itype_pseudo_magazine_mod );
mag_mod.set_flag( STATIC( flag_id( "IRREMOVABLE" ) ) );
if( !pseudo.put_in( mag_mod, pocket_type::MOD ).success() ) {
debugmsg( "tool %s has no space for a %s, this is likely a bug",
Expand Down
9 changes: 6 additions & 3 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ static const efftype_id effect_winded( "winded" );

static const furn_str_id furn_f_safe_c( "f_safe_c" );

static const itype_id itype_grass( "grass" );
static const itype_id itype_small_plant( "small_plant" );
static const itype_id itype_swim_fins( "swim_fins" );
static const itype_id itype_underbrush( "underbrush" );

static const json_character_flag json_flag_CANNOT_ATTACK( "CANNOT_ATTACK" );
static const json_character_flag json_flag_CANNOT_MOVE( "CANNOT_MOVE" );
Expand Down Expand Up @@ -879,7 +882,7 @@ bool avatar_action::eat_here( avatar &you )
return true;
} else {
here.ter_set( you.pos_bub(), ter_t_grass );
item food( "underbrush", calendar::turn, 1 );
item food( itype_underbrush, calendar::turn, 1 );
you.assign_activity( consume_activity_actor( food ) );
return true;
}
Expand All @@ -892,7 +895,7 @@ bool avatar_action::eat_here( avatar &you )
return true;
} else {
here.furn_set( you.pos_bub(), furn_str_id::NULL_ID() );
item food( "small_plant", calendar::turn, 1 );
item food( itype_small_plant, calendar::turn, 1 );
you.assign_activity( consume_activity_actor( food ) );
return true;
}
Expand All @@ -904,7 +907,7 @@ bool avatar_action::eat_here( avatar &you )
add_msg( _( "You're too full to graze." ) );
return true;
} else {
item food( item( "grass", calendar::turn, 1 ) );
item food( item( itype_grass, calendar::turn, 1 ) );
you.assign_activity( consume_activity_actor( food ) );
here.ter_set( you.pos_bub(), here.get_ter_transforms_into( you.pos_bub() ) );
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/ballistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )
drop_item.tname(), nb_of_dropped_shard, max_nb_of_shards - 1, to_gram( drop_item.type->weight ) );*/

for( int i = 0; i < nb_of_dropped_shard; ++i ) {
item shard( "glass_shard" );
item shard( itype_glass_shard );
//actual dropping of shards
get_map().add_item_or_charges( pt, shard );
}
Expand Down
15 changes: 8 additions & 7 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static const efftype_id effect_under_operation( "under_operation" );
static const fault_id fault_bionic_salvaged( "fault_bionic_salvaged" );

static const itype_id itype_anesthetic( "anesthetic" );
static const itype_id itype_burnt_out_bionic( "burnt_out_bionic" );
static const itype_id itype_radiocontrol( "radiocontrol" );
static const itype_id itype_remotevehcontrol( "remotevehcontrol" );
static const itype_id itype_water_clean( "water_clean" );
Expand Down Expand Up @@ -1095,9 +1096,9 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics
if( choice >= 0 && choice <= 1 ) {
item ctr;
if( choice == 0 ) {
ctr = item( "remotevehcontrol", calendar::turn_zero );
ctr = item( itype_remotevehcontrol, calendar::turn_zero );
} else {
ctr = item( "radiocontrol", calendar::turn_zero );
ctr = item( itype_radiocontrol, calendar::turn_zero );
}
ctr.charges = units::to_kilojoule( get_power_level() );
int power_use = invoke_item( &ctr );
Expand Down Expand Up @@ -2198,9 +2199,9 @@ void Character::perform_uninstall( const bionic &bio, int difficulty, int succes
}
}

item cbm( "burnt_out_bionic" );
item cbm( itype_burnt_out_bionic );
if( item::type_is_defined( bio_id->itype() ) ) {
cbm = item( bio_id.c_str() );
cbm = item( bio_id->itype() );
}
cbm.set_flag( flag_FILTHY );
cbm.set_flag( flag_NO_STERILE );
Expand Down Expand Up @@ -2228,7 +2229,7 @@ bool Character::uninstall_bionic( const bionic &bio, monster &installer, Charact
return false;
}

item bionic_to_uninstall = item( bio.id.str(), calendar::turn_zero );
item bionic_to_uninstall = item( bio.info().itype(), calendar::turn_zero );
const itype *itemtype = bionic_to_uninstall.type;
int difficulty = itemtype->bionic->difficulty;
int chance_of_success = bionic_manip_cos( adjusted_skill, difficulty + 2 );
Expand Down Expand Up @@ -2272,7 +2273,7 @@ bool Character::uninstall_bionic( const bionic &bio, monster &installer, Charact
add_msg( m_mixed, _( "Successfully removed %s." ), bio.info().name );
}

item cbm( "burnt_out_bionic" );
item cbm( itype_burnt_out_bionic );
if( item::type_is_defined( bio.info().itype() ) ) {
cbm = bionic_to_uninstall;
}
Expand Down Expand Up @@ -2620,7 +2621,7 @@ void Character::bionics_install_failure( const bionic_id &bid, const std::string
}
}
if( drop_cbm ) {
item cbm( bid.c_str() );
item cbm( bid->itype() );
cbm.set_flag( flag_NO_STERILE );
cbm.set_flag( flag_NO_PACKED );
cbm.faults.emplace( fault_bionic_salvaged );
Expand Down
2 changes: 1 addition & 1 deletion src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ bool cata_tiles::draw_from_id_string_internal( const std::string &id, TILE_CATEG
if( string_starts_with( found_id, "corpse_" ) ) {
tmp = item( itype_corpse, calendar::turn_zero );
} else {
tmp = item( found_id, calendar::turn_zero );
tmp = item( itype_id( found_id ), calendar::turn_zero );
}
if( !variant.empty() ) {
tmp.set_itype_variant( variant );
Expand Down
28 changes: 16 additions & 12 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,16 @@ static const itype_id fuel_type_muscle( "muscle" );
static const itype_id itype_UPS( "UPS" );
static const itype_id itype_apparatus( "apparatus" );
static const itype_id itype_battery( "battery" );
static const itype_id itype_beartrap( "beartrap" );
static const itype_id itype_cookbook_human( "cookbook_human" );
static const itype_id itype_e_handcuffs( "e_handcuffs" );
static const itype_id itype_fire( "fire" );
static const itype_id itype_foodperson_mask( "foodperson_mask" );
static const itype_id itype_foodperson_mask_on( "foodperson_mask_on" );
static const itype_id itype_null( "null" );
static const itype_id itype_human_sample( "human_sample" );
static const itype_id itype_rm13_armor_on( "rm13_armor_on" );
static const itype_id itype_rope_6( "rope_6" );
static const itype_id itype_snare_trigger( "snare_trigger" );

static const json_character_flag json_flag_ACIDBLOOD( "ACIDBLOOD" );
static const json_character_flag json_flag_ALARMCLOCK( "ALARMCLOCK" );
Expand Down Expand Up @@ -611,7 +614,7 @@ Character::Character() :
grab_point = tripoint_rel_ms::zero;
hauling = false;
set_focus( 100 );
last_item = itype_null;
last_item = itype_id::NULL_ID();
sight_max = 9999;
last_batch = 0;
death_drops = true;
Expand Down Expand Up @@ -2405,7 +2408,7 @@ void Character::process_turn()
process_items();
leak_items();
// Didn't just pick something up
last_item = itype_null;
last_item = itype_id::NULL_ID();

cache_visit_items_with( "is_relic", &item::is_relic, [this]( item & it ) {
it.process_relic( this, pos_bub() );
Expand Down Expand Up @@ -3652,7 +3655,7 @@ void Character::normalize()

activity_history.weary_clear();
martial_arts_data->reset_style();
weapon = item( "null", calendar::turn_zero );
weapon = item( itype_id::NULL_ID(), calendar::turn_zero );

set_body();
recalc_hp();
Expand All @@ -3670,11 +3673,11 @@ void Character::die( Creature *nkiller )
set_time_died( calendar::turn );

if( has_effect( effect_heavysnare ) ) {
inv->add_item( item( "rope_6", calendar::turn_zero ) );
inv->add_item( item( "snare_trigger", calendar::turn_zero ) );
inv->add_item( item( itype_rope_6, calendar::turn_zero ) );
inv->add_item( item( itype_snare_trigger, calendar::turn_zero ) );
}
if( has_effect( effect_beartrap ) ) {
inv->add_item( item( "beartrap", calendar::turn_zero ) );
inv->add_item( item( itype_beartrap, calendar::turn_zero ) );
}
mission::on_creature_death( *this );
}
Expand Down Expand Up @@ -10441,11 +10444,11 @@ void Character::place_corpse()
body.force_insert_item( *itm, pocket_type::CONTAINER );
}
// One sample, as you would get from dissecting any other human.
body.put_in( item( "human_sample" ), pocket_type::CORPSE );
body.put_in( item( itype_human_sample ), pocket_type::CORPSE );

for( const bionic &bio : *my_bionics ) {
if( item::type_is_defined( bio.info().itype() ) ) {
item cbm( bio.id.str(), calendar::turn );
item cbm( bio.info().itype(), calendar::turn );
cbm.set_flag( flag_FILTHY );
cbm.set_flag( flag_NO_STERILE );
cbm.set_flag( flag_NO_PACKED );
Expand Down Expand Up @@ -10483,11 +10486,12 @@ void Character::place_corpse( const tripoint_abs_omt &om_target )
body.force_insert_item( *itm, pocket_type::CONTAINER );
}
// One sample, as you would get from dissecting any other human.
body.put_in( item( "human_sample" ), pocket_type::CORPSE );
body.put_in( item( itype_human_sample ), pocket_type::CORPSE );

for( const bionic &bio : *my_bionics ) {
if( item::type_is_defined( bio.info().itype() ) ) {
body.put_in( item( bio.id.str(), calendar::turn ), pocket_type::CORPSE );
const itype_id &bio_itype = bio.info().itype();
if( item::type_is_defined( bio_itype ) ) {
body.put_in( item( bio_itype, calendar::turn ), pocket_type::CORPSE );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/character_escape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ void Character::try_remove_heavysnare()
remove_effect( effect_heavysnare );
add_msg_player_or_npc( m_good, _( "You free yourself from the heavy snare!" ),
_( "<npcname> frees themselves from the heavy snare!" ) );
item rope( "rope_6", calendar::turn );
item snare( "snare_trigger", calendar::turn );
item rope( itype_rope_6, calendar::turn );
item snare( itype_snare_trigger, calendar::turn );
here.add_item_or_charges( pos_bub(), rope );
here.add_item_or_charges( pos_bub(), snare );
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ static const faction_id faction_your_followers( "your_followers" );
static const item_category_id item_category_food( "food" );

static const itype_id itype_disassembly( "disassembly" );
static const itype_id itype_null( "null" );

static const zone_type_id zone_type_AUTO_DRINK( "AUTO_DRINK" );
static const zone_type_id zone_type_AUTO_EAT( "AUTO_EAT" );
Expand Down Expand Up @@ -319,7 +318,7 @@ plot_options::query_seed_result plot_options::query_seed()
}
}
std::vector<seed_tuple> seed_entries = iexamine::get_seed_entries( seed_inv );
seed_entries.emplace( seed_entries.begin(), itype_null, _( "No seed" ), 0 );
seed_entries.emplace( seed_entries.begin(), itype_id::NULL_ID(), _( "No seed" ), 0 );

int seed_index = iexamine::query_seed( seed_entries );

Expand Down
6 changes: 4 additions & 2 deletions src/computer_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static const furn_str_id furn_f_counter( "f_counter" );
static const furn_str_id furn_f_rubble_rock( "f_rubble_rock" );

static const itype_id itype_black_box( "black_box" );
static const itype_id itype_black_box_transcript( "black_box_transcript" );
static const itype_id itype_blood( "blood" );
static const itype_id itype_blood_tainted( "blood_tainted" );
static const itype_id itype_c4( "c4" );
Expand All @@ -83,6 +84,7 @@ static const itype_id itype_mininuke_act( "mininuke_act" );
static const itype_id itype_radio_repeater_mod( "radio_repeater_mod" );
static const itype_id itype_sarcophagus_access_code( "sarcophagus_access_code" );
static const itype_id itype_sewage( "sewage" );
static const itype_id itype_software_blood_data( "software_blood_data" );
static const itype_id itype_usb_drive( "usb_drive" );
static const itype_id itype_vacutainer( "vacutainer" );

Expand Down Expand Up @@ -1074,7 +1076,7 @@ void computer_session::action_blood_anal()
print_line( _( "Pathogen bonded to erythrocytes and leukocytes." ) );
if( query_bool( _( "Download data?" ) ) ) {
if( item *const usb = pick_usb() ) {
item software( "software_blood_data", calendar::turn_zero );
item software( itype_software_blood_data, calendar::turn_zero );
usb->clear_items();
usb->put_in( software, pocket_type::SOFTWARE );
print_line( _( "Software downloaded." ) );
Expand Down Expand Up @@ -1113,7 +1115,7 @@ void computer_session::action_data_anal()
} else { // Success!
if( items.only_item().typeId() == itype_black_box ) {
print_line( _( "Memory Bank: Military Hexron Encryption\nPrinting Transcript\n" ) );
item transcript( "black_box_transcript", calendar::turn );
item transcript( itype_black_box_transcript, calendar::turn );
here.add_item_or_charges( player_character.pos_bub(), transcript );
} else {
print_line( _( "Memory Bank: Unencrypted\nNothing of interest.\n" ) );
Expand Down
3 changes: 2 additions & 1 deletion src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static const item_group_id Item_spawn_data_jewelry_front( "jewelry_front" );
static const itype_id itype_2x4( "2x4" );
static const itype_id itype_bone_human( "bone_human" );
static const itype_id itype_nail( "nail" );
static const itype_id itype_rope_30( "rope_30" );
static const itype_id itype_sheet( "sheet" );
static const itype_id itype_stick( "stick" );
static const itype_id itype_string_36( "string_36" );
Expand Down Expand Up @@ -1836,7 +1837,7 @@ void construct::done_deconstruct( const tripoint_bub_ms &p, Character &player_ch
static void unroll_digging( const int numer_of_2x4s )
{
// refund components!
item rope( "rope_30" );
item rope( itype_rope_30 );
map &here = get_map();
tripoint_bub_ms avatar_pos = get_player_character().pos_bub();
here.add_item_or_charges( avatar_pos, rope );
Expand Down
6 changes: 4 additions & 2 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ static const furn_str_id furn_f_fake_bench_hands( "f_fake_bench_hands" );
static const furn_str_id furn_f_ground_crafting_spot( "f_ground_crafting_spot" );

static const itype_id itype_disassembly( "disassembly" );
static const itype_id itype_pickaxe( "pickaxe" );
static const itype_id itype_plut_cell( "plut_cell" );
static const itype_id itype_shovel( "shovel" );

static const json_character_flag json_flag_CRAFT_IN_DARKNESS( "CRAFT_IN_DARKNESS" );
static const json_character_flag json_flag_HYPEROPIC( "HYPEROPIC" );
Expand Down Expand Up @@ -682,8 +684,8 @@ const inventory &Character::crafting_inventory( const tripoint_bub_ms &src_pos,
}

if( has_trait( trait_BURROW ) || has_trait( trait_BURROWLARGE ) ) {
*crafting_cache.crafting_inventory += item( "pickaxe", calendar::turn );
*crafting_cache.crafting_inventory += item( "shovel", calendar::turn );
*crafting_cache.crafting_inventory += item( itype_pickaxe, calendar::turn );
*crafting_cache.crafting_inventory += item( itype_shovel, calendar::turn );
}

crafting_cache.valid = true;
Expand Down
7 changes: 5 additions & 2 deletions src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ static const efftype_id effect_bleed( "bleed" );
static const faction_id faction_no_faction( "no_faction" );
static const faction_id faction_your_followers( "your_followers" );

static const itype_id itype_architect_cube( "architect_cube" );
static const itype_id itype_debug_backpack( "debug_backpack" );

static const matype_id style_none( "style_none" );

static const mongroup_id GROUP_DEBUG_EXACTLY_ONE( "GROUP_DEBUG_EXACTLY_ONE" );
Expand Down Expand Up @@ -3833,7 +3836,7 @@ void do_debug_quick_setup()
u.set_mutations( setup_traits );
u.remove_weapon();
u.clear_worn();
item backpack( "debug_backpack" );
item backpack( itype_debug_backpack );
u.wear_item( backpack );
for( const std::pair<const skill_id, SkillLevel> &pair : u.get_all_skills() ) {
u.set_skill_level( pair.first, 10 );
Expand Down Expand Up @@ -4013,7 +4016,7 @@ void debug()
break;

case debug_menu_index::SPAWN_CLAIRVOYANCE:
player_character.i_add( item( "architect_cube", calendar::turn ) );
player_character.i_add( item( itype_architect_cube, calendar::turn ) );
break;

case debug_menu_index::MAP_EDITOR:
Expand Down
4 changes: 3 additions & 1 deletion src/fungal_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ static const furn_str_id furn_f_flower_fungal( "f_flower_fungal" );
static const furn_str_id furn_f_fungal_clump( "f_fungal_clump" );
static const furn_str_id furn_f_fungal_mass( "f_fungal_mass" );

static const itype_id itype_fungal_seeds( "fungal_seeds" );

static const mtype_id mon_fungal_blossom( "mon_fungal_blossom" );
static const mtype_id mon_spore( "mon_spore" );

Expand Down Expand Up @@ -242,7 +244,7 @@ void fungal_effects::spread_fungus_one_tile( const tripoint_bub_ms &p, const int
DebugLog( D_ERROR, DC_ALL ) << "No seed item in the PLANT terrain at position " <<
p.to_string_writable();
} else {
*seed = item( "fungal_seeds", calendar::turn );
*seed = item( itype_fungal_seeds, calendar::turn );
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ static const harvest_drop_type_id harvest_drop_offal( "offal" );
static const harvest_drop_type_id harvest_drop_skin( "skin" );

static const itype_id fuel_type_animal( "animal" );
static const itype_id fuel_type_muscle( "muscle" );
static const itype_id itype_battery( "battery" );
static const itype_id itype_disassembly( "disassembly" );
static const itype_id itype_grapnel( "grapnel" );
Expand Down Expand Up @@ -11836,7 +11837,7 @@ void game::on_move_effects()
{
// TODO: Move this to a character method
if( !u.is_mounted() ) {
const item muscle( "muscle" );
const item muscle( fuel_type_muscle );
for( const bionic_id &bid : u.get_bionic_fueled_with_muscle() ) {
if( u.has_active_bionic( bid ) ) {// active power gen
u.mod_power_level( muscle.fuel_energy() * bid->fuel_efficiency );
Expand Down
Loading
Loading