Skip to content

Commit

Permalink
Move string consts into single file (#38184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 authored Feb 20, 2020
1 parent 123f1b6 commit 19c5698
Show file tree
Hide file tree
Showing 11 changed files with 227 additions and 126 deletions.
8 changes: 4 additions & 4 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1504,19 +1504,19 @@ void activity_handlers::forage_finish( player_activity *act, player *p )
switch( season_of_year( calendar::turn ) ) {
case SPRING:
loc = "forage_spring";
next_ter = ter_str_id( "t_underbrush_harvested_spring" );
next_ter = ter_underbrush_harvested_spring;
break;
case SUMMER:
loc = "forage_summer";
next_ter = ter_str_id( "t_underbrush_harvested_summer" );
next_ter = ter_underbrush_harvested_summer;
break;
case AUTUMN:
loc = "forage_autumn";
next_ter = ter_str_id( "t_underbrush_harvested_autumn" );
next_ter = ter_underbrush_harvested_autumn;
break;
case WINTER:
loc = "forage_winter";
next_ter = ter_str_id( "t_underbrush_harvested_winter" );
next_ter = ter_underbrush_harvested_winter;
break;
default:
debugmsg( "Invalid season" );
Expand Down
105 changes: 103 additions & 2 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ static const std::string flag_ORGANIC( "ORGANIC" );
static const std::string flag_OUTER( "OUTER" );
static const std::string flag_OVERSIZE( "OVERSIZE" );
static const std::string flag_PARTIAL_DEAF( "PARTIAL_DEAF" );
static const std::string flag_PERMEABLE( "PERMEABLE" );
static const std::string flag_PERPETUAL( "PERPETUAL" );
static const std::string flag_PERSONAL( "PERSONAL" );
static const std::string flag_PLACE_ITEM( "PLACE_ITEM" );
Expand Down Expand Up @@ -1242,6 +1243,7 @@ static const std::string flag_RADIOSIGNAL_2( "RADIOSIGNAL_2" );
static const std::string flag_RADIOSIGNAL_3( "RADIOSIGNAL_3" );
static const std::string flag_RAIN_PROTECT( "RAIN_PROTECT" );
static const std::string flag_RAINPROOF( "RAINPROOF" );
static const std::string flag_RAMP( "RAMP" );
static const std::string flag_RAMP_END( "RAMP_END" );
static const std::string flag_RAW( "RAW" );
static const std::string flag_REACH_ATTACK( "REACH_ATTACK" );
Expand Down Expand Up @@ -1508,15 +1510,114 @@ static const matec_id matec_WBLOCK_2( "WBLOCK_2" );
static const matec_id matec_WBLOCK_3( "WBLOCK_3" );
static const matec_id matec_WHIP_DISARM( "WHIP_DISARM" );

static const ter_str_id ter_bridge( "t_bridge" );
static const ter_str_id ter_chainfence( "t_chainfence" );
static const ter_str_id ter_clay( "t_clay" );
static const ter_str_id ter_claymound( "t_claymound" );
static const ter_str_id ter_conveyor( "t_conveyor" );
static const ter_str_id ter_dirt( "t_dirt" );
static const ter_str_id ter_dirtfloor( "t_dirtfloor" );
static const ter_str_id ter_dirtmound( "t_dirtmound" );
static const ter_str_id ter_dirtmoundfloor( "t_dirtmoundfloor" );
static const ter_str_id ter_elevator( "t_elevator" );
static const ter_str_id ter_gas_pump( "t_gas_pump" );
static const ter_str_id ter_gas_pump_a( "t_gas_pump_a" );
static const ter_str_id ter_gas_tank( "t_gas_tank" );
static const ter_str_id ter_golf_hole( "t_golf_hole" );
static const ter_str_id ter_grass( "t_grass" );
static const ter_str_id ter_grass_dead( "t_grass_dead" );
static const ter_str_id ter_grass_golf( "t_grass_golf" );
static const ter_str_id ter_grass_long( "t_grass_long" );
static const ter_str_id ter_grass_tall( "t_grass_tall" );
static const ter_str_id ter_grass_white( "t_grass_white" );
static const ter_str_id ter_grate( "t_grate" );
static const ter_str_id ter_grave( "t_grave" );
static const ter_str_id ter_grave_new( "t_grave_new" );
static const ter_str_id ter_guardrail_bg_dp( "t_guardrail_bg_dp" );
static const ter_str_id ter_machinery_electronic( "t_machinery_electronic" );
static const ter_str_id ter_machinery_heavy( "t_machinery_heavy" );
static const ter_str_id ter_machinery_light( "t_machinery_light" );
static const ter_str_id ter_machinery_old( "t_machinery_old" );
static const ter_str_id ter_metal_floor( "t_metal_floor" );
static const ter_str_id ter_moss( "t_moss" );
static const ter_str_id ter_nanofab_body( "t_nanofab_body" );
static const ter_str_id ter_ov_smreb_cage( "t_ov_smreb_cage" );
static const ter_str_id ter_palisade_gate_o( "t_palisade_gate_o" );
static const ter_str_id ter_pit( "t_pit" );
static const ter_str_id ter_pit_corpsed( "t_pit_corpsed" );
static const ter_str_id ter_pit_covered( "t_pit_covered" );
static const ter_str_id ter_pit_glass( "t_pit_glass" );
static const ter_str_id ter_pit_shallow( "t_pit_shallow" );
static const ter_str_id ter_pit_spiked( "t_pit_spiked" );
static const ter_str_id ter_pit_spiked_covered( "t_pit_spiked_covered" );
static const ter_str_id ter_plut_generator( "t_plut_generator" );
static const ter_str_id ter_railroad_rubble( "t_railroad_rubble" );
static const ter_str_id ter_railroad_tie( "t_railroad_tie" );
static const ter_str_id ter_railroad_tie_d( "t_railroad_tie_d" );
static const ter_str_id ter_railroad_tie_d1( "t_railroad_tie_d1" );
static const ter_str_id ter_railroad_tie_d2( "t_railroad_tie_d2" );
static const ter_str_id ter_railroad_tie_h( "t_railroad_tie_h" );
static const ter_str_id ter_railroad_tie_v( "t_railroad_tie_v" );
static const ter_str_id ter_railroad_track( "t_railroad_track" );
static const ter_str_id ter_railroad_track_d( "t_railroad_track_d" );
static const ter_str_id ter_railroad_track_d_on_tie( "t_railroad_track_d_on_tie" );
static const ter_str_id ter_railroad_track_d1( "t_railroad_track_d1" );
static const ter_str_id ter_railroad_track_d2( "t_railroad_track_d2" );
static const ter_str_id ter_railroad_track_h( "t_railroad_track_h" );
static const ter_str_id ter_railroad_track_h_on_tie( "t_railroad_track_h_on_tie" );
static const ter_str_id ter_railroad_track_on_tie( "t_railroad_track_on_tie" );
static const ter_str_id ter_railroad_track_v( "t_railroad_track_v" );
static const ter_str_id ter_railroad_track_v_on_tie( "t_railroad_track_v_on_tie" );
static const ter_str_id ter_rootcellar( "t_rootcellar" );
static const ter_str_id ter_sand( "t_sand" );
static const ter_str_id ter_sandbox( "t_sandbox" );
static const ter_str_id ter_sandmound( "t_sandmound" );
static const ter_str_id ter_sewage( "t_sewage" );
static const ter_str_id ter_shrub( "t_shrub" );
static const ter_str_id ter_shrub_blackberry( "t_shrub_blackberry" );
static const ter_str_id ter_shrub_blackberry_harvested( "t_shrub_blackberry_harvested" );
static const ter_str_id ter_shrub_blueberry( "t_shrub_blueberry" );
static const ter_str_id ter_shrub_blueberry_harvested( "t_shrub_blueberry_harvested" );
static const ter_str_id ter_shrub_grape( "t_shrub_grape" );
static const ter_str_id ter_shrub_grape_harvested( "t_shrub_grape_harvested" );
static const ter_str_id ter_shrub_huckleberry( "t_shrub_huckleberry" );
static const ter_str_id ter_shrub_huckleberry_harvested( "t_shrub_huckleberry_harvested" );
static const ter_str_id ter_shrub_hydrangea( "t_shrub_hydrangea" );
static const ter_str_id ter_shrub_hydrangea_harvested( "t_shrub_hydrangea_harvested" );
static const ter_str_id ter_shrub_lilac( "t_shrub_lilac" );
static const ter_str_id ter_shrub_lilac_harvested( "t_shrub_lilac_harvested" );
static const ter_str_id ter_shrub_peanut( "t_shrub_peanut" );
static const ter_str_id ter_shrub_peanut_harvested( "t_shrub_peanut_harvested" );
static const ter_str_id ter_shrub_raspberry( "t_shrub_raspberry" );
static const ter_str_id ter_shrub_raspberry_harvested( "t_shrub_raspberry_harvested" );
static const ter_str_id ter_shrub_rose( "t_shrub_rose" );
static const ter_str_id ter_shrub_rose_harvested( "t_shrub_rose_harvested" );
static const ter_str_id ter_shrub_strawberry( "t_shrub_strawberry" );
static const ter_str_id ter_shrub_strawberry_harvested( "t_shrub_strawberry_harvested" );
static const ter_str_id ter_slide( "t_slide" );
static const ter_str_id ter_stump( "t_stump" );
static const ter_str_id ter_swater_dp( "t_swater_dp" );
static const ter_str_id ter_swater_sh( "t_swater_sh" );
static const ter_str_id ter_tree_birch_harvested( "t_tree_birch_harvested" );
static const ter_str_id ter_tree_dead( "t_tree_dead" );
static const ter_str_id ter_tree_deadpine( "t_tree_deadpine" );
static const ter_str_id ter_tree_birch_harvested( "t_tree_birch_harvested" );
static const ter_str_id ter_tree_willow_harvested( "t_tree_willow_harvested" );
static const ter_str_id ter_tree_hickory_dead( "t_tree_hickory_dead" );
static const ter_str_id ter_tree_willow_harvested( "t_tree_willow_harvested" );
static const ter_str_id ter_trunk( "t_trunk" );
static const ter_str_id ter_underbrush( "t_underbrush" );
static const ter_str_id ter_underbrush_harvested_autumn( "t_underbrush_harvested_autumn" );
static const ter_str_id ter_underbrush_harvested_spring( "t_underbrush_harvested_spring" );
static const ter_str_id ter_underbrush_harvested_summer( "t_underbrush_harvested_summer" );
static const ter_str_id ter_underbrush_harvested_winter( "t_underbrush_harvested_winter" );
static const ter_str_id ter_utility_light( "t_utility_light" );
static const ter_str_id ter_water_dp( "t_water_dp" );
static const ter_str_id ter_water_moving_dp( "t_water_moving_dp" );
static const ter_str_id ter_water_moving_sh( "t_water_moving_sh" );
static const ter_str_id ter_water_pool( "t_water_pool" );
static const ter_str_id ter_water_sh( "t_water_sh" );

static const oter_str_id oter_forest( "forest" );
static const oter_str_id oter_forest_thick( "forest_thick" );

static const std::string part_location_structure( "structure" );
static const std::string part_location_center( "center" );
Expand Down
14 changes: 7 additions & 7 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void iexamine::nanofab( player &p, const tripoint &examp )
bool table_exists = false;
tripoint spawn_point;
for( const auto &valid_location : g->m.points_in_radius( examp, 1 ) ) {
if( g->m.ter( valid_location ) == ter_str_id( "t_nanofab_body" ) ) {
if( g->m.ter( valid_location ) == ter_nanofab_body ) {
spawn_point = valid_location;
table_exists = true;
break;
Expand Down Expand Up @@ -3788,7 +3788,7 @@ static int getNearPumpCount( const tripoint &p )
int result = 0;
for( const tripoint &tmp : g->m.points_in_radius( p, 12 ) ) {
const auto t = g->m.ter( tmp );
if( t == ter_str_id( "t_gas_pump" ) || t == ter_str_id( "t_gas_pump_a" ) ) {
if( t == ter_gas_pump || t == ter_gas_pump_a ) {
result++;
}
}
Expand All @@ -3802,7 +3802,7 @@ cata::optional<tripoint> iexamine::getNearFilledGasTank( const tripoint &center,
gas_units = 0;

for( const tripoint &tmp : g->m.points_in_radius( center, SEEX * 2 ) ) {
if( g->m.ter( tmp ) != ter_str_id( "t_gas_tank" ) ) {
if( g->m.ter( tmp ) != ter_gas_tank ) {
continue;
}

Expand Down Expand Up @@ -3908,7 +3908,7 @@ cata::optional<tripoint> iexamine::getGasPumpByNumber( const tripoint &p, int nu
int k = 0;
for( const tripoint &tmp : g->m.points_in_radius( p, 12 ) ) {
const auto t = g->m.ter( tmp );
if( ( t == ter_str_id( "t_gas_pump" ) || t == ter_str_id( "t_gas_pump_a" ) ) && number == k++ ) {
if( ( t == ter_gas_pump || t == ter_gas_pump_a ) && number == k++ ) {
return tmp;
}
}
Expand Down Expand Up @@ -3972,11 +3972,11 @@ static void turnOnSelectedPump( const tripoint &p, int number )
int k = 0;
for( const tripoint &tmp : g->m.points_in_radius( p, 12 ) ) {
const auto t = g->m.ter( tmp );
if( t == ter_str_id( "t_gas_pump" ) || t == ter_str_id( "t_gas_pump_a" ) ) {
if( t == ter_gas_pump || t == ter_gas_pump_a ) {
if( number == k++ ) {
g->m.ter_set( tmp, ter_str_id( "t_gas_pump_a" ) );
g->m.ter_set( tmp, ter_gas_pump_a );
} else {
g->m.ter_set( tmp, ter_str_id( "t_gas_pump" ) );
g->m.ter_set( tmp, ter_gas_pump );
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ static extended_photo_def photo_def_for_camera_point( const tripoint &aim_point,
std::vector<monster *> &monster_vec, std::vector<player *> &player_vec );

static const std::vector<std::string> camera_ter_whitelist_flags = {
"HIDE_PLACE", "FUNGUS", "TREE", "PERMEABLE", "SHRUB",
"PLACE_ITEM", "GROWTH_HARVEST", "GROWTH_MATURE", "GOES_UP",
"GOES_DOWN", "RAMP", "SHARP", "SIGN", "CLIMBABLE"
flag_HIDE_PLACE, flag_FUNGUS, flag_TREE, flag_PERMEABLE, flag_SHRUB,
flag_PLACE_ITEM, flag_GROWTH_HARVEST, flag_GROWTH_MATURE, flag_GOES_UP,
flag_GOES_DOWN, flag_RAMP, flag_SHARP, flag_SIGN, flag_CLIMBABLE
};
static const std::vector<ter_str_id> camera_ter_whitelist_types = {
ter_str_id( "t_pit_covered" ), ter_str_id( "t_grave_new" ), ter_str_id( "t_grave" ), ter_str_id( "t_pit" ),
ter_str_id( "t_pit_shallow" ), ter_str_id( "t_pit_corpsed" ), ter_str_id( "t_pit_spiked" ),
ter_str_id( "t_pit_spiked_covered" ), ter_str_id( "t_pit_glass" ), ter_str_id( "t_pit_glass" ), ter_str_id( "t_utility_light" )
ter_pit_covered, ter_grave_new, ter_grave, ter_pit,
ter_pit_shallow, ter_pit_corpsed, ter_pit_spiked,
ter_pit_spiked_covered, ter_pit_glass, ter_pit_glass, ter_utility_light
};

void remove_radio_mod( item &it, player &p )
Expand Down
16 changes: 8 additions & 8 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6972,13 +6972,13 @@ void map::rad_scorch( const tripoint &p, const time_duration &time_since_last_ac
const ter_id tid = ter( p );
// TODO: De-hardcode this
static const std::map<ter_id, ter_str_id> dies_into {{
{t_grass, ter_str_id( "t_dirt" )},
{t_tree_young, ter_str_id( "t_dirt" )},
{t_tree_pine, ter_str_id( "t_tree_deadpine" )},
{t_tree_birch, ter_str_id( "t_tree_birch_harvested" )},
{t_tree_willow, ter_str_id( "t_tree_willow_harvested" )},
{t_tree_hickory, ter_str_id( "t_tree_hickory_dead" )},
{t_tree_hickory_harvested, ter_str_id( "t_tree_hickory_dead" )},
{t_grass, ter_dirt},
{t_tree_young, ter_dirt},
{t_tree_pine, ter_tree_deadpine},
{t_tree_birch, ter_tree_birch_harvested},
{t_tree_willow, ter_tree_willow_harvested},
{t_tree_hickory, ter_tree_hickory_dead},
{t_tree_hickory_harvested, ter_tree_hickory_dead},
}};

const auto iter = dies_into.find( tid );
Expand All @@ -6991,7 +6991,7 @@ void map::rad_scorch( const tripoint &p, const time_duration &time_since_last_ac
if( tr.has_flag( flag_SHRUB ) ) {
ter_set( p, t_dirt );
} else if( tr.has_flag( flag_TREE ) ) {
ter_set( p, ter_str_id( "t_tree_dead" ) );
ter_set( p, ter_tree_dead );
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/mapgen_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,7 @@ void mapgen_cave( mapgendata &dat )
m->place_spawns( GROUP_CAVE, 2, point( 6, 6 ), point( 18, 18 ), 1.0 );
} else { // We're above ground!
// First, draw a forest
mapgendata forest_mapgen_dat( dat, oter_str_id( "forest" ).id() );
mapgendata forest_mapgen_dat( dat, oter_forest.id() );
mapgen_forest( forest_mapgen_dat );
// Clear the center with some rocks
square( m, t_rock, SEEX - 6, SEEY - 6, SEEX + 5, SEEY + 5 );
Expand Down Expand Up @@ -2936,7 +2936,7 @@ void mapgen_forest( mapgendata &dat )
void mapgen_forest_trail_straight( mapgendata &dat )
{
map *const m = &dat.m;
mapgendata forest_mapgen_dat( dat, oter_str_id( "forest_thick" ).id() );
mapgendata forest_mapgen_dat( dat, oter_forest_thick.id() );
mapgen_forest( forest_mapgen_dat );

const auto center_offset = [&dat]() {
Expand Down Expand Up @@ -2974,7 +2974,7 @@ void mapgen_forest_trail_straight( mapgendata &dat )
void mapgen_forest_trail_curved( mapgendata &dat )
{
map *const m = &dat.m;
mapgendata forest_mapgen_dat( dat, oter_str_id( "forest_thick" ).id() );
mapgendata forest_mapgen_dat( dat, oter_forest_thick.id() );
mapgen_forest( forest_mapgen_dat );

const auto center_offset = [&dat]() {
Expand Down Expand Up @@ -3020,7 +3020,7 @@ void mapgen_forest_trail_curved( mapgendata &dat )
void mapgen_forest_trail_tee( mapgendata &dat )
{
map *const m = &dat.m;
mapgendata forest_mapgen_dat( dat, oter_str_id( "forest_thick" ).id() );
mapgendata forest_mapgen_dat( dat, oter_forest_thick.id() );
mapgen_forest( forest_mapgen_dat );

const auto center_offset = [&dat]() {
Expand Down Expand Up @@ -3065,7 +3065,7 @@ void mapgen_forest_trail_tee( mapgendata &dat )
void mapgen_forest_trail_four_way( mapgendata &dat )
{
map *const m = &dat.m;
mapgendata forest_mapgen_dat( dat, oter_str_id( "forest_thick" ).id() );
mapgendata forest_mapgen_dat( dat, oter_forest_thick.id() );
mapgen_forest( forest_mapgen_dat );

const auto center_offset = [&dat]() {
Expand Down
2 changes: 1 addition & 1 deletion src/mission_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void mission_start::ranch_scavenger_3( mission *miss )
bay.spawn_item( point( 17, 21 ), "wheel_wide" );
bay.spawn_item( point( 23, 18 ), "v8_combustion" );
bay.furn_set( point( 23, 17 ), furn_str_id( "f_arcade_machine" ) );
bay.ter_set( point( 23, 16 ), ter_str_id( "t_machinery_light" ) );
bay.ter_set( point( 23, 16 ), ter_machinery_light );
bay.furn_set( point( 20, 21 ), f_woodstove );
bay.save();

Expand Down
2 changes: 1 addition & 1 deletion src/monattack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3376,7 +3376,7 @@ bool mattack::searchlight( monster *z )
for( int x = zposx - 24; x < zposx + 24; x++ ) {
for( int y = zposy - 24; y < zposy + 24; y++ ) {
tripoint dest( x, y, z->posz() );
if( g->m.ter( dest ) == ter_str_id( "t_plut_generator" ) ) {
if( g->m.ter( dest ) == ter_plut_generator ) {
generator_ok = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ void monster::process_turn()
explosion_handler::emp_blast( zap ); // Fries electronics due to the intensity of the field
}
const auto t = g->m.ter( zap );
if( t == ter_str_id( "t_gas_pump" ) || t == ter_str_id( "t_gas_pump_a" ) ) {
if( t == ter_gas_pump || t == ter_gas_pump_a ) {
if( one_in( 4 ) ) {
explosion_handler::explosion( pos(), 40, 0.8, true );
if( player_sees ) {
Expand Down
2 changes: 1 addition & 1 deletion src/overmap_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void draw( const catacurses::window &w, const catacurses::window &wbar, const tr
// Whether showing hordes is currently enabled
const bool showhordes = uistate.overmap_show_hordes;

const oter_id forest = oter_str_id( "forest" ).id();
const oter_id forest = oter_forest.id();

std::string sZoneName;
tripoint tripointZone = tripoint( -1, -1, -1 );
Expand Down
Loading

0 comments on commit 19c5698

Please sign in to comment.