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

More string consts into single file #38189

Merged
merged 3 commits into from
Feb 21, 2020
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
10 changes: 5 additions & 5 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ static void set_up_butchery( player_activity &act, player &u, butcher_type actio
}

// applies to all butchery actions
const bool is_human = corpse.id == mtype_id::NULL_ID() || ( corpse.in_species( HUMAN ) &&
!corpse.in_species( ZOMBIE ) );
const bool is_human = corpse.id == mtype_id::NULL_ID() || ( corpse.in_species( species_HUMAN ) &&
!corpse.in_species( species_ZOMBIE ) );
if( is_human && !( u.has_trait_flag( flag_CANNIBAL ) ||
u.has_trait_flag( flag_PSYCHOPATH ) ||
u.has_trait_flag( flag_SAPIOVORE ) ) ) {
Expand Down Expand Up @@ -2553,7 +2553,7 @@ void activity_handlers::heat_item_finish( player_activity *act, player *p )
return;
}
item &target = *heat->get_food();
if( target.item_tags.count( "FROZEN" ) ) {
if( target.item_tags.count( flag_FROZEN ) ) {
target.apply_freezerburn();
if( target.has_flag( flag_EATEN_COLD ) ) {
target.cold_up();
Expand Down Expand Up @@ -2690,7 +2690,7 @@ void activity_handlers::toolmod_add_finish( player_activity *act, player *p )
item &mod = *act->targets[1];
p->add_msg_if_player( m_good, _( "You successfully attached the %1$s to your %2$s." ),
mod.tname(), tool.tname() );
mod.item_tags.insert( "IRREMOVABLE" );
mod.item_tags.insert( flag_IRREMOVABLE );
tool.contents.push_back( mod );
act->targets[1].remove_item();
}
Expand Down Expand Up @@ -3860,7 +3860,7 @@ void activity_handlers::dig_finish( player_activity *act, player *p )
g->m.place_items( "jewelry_front", 20, pos, pos, false, calendar::turn );
for( const auto &it : dropped ) {
if( it->is_armor() ) {
it->item_tags.insert( "FILTHY" );
it->item_tags.insert( flag_FILTHY );
it->set_damage( rng( 1, it->max_damage() - 1 ) );
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ void activity_handlers::washing_finish( player_activity *act, player *p )

for( const auto &ait : items ) {
item *filthy_item = const_cast<item *>( &*ait.loc );
filthy_item->item_tags.erase( "FILTHY" );
filthy_item->item_tags.erase( flag_FILTHY );
p->on_worn_item_washed( *filthy_item );
}

Expand Down Expand Up @@ -1235,12 +1235,12 @@ static bool are_requirements_nearby( const std::vector<tripoint> &loot_spots,
const cata::optional<vpart_reference> weldpart = vp.part_with_feature( "WELDRIG", true );
if( weldpart ) {
item welder( "welder", 0 );
welder.charges = veh.fuel_left( "battery", true );
welder.item_tags.insert( "PSEUDO" );
welder.charges = veh.fuel_left( fuel_type_battery, true );
welder.item_tags.insert( flag_PSEUDO );
temp_inv.add_item( welder );
item soldering_iron( "soldering_iron", 0 );
soldering_iron.charges = veh.fuel_left( "battery", true );
soldering_iron.item_tags.insert( "PSEUDO" );
soldering_iron.charges = veh.fuel_left( fuel_type_battery, true );
soldering_iron.item_tags.insert( flag_PSEUDO );
temp_inv.add_item( soldering_iron );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ void basecamp::form_crafting_inventory( map &target_map )
for( basecamp_resource &bcp_r : resources ) {
bcp_r.consumed = 0;
item camp_item( bcp_r.fake_id, 0 );
camp_item.item_tags.insert( "PSEUDO" );
camp_item.item_tags.insert( flag_PSEUDO );
if( bcp_r.ammo_id != "NULL" ) {
for( basecamp_fuel &bcp_f : fuels ) {
if( bcp_f.ammo_id == bcp_r.ammo_id ) {
Expand Down
28 changes: 16 additions & 12 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ static const std::string flag_DIG_TOOL( "DIG_TOOL" );
static const std::string flag_DIGGABLE( "DIGGABLE" );
static const std::string flag_DIGGABLE_CAN_DEEPEN( "DIGGABLE_CAN_DEEPEN" );
static const std::string flag_DIMENSIONAL_ANCHOR( "DIMENSIONAL_ANCHOR" );
static const std::string flag_DIRTY( "DIRTY" );
static const std::string flag_DISABLE_SIGHTS( "DISABLE_SIGHTS" );
static const std::string flag_DONT_REMOVE_ROTTEN( "DONT_REMOVE_ROTTEN" );
static const std::string flag_DOOR( "DOOR" );
Expand Down Expand Up @@ -1396,6 +1397,7 @@ static const std::string flag_WIND_TURBINE( "WIND_TURBINE" );
static const std::string flag_WINDOW( "WINDOW" );
static const std::string flag_WINDOW_CURTAIN( "WINDOW_CURTAIN" );
static const std::string flag_WINDSHIELD( "WINDSHIELD" );
static const std::string flag_wooled( "wooled" );
static const std::string flag_WORKBENCH( "WORKBENCH" );
static const std::string flag_WRITE_MESSAGE( "WRITE_MESSAGE" );
static const std::string flag_YOUNG( "YOUNG" );
Expand Down Expand Up @@ -1477,6 +1479,8 @@ static const itype_id fuel_type_muscle( "muscle" );
static const itype_id fuel_type_none( "null" );
static const itype_id fuel_type_plutonium_cell( "plut_cell" );
static const itype_id fuel_type_sun_light( "sunlight" );
static const itype_id fuel_type_water( "water" );
static const itype_id fuel_type_water_clean( "water_clean" );
static const itype_id fuel_type_wind( "wind" );

static const fault_id fault_belt( "fault_engine_belt_drive" );
Expand Down Expand Up @@ -1519,18 +1523,18 @@ static const matype_id style_wingchun( "style_wingchun" );
static const matype_id style_zui_quan( "style_zui_quan" );

static const species_id species_BLOB( "BLOB" );
static const species_id FISH( "FISH" );
static const species_id FUNGUS( "FUNGUS" );
static const species_id HALLUCINATION( "HALLUCINATION" );
static const species_id HUMAN( "HUMAN" );
static const species_id INSECT( "INSECT" );
static const species_id LEECH_PLANT( "LEECH_PLANT" );
static const species_id MAMMAL( "MAMMAL" );
static const species_id MOLLUSK( "MOLLUSK" );
static const species_id PLANT( "PLANT" );
static const species_id ROBOT( "ROBOT" );
static const species_id SPIDER( "SPIDER" );
static const species_id ZOMBIE( "ZOMBIE" );
static const species_id species_FISH( "FISH" );
static const species_id species_FUNGUS( "FUNGUS" );
static const species_id species_HALLUCINATION( "HALLUCINATION" );
static const species_id species_HUMAN( "HUMAN" );
static const species_id species_INSECT( "INSECT" );
static const species_id species_LEECH_PLANT( "LEECH_PLANT" );
static const species_id species_MAMMAL( "MAMMAL" );
static const species_id species_MOLLUSK( "MOLLUSK" );
static const species_id species_PLANT( "PLANT" );
static const species_id species_ROBOT( "ROBOT" );
static const species_id species_SPIDER( "SPIDER" );
static const species_id species_ZOMBIE( "ZOMBIE" );

static const matec_id matec_no_technique_id( "" );
static const matec_id matec_RAPID( "RAPID" );
Expand Down
6 changes: 3 additions & 3 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ field_type_id Character::gibType() const

bool Character::in_species( const species_id &spec ) const
{
return spec == HUMAN;
return spec == species_HUMAN;
}

bool Character::is_warm() const
Expand Down Expand Up @@ -2139,7 +2139,7 @@ ret_val<bool> Character::can_wear( const item &it, bool with_equip_change ) cons
}

if( has_trait( trait_WOOLALLERGY ) && ( it.made_of( material_id( "wool" ) ) ||
it.item_tags.count( "wooled" ) ) ) {
it.item_tags.count( flag_wooled ) ) ) {
return ret_val<bool>::make_failure( _( "Can't wear that, it's made of wool!" ) );
}

Expand Down Expand Up @@ -5645,7 +5645,7 @@ bool Character::sees_with_specials( const Creature &critter ) const
{
// electroreceptors grants vision of robots and electric monsters through walls
if( has_trait( trait_ELECTRORECEPTORS ) &&
( critter.in_species( ROBOT ) || critter.has_flag( MF_ELECTRIC ) ) ) {
( critter.in_species( species_ROBOT ) || critter.has_flag( MF_ELECTRIC ) ) ) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/computer_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ void computer_session::action_blood_anal()
const mtype *mt = blood.get_mtype();
if( mt == nullptr || mt->id == mtype_id::NULL_ID() ) {
print_line( _( "Result: Human blood, no pathogens found." ) );
} else if( mt->in_species( ZOMBIE ) ) {
if( mt->in_species( HUMAN ) ) {
} else if( mt->in_species( species_ZOMBIE ) ) {
if( mt->in_species( species_HUMAN ) ) {
print_line( _( "Result: Human blood. Unknown pathogen found." ) );
} else {
print_line( _( "Result: Unknown blood type. Unknown pathogen found." ) );
Expand Down
2 changes: 1 addition & 1 deletion src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ ret_val<edible_rating> Character::can_eat( const item &food ) const
return ret_val<edible_rating>::make_failure( _( "That doesn't look edible in its current form." ) );
}

if( food.item_tags.count( "DIRTY" ) ) {
if( food.item_tags.count( flag_DIRTY ) ) {
return ret_val<edible_rating>::make_failure(
_( "This is full of dirt after being on the ground." ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ void player::complete_disassemble( item_location &target, const recipe &dis )
}

if( filthy ) {
act_item.item_tags.insert( "FILTHY" );
act_item.item_tags.insert( flag_FILTHY );
}

for( std::list<item>::iterator a = dis_item.components.begin(); a != dis_item.components.end();
Expand Down
2 changes: 1 addition & 1 deletion src/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool game::dump_stats( const std::string &what, dump_mode mode,
item obj( e );
if( bp == num_bp || obj.covers( bp ) ) {
if( obj.has_flag( flag_VARSIZE ) ) {
obj.item_tags.insert( "FIT" );
obj.item_tags.insert( flag_FIT );
}
dump( obj );
}
Expand Down
4 changes: 2 additions & 2 deletions src/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ void flashbang( const tripoint &p, bool player_immune )
}
}
for( monster &critter : g->all_monsters() ) {
if( critter.type->in_species( ROBOT ) ) {
if( critter.type->in_species( species_ROBOT ) ) {
continue;
}
// TODO: can the following code be called for all types of creatures
Expand Down Expand Up @@ -721,7 +721,7 @@ void emp_blast( const tripoint &p )
// TODO: More effects?
//e-handcuffs effects
if( g->u.weapon.typeId() == "e_handcuffs" && g->u.weapon.charges > 0 ) {
g->u.weapon.item_tags.erase( "NO_UNWIELD" );
g->u.weapon.item_tags.erase( flag_NO_UNWIELD );
g->u.weapon.charges = 0;
g->u.weapon.active = false;
add_msg( m_good, _( "The %s on your wrists spark briefly, then release your hands!" ),
Expand Down
2 changes: 1 addition & 1 deletion src/fungal_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void fungal_effects::fungalize( const tripoint &p, Creature *origin, double spor
if( monster *const mon_ptr = g->critter_at<monster>( p ) ) {
monster &critter = *mon_ptr;
if( gm.u.sees( p ) &&
!critter.type->in_species( FUNGUS ) ) {
!critter.type->in_species( species_FUNGUS ) ) {
add_msg( _( "The %s is covered in tiny spores!" ), critter.name() );
}
if( !critter.make_fungus() ) {
Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3948,7 +3948,7 @@ void game::mon_info_update( )
monster &critter = *new_seen_mon.back();
cancel_activity_or_ignore_query( distraction_type::hostile_spotted,
string_format( _( "%s spotted!" ), critter.name() ) );
if( u.has_trait( trait_id( "M_DEFENDER" ) ) && critter.type->in_species( PLANT ) ) {
if( u.has_trait( trait_id( "M_DEFENDER" ) ) && critter.type->in_species( species_PLANT ) ) {
add_msg( m_warning, _( "We have detected a %s - an enemy of the Mycus!" ), critter.name() );
if( !u.has_effect( effect_adrenaline_mycus ) ) {
u.add_effect( effect_adrenaline_mycus, 30_minutes );
Expand Down
4 changes: 2 additions & 2 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void iexamine::cvdmachine( player &p, const tripoint & )
p.invalidate_crafting_inventory();

// Apply flag to item
loc->item_tags.insert( "DIAMOND" );
loc->item_tags.insert( flag_DIAMOND );
add_msg( m_good, _( "You apply a diamond coating to your %s" ), loc->type_name() );
p.mod_moves( -to_turns<int>( 10_seconds ) );
}
Expand Down Expand Up @@ -188,7 +188,7 @@ void iexamine::nanofab( player &p, const tripoint &examp )
p.invalidate_crafting_inventory();

if( new_item.is_armor() && new_item.has_flag( flag_VARSIZE ) ) {
new_item.item_tags.insert( "FIT" );
new_item.item_tags.insert( flag_FIT );
}

g->m.add_item_or_charges( spawn_point, new_item );
Expand Down
50 changes: 25 additions & 25 deletions src/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void inventory::form_from_map( map &m, std::vector<tripoint> pts, const Characte
if( type != nullptr ) {
const itype *ammo = f.crafting_ammo_item_type();
item furn_item( type, calendar::turn, 0 );
furn_item.item_tags.insert( "PSEUDO" );
furn_item.item_tags.insert( flag_PSEUDO );
furn_item.charges = ammo ? count_charges_in_list( ammo, m.i_at( p ) ) : 0;
add_item( furn_item );
}
Expand Down Expand Up @@ -532,70 +532,70 @@ void inventory::form_from_map( map &m, std::vector<tripoint> pts, const Characte

if( kpart ) {
item hotplate( "hotplate", 0 );
hotplate.charges = veh->fuel_left( "battery", true );
hotplate.item_tags.insert( "PSEUDO" );
hotplate.charges = veh->fuel_left( fuel_type_battery, true );
hotplate.item_tags.insert( flag_PSEUDO );
add_item( hotplate );

item pot( "pot", 0 );
pot.item_tags.insert( "PSEUDO" );
pot.item_tags.insert( flag_PSEUDO );
add_item( pot );
item pan( "pan", 0 );
pan.item_tags.insert( "PSEUDO" );
pan.item_tags.insert( flag_PSEUDO );
add_item( pan );
}
if( weldpart ) {
item welder( "welder", 0 );
welder.charges = veh->fuel_left( "battery", true );
welder.item_tags.insert( "PSEUDO" );
welder.charges = veh->fuel_left( fuel_type_battery, true );
welder.item_tags.insert( flag_PSEUDO );
add_item( welder );

item soldering_iron( "soldering_iron", 0 );
soldering_iron.charges = veh->fuel_left( "battery", true );
soldering_iron.item_tags.insert( "PSEUDO" );
soldering_iron.charges = veh->fuel_left( fuel_type_battery, true );
soldering_iron.item_tags.insert( flag_PSEUDO );
add_item( soldering_iron );
}
if( craftpart ) {
item vac_sealer( "vac_sealer", 0 );
vac_sealer.charges = veh->fuel_left( "battery", true );
vac_sealer.item_tags.insert( "PSEUDO" );
vac_sealer.charges = veh->fuel_left( fuel_type_battery, true );
vac_sealer.item_tags.insert( flag_PSEUDO );
add_item( vac_sealer );

item dehydrator( "dehydrator", 0 );
dehydrator.charges = veh->fuel_left( "battery", true );
dehydrator.item_tags.insert( "PSEUDO" );
dehydrator.charges = veh->fuel_left( fuel_type_battery, true );
dehydrator.item_tags.insert( flag_PSEUDO );
add_item( dehydrator );

item food_processor( "food_processor", 0 );
food_processor.charges = veh->fuel_left( "battery", true );
food_processor.item_tags.insert( "PSEUDO" );
food_processor.charges = veh->fuel_left( fuel_type_battery, true );
food_processor.item_tags.insert( flag_PSEUDO );
add_item( food_processor );

item press( "press", 0 );
press.charges = veh->fuel_left( "battery", true );
press.item_tags.insert( "PSEUDO" );
press.charges = veh->fuel_left( fuel_type_battery, true );
press.item_tags.insert( flag_PSEUDO );
add_item( press );
}
if( forgepart ) {
item forge( "forge", 0 );
forge.charges = veh->fuel_left( "battery", true );
forge.item_tags.insert( "PSEUDO" );
forge.charges = veh->fuel_left( fuel_type_battery, true );
forge.item_tags.insert( flag_PSEUDO );
add_item( forge );
}
if( kilnpart ) {
item kiln( "kiln", 0 );
kiln.charges = veh->fuel_left( "battery", true );
kiln.item_tags.insert( "PSEUDO" );
kiln.charges = veh->fuel_left( fuel_type_battery, true );
kiln.item_tags.insert( flag_PSEUDO );
add_item( kiln );
}
if( chempart ) {
item chemistry_set( "chemistry_set", 0 );
chemistry_set.charges = veh->fuel_left( "battery", true );
chemistry_set.item_tags.insert( "PSEUDO" );
chemistry_set.charges = veh->fuel_left( fuel_type_battery, true );
chemistry_set.item_tags.insert( flag_PSEUDO );
add_item( chemistry_set );

item electrolysis_kit( "electrolysis_kit", 0 );
electrolysis_kit.charges = veh->fuel_left( "battery", true );
electrolysis_kit.item_tags.insert( "PSEUDO" );
electrolysis_kit.charges = veh->fuel_left( fuel_type_battery, true );
electrolysis_kit.item_tags.insert( flag_PSEUDO );
add_item( electrolysis_kit );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8669,14 +8669,14 @@ bool item::process_corpse( player *carrier, const tripoint &pos )
if( rng( 0, volume() / units::legacy_volume_factor ) > burnt && g->revive_corpse( pos, *this ) ) {
if( carrier == nullptr ) {
if( g->u.sees( pos ) ) {
if( corpse->in_species( ROBOT ) ) {
if( corpse->in_species( species_ROBOT ) ) {
add_msg( m_warning, _( "A nearby robot has repaired itself and stands up!" ) );
} else {
add_msg( m_warning, _( "A nearby corpse rises and moves towards you!" ) );
}
}
} else {
if( corpse->in_species( ROBOT ) ) {
if( corpse->in_species( species_ROBOT ) ) {
carrier->add_msg_if_player( m_warning,
_( "Oh dear god, a robot you're carrying has started moving!" ) );
} else {
Expand Down
Loading