Skip to content

Commit

Permalink
Move string consts into single file (#38158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 authored Feb 19, 2020
1 parent 8ec8e78 commit 50059c8
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 125 deletions.
23 changes: 23 additions & 0 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ static const mtype_id mon_zombie_waif( "mon_zombie_waif" );

static const std::string flag_ACID( "ACID" );
static const std::string flag_ACT_IN_FIRE( "ACT_IN_FIRE" );
static const std::string flag_ACT_ON_RANGED_HIT( "ACT_ON_RANGED_HIT" );
static const std::string flag_ACTIVE_CLOAKING( "ACTIVE_CLOAKING" );
static const std::string flag_ALARMED( "ALARMED" );
static const std::string flag_ALLERGEN_EGG( "ALLERGEN_EGG" );
Expand All @@ -932,12 +933,14 @@ static const std::string flag_ALLERGEN_MEAT( "ALLERGEN_MEAT" );
static const std::string flag_ALLERGEN_MILK( "ALLERGEN_MILK" );
static const std::string flag_ALLERGEN_VEGGY( "ALLERGEN_VEGGY" );
static const std::string flag_ALLERGEN_WHEAT( "ALLERGEN_WHEAT" );
static const std::string flag_ALLOW_ROTTEN( "ALLOW_ROTTEN" );
static const std::string flag_ALLOWS_NATURAL_ATTACKS( "ALLOWS_NATURAL_ATTACKS" );
static const std::string flag_ALLOWS_REMOTE_USE( "ALLOWS_REMOTE_USE" );
static const std::string flag_ALWAYS_TWOHAND( "ALWAYS_TWOHAND" );
static const std::string flag_ANESTHESIA( "ANESTHESIA" );
static const std::string flag_AURA( "AURA" );
static const std::string flag_AUT_START( "AUT_START" );
static const std::string flag_auto_wield( "auto_wield" );
static const std::string flag_AUTODOC( "AUTODOC" );
static const std::string flag_AUTODOC_COUCH( "AUTODOC_COUCH" );
static const std::string flag_BAD_DAY( "BAD_DAY" );
Expand All @@ -955,6 +958,7 @@ static const std::string flag_BLIND_HARD( "BLIND_HARD" );
static const std::string flag_BLOCK_WHILE_WORN( "BLOCK_WHILE_WORN" );
static const std::string flag_BLOCKSDOOR( "BLOCKSDOOR" );
static const std::string flag_BOMB( "BOMB" );
static const std::string flag_BURROWABLE( "BURROWABLE" );
static const std::string flag_BUTCHER_EQ( "BUTCHER_EQ" );
static const std::string flag_BYPRODUCT( "BYPRODUCT" );
static const std::string flag_CABLE_SPOOL( "CABLE_SPOOL" );
Expand All @@ -964,6 +968,7 @@ static const std::string flag_CAMERA_PRO( "CAMERA_PRO" );
static const std::string flag_CAN_SIT( "CAN_SIT" );
static const std::string flag_CANNIBAL( "CANNIBAL" );
static const std::string flag_CANNIBALISM( "CANNIBALISM" );
static const std::string flag_CANT_HEAL_EVERYONE( "CANT_HEAL_EVERYONE" );
static const std::string flag_CARNIVORE_OK( "CARNIVORE_OK" );
static const std::string flag_CASING( "CASING" );
static const std::string flag_CATTLE( "CATTLE" );
Expand Down Expand Up @@ -994,6 +999,7 @@ 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_DISABLE_SIGHTS( "DISABLE_SIGHTS" );
static const std::string flag_DONT_REMOVE_ROTTEN( "DONT_REMOVE_ROTTEN" );
static const std::string flag_DOOR( "DOOR" );
static const std::string flag_DROP_ACTION_ONLY_IF_LIQUID( "DROP_ACTION_ONLY_IF_LIQUID" );
static const std::string flag_DURABLE_MELEE( "DURABLE_MELEE" );
static const std::string flag_EASY_DECONSTRUCT( "EASY_DECONSTRUCT" );
Expand Down Expand Up @@ -1068,6 +1074,8 @@ static const std::string flag_INDOORS( "INDOORS" );
static const std::string flag_INEDIBLE( "INEDIBLE" );
static const std::string flag_INFECTED( "INFECTED" );
static const std::string flag_INITIAL_PART( "INITIAL_PART" );
static const std::string flag_INSPIRATIONAL( "INSPIRATIONAL" );
static const std::string flag_INSTALL_DIFFICULT( "INSTALL_DIFFICULT" );
static const std::string flag_IR_EFFECT( "IR_EFFECT" );
static const std::string flag_IRREMOVABLE( "IRREMOVABLE" );
static const std::string flag_IS_ARMOR( "IS_ARMOR" );
Expand All @@ -1084,6 +1092,7 @@ static const std::string flag_LOCKED( "LOCKED" );
static const std::string flag_LONE_START( "LONE_START" );
static const std::string flag_LUPINE( "LUPINE" );
static const std::string flag_MAG_BELT( "MAG_BELT" );
static const std::string flag_MAG_BULKY( "MAG_BULKY" );
static const std::string flag_MAG_DESTROY( "MAG_DESTROY" );
static const std::string flag_MAG_EJECT( "MAG_EJECT" );
static const std::string flag_MAGIC_FOCUS( "MAGIC_FOCUS" );
Expand All @@ -1095,6 +1104,7 @@ static const std::string flag_MC_RANDOM_STUFF( "MC_RANDOM_STUFF" );
static const std::string flag_MC_SCIENCE_STUFF( "MC_SCIENCE_STUFF" );
static const std::string flag_MC_TURN_USED( "MC_TURN_USED" );
static const std::string flag_MC_USED( "MC_USED" );
static const std::string flag_MECH_BAT( "MECH_BAT" );
static const std::string flag_MELTS( "MELTS" );
static const std::string flag_MESSY( "MESSY" );
static const std::string flag_MILLABLE( "MILLABLE" );
Expand All @@ -1109,9 +1119,11 @@ static const std::string flag_NEEDS_NO_LUBE( "NEEDS_NO_LUBE" );
static const std::string flag_NEEDS_UNFOLD( "NEEDS_UNFOLD" );
static const std::string flag_NEGATIVE_MONOTONY_OK( "NEGATIVE_MONOTONY_OK" );
static const std::string flag_NEVER_JAMS( "NEVER_JAMS" );
static const std::string flag_no_auto_equip( "no_auto_equip" );
static const std::string flag_NO_CVD( "NO_CVD" );
static const std::string flag_NO_DISPLAY( "NO_DISPLAY" );
static const std::string flag_NO_DROP( "NO_DROP" );
static const std::string flag_NO_INGEST( "NO_INGEST" );
static const std::string flag_NO_PACKED( "NO_PACKED" );
static const std::string flag_NO_PARASITES( "NO_PARASITES" );
static const std::string flag_NO_QUICKDRAW( "NO_QUICKDRAW" );
Expand All @@ -1120,12 +1132,14 @@ static const std::string flag_NO_REPAIR( "NO_REPAIR" );
static const std::string flag_NO_RESIZE( "NO_RESIZE" );
static const std::string flag_NO_SALVAGE( "NO_SALVAGE" );
static const std::string flag_NO_STERILE( "NO_STERILE" );
static const std::string flag_NO_TAKEOFF( "NO_TAKEOFF" );
static const std::string flag_NO_UNLOAD( "NO_UNLOAD" );
static const std::string flag_NO_UNWIELD( "NO_UNWIELD" );
static const std::string flag_NOCOLLIDE( "NOCOLLIDE" );
static const std::string flag_NOITEM( "NOITEM" );
static const std::string flag_NON_FOULING( "NON-FOULING" );
static const std::string flag_NONCONDUCTIVE( "NONCONDUCTIVE" );
static const std::string flag_NPC_ACTIVATE( "NPC_ACTIVATE" );
static const std::string flag_NPC_SAFE( "NPC_SAFE" );
static const std::string flag_NUTRIENT_OVERRIDE( "NUTRIENT_OVERRIDE" );
static const std::string flag_ONLY_ONE( "ONLY_ONE" );
Expand Down Expand Up @@ -1181,6 +1195,7 @@ static const std::string flag_RELOAD_ONE( "RELOAD_ONE" );
static const std::string flag_REQUIRES_TINDER( "REQUIRES_TINDER" );
static const std::string flag_RESTRICT_HANDS( "RESTRICT_HANDS" );
static const std::string flag_REVIVE_SPECIAL( "REVIVE_SPECIAL" );
static const std::string flag_ROAD( "ROAD" );
static const std::string flag_ROLLER_INLINE( "ROLLER_INLINE" );
static const std::string flag_ROLLER_ONE( "ROLLER_ONE" );
static const std::string flag_ROLLER_QUAD( "ROLLER_QUAD" );
Expand Down Expand Up @@ -1208,6 +1223,7 @@ static const std::string flag_SPEEDLOADER( "SPEEDLOADER" );
static const std::string flag_SPLINT( "SPLINT" );
static const std::string flag_SPR_START( "SPR_START" );
static const std::string flag_STR_DRAW( "STR_DRAW" );
static const std::string flag_STR_RELOAD( "STR_RELOAD" );
static const std::string flag_STURDY( "STURDY" );
static const std::string flag_SUM_ADV_START( "SUM_ADV_START" );
static const std::string flag_SUM_START( "SUM_START" );
Expand All @@ -1217,11 +1233,15 @@ static const std::string flag_SUPPORTS_ROOF( "SUPPORTS_ROOF" );
static const std::string flag_SUR_START( "SUR_START" );
static const std::string flag_SWIM_GOGGLES( "SWIM_GOGGLES" );
static const std::string flag_SWIMMABLE( "SWIMMABLE" );
static const std::string flag_TACK( "TACK" );
static const std::string flag_TANGLE( "TANGLE" );
static const std::string flag_THERMOMETER( "THERMOMETER" );
static const std::string flag_THIN_OBSTACLE( "THIN_OBSTACLE" );
static const std::string flag_TIE_UP( "TIE_UP" );
static const std::string flag_TINDER( "TINDER" );
static const std::string flag_TINY( "TINY" );
static const std::string flag_TOBACCO( "TOBACCO" );
static const std::string flag_TRADER_AVOID( "TRADER_AVOID" );
static const std::string flag_TRANSPARENT( "TRANSPARENT" );
static const std::string flag_TREE( "TREE" );
static const std::string flag_UNARMED_BONUS( "UNARMED_BONUS" );
Expand All @@ -1231,6 +1251,7 @@ static const std::string flag_UNCRAFT_LIQUIDS_CONTAINED( "UNCRAFT_LIQUIDS_CONTAI
static const std::string flag_UNCRAFT_SINGLE_CHARGE( "UNCRAFT_SINGLE_CHARGE " );
static const std::string flag_UNDERSIZE( "UNDERSIZE" );
static const std::string flag_UNDERWATER_GUN( "UNDERWATER_GUN" );
static const std::string flag_UNRECOVERABLE( "UNRECOVERABLE" );
static const std::string flag_UNSTABLE( "UNSTABLE" );
static const std::string flag_URSINE_HONEY( "URSINE_HONEY" );
static const std::string flag_USABLE_FIRE( "USABLE_FIRE" );
Expand Down Expand Up @@ -1313,9 +1334,11 @@ static const zone_type_id zone_type_LOOT_CORPSE( "LOOT_CORPSE" );
static const zone_type_id zone_type_LOOT_IGNORE( "LOOT_IGNORE" );
static const zone_type_id zone_type_LOOT_UNSORTED( "LOOT_UNSORTED" );
static const zone_type_id zone_type_LOOT_WOOD( "LOOT_WOOD" );
static const zone_type_id zone_type_NO_AUTO_PICKUP( "NO_AUTO_PICKUP" );
static const zone_type_id zone_type_VEHICLE_DECONSTRUCT( "VEHICLE_DECONSTRUCT" );
static const zone_type_id zone_type_VEHICLE_REPAIR( "VEHICLE_REPAIR" );


static const zone_type_id z_camp_food( "CAMP_FOOD" );
static const zone_type_id z_camp_storage( "CAMP_STORAGE" );
static const zone_type_id z_loot_unsorted( "LOOT_UNSORTED" );
Expand Down
8 changes: 4 additions & 4 deletions src/monexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool monexamine::pet_menu( monster &z )
amenu.addentry( rope, true, 't', _( "Untie" ) );
} else if( !z.has_flag( MF_RIDEABLE_MECH ) ) {
std::vector<item *> rope_inv = g->u.items_with( []( const item & itm ) {
return itm.has_flag( "TIE_UP" );
return itm.has_flag( flag_TIE_UP );
} );
if( !rope_inv.empty() ) {
amenu.addentry( rope, true, 't', _( "Tie" ) );
Expand Down Expand Up @@ -254,7 +254,7 @@ static item_location pet_armor_loc( monster &z )
static item_location tack_loc()
{
auto filter = []( const item & it ) {
return it.has_flag( "TACK" );
return it.has_flag( flag_TACK );
};

return game_menus::inv::titled_filter_menu( filter, g->u, _( "Tack" ) );
Expand All @@ -273,7 +273,7 @@ void monexamine::insert_battery( monster &z )
return;
}
std::vector<item *> bat_inv = g->u.items_with( []( const item & itm ) {
return itm.has_flag( "MECH_BAT" );
return itm.has_flag( flag_MECH_BAT );
} );
if( bat_inv.empty() ) {
return;
Expand Down Expand Up @@ -637,7 +637,7 @@ void monexamine::tie_or_untie( monster &z )
}
} else {
std::vector<item *> rope_inv = g->u.items_with( []( const item & itm ) {
return itm.has_flag( "TIE_UP" );
return itm.has_flag( flag_TIE_UP );
} );
if( rope_inv.empty() ) {
return;
Expand Down
42 changes: 22 additions & 20 deletions src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ bool monster::will_move_to( const tripoint &p ) const
{
if( g->m.impassable( p ) ) {
if( digging() ) {
if( !g->m.has_flag( "BURROWABLE", p ) ) {
if( !g->m.has_flag( flag_BURROWABLE, p ) ) {
return false;
}
} else if( !( can_climb() && g->m.has_flag( "CLIMBABLE", p ) ) ) {
} else if( !( can_climb() && g->m.has_flag( flag_CLIMBABLE, p ) ) ) {
return false;
}
}
Expand All @@ -101,11 +101,11 @@ bool monster::will_move_to( const tripoint &p ) const
return false;
}

if( digs() && !g->m.has_flag( "DIGGABLE", p ) && !g->m.has_flag( "BURROWABLE", p ) ) {
if( digs() && !g->m.has_flag( flag_DIGGABLE, p ) && !g->m.has_flag( flag_BURROWABLE, p ) ) {
return false;
}

if( has_flag( MF_AQUATIC ) && !g->m.has_flag( "SWIMMABLE", p ) ) {
if( has_flag( MF_AQUATIC ) && !g->m.has_flag( flag_SWIMMABLE, p ) ) {
return false;
}

Expand Down Expand Up @@ -163,7 +163,7 @@ bool monster::will_move_to( const tripoint &p ) const
// Some things are only avoided if we're not attacking
if( attitude( &g->u ) != MATT_ATTACK ) {
// Sharp terrain is ignored while attacking
if( avoid_simple && g->m.has_flag( "SHARP", p ) &&
if( avoid_simple && g->m.has_flag( flag_SHARP, p ) &&
!( type->size == MS_TINY || flies() ) ) {
return false;
}
Expand Down Expand Up @@ -548,7 +548,7 @@ static float get_stagger_adjust( const tripoint &source, const tripoint &destina

bool monster::die_if_drowning( const tripoint &at_pos, const int chance )
{
if( g->m.has_flag( "LIQUID", at_pos ) && can_drown() && one_in( chance ) ) {
if( g->m.has_flag( flag_LIQUID, at_pos ) && can_drown() && one_in( chance ) ) {
// if there's a vehicle here with a boardable part, the monster is on it
// and not drowning
if( g->m.veh_at( at_pos ).part_with_feature( "BOARDABLE", false ) ) {
Expand Down Expand Up @@ -1132,40 +1132,40 @@ int monster::calc_movecost( const tripoint &f, const tripoint &t ) const
const int source_cost = g->m.move_cost( f );
const int dest_cost = g->m.move_cost( t );
// Digging and flying monsters ignore terrain cost
if( flies() || ( digging() && g->m.has_flag( "DIGGABLE", t ) ) ) {
if( flies() || ( digging() && g->m.has_flag( flag_DIGGABLE, t ) ) ) {
movecost = 100;
// Swimming monsters move super fast in water
} else if( swims() ) {
if( g->m.has_flag( "SWIMMABLE", f ) ) {
if( g->m.has_flag( flag_SWIMMABLE, f ) ) {
movecost += 25;
} else {
movecost += 50 * g->m.move_cost( f );
}
if( g->m.has_flag( "SWIMMABLE", t ) ) {
if( g->m.has_flag( flag_SWIMMABLE, t ) ) {
movecost += 25;
} else {
movecost += 50 * g->m.move_cost( t );
}
} else if( can_submerge() ) {
// No-breathe monsters have to walk underwater slowly
if( g->m.has_flag( "SWIMMABLE", f ) ) {
if( g->m.has_flag( flag_SWIMMABLE, f ) ) {
movecost += 250;
} else {
movecost += 50 * g->m.move_cost( f );
}
if( g->m.has_flag( "SWIMMABLE", t ) ) {
if( g->m.has_flag( flag_SWIMMABLE, t ) ) {
movecost += 250;
} else {
movecost += 50 * g->m.move_cost( t );
}
movecost /= 2;
} else if( climbs() ) {
if( g->m.has_flag( "CLIMBABLE", f ) ) {
if( g->m.has_flag( flag_CLIMBABLE, f ) ) {
movecost += 150;
} else {
movecost += 50 * g->m.move_cost( f );
}
if( g->m.has_flag( "CLIMBABLE", t ) ) {
if( g->m.has_flag( flag_CLIMBABLE, t ) ) {
movecost += 150;
} else {
movecost += 50 * g->m.move_cost( t );
Expand Down Expand Up @@ -1252,7 +1252,7 @@ bool monster::bash_at( const tripoint &p )
return false;
}

bool flat_ground = g->m.has_flag( "ROAD", p ) || g->m.has_flag( "FLAT", p );
bool flat_ground = g->m.has_flag( flag_ROAD, p ) || g->m.has_flag( flag_FLAT, p );
if( flat_ground ) {
bool can_bash_ter = g->m.is_bashable_ter( p );
bool try_bash_ter = one_in( 50 );
Expand Down Expand Up @@ -1412,7 +1412,7 @@ bool monster::move_to( const tripoint &p, bool force, const float stagger_adjust

// Allows climbing monsters to move on terrain with movecost <= 0
Creature *critter = g->critter_at( destination, is_hallucination() );
if( g->m.has_flag( "CLIMBABLE", destination ) ) {
if( g->m.has_flag( flag_CLIMBABLE, destination ) ) {
if( g->m.impassable( destination ) && critter == nullptr ) {
if( flies() ) {
moves -= 100;
Expand Down Expand Up @@ -1495,15 +1495,17 @@ bool monster::move_to( const tripoint &p, bool force, const float stagger_adjust
if( type->size != MS_TINY && on_ground ) {
const int sharp_damage = rng( 1, 10 );
const int rough_damage = rng( 1, 2 );
if( g->m.has_flag( "SHARP", pos() ) && !one_in( 4 ) && get_armor_cut( bp_torso ) < sharp_damage ) {
if( g->m.has_flag( flag_SHARP, pos() ) && !one_in( 4 ) &&
get_armor_cut( bp_torso ) < sharp_damage ) {
apply_damage( nullptr, bp_torso, sharp_damage );
}
if( g->m.has_flag( "ROUGH", pos() ) && one_in( 6 ) && get_armor_cut( bp_torso ) < rough_damage ) {
if( g->m.has_flag( flag_ROUGH, pos() ) && one_in( 6 ) &&
get_armor_cut( bp_torso ) < rough_damage ) {
apply_damage( nullptr, bp_torso, rough_damage );
}
}

if( g->m.has_flag( "UNSTABLE", destination ) && on_ground ) {
if( g->m.has_flag( flag_UNSTABLE, destination ) && on_ground ) {
add_effect( effect_bouldering, 1_turns, num_bp, true );
} else if( has_effect( effect_bouldering ) ) {
remove_effect( effect_bouldering );
Expand All @@ -1520,10 +1522,10 @@ bool monster::move_to( const tripoint &p, bool force, const float stagger_adjust
return true;
}
if( !will_be_water && ( digs() || can_dig() ) ) {
underwater = g->m.has_flag( "DIGGABLE", pos() );
underwater = g->m.has_flag( flag_DIGGABLE, pos() );
}
// Diggers turn the dirt into dirtmound
if( digging() && g->m.has_flag( "DIGGABLE", pos() ) ) {
if( digging() && g->m.has_flag( flag_DIGGABLE, pos() ) ) {
int factor = 0;
switch( type->size ) {
case MS_TINY:
Expand Down
6 changes: 3 additions & 3 deletions src/morale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,9 @@ void player_morale::on_effect_int_change( const efftype_id &eid, int intensity,

void player_morale::set_worn( const item &it, bool worn )
{
const bool fancy = it.has_flag( "FANCY" );
const bool super_fancy = it.has_flag( "SUPER_FANCY" );
const bool filthy_gear = it.has_flag( "FILTHY" );
const bool fancy = it.has_flag( flag_FANCY );
const bool super_fancy = it.has_flag( flag_SUPER_FANCY );
const bool filthy_gear = it.has_flag( flag_FILTHY );
const int sign = ( worn ) ? 1 : -1;

const auto update_body_part = [&]( body_part_data & bp_data ) {
Expand Down
4 changes: 2 additions & 2 deletions src/mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ bool Character::can_use_heal_item( const item &med ) const
}
}
if( !got_restriction ) {
can_use = !med.has_flag( "CANT_HEAL_EVERYONE" );
can_use = !med.has_flag( flag_CANT_HEAL_EVERYONE );
}

if( !can_use ) {
Expand Down Expand Up @@ -493,7 +493,7 @@ void Character::activate_mutation( const trait_id &mut )
// Check for adjacent trees.
bool adjacent_tree = false;
for( const tripoint &p2 : g->m.points_in_radius( pos(), 1 ) ) {
if( g->m.has_flag( "TREE", p2 ) ) {
if( g->m.has_flag( flag_TREE, p2 ) ) {
adjacent_tree = true;
}
}
Expand Down
Loading

0 comments on commit 50059c8

Please sign in to comment.