From e9f4fbd110ee99cb4d69ff15368c43567e37f166 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:08:37 +0100 Subject: [PATCH] Remove extern ter ids (#72766) --- src/activity_actor.cpp | 31 ++- src/activity_handlers.cpp | 7 +- src/activity_item_handling.cpp | 9 +- src/avatar.cpp | 15 +- src/avatar_action.cpp | 33 ++- src/build_reqs.h | 2 +- src/cata_tiles.cpp | 12 +- src/character.cpp | 12 +- src/computer_session.cpp | 153 +++++++----- src/construction.cpp | 50 ++-- src/editmap.cpp | 4 +- src/explosion.cpp | 17 +- src/faction_camp.cpp | 47 ++-- src/fungal_effects.cpp | 42 ++-- src/game.cpp | 22 +- src/gamemode_tutorial.cpp | 19 +- src/iexamine.cpp | 181 ++++++++------ src/iuse.cpp | 15 +- src/map.cpp | 163 +++++++----- src/map.h | 8 +- src/map_extras.cpp | 129 ++++++---- src/map_field.cpp | 23 +- src/mapdata.cpp | 415 +------------------------------ src/mapdata.h | 121 +-------- src/mapgen.cpp | 407 ++++++++++++++++-------------- src/mapgen_functions.cpp | 269 +++++++++++--------- src/mapgen_functions.h | 9 +- src/mapgendata.cpp | 2 +- src/mapgenformat.cpp | 2 +- src/mission_companion.cpp | 75 ++++-- src/mission_start.cpp | 9 +- src/monattack.cpp | 38 +-- src/monmove.cpp | 9 +- src/npctrade_utils.cpp | 4 +- src/recipe.cpp | 1 + src/regional_settings.cpp | 8 +- src/savegame_json.cpp | 20 +- src/start_location.cpp | 26 +- src/timed_event.cpp | 42 ++-- src/trapfunc.cpp | 64 ++--- src/vehicle_autodrive.cpp | 8 +- src/vehicle_move.cpp | 28 ++- src/vehicle_use.cpp | 11 +- tests/act_build_test.cpp | 20 +- tests/cardio_test.cpp | 4 +- tests/char_suffer_test.cpp | 6 +- tests/connect_rotate_test.cpp | 236 +++++++++--------- tests/eoc_test.cpp | 15 +- tests/field_test.cpp | 3 +- tests/gates_test.cpp | 68 ++--- tests/ground_destroy_test.cpp | 22 +- tests/map_bash_test.cpp | 3 +- tests/map_helpers.cpp | 10 +- tests/monster_vision_test.cpp | 4 +- tests/move_cost_test.cpp | 15 +- tests/player_activities_test.cpp | 45 ++-- tests/stats_tracker_test.cpp | 69 ++--- tests/submap_load_test.cpp | 28 ++- 58 files changed, 1518 insertions(+), 1592 deletions(-) diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index c203b6452e966..5e906a3d71b2b 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -225,6 +225,15 @@ static const skill_id skill_traps( "traps" ); static const species_id species_ZOMBIE( "ZOMBIE" ); +static const ter_str_id ter_t_card_reader_broken( "t_card_reader_broken" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_locked_alarm( "t_door_locked_alarm" ); +static const ter_str_id ter_t_door_metal_c( "t_door_metal_c" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_stump( "t_stump" ); +static const ter_str_id ter_t_trunk( "t_trunk" ); static const ter_str_id ter_t_underbrush_harvested_autumn( "t_underbrush_harvested_autumn" ); static const ter_str_id ter_t_underbrush_harvested_spring( "t_underbrush_harvested_spring" ); static const ter_str_id ter_t_underbrush_harvested_summer( "t_underbrush_harvested_summer" ); @@ -814,10 +823,10 @@ void hacking_activity_actor::finish( player_activity &act, Character &who ) } else if( type == hack_type::DOOR ) { who.add_msg_if_player( _( "You activate the panel!" ) ); who.add_msg_if_player( m_good, _( "The nearby doors unlock." ) ); - here.ter_set( examp, t_card_reader_broken ); + here.ter_set( examp, ter_t_card_reader_broken ); for( const tripoint &tmp : here.points_in_radius( examp, 3 ) ) { - if( here.ter( tmp ) == t_door_metal_locked ) { - here.ter_set( tmp, t_door_metal_c ); + if( here.ter( tmp ) == ter_t_door_metal_locked ) { + here.ter_set( tmp, ter_t_door_metal_c ); } } } @@ -2811,7 +2820,7 @@ void lockpick_activity_actor::finish( player_activity &act, Character &who ) you->practice( skill_traps, xp_gain ); } - if( !perfect && ter_type == t_door_locked_alarm && ( lock_roll + dice( 1, 30 ) ) > pick_roll ) { + if( !perfect && ter_type == ter_t_door_locked_alarm && ( lock_roll + dice( 1, 30 ) ) > pick_roll ) { sounds::sound( who.pos(), 40, sounds::sound_t::alarm, _( "an alarm sound!" ), true, "environment", "alarm" ); } @@ -2858,7 +2867,7 @@ std::optional lockpick_activity_actor::select_location( avatar &you ) } else if( get_creature_tracker().creature_at( *target ) ) { you.add_msg_if_player( m_info, _( "You can pick your friends, and you can\npick your nose, but you can't pick\nyour friend's nose." ) ); - } else if( terr_type == t_door_c ) { + } else if( terr_type == ter_t_door_c ) { you.add_msg_if_player( m_info, _( "That door isn't locked." ) ); } else { you.add_msg_if_player( m_info, _( "That cannot be picked." ) ); @@ -6213,11 +6222,11 @@ void chop_logs_activity_actor::finish( player_activity &act, Character &who ) int log_quan; int stick_quan; int splint_quan; - if( here.ter( pos ) == t_trunk ) { + if( here.ter( pos ) == ter_t_trunk ) { log_quan = rng( 2, 3 ); stick_quan = rng( 0, 3 ); splint_quan = 0; - } else if( here.ter( pos ) == t_stump ) { + } else if( here.ter( pos ) == ter_t_stump ) { log_quan = rng( 0, 2 ); stick_quan = 0; splint_quan = rng( 5, 15 ); @@ -6241,7 +6250,7 @@ void chop_logs_activity_actor::finish( player_activity &act, Character &who ) obj.set_var( "activity_var", who.name ); here.add_item_or_charges( pos, obj ); } - here.ter_set( pos, t_dirt ); + here.ter_set( pos, ter_t_dirt ); who.add_msg_if_player( m_good, _( "You finish chopping wood." ) ); act.set_to_null(); @@ -6399,10 +6408,10 @@ void chop_tree_activity_actor::finish( player_activity &act, Character &who ) std::vector tree = line_to( pos, to, rng( 1, 8 ) ); for( const tripoint &elem : tree ) { here.batter( elem, 300, 5 ); - here.ter_set( elem, t_trunk ); + here.ter_set( elem, ter_t_trunk ); } - here.ter_set( pos, t_stump ); + here.ter_set( pos, ter_t_stump ); who.add_msg_if_player( m_good, _( "You finish chopping down a tree." ) ); // sound of falling tree here.collapse_at( pos, false, true, false ); @@ -6445,7 +6454,7 @@ void churn_activity_actor::finish( player_activity &act, Character &who ) { map &here = get_map(); who.add_msg_if_player( _( "You finish churning up the earth here." ) ); - here.ter_set( here.getlocal( act.placement ), t_dirtmound ); + here.ter_set( here.getlocal( act.placement ), ter_t_dirtmound ); // Go back to what we were doing before // could be player zone activity, or could be NPC multi-farming act.set_to_null(); diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 669bdb58b40f4..62f4a4d7e7be0 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -228,6 +228,9 @@ static const species_id species_FERAL( "FERAL" ); static const species_id species_HUMAN( "HUMAN" ); static const species_id species_ZOMBIE( "ZOMBIE" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_tree( "t_tree" ); + static const trait_id trait_DEBUG_HS( "DEBUG_HS" ); static const trait_id trait_SPIRITUAL( "SPIRITUAL" ); static const trait_id trait_STOCKY_TROGLO( "STOCKY_TROGLO" ); @@ -1670,7 +1673,7 @@ void activity_handlers::pickaxe_finish( player_activity *act, Character *you ) if( you->is_avatar() ) { const int helpersize = get_player_character().get_num_crafting_helpers( 3 ); if( here.is_bashable( pos ) && here.has_flag( ter_furn_flag::TFLAG_SUPPORTS_ROOF, pos ) && - here.ter( pos ) != t_tree ) { + here.ter( pos ) != ter_t_tree ) { // Tunneling through solid rock is sweaty, backbreaking work // Betcha wish you'd opted for the J-Hammer if( you->has_trait( trait_STOCKY_TROGLO ) ) { @@ -3273,7 +3276,7 @@ void activity_handlers::plant_seed_finish( player_activity *act, Character *you if( here.has_flag_furn( seed_id->seed->required_terrain_flag, examp ) ) { here.furn_set( examp, furn_str_id( here.furn( examp )->plant->transform ) ); } else if( seed_id->seed->required_terrain_flag == ter_furn_flag::TFLAG_PLANTABLE ) { - here.set( examp, t_dirt, f_plant_seed ); + here.set( examp, ter_t_dirt, f_plant_seed ); } else { here.furn_set( examp, f_plant_seed ); } diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 7de946961128e..abc53d671cd3b 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -118,6 +118,9 @@ static const quality_id qual_WELD( "WELD" ); static const requirement_id requirement_data_mining_standard( "mining_standard" ); +static const ter_str_id ter_t_stump( "t_stump" ); +static const ter_str_id ter_t_trunk( "t_trunk" ); + static const trait_id trait_SAPROPHAGE( "SAPROPHAGE" ); static const trait_id trait_SAPROVORE( "SAPROVORE" ); @@ -1167,8 +1170,8 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara } } if( act == ACT_MULTIPLE_CHOP_TREES ) { - if( here.has_flag( ter_furn_flag::TFLAG_TREE, src_loc ) || here.ter( src_loc ) == t_trunk || - here.ter( src_loc ) == t_stump ) { + if( here.has_flag( ter_furn_flag::TFLAG_TREE, src_loc ) || here.ter( src_loc ) == ter_t_trunk || + here.ter( src_loc ) == ter_t_stump ) { if( you.has_quality( qual_AXE ) ) { return activity_reason_info::ok( do_activity_reason::NEEDS_TREE_CHOPPING ); } else { @@ -2456,7 +2459,7 @@ static bool chop_tree_activity( Character &you, const tripoint_bub_ms &src_loc ) you.assign_activity( chop_tree_activity_actor( moves, item_location( you, &best_qual ) ) ); you.activity.placement = here.getglobal( src_loc ); return true; - } else if( ter == t_trunk || ter == t_stump ) { + } else if( ter == ter_t_trunk || ter == ter_t_stump ) { you.assign_activity( chop_logs_activity_actor( moves, item_location( you, &best_qual ) ) ); you.activity.placement = here.getglobal( src_loc ); return true; diff --git a/src/avatar.cpp b/src/avatar.cpp index f84ab64bf4b84..a3eaff6ba6bbd 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -121,6 +121,13 @@ static const move_mode_id move_mode_walk( "walk" ); static const string_id monfaction_player( "player" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_shallow( "t_pit_shallow" ); + static const trait_id trait_ARACHNID_ARMS( "ARACHNID_ARMS" ); static const trait_id trait_ARACHNID_ARMS_OK( "ARACHNID_ARMS_OK" ); static const trait_id trait_CENOBITE( "CENOBITE" ); @@ -1929,10 +1936,8 @@ void avatar::try_to_sleep( const time_duration &dur ) bool watersleep = false; if( has_trait( trait_CHLOROMORPH ) ) { plantsleep = true; - if( ( ter_at_pos == t_dirt || ter_at_pos == t_pit || - ter_at_pos == t_dirtmound || ter_at_pos == t_pit_shallow || - ter_at_pos == t_grass ) && !vp && - furn_at_pos == f_null ) { + const std::unordered_set comfy_ters = { ter_t_dirt, ter_t_dirtmound, ter_t_grass, ter_t_pit, ter_t_pit_shallow }; + if( comfy_ters.find( ter_at_pos.id() ) != comfy_ters.end() && !vp && furn_at_pos == f_null ) { add_msg_if_player( m_good, _( "You relax as your roots embrace the soil." ) ); } else if( vp ) { add_msg_if_player( m_bad, _( "It's impossible to sleep in this wheeled pot!" ) ); @@ -2004,7 +2009,7 @@ void avatar::try_to_sleep( const time_duration &dur ) vp.part_with_feature( "BED", true ) ) ) { add_msg_if_player( m_good, _( "This is a comfortable place to sleep." ) ); } else if( !plantsleep && !fungaloid_cosplay && !watersleep ) { - if( !vp && ter_at_pos != t_floor ) { + if( !vp && ter_at_pos != ter_t_floor ) { add_msg_if_player( ter_at_pos.obj().movecost <= 2 ? _( "It's a little hard to get to sleep on this %s." ) : _( "It's hard to get to sleep on this %s." ), diff --git a/src/avatar_action.cpp b/src/avatar_action.cpp index 84d35e46e8bbe..010703d79e61f 100644 --- a/src/avatar_action.cpp +++ b/src/avatar_action.cpp @@ -78,6 +78,18 @@ static const move_mode_id move_mode_prone( "prone" ); static const skill_id skill_swimming( "swimming" ); +static const ter_str_id ter_t_door_bar_locked( "t_door_bar_locked" ); +static const ter_str_id ter_t_door_locked( "t_door_locked" ); +static const ter_str_id ter_t_door_locked_alarm( "t_door_locked_alarm" ); +static const ter_str_id ter_t_door_locked_interior( "t_door_locked_interior" ); +static const ter_str_id ter_t_door_locked_peep( "t_door_locked_peep" ); +static const ter_str_id ter_t_fault( "t_fault" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_grass_alien( "t_grass_alien" ); +static const ter_str_id ter_t_grass_dead( "t_grass_dead" ); +static const ter_str_id ter_t_grass_golf( "t_grass_golf" ); +static const ter_str_id ter_t_grass_white( "t_grass_white" ); + static const trait_id trait_GRAZER( "GRAZER" ); static const trait_id trait_RUMINANT( "RUMINANT" ); static const trait_id trait_SHELL2( "SHELL2" ); @@ -294,7 +306,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint &d ) const tripoint minp = tripoint( 0, 0, you.posz() ); const tripoint maxp = tripoint( MAPSIZE_X, MAPSIZE_Y, you.posz() ); for( const tripoint &pt : m.points_in_rectangle( minp, maxp ) ) { - if( m.ter( pt ) == t_fault ) { + if( m.ter( pt ) == ter_t_fault ) { int dist = rl_dist( pt, you.pos() ); if( dist < curdist ) { curdist = dist; @@ -534,12 +546,12 @@ bool avatar_action::move( avatar &you, map &m, const tripoint &d ) if( waste_moves ) { you.mod_moves( -you.get_speed() ); } - } else if( m.ter( dest_loc ) == t_door_locked || m.ter( dest_loc ) == t_door_locked_peep || - m.ter( dest_loc ) == t_door_locked_alarm || m.ter( dest_loc ) == t_door_locked_interior ) { + } else if( m.ter( dest_loc ) == ter_t_door_bar_locked ) { + add_msg( _( "You rattle the bars but the door is locked!" ) ); + } else if( const std::unordered_set locked_doors = { ter_t_door_locked, ter_t_door_locked_peep, ter_t_door_locked_alarm, ter_t_door_locked_interior }; + locked_doors.find( m.ter( dest_loc ).id() ) != locked_doors.end() ) { // Don't drain move points for learning something you could learn just by looking add_msg( _( "That door is locked!" ) ); - } else if( m.ter( dest_loc ) == t_door_bar_locked ) { - add_msg( _( "You rattle the bars but the door is locked!" ) ); } return false; } @@ -876,7 +888,7 @@ bool avatar_action::eat_here( avatar &you ) add_msg( _( "You're too full to eat the leaves from the %s." ), here.ter( you.pos() )->name() ); return true; } else { - here.ter_set( you.pos(), t_grass ); + here.ter_set( you.pos(), ter_t_grass ); item food( "underbrush", calendar::turn, 1 ); you.assign_activity( consume_activity_actor( food ) ); return true; @@ -909,16 +921,17 @@ bool avatar_action::eat_here( avatar &you ) } } if( you.has_active_mutation( trait_GRAZER ) ) { - if( here.ter( you.pos() ) == t_grass_golf || here.ter( you.pos() ) == t_grass ) { + const ter_id &ter_underfoot = here.ter( you.pos() ); + if( ter_underfoot == ter_t_grass_golf || ter_underfoot == ter_t_grass ) { add_msg( _( "This grass is too short to graze." ) ); return true; - } else if( here.ter( you.pos() ) == t_grass_dead ) { + } else if( ter_underfoot == ter_t_grass_dead ) { add_msg( _( "This grass is dead and too mangled for you to graze." ) ); return true; - } else if( here.ter( you.pos() ) == t_grass_white ) { + } else if( ter_underfoot == ter_t_grass_white ) { add_msg( _( "This grass is tainted with paint and thus inedible." ) ); return true; - } else if( here.ter( you.pos() ) == t_grass_alien ) { + } else if( ter_underfoot == ter_t_grass_alien ) { add_msg( _( "This grass is razor sharp and would probably shred your mouth." ) ); return true; } diff --git a/src/build_reqs.h b/src/build_reqs.h index 66fe94fe69db0..6b08bbf2a3b6e 100644 --- a/src/build_reqs.h +++ b/src/build_reqs.h @@ -40,6 +40,6 @@ struct parameterized_build_reqs { build_reqs get_build_reqs_for_furn_ter_ids( const std::pair, std::map> &changed_ids, - ter_id const &base_ter = t_dirt ); + ter_id const &base_ter = ter_str_id( "t_dirt" ).id() ); #endif // CATA_SRC_BUILD_REQS_H diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp index 96578807bdfd6..76e7a986ca918 100644 --- a/src/cata_tiles.cpp +++ b/src/cata_tiles.cpp @@ -79,7 +79,9 @@ static const efftype_id effect_ridden( "ridden" ); static const itype_id itype_corpse( "corpse" ); + static const trait_id trait_INATTENTIVE( "INATTENTIVE" ); + static const trap_str_id tr_unfinished_construction( "tr_unfinished_construction" ); static const std::string ITEM_HIGHLIGHT( "highlight_item" ); @@ -4839,15 +4841,15 @@ void cata_tiles::get_terrain_orientation( const tripoint &p, int &rota, int &sub { map &here = get_map(); const bool overridden = ter_override.find( p ) != ter_override.end(); - const auto ter = [&]( const tripoint & q, const bool invis ) -> ter_id { - const auto override = ter_override.find( q ); - return override != ter_override.end() ? override->second : - ( !overridden || !invis ) ? here.ter( q ) : t_null; + const auto ter = [&]( const tripoint & q, const bool invis ) -> ter_str_id { + const auto override_it = ter_override.find( q ); + return override_it != ter_override.end() ? override_it->second.id() : + ( !overridden || !invis ) ? here.ter( q ).id() : ter_str_id::NULL_ID(); }; // get terrain at x,y const ter_id tid = ter( p, invisible[0] ); - if( tid == t_null ) { + if( tid == ter_str_id::NULL_ID() ) { subtile = 0; rota = 0; return; diff --git a/src/character.cpp b/src/character.cpp index 610b75e05c942..8bb54a086dd00 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -388,6 +388,12 @@ static const species_id species_HUMAN( "HUMAN" ); static const start_location_id start_location_sloc_shelter_a( "sloc_shelter_a" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_shallow( "t_pit_shallow" ); + static const trait_id trait_ADRENALINE( "ADRENALINE" ); static const trait_id trait_ANTENNAE( "ANTENNAE" ); static const trait_id trait_BADBACK( "BADBACK" ); @@ -5647,12 +5653,12 @@ Character::comfort_response_t Character::base_comfort_value( const tripoint_bub_ comfort = static_cast( comfort_level::impossible ); } else { // It's very easy for Chloromorphs to get to sleep on soil! - if( ter_at_pos == t_dirt || ter_at_pos == t_pit || ter_at_pos == t_dirtmound || - ter_at_pos == t_pit_shallow ) { + const std::unordered_set very_comfy_ters = { ter_t_dirt, ter_t_dirtmound, ter_t_pit, ter_t_pit_shallow }; + if( very_comfy_ters.find( ter_at_pos.id() ) != very_comfy_ters.end() ) { comfort += static_cast( comfort_level::very_comfortable ); } // Not as much if you have to dig through stuff first - else if( ter_at_pos == t_grass ) { + else if( ter_at_pos == ter_t_grass ) { comfort += static_cast( comfort_level::comfortable ); } // Sleep ain't happening diff --git a/src/computer_session.cpp b/src/computer_session.cpp index 63299c8b3867a..1a8ac82cb7931 100644 --- a/src/computer_session.cpp +++ b/src/computer_session.cpp @@ -65,6 +65,7 @@ static const efftype_id effect_amigara( "amigara" ); static const furn_str_id furn_f_centrifuge( "f_centrifuge" ); static const furn_str_id furn_f_console_broken( "f_console_broken" ); +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_blood( "blood" ); @@ -101,6 +102,35 @@ static const skill_id skill_computer( "computer" ); static const species_id species_HUMAN( "HUMAN" ); static const species_id species_ZOMBIE( "ZOMBIE" ); +static const ter_str_id ter_t_concrete( "t_concrete" ); +static const ter_str_id ter_t_concrete_wall( "t_concrete_wall" ); +static const ter_str_id ter_t_door_metal_c( "t_door_metal_c" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_elevator( "t_elevator" ); +static const ter_str_id ter_t_elevator_control( "t_elevator_control" ); +static const ter_str_id ter_t_elevator_control_off( "t_elevator_control_off" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_floor_blue( "t_floor_blue" ); +static const ter_str_id ter_t_floor_green( "t_floor_green" ); +static const ter_str_id ter_t_floor_red( "t_floor_red" ); +static const ter_str_id ter_t_grate( "t_grate" ); +static const ter_str_id ter_t_hole( "t_hole" ); +static const ter_str_id ter_t_metal_floor( "t_metal_floor" ); +static const ter_str_id ter_t_missile( "t_missile" ); +static const ter_str_id ter_t_rad_platform( "t_rad_platform" ); +static const ter_str_id ter_t_radio_tower( "t_radio_tower" ); +static const ter_str_id ter_t_reinforced_glass( "t_reinforced_glass" ); +static const ter_str_id ter_t_reinforced_glass_shutter( "t_reinforced_glass_shutter" ); +static const ter_str_id ter_t_reinforced_glass_shutter_open( "t_reinforced_glass_shutter_open" ); +static const ter_str_id ter_t_sewage( "t_sewage" ); +static const ter_str_id ter_t_sewage_pipe( "t_sewage_pipe" ); +static const ter_str_id ter_t_sewage_pump( "t_sewage_pump" ); +static const ter_str_id ter_t_thconc_floor( "t_thconc_floor" ); +static const ter_str_id ter_t_vat( "t_vat" ); +static const ter_str_id ter_t_wall_glass( "t_wall_glass" ); +static const ter_str_id ter_t_wall_metal( "t_wall_metal" ); +static const ter_str_id ter_t_water_pool( "t_water_pool" ); + static catacurses::window init_window() { const int width = FULL_SCREEN_WIDTH; @@ -345,14 +375,14 @@ bool computer_session::can_activate( computer_action action ) { switch( action ) { case COMPACT_LOCK: - return get_map().has_nearby_ter( get_player_character().pos(), t_door_metal_c, 8 ); + return get_map().has_nearby_ter( get_player_character().pos(), ter_t_door_metal_c, 8 ); case COMPACT_RELEASE: case COMPACT_RELEASE_DISARM: - return get_map().has_nearby_ter( get_player_character().pos(), t_reinforced_glass, 25 ); + return get_map().has_nearby_ter( get_player_character().pos(), ter_t_reinforced_glass, 25 ); case COMPACT_RELEASE_BIONICS: - return get_map().has_nearby_ter( get_player_character().pos(), t_reinforced_glass, 3 ); + return get_map().has_nearby_ter( get_player_character().pos(), ter_t_reinforced_glass, 3 ); case COMPACT_TERMINATE: { map &here = get_map(); @@ -362,10 +392,10 @@ bool computer_session::can_activate( computer_action action ) if( !mon ) { continue; } - if( ( here.ter( p + tripoint_north ) == t_reinforced_glass && - here.ter( p + tripoint_south ) == t_concrete_wall ) || - ( here.ter( p + tripoint_south ) == t_reinforced_glass && - here.ter( p + tripoint_north ) == t_concrete_wall ) ) { + if( ( here.ter( p + tripoint_north ) == ter_t_reinforced_glass && + here.ter( p + tripoint_south ) == ter_t_concrete_wall ) || + ( here.ter( p + tripoint_south ) == ter_t_reinforced_glass && + here.ter( p + tripoint_north ) == ter_t_concrete_wall ) ) { return true; } } @@ -374,7 +404,7 @@ bool computer_session::can_activate( computer_action action ) case COMPACT_UNLOCK: case COMPACT_UNLOCK_DISARM: - return get_map().has_nearby_ter( get_player_character().pos(), t_door_metal_locked, 8 ); + return get_map().has_nearby_ter( get_player_character().pos(), ter_t_door_metal_locked, 8 ); default: return true; @@ -399,21 +429,22 @@ void computer_session::action_open_disarm() void computer_session::action_open() { - get_map().translate_radius( t_door_metal_locked, t_floor, 25.0, get_player_character().pos(), + get_map().translate_radius( ter_t_door_metal_locked, ter_t_floor, 25.0, + get_player_character().pos(), true ); query_any( _( "Doors opened. Press any key…" ) ); } void computer_session::action_open_gate() { - get_map().translate_radius( t_wall_metal, t_metal_floor, 8.0, get_player_character().pos(), + get_map().translate_radius( ter_t_wall_metal, ter_t_metal_floor, 8.0, get_player_character().pos(), true ); query_any( _( "Gates opened. Press any key…" ) ); } void computer_session::action_close_gate() { - get_map().translate_radius( t_metal_floor, t_wall_metal, 8.0, get_player_character().pos(), + get_map().translate_radius( ter_t_metal_floor, ter_t_wall_metal, 8.0, get_player_character().pos(), true ); query_any( _( "Gates closed. Press any key…" ) ); } @@ -425,7 +456,8 @@ void computer_session::action_close_gate() // player position to determine which terrain tiles to edit. void computer_session::action_lock() { - get_map().translate_radius( t_door_metal_c, t_door_metal_locked, 8.0, get_player_character().pos(), + get_map().translate_radius( ter_t_door_metal_c, ter_t_door_metal_locked, 8.0, + get_player_character().pos(), true ); query_any( _( "Lock enabled. Press any key…" ) ); } @@ -438,7 +470,8 @@ void computer_session::action_unlock_disarm() void computer_session::action_unlock() { - get_map().translate_radius( t_door_metal_locked, t_door_metal_c, 8.0, get_player_character().pos(), + get_map().translate_radius( ter_t_door_metal_locked, ter_t_door_metal_c, 8.0, + get_player_character().pos(), true ); query_any( _( "Lock disabled. Press any key…" ) ); } @@ -465,7 +498,7 @@ void computer_session::action_sample() get_player_character().mod_moves( -to_moves( 1_seconds ) * 0.3 ); map &here = get_map(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) != t_sewage_pump ) { + if( here.ter( p ) != ter_t_sewage_pump ) { continue; } for( const tripoint &n : here.points_in_radius( p, 1 ) ) { @@ -500,7 +533,8 @@ void computer_session::action_release() sounds::sound( player_character.pos(), 40, sounds::sound_t::alarm, _( "an alarm sound!" ), false, "environment", "alarm" ); - get_map().translate_radius( t_reinforced_glass, t_thconc_floor, 25.0, player_character.pos(), + get_map().translate_radius( ter_t_reinforced_glass, ter_t_thconc_floor, 25.0, + player_character.pos(), true ); query_any( _( "Containment shields opened. Press any key…" ) ); } @@ -517,7 +551,8 @@ void computer_session::action_release_bionics() sounds::sound( player_character.pos(), 40, sounds::sound_t::alarm, _( "an alarm sound!" ), false, "environment", "alarm" ); - get_map().translate_radius( t_reinforced_glass, t_thconc_floor, 3.0, player_character.pos(), true ); + get_map().translate_radius( ter_t_reinforced_glass, ter_t_thconc_floor, 3.0, player_character.pos(), + true ); query_any( _( "Containment shields opened. Press any key…" ) ); } @@ -532,10 +567,10 @@ void computer_session::action_terminate() if( !mon ) { continue; } - if( ( here.ter( p + tripoint_north ) == t_reinforced_glass && - here.ter( p + tripoint_south ) == t_concrete_wall ) || - ( here.ter( p + tripoint_south ) == t_reinforced_glass && - here.ter( p + tripoint_north ) == t_concrete_wall ) ) { + if( ( here.ter( p + tripoint_north ) == ter_t_reinforced_glass && + here.ter( p + tripoint_south ) == ter_t_concrete_wall ) || + ( here.ter( p + tripoint_south ) == ter_t_reinforced_glass && + here.ter( p + tripoint_north ) == ter_t_concrete_wall ) ) { mon->die( &player_character ); } } @@ -549,7 +584,7 @@ void computer_session::action_portal() for( const tripoint &tmp : here.points_on_zlevel() ) { int numtowers = 0; for( const tripoint &tmp2 : here.points_in_radius( tmp, 2 ) ) { - if( here.ter( tmp2 ) == t_radio_tower ) { + if( here.ter( tmp2 ) == ter_t_radio_tower ) { numtowers++; } } @@ -573,7 +608,7 @@ void computer_session::action_cascade() map &here = get_map(); std::vector cascade_points; for( const tripoint &dest : here.points_in_radius( player_pos, 10 ) ) { - if( here.ter( dest ) == t_radio_tower ) { + if( here.ter( dest ) == ter_t_radio_tower ) { cascade_points.push_back( dest ); } } @@ -725,9 +760,9 @@ void computer_session::action_miss_launch() false ); if( level < 0 ) { - tmpmap.translate( t_missile, t_hole ); + tmpmap.translate( ter_t_missile, ter_t_hole ); } else { - tmpmap.translate( t_metal_floor, t_hole ); + tmpmap.translate( ter_t_metal_floor, ter_t_hole ); } tmpmap.save(); } @@ -843,8 +878,8 @@ void computer_session::action_elevator_on() { map &here = get_map(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_elevator_control_off ) { - here.ter_set( p, t_elevator_control ); + if( here.ter( p ) == ter_t_elevator_control_off ) { + here.ter_set( p, ter_t_elevator_control ); } } query_any( _( "Elevator activated. Press any key…" ) ); @@ -1049,7 +1084,7 @@ void computer_session::action_data_anal() player_character.mod_moves( -to_moves( 1_seconds ) * 0.3 ); map &here = get_map(); for( const tripoint &dest : here.points_in_radius( player_character.pos(), 2 ) ) { - if( here.ter( dest ) == t_floor_blue ) { + if( here.ter( dest ) == ter_t_floor_blue ) { print_error( _( "PROCESSING DATA" ) ); map_stack items = here.i_at( dest ); if( items.empty() ) { @@ -1183,18 +1218,19 @@ void computer_session::action_srcf_seal() add_msg( m_warning, _( "Evacuate Immediately!" ) ); map &here = get_map(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_elevator || here.ter( p ) == t_vat ) { - here.make_rubble( p, f_rubble_rock, true ); + if( here.ter( p ) == ter_t_elevator || here.ter( p ) == ter_t_vat ) { + here.make_rubble( p, furn_f_rubble_rock, true ); explosion_handler::explosion( &get_player_character(), p, 40, 0.7, true ); } - if( here.ter( p ) == t_wall_glass ) { - here.make_rubble( p, f_rubble_rock, true ); + if( here.ter( p ) == ter_t_wall_glass ) { + here.make_rubble( p, furn_f_rubble_rock, true ); } - if( here.ter( p ) == t_sewage_pipe || here.ter( p ) == t_sewage || here.ter( p ) == t_grate ) { - here.make_rubble( p, f_rubble_rock, true ); + if( here.ter( p ) == ter_t_sewage_pipe || here.ter( p ) == ter_t_sewage || + here.ter( p ) == ter_t_grate ) { + here.make_rubble( p, furn_f_rubble_rock, true ); } - if( here.ter( p ) == t_sewage_pump ) { - here.make_rubble( p, f_rubble_rock, true ); + if( here.ter( p ) == ter_t_sewage_pump ) { + here.make_rubble( p, furn_f_rubble_rock, true ); explosion_handler::explosion( &get_player_character(), p, 50, 0.7, true ); } } @@ -1214,16 +1250,16 @@ void computer_session::action_srcf_elevator() bool is_underground_elevator_exist = false; for( const tripoint &p : here.points_on_zlevel( 0 ) ) { - if( here.ter( p ) == t_elevator_control_off || here.ter( p ) == t_elevator_control ) { + if( here.ter( p ) == ter_t_elevator_control_off || here.ter( p ) == ter_t_elevator_control ) { surface_elevator = p; - is_surface_elevator_on = here.ter( p ) == t_elevator_control; + is_surface_elevator_on = here.ter( p ) == ter_t_elevator_control; is_surface_elevator_exist = true; } } for( const tripoint &p : here.points_on_zlevel( -2 ) ) { - if( here.ter( p ) == t_elevator_control_off || here.ter( p ) == t_elevator_control ) { + if( here.ter( p ) == ter_t_elevator_control_off || here.ter( p ) == ter_t_elevator_control ) { underground_elevator = p; - is_underground_elevator_on = here.ter( p ) == t_elevator_control; + is_underground_elevator_on = here.ter( p ) == ter_t_elevator_control; is_underground_elevator_exist = true; } } @@ -1241,21 +1277,21 @@ void computer_session::action_srcf_elevator() print_error( _( "Access code required!\n\n" ) ); } else { player_character.use_amount( itype_sarcophagus_access_code, 1 ); - here.ter_set( surface_elevator, t_elevator_control ); + here.ter_set( surface_elevator, ter_t_elevator_control ); is_surface_elevator_on = true; - here.ter_set( underground_elevator, t_elevator_control ); + here.ter_set( underground_elevator, ter_t_elevator_control ); is_underground_elevator_on = true; } } //If only one is enabled, enable the other one. Fix for before this change else if( is_surface_elevator_on && !is_underground_elevator_on && is_underground_elevator_exist ) { - here.ter_set( underground_elevator, t_elevator_control ); + here.ter_set( underground_elevator, ter_t_elevator_control ); is_underground_elevator_on = true; } else if( is_underground_elevator_on && !is_surface_elevator_on && is_surface_elevator_exist ) { - here.ter_set( surface_elevator, t_elevator_control ); + here.ter_set( surface_elevator, ter_t_elevator_control ); is_surface_elevator_on = true; } @@ -1269,7 +1305,7 @@ void computer_session::action_srcf_elevator() query_any( _( "Press any key…" ) ); } -//irradiates food at t_rad_platform, adds radiation +//irradiates food at ter_t_rad_platform, adds radiation void computer_session::action_irradiator() { Character &player_character = get_player_character(); @@ -1278,7 +1314,7 @@ void computer_session::action_irradiator() bool platform_exists = false; map &here = get_map(); for( const tripoint &dest : here.points_in_radius( player_character.pos(), 10 ) ) { - if( here.ter( dest ) == t_rad_platform ) { + if( here.ter( dest ) == ter_t_rad_platform ) { platform_exists = true; if( here.i_at( dest ).empty() ) { print_error( _( "ERROR: Processing platform empty." ) ); @@ -1305,7 +1341,7 @@ void computer_session::action_irradiator() here.i_rem( dest, it ); here.make_rubble( dest ); here.propagate_field( dest, fd_nuke_gas, 100, 3 ); - here.translate_radius( t_water_pool, t_sewage, 8.0, dest, true ); + here.translate_radius( ter_t_water_pool, ter_t_sewage, 8.0, dest, true ); here.adjust_radiation( dest, rng( 50, 500 ) ); for( const tripoint &radorigin : here.points_in_radius( dest, 5 ) ) { here.adjust_radiation( radorigin, rng( 50, 500 ) / ( rl_dist( radorigin, @@ -1348,7 +1384,7 @@ void computer_session::action_irradiator() } } -// geiger counter for irradiator, primary measurement at t_rad_platform, secondary at player location +// geiger counter for irradiator, primary measurement at ter_t_rad_platform, secondary at player location void computer_session::action_geiger() { Character &player_character = get_player_character(); @@ -1361,7 +1397,7 @@ void computer_session::action_geiger() map &here = get_map(); print_error( _( "RADIATION MEASUREMENTS:" ) ); for( const tripoint &dest : here.points_in_radius( player_character.pos(), 10 ) ) { - if( here.ter( dest ) == t_rad_platform ) { + if( here.ter( dest ) == ter_t_rad_platform ) { source_exists = true; platform = dest; } @@ -1404,13 +1440,13 @@ void computer_session::action_conveyor() bool p_exists = false; map &here = get_map(); for( const tripoint &dest : here.points_in_radius( player_character.pos(), 10 ) ) { - if( here.ter( dest ) == t_rad_platform ) { + if( here.ter( dest ) == ter_t_rad_platform ) { platform = dest; p_exists = true; - } else if( here.ter( dest ) == t_floor_red ) { + } else if( here.ter( dest ) == ter_t_floor_red ) { loading = dest; l_exists = true; - } else if( here.ter( dest ) == t_floor_green ) { + } else if( here.ter( dest ) == ter_t_floor_green ) { unloading = dest; u_exists = true; } @@ -1450,7 +1486,8 @@ void computer_session::action_shutters() { Character &player_character = get_player_character(); player_character.mod_moves( -to_moves( 3_seconds ) ); - get_map().translate_radius( t_reinforced_glass_shutter_open, t_reinforced_glass_shutter, 8.0, + get_map().translate_radius( ter_t_reinforced_glass_shutter_open, ter_t_reinforced_glass_shutter, + 8.0, player_character.pos(), true, true ); query_any( _( "Toggling shutters. Press any key…" ) ); @@ -1466,14 +1503,14 @@ void computer_session::action_extract_rad_source() bool p_exists = false; map &here = get_map(); for( const tripoint &dest : here.points_in_radius( player_character.pos(), 10 ) ) { - if( here.ter( dest ) == t_rad_platform ) { + if( here.ter( dest ) == ter_t_rad_platform ) { platform = dest; p_exists = true; } } if( p_exists ) { here.spawn_item( platform, itype_cobalt_60, rng( 8, 15 ) ); - here.translate_radius( t_rad_platform, t_concrete, 8.0, player_character.pos(), true ); + here.translate_radius( ter_t_rad_platform, ter_t_concrete, 8.0, player_character.pos(), true ); comp.remove_option( COMPACT_IRRADIATOR ); comp.remove_option( COMPACT_EXTRACT_RAD_SOURCE ); query_any( _( "Extraction sequence complete… Press any key." ) ); @@ -1613,7 +1650,7 @@ void computer_session::failure_pump_explode() add_msg( m_warning, _( "The pump explodes!" ) ); map &here = get_map(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_sewage_pump ) { + if( here.ter( p ) == ter_t_sewage_pump ) { here.make_rubble( p ); explosion_handler::explosion( &get_player_character(), p, 10 ); } @@ -1625,7 +1662,7 @@ void computer_session::failure_pump_leak() add_msg( m_warning, _( "Sewage leaks!" ) ); map &here = get_map(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) != t_sewage_pump ) { + if( here.ter( p ) != ter_t_sewage_pump ) { continue; } const int leak_size = rng( 4, 10 ); @@ -1646,7 +1683,7 @@ void computer_session::failure_pump_leak() if( next_move.empty() ) { break; } - here.ter_set( random_entry( next_move ), t_sewage ); + here.ter_set( random_entry( next_move ), ter_t_sewage ); } } } @@ -1695,7 +1732,7 @@ void computer_session::failure_destroy_data() print_error( _( "ERROR: ACCESSING DATA MALFUNCTION" ) ); map &here = get_map(); for( const tripoint &p : here.points_in_radius( get_player_character().pos(), 2 ) ) { - if( here.ter( p ) == t_floor_blue ) { + if( here.ter( p ) == ter_t_floor_blue ) { map_stack items = here.i_at( p ); if( items.empty() ) { print_error( _( "ERROR: Please place memory bank in scan area." ) ); diff --git a/src/construction.cpp b/src/construction.cpp index 20d8662c67436..7f1cdb17b7443 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -98,6 +98,21 @@ static const quality_id qual_CUT( "CUT" ); static const skill_id skill_fabrication( "fabrication" ); +static const ter_str_id ter_t_clay( "t_clay" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_hole( "t_hole" ); +static const ter_str_id ter_t_ladder_up( "t_ladder_up" ); +static const ter_str_id ter_t_lava( "t_lava" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_ramp_down_high( "t_ramp_down_high" ); +static const ter_str_id ter_t_ramp_down_low( "t_ramp_down_low" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_sand( "t_sand" ); +static const ter_str_id ter_t_stairs_down( "t_stairs_down" ); +static const ter_str_id ter_t_stairs_up( "t_stairs_up" ); +static const ter_str_id ter_t_wood_stairs_down( "t_wood_stairs_down" ); + static const trait_id trait_DEBUG_HS( "DEBUG_HS" ); static const trait_id trait_EATDEAD( "EATDEAD" ); static const trait_id trait_NUMB( "NUMB" ); @@ -1121,7 +1136,7 @@ void complete_construction( Character *you ) const int_id post_terrain = ter_id( built.post_terrain ); if( post_terrain->roof ) { const tripoint_bub_ms top = terp + tripoint_above; - if( here.ter( top ) == t_open_air ) { + if( here.ter( top ) == ter_t_open_air ) { here.ter_set( top, ter_id( post_terrain->roof ) ); } } @@ -1548,14 +1563,14 @@ void construct::done_digormine_stair( const tripoint_bub_ms &p, bool dig, player_character.mod_thirst( 5 + mine_penalty + no_mut_penalty ); player_character.mod_fatigue( 10 + mine_penalty + no_mut_penalty ); - if( tmpmap.ter( local_tmp ) == t_lava ) { + if( tmpmap.ter( local_tmp ) == ter_t_lava ) { if( !query_yn( _( "The rock feels much warmer than normal. Proceed?" ) ) ) { - here.ter_set( p, t_pit ); // You dug down a bit before detecting the problem + here.ter_set( p, ter_t_pit ); // You dug down a bit before detecting the problem unroll_digging( dig ? 8 : 12 ); } else { add_msg( m_warning, _( "You just tunneled into lava!" ) ); get_event_bus().send(); - here.ter_set( p, t_hole ); + here.ter_set( p, ter_t_hole ); } return; @@ -1569,9 +1584,10 @@ void construct::done_digormine_stair( const tripoint_bub_ms &p, bool dig, } else { add_msg( _( "You drill out a passage, heading deeper underground." ) ); } - here.ter_set( p, t_stairs_down ); // There's the top half + here.ter_set( p, ter_t_stairs_down ); // There's the top half // Again, need to use submap-local coordinates. - tmpmap.ter_set( local_tmp, impassable ? t_stairs_up : t_ladder_up ); // and there's the bottom half. + tmpmap.ter_set( local_tmp, impassable ? ter_t_stairs_up : + ter_t_ladder_up ); // and there's the bottom half. // And save to the center coordinate of the current active map. tmpmap.save(); } @@ -1632,8 +1648,8 @@ void construct::done_mine_upstair( const tripoint_bub_ms &p, Character &player_c tmpmap.load( pos_omt + tripoint_above, false ); const tripoint local_tmp = tmpmap.getlocal( abs_pos ); - if( tmpmap.ter( local_tmp ) == t_lava ) { - here.ter_set( p.xy(), t_rock_floor ); // You dug a bit before discovering the problem + if( tmpmap.ter( local_tmp ) == ter_t_lava ) { + here.ter_set( p.xy(), ter_t_rock_floor ); // You dug a bit before discovering the problem add_msg( m_warning, _( "The rock overhead feels hot. You decide *not* to mine magma." ) ); unroll_digging( 12 ); return; @@ -1641,7 +1657,7 @@ void construct::done_mine_upstair( const tripoint_bub_ms &p, Character &player_c if( tmpmap.has_flag_ter( ter_furn_flag::TFLAG_SHALLOW_WATER, local_tmp ) || tmpmap.has_flag_ter( ter_furn_flag::TFLAG_DEEP_WATER, local_tmp ) ) { - here.ter_set( p.xy(), t_rock_floor ); // You dug a bit before discovering the problem + here.ter_set( p.xy(), ter_t_rock_floor ); // You dug a bit before discovering the problem add_msg( m_warning, _( "The rock above is rather damp. You decide *not* to mine water." ) ); unroll_digging( 12 ); return; @@ -1656,16 +1672,16 @@ void construct::done_mine_upstair( const tripoint_bub_ms &p, Character &player_c player_character.mod_fatigue( 25 + no_mut_penalty ); add_msg( _( "You drill out a passage, heading for the surface." ) ); - here.ter_set( p.xy(), t_stairs_up ); // There's the bottom half + here.ter_set( p.xy(), ter_t_stairs_up ); // There's the bottom half // We need to write to submap-local coordinates. - tmpmap.ter_set( local_tmp, t_stairs_down ); // and there's the top half. + tmpmap.ter_set( local_tmp, ter_t_stairs_down ); // and there's the top half. tmpmap.save(); } void construct::done_wood_stairs( const tripoint_bub_ms &p, Character &/*who*/ ) { const tripoint_bub_ms top = p + tripoint_above; - get_map().ter_set( top, ter_id( "t_wood_stairs_down" ) ); + get_map().ter_set( top, ter_t_wood_stairs_down ); } void construct::done_window_curtains( const tripoint_bub_ms &, Character &who ) @@ -1684,12 +1700,12 @@ void construct::done_extract_maybe_revert_to_dirt( const tripoint_bub_ms &p, Cha { map &here = get_map(); if( one_in( 10 ) ) { - here.ter_set( p, t_dirt ); + here.ter_set( p, ter_t_dirt ); } - if( here.ter( p ) == t_clay ) { + if( here.ter( p ) == ter_t_clay ) { add_msg( _( "You gather some clay." ) ); - } else if( here.ter( p ) == t_sand ) { + } else if( here.ter( p ) == ter_t_sand ) { add_msg( _( "You gather some sand." ) ); } else { // Fall through to an undefined material. @@ -1710,13 +1726,13 @@ void construct::done_mark_practice_target( const tripoint_bub_ms &p, Character & void construct::done_ramp_low( const tripoint_bub_ms &p, Character &/*who*/ ) { const tripoint_bub_ms top = p + tripoint_above; - get_map().ter_set( top, ter_id( "t_ramp_down_low" ) ); + get_map().ter_set( top, ter_t_ramp_down_low ); } void construct::done_ramp_high( const tripoint_bub_ms &p, Character &/*who*/ ) { const tripoint_bub_ms top = p + tripoint_above; - get_map().ter_set( top, ter_id( "t_ramp_down_high" ) ); + get_map().ter_set( top, ter_t_ramp_down_high ); } void construct::do_turn_shovel( const tripoint_bub_ms &p, Character &who ) diff --git a/src/editmap.cpp b/src/editmap.cpp index bb6de87f5f7c2..4d343c7556e98 100644 --- a/src/editmap.cpp +++ b/src/editmap.cpp @@ -66,6 +66,8 @@ static constexpr half_open_cuboid editmap_boundaries( // NOLINTNEXTLINE(cata-static-int_id-constants) static const ter_id undefined_ter_id( -1 ); +static const ter_str_id ter_t_grave_new( "t_grave_new" ); + static std::vector fld_string( const std::string &str, int width ) { std::vector lines; @@ -825,7 +827,7 @@ void editmap::update_view_with_help( const std::string &txt, const std::string & if( here.has_graffiti_at( target ) ) { mvwprintw( w_info, point( 1, off ), - here.ter( target ) == t_grave_new ? _( "Graffiti: %s" ) : _( "Inscription: %s" ), + here.ter( target ) == ter_t_grave_new ? _( "Graffiti: %s" ) : _( "Inscription: %s" ), here.graffiti_at( target ) ); } diff --git a/src/explosion.cpp b/src/explosion.cpp index a0da1844e3eec..53753ae020497 100644 --- a/src/explosion.cpp +++ b/src/explosion.cpp @@ -88,6 +88,13 @@ static const mongroup_id GROUP_NETHER( "GROUP_NETHER" ); static const species_id species_ROBOT( "ROBOT" ); +static const ter_str_id ter_t_card_industrial( "t_card_industrial" ); +static const ter_str_id ter_t_card_military( "t_card_military" ); +static const ter_str_id ter_t_card_reader_broken( "t_card_reader_broken" ); +static const ter_str_id ter_t_card_science( "t_card_science" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_floor( "t_floor" ); + static const trait_id trait_LEG_TENT_BRACE( "LEG_TENT_BRACE" ); static const trait_id trait_PER_SLIME( "PER_SLIME" ); static const trait_id trait_PER_SLIME_OK( "PER_SLIME_OK" ); @@ -658,14 +665,14 @@ void emp_blast( const tripoint &p ) return; } // TODO: More terrain effects. - if( here.ter( p ) == t_card_science || here.ter( p ) == t_card_military || - here.ter( p ) == t_card_industrial ) { + if( here.ter( p ) == ter_t_card_science || here.ter( p ) == ter_t_card_military || + here.ter( p ) == ter_t_card_industrial ) { int rn = rng( 1, 100 ); if( rn > 92 || rn < 40 ) { if( sight ) { add_msg( _( "The card reader is rendered non-functional." ) ); } - here.ter_set( p, t_card_reader_broken ); + here.ter_set( p, ter_t_card_reader_broken ); } if( rn > 80 ) { if( sight ) { @@ -673,8 +680,8 @@ void emp_blast( const tripoint &p ) } for( int i = -3; i <= 3; i++ ) { for( int j = -3; j <= 3; j++ ) { - if( here.ter( p + tripoint( i, j, 0 ) ) == t_door_metal_locked ) { - here.ter_set( p + tripoint( i, j, 0 ), t_floor ); + if( here.ter( p + tripoint( i, j, 0 ) ) == ter_t_door_metal_locked ) { + here.ter_set( p + tripoint( i, j, 0 ), ter_t_floor ); } } } diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp index c93c92346b068..3f190defe405a 100644 --- a/src/faction_camp.cpp +++ b/src/faction_camp.cpp @@ -158,6 +158,20 @@ static const skill_id skill_swimming( "swimming" ); static const skill_id skill_traps( "traps" ); static const skill_id skill_unarmed( "unarmed" ); +static const ter_str_id ter_t_clay( "t_clay" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_grass_dead( "t_grass_dead" ); +static const ter_str_id ter_t_grass_golf( "t_grass_golf" ); +static const ter_str_id ter_t_grass_long( "t_grass_long" ); +static const ter_str_id ter_t_grass_tall( "t_grass_tall" ); +static const ter_str_id ter_t_improvised_shelter( "t_improvised_shelter" ); +static const ter_str_id ter_t_moss( "t_moss" ); +static const ter_str_id ter_t_sand( "t_sand" ); +static const ter_str_id ter_t_tree_young( "t_tree_young" ); +static const ter_str_id ter_t_trunk( "t_trunk" ); + static const trait_id trait_DEBUG_HS( "DEBUG_HS" ); static const update_mapgen_id update_mapgen_faction_wall_level_E_1( "faction_wall_level_E_1" ); @@ -2552,7 +2566,7 @@ void basecamp::start_cut_logs( const mission_id &miss_id, float exertion_level ) sample_npc.set_fake( true ); int tree_est = om_cutdown_trees_est( forest, 50 ); int tree_young_est = om_harvest_ter_est( sample_npc, forest, - ter_id( "t_tree_young" ), 50 ); + ter_t_tree_young, 50 ); int dist = rl_dist( forest.xy(), omt_pos.xy() ); //Very roughly what the player does + 6 hours for prep, clean up, breaks time_duration chop_time = 6_hours + 1_hours * tree_est + 7_minutes * tree_young_est; @@ -2571,7 +2585,7 @@ void basecamp::start_cut_logs( const mission_id &miss_id, float exertion_level ) skill_fabrication, 2, exertion_level ); if( comp != nullptr ) { om_cutdown_trees_logs( forest, 50 ); - om_harvest_ter( *comp, forest, ter_id( "t_tree_young" ), 50 ); + om_harvest_ter( *comp, forest, ter_t_tree_young, 50 ); om_harvest_itm( comp, forest, 95 ); comp->companion_mission_time_ret = calendar::turn + work_time; change_cleared_terrain( forest ); @@ -2591,7 +2605,7 @@ void basecamp::start_clearcut( const mission_id &miss_id, float exertion_level ) sample_npc.set_fake( true ); int tree_est = om_cutdown_trees_est( forest, 95 ); int tree_young_est = om_harvest_ter_est( sample_npc, forest, - ter_id( "t_tree_young" ), 95 ); + ter_t_tree_young, 95 ); int dist = rl_dist( forest.xy(), omt_pos.xy() ); //Very roughly what the player does + 6 hours for prep, clean up, breaks time_duration chop_time = 6_hours + 1_hours * tree_est + 7_minutes * tree_young_est; @@ -2608,7 +2622,7 @@ void basecamp::start_clearcut( const mission_id &miss_id, float exertion_level ) skill_fabrication, 1, exertion_level ); if( comp != nullptr ) { om_cutdown_trees_trunks( forest, 95 ); - om_harvest_ter_break( *comp, forest, ter_id( "t_tree_young" ), 95 ); + om_harvest_ter_break( *comp, forest, ter_t_tree_young, 95 ); change_cleared_terrain( forest ); } } @@ -3531,7 +3545,7 @@ static std::pair farm_action( const tripoint_abs_omt &omt_t std::string crops; const auto is_dirtmound = []( const tripoint & pos, tinymap & bay1, tinymap & bay2 ) { - return ( bay1.ter( pos ) == t_dirtmound ) && ( !bay2.has_furn( pos ) ); + return ( bay1.ter( pos ) == ter_t_dirtmound ) && ( !bay2.has_furn( pos ) ); }; const auto is_unplowed = []( const tripoint & pos, tinymap & farm_map ) { const ter_id &farm_ter = farm_map.ter( pos ); @@ -3572,7 +3586,7 @@ static std::pair farm_action( const tripoint_abs_omt &omt_t if( is_dirtmound( pos, *farm_json, farm_map ) && is_unplowed( pos, farm_map ) ) { plots_cnt += 1; if( comp ) { - farm_map.ter_set( pos, t_dirtmound ); + farm_map.ter_set( pos, ter_t_dirtmound ); } } break; @@ -3597,7 +3611,7 @@ static std::pair farm_action( const tripoint_abs_omt &omt_t } used_seed.front().set_age( 0_turns ); farm_map.add_item_or_charges( pos, used_seed.front() ); - farm_map.set( pos, t_dirt, f_plant_seed ); + farm_map.set( pos, ter_t_dirt, f_plant_seed ); if( !tmp_seed->count_by_charges() ) { comp->companion_mission_inv.remove_item( tmp_seed ); } @@ -3626,7 +3640,7 @@ static std::pair farm_action( const tripoint_abs_omt &omt_t } farm_map.i_clear( pos ); farm_map.furn_set( pos, f_null ); - farm_map.ter_set( pos, t_dirt ); + farm_map.ter_set( pos, ter_t_dirt ); } else { plant_names.insert( item::nname( itype_id( seed->type->seed->fruit_id ) ) ); } @@ -4451,11 +4465,9 @@ bool basecamp::survey_field_return( const mission_id &miss_id ) int mismatch_tiles = 0; tripoint mapmin = tripoint( 0, 0, where.z() ); tripoint mapmax = tripoint( 2 * SEEX - 1, 2 * SEEY - 1, where.z() ); + const std::unordered_set match_terrains = { ter_t_clay, ter_t_dirt, ter_t_dirtmound, ter_t_grass, ter_t_grass_dead, ter_t_grass_golf, ter_t_grass_long, ter_t_grass_tall, ter_t_moss, ter_t_sand }; for( const tripoint &p : target.points_in_rectangle( mapmin, mapmax ) ) { - if( target.ter( p ) != t_dirt && target.ter( p ) != t_sand && target.ter( p ) != t_clay && - target.ter( p ) != t_dirtmound && target.ter( p ) != t_grass && target.ter( p ) != t_grass_dead && - target.ter( p ) != t_grass_golf && target.ter( p ) != t_grass_long && - target.ter( p ) != t_grass_tall && target.ter( p ) != t_moss ) { + if( match_terrains.find( target.ter( p ).id() ) == match_terrains.end() ) { mismatch_tiles++; } } @@ -4819,9 +4831,9 @@ int om_cutdown_trees( const tripoint_abs_omt &omt_tgt, int chance, bool estimate std::vector tree = line_to( p, to, rng( 1, 8 ) ); for( tripoint &elem : tree ) { target_bay.destroy( elem ); - target_bay.ter_set( elem, t_trunk ); + target_bay.ter_set( elem, ter_t_trunk ); } - target_bay.ter_set( p, t_dirt ); + target_bay.ter_set( p, ter_t_dirt ); harvested++; } } @@ -4834,8 +4846,8 @@ int om_cutdown_trees( const tripoint_abs_omt &omt_tgt, int chance, bool estimate } // having cut down the trees, cut the trunks into logs for( const tripoint &p : target_bay.points_in_rectangle( mapmin, mapmax ) ) { - if( target_bay.ter( p ) == ter_id( "t_trunk" ) ) { - target_bay.ter_set( p, t_dirt ); + if( target_bay.ter( p ) == ter_t_trunk ) { + target_bay.ter_set( p, ter_t_dirt ); target_bay.spawn_item( p, itype_log, rng( 2, 3 ), 0, calendar::turn ); harvested++; } @@ -5024,9 +5036,8 @@ bool om_set_hide_site( npc &comp, const tripoint_abs_omt &omt_tgt, const drop_locations &itms_rem ) { tinymap target_bay; - target_bay.load( omt_tgt, false ); - target_bay.ter_set( relay_site_stash, t_improvised_shelter ); + target_bay.ter_set( relay_site_stash, ter_t_improvised_shelter ); for( drop_location it : itms_rem ) { item *i = it.first.get_item(); item split_item; diff --git a/src/fungal_effects.cpp b/src/fungal_effects.cpp index 4c418144c46f3..e148f72f9f009 100644 --- a/src/fungal_effects.cpp +++ b/src/fungal_effects.cpp @@ -36,6 +36,18 @@ static const skill_id skill_melee( "melee" ); static const species_id species_FUNGUS( "FUNGUS" ); +static const ter_str_id ter_t_fungus( "t_fungus" ); +static const ter_str_id ter_t_fungus_floor_in( "t_fungus_floor_in" ); +static const ter_str_id ter_t_fungus_floor_out( "t_fungus_floor_out" ); +static const ter_str_id ter_t_fungus_floor_sup( "t_fungus_floor_sup" ); +static const ter_str_id ter_t_fungus_mound( "t_fungus_mound" ); +static const ter_str_id ter_t_fungus_wall( "t_fungus_wall" ); +static const ter_str_id ter_t_marloss( "t_marloss" ); +static const ter_str_id ter_t_marloss_tree( "t_marloss_tree" ); +static const ter_str_id ter_t_shrub_fungal( "t_shrub_fungal" ); +static const ter_str_id ter_t_tree_fungal( "t_tree_fungal" ); +static const ter_str_id ter_t_tree_fungal_young( "t_tree_fungal_young" ); + static const trait_id trait_TAIL_CATTLE( "TAIL_CATTLE" ); static const trait_id trait_THRESH_MYCUS( "THRESH_MYCUS" ); @@ -113,7 +125,7 @@ void fungal_effects::marlossify( const tripoint &p ) if( one_in( 25 ) && terrain.movecost != 0 && !here.has_furn( p ) && !terrain.has_flag( ter_furn_flag::TFLAG_DEEP_WATER ) && !terrain.has_flag( ter_furn_flag::TFLAG_NO_FLOOR ) ) { - here.ter_set( p, t_marloss ); + here.ter_set( p, ter_t_marloss ); return; } for( int i = 0; i < 25; i++ ) { @@ -132,52 +144,52 @@ void fungal_effects::spread_fungus_one_tile( const tripoint &p, const int growth // Terrain conversion if( here.has_flag_ter( ter_furn_flag::TFLAG_DIGGABLE, p ) ) { if( x_in_y( growth * 10, 100 ) ) { - here.ter_set( p, t_fungus ); + here.ter_set( p, ter_t_fungus ); converted = true; } } else if( here.has_flag( ter_furn_flag::TFLAG_FLAT, p ) ) { if( here.has_flag( ter_furn_flag::TFLAG_INDOORS, p ) ) { if( x_in_y( growth * 10, 500 ) ) { - here.ter_set( p, t_fungus_floor_in ); + here.ter_set( p, ter_t_fungus_floor_in ); converted = true; } } else if( here.has_flag( ter_furn_flag::TFLAG_SUPPORTS_ROOF, p ) ) { if( x_in_y( growth * 10, 1000 ) ) { - here.ter_set( p, t_fungus_floor_sup ); + here.ter_set( p, ter_t_fungus_floor_sup ); converted = true; } } else { if( x_in_y( growth * 10, 2500 ) ) { - here.ter_set( p, t_fungus_floor_out ); + here.ter_set( p, ter_t_fungus_floor_out ); converted = true; } } } else if( here.has_flag( ter_furn_flag::TFLAG_SHRUB, p ) ) { if( x_in_y( growth * 10, 200 ) ) { - here.ter_set( p, t_shrub_fungal ); + here.ter_set( p, ter_t_shrub_fungal ); converted = true; } else if( x_in_y( growth, 1000 ) ) { - here.ter_set( p, t_marloss ); + here.ter_set( p, ter_t_marloss ); converted = true; } } else if( here.has_flag( ter_furn_flag::TFLAG_THIN_OBSTACLE, p ) ) { if( x_in_y( growth * 10, 150 ) ) { - here.ter_set( p, t_fungus_mound ); + here.ter_set( p, ter_t_fungus_mound ); converted = true; } } else if( here.has_flag( ter_furn_flag::TFLAG_YOUNG, p ) ) { if( x_in_y( growth * 10, 500 ) ) { if( here.get_field_intensity( p, fd_fungal_haze ) != 0 ) { if( x_in_y( growth * 10, 800 ) ) { // young trees are vulnerable - here.ter_set( p, t_fungus ); + here.ter_set( p, ter_t_fungus ); if( g->place_critter_at( mon_fungal_blossom, p ) ) { add_msg_if_player_sees( p, m_warning, _( "The young tree blooms forth into a fungal blossom!" ) ); } } else if( x_in_y( growth * 10, 400 ) ) { - here.ter_set( p, t_marloss_tree ); + here.ter_set( p, ter_t_marloss_tree ); } } else { - here.ter_set( p, t_tree_fungal_young ); + here.ter_set( p, ter_t_tree_fungal_young ); } converted = true; } @@ -185,22 +197,22 @@ void fungal_effects::spread_fungus_one_tile( const tripoint &p, const int growth if( one_in( 10 ) ) { if( here.get_field_intensity( p, fd_fungal_haze ) != 0 ) { if( x_in_y( growth * 10, 100 ) ) { - here.ter_set( p, t_fungus ); + here.ter_set( p, ter_t_fungus ); if( g->place_critter_at( mon_fungal_blossom, p ) ) { add_msg_if_player_sees( p, m_warning, _( "The tree blooms forth into a fungal blossom!" ) ); } } else if( x_in_y( growth * 10, 600 ) ) { - here.ter_set( p, t_marloss_tree ); + here.ter_set( p, ter_t_marloss_tree ); } } else { - here.ter_set( p, t_tree_fungal ); + here.ter_set( p, ter_t_tree_fungal ); } converted = true; } } else if( here.has_flag( ter_furn_flag::TFLAG_WALL, p ) && here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE, p ) ) { if( x_in_y( growth * 10, 5000 ) ) { - here.ter_set( p, t_fungus_wall ); + here.ter_set( p, ter_t_fungus_wall ); converted = true; } } diff --git a/src/game.cpp b/src/game.cpp index fe76cbd516771..50aa25f451b6b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -308,6 +308,14 @@ static const species_id species_PLANT( "PLANT" ); static const string_id npc_template_cyborg_rescued( "cyborg_rescued" ); +static const ter_str_id ter_t_elevator( "t_elevator" ); +static const ter_str_id ter_t_grave_new( "t_grave_new" ); +static const ter_str_id ter_t_lava( "t_lava" ); +static const ter_str_id ter_t_manhole( "t_manhole" ); +static const ter_str_id ter_t_manhole_cover( "t_manhole_cover" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_shallow( "t_pit_shallow" ); + static const trait_id trait_BADKNEES( "BADKNEES" ); static const trait_id trait_CANNIBAL( "CANNIBAL" ); static const trait_id trait_CENOBITE( "CENOBITE" ); @@ -6683,7 +6691,7 @@ void game::print_fields_info( const tripoint &lp, const catacurses::window &w_lo for( const auto &fld : tmpfield ) { const field_entry &cur = fld.second; if( fld.first.obj().has_fire && ( m.has_flag( ter_furn_flag::TFLAG_FIRE_CONTAINER, lp ) || - m.ter( lp ) == t_pit_shallow || m.ter( lp ) == t_pit ) ) { + m.ter( lp ) == ter_t_pit_shallow || m.ter( lp ) == ter_t_pit ) ) { const int max_width = getmaxx( w_look ) - column - 2; int lines = fold_and_print( w_look, point( column, ++line ), max_width, cur.color(), get_fire_fuel_string( lp ) ) - 1; @@ -6811,7 +6819,7 @@ void game::print_graffiti_info( const tripoint &lp, const catacurses::window &w_ const int max_width = getmaxx( w_look ) - column - 2; if( m.has_graffiti_at( lp ) ) { const int lines = fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, - m.ter( lp ) == t_grave_new ? _( "Graffiti: %s" ) : _( "Inscription: %s" ), + m.ter( lp ) == ter_t_grave_new ? _( "Graffiti: %s" ) : _( "Inscription: %s" ), m.graffiti_at( lp ) ); line += lines - 1; } @@ -12196,9 +12204,9 @@ void game::vertical_move( int movez, bool force, bool peeking ) } } - if( here.ter( stairs ) == t_manhole_cover ) { + if( here.ter( stairs ) == ter_t_manhole_cover ) { here.spawn_item( stairs + point( rng( -1, 1 ), rng( -1, 1 ) ), itype_manhole_cover ); - here.ter_set( stairs, t_manhole ); + here.ter_set( stairs, ter_t_manhole ); } if( u.is_hauling() ) { @@ -12294,8 +12302,8 @@ std::optional game::find_or_make_stairs( map &mp, const int z_after, b if( rl_dist( u.pos(), dest ) <= best && ( ( going_down_1 && mp.has_flag( ter_furn_flag::TFLAG_GOES_UP, dest ) ) || ( going_up_1 && ( mp.has_flag( ter_furn_flag::TFLAG_GOES_DOWN, dest ) || - mp.ter( dest ) == t_manhole_cover ) ) || - ( ( movez == 2 || movez == -2 ) && mp.ter( dest ) == t_elevator ) ) ) { + mp.ter( dest ) == ter_t_manhole_cover ) ) || + ( ( movez == 2 || movez == -2 ) && mp.ter( dest ) == ter_t_elevator ) ) ) { stairs.emplace( dest ); best = rl_dist( u.pos(), dest ); } @@ -12340,7 +12348,7 @@ std::optional game::find_or_make_stairs( map &mp, const int z_after, b stairs.emplace( pos ); stairs->z = z_after; // Check the destination area for lava. - if( mp.ter( *stairs ) == t_lava ) { + if( mp.ter( *stairs ) == ter_t_lava ) { if( movez < 0 && !query_yn( _( "There is a LOT of heat coming out of there, even the stairs have melted away. Jump down? You won't be able to get back up." ) ) ) { diff --git a/src/gamemode_tutorial.cpp b/src/gamemode_tutorial.cpp index 8110839819f30..d0d708a492342 100644 --- a/src/gamemode_tutorial.cpp +++ b/src/gamemode_tutorial.cpp @@ -39,6 +39,13 @@ static const skill_id skill_gun( "gun" ); static const skill_id skill_melee( "melee" ); static const skill_id skill_throwing( "throwing" ); +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_locked_interior( "t_door_locked_interior" ); +static const ter_str_id ter_t_door_o( "t_door_o" ); +static const ter_str_id ter_t_stairs_down( "t_stairs_down" ); +static const ter_str_id ter_t_water_dispenser( "t_water_dispenser" ); +static const ter_str_id ter_t_window( "t_window" ); + static const trap_str_id tr_bubblewrap( "tr_bubblewrap" ); static const trap_str_id tr_tutorial_1( "tr_tutorial_1" ); static const trap_str_id tr_tutorial_10( "tr_tutorial_10" ); @@ -210,25 +217,25 @@ void tutorial_game::per_turn() } for( const tripoint &p : here.points_in_radius( player_character.pos(), 1 ) ) { - if( here.ter( p ) == t_door_c ) { + if( here.ter( p ) == ter_t_door_c ) { add_message( tut_lesson::LESSON_OPEN ); break; - } else if( here.ter( p ) == t_door_o ) { + } else if( here.ter( p ) == ter_t_door_o ) { add_message( tut_lesson::LESSON_CLOSE ); break; - } else if( here.ter( p ) == t_door_locked_interior ) { + } else if( here.ter( p ) == ter_t_door_locked_interior ) { add_message( tut_lesson::LESSON_LOCKED_DOOR ); break; - } else if( here.ter( p ) == t_window ) { + } else if( here.ter( p ) == ter_t_window ) { add_message( tut_lesson::LESSON_WINDOW ); break; } else if( here.furn( p ) == f_rack ) { add_message( tut_lesson::LESSON_EXAMINE ); break; - } else if( here.ter( p ) == t_stairs_down ) { + } else if( here.ter( p ) == ter_t_stairs_down ) { add_message( tut_lesson::LESSON_STAIRS ); break; - } else if( here.ter( p ) == ter_id( "t_water_dispenser" ) ) { + } else if( here.ter( p ) == ter_t_water_dispenser ) { add_message( tut_lesson::LESSON_PICKUP_WATER ); break; } else if( here.tr_at( p ).id == tr_bubblewrap ) { diff --git a/src/iexamine.cpp b/src/iexamine.cpp index cd7beab9b9ead..9a92b7e59b835 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -221,10 +221,41 @@ static const skill_id skill_fabrication( "fabrication" ); static const skill_id skill_survival( "survival" ); static const skill_id skill_traps( "traps" ); +static const ter_str_id ter_t_card_reader_broken( "t_card_reader_broken" ); static const ter_str_id ter_t_diesel_pump( "t_diesel_pump" ); static const ter_str_id ter_t_diesel_pump_a( "t_diesel_pump_a" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_door_metal_c( "t_door_metal_c" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_door_metal_o( "t_door_metal_o" ); +static const ter_str_id ter_t_floor_blue( "t_floor_blue" ); +static const ter_str_id ter_t_floor_green( "t_floor_green" ); +static const ter_str_id ter_t_floor_red( "t_floor_red" ); +static const ter_str_id ter_t_fungus( "t_fungus" ); static const ter_str_id ter_t_gas_pump( "t_gas_pump" ); static const ter_str_id ter_t_gas_pump_a( "t_gas_pump_a" ); +static const ter_str_id ter_t_marloss( "t_marloss" ); +static const ter_str_id ter_t_marloss_tree( "t_marloss_tree" ); +static const ter_str_id ter_t_orifice( "t_orifice" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_covered( "t_pit_covered" ); +static const ter_str_id ter_t_pit_glass( "t_pit_glass" ); +static const ter_str_id ter_t_pit_glass_covered( "t_pit_glass_covered" ); +static const ter_str_id ter_t_pit_spiked( "t_pit_spiked" ); +static const ter_str_id ter_t_pit_spiked_covered( "t_pit_spiked_covered" ); +static const ter_str_id ter_t_rock_blue( "t_rock_blue" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_rock_green( "t_rock_green" ); +static const ter_str_id ter_t_rock_red( "t_rock_red" ); +static const ter_str_id ter_t_shrub_fungal( "t_shrub_fungal" ); +static const ter_str_id ter_t_switch_even( "t_switch_even" ); +static const ter_str_id ter_t_switch_gb( "t_switch_gb" ); +static const ter_str_id ter_t_switch_rb( "t_switch_rb" ); +static const ter_str_id ter_t_switch_rg( "t_switch_rg" ); +static const ter_str_id ter_t_tree_fungal( "t_tree_fungal" ); +static const ter_str_id ter_t_tree_hickory_dead( "t_tree_hickory_dead" ); +static const ter_str_id ter_t_tree_maple( "t_tree_maple" ); +static const ter_str_id ter_t_tree_maple_tapped( "t_tree_maple_tapped" ); static const trait_id trait_AMORPHOUS( "AMORPHOUS" ); static const trait_id trait_ARACHNID_ARMS_OK( "ARACHNID_ARMS_OK" ); @@ -1363,7 +1394,7 @@ void iexamine::cardreader_robofac( Character &you, const tripoint &examp ) you.mod_moves( -100 ); you.use_amount( card_type, 1 ); add_msg( m_bad, _( "The card reader short circuits!" ) ); - get_map().ter_set( examp, t_card_reader_broken ); + get_map().ter_set( examp, ter_t_card_reader_broken ); intercom( you, examp ); } else { add_msg( _( "You have never seen this card reader model before. Hacking it seems impossible." ) ); @@ -1379,8 +1410,8 @@ void iexamine::cardreader_foodplace( Character &you, const tripoint &examp ) you.mod_moves( -100 ); map &here = get_map(); for( const tripoint &tmp : here.points_in_radius( examp, 3 ) ) { - if( here.ter( tmp ) == t_door_metal_locked ) { - here.ter_set( tmp, t_door_metal_c ); + if( here.ter( tmp ) == ter_t_door_metal_locked ) { + here.ter_set( tmp, ter_t_door_metal_c ); open = true; } } @@ -1393,11 +1424,11 @@ void iexamine::cardreader_foodplace( Character &you, const tripoint &examp ) add_msg( _( "The nearby doors are already unlocked." ) ); if( query_yn( _( "Lock doors?" ) ) ) { for( const tripoint &tmp : here.points_in_radius( examp, 3 ) ) { - if( here.ter( tmp ) == t_door_metal_o || here.ter( tmp ) == t_door_metal_c ) { + if( here.ter( tmp ) == ter_t_door_metal_o || here.ter( tmp ) == ter_t_door_metal_c ) { if( you.pos() == tmp ) { you.add_msg_if_player( m_bad, _( "You are in the way of the door, move before trying again." ) ); } else { - here.ter_set( tmp, t_door_metal_locked ); + here.ter_set( tmp, ter_t_door_metal_locked ); } } } @@ -1675,12 +1706,13 @@ void iexamine::pit( Character &you, const tripoint &examp ) map &here = get_map(); if( query_yn( _( "Place a plank over the pit?" ) ) ) { you.consume_items( planks, 1, is_crafting_component ); - if( here.ter( examp ) == t_pit ) { - here.ter_set( examp, t_pit_covered ); - } else if( here.ter( examp ) == t_pit_spiked ) { - here.ter_set( examp, t_pit_spiked_covered ); - } else if( here.ter( examp ) == t_pit_glass ) { - here.ter_set( examp, t_pit_glass_covered ); + const ter_id &ter_pit = here.ter( examp ); + if( ter_pit == ter_t_pit ) { + here.ter_set( examp, ter_t_pit_covered ); + } else if( ter_pit == ter_t_pit_spiked ) { + here.ter_set( examp, ter_t_pit_spiked_covered ); + } else if( ter_pit == ter_t_pit_glass ) { + here.ter_set( examp, ter_t_pit_glass_covered ); } add_msg( _( "You place a plank of wood over the pit." ) ); you.mod_moves( -to_moves( 1_seconds ) ); @@ -1701,13 +1733,13 @@ void iexamine::pit_covered( Character &you, const tripoint &examp ) item plank( "2x4", calendar::turn ); add_msg( _( "You remove the plank." ) ); here.add_item_or_charges( you.pos(), plank ); - - if( here.ter( examp ) == t_pit_covered ) { - here.ter_set( examp, t_pit ); - } else if( here.ter( examp ) == t_pit_spiked_covered ) { - here.ter_set( examp, t_pit_spiked ); - } else if( here.ter( examp ) == t_pit_glass_covered ) { - here.ter_set( examp, t_pit_glass ); + const ter_id &ter_pit = here.ter( examp ); + if( ter_pit == ter_t_pit_covered ) { + here.ter_set( examp, ter_t_pit ); + } else if( ter_pit == ter_t_pit_spiked_covered ) { + here.ter_set( examp, ter_t_pit_spiked ); + } else if( ter_pit == ter_t_pit_glass_covered ) { + here.ter_set( examp, ter_t_pit_glass ); } you.mod_moves( -to_moves( 1_seconds ) ); } @@ -1961,7 +1993,7 @@ void iexamine::pedestal_wyrm( Character &you, const tripoint &examp ) // Send in a few wyrms to start things off. get_event_bus().send(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == ter_id( "t_orifice" ) ) { + if( here.ter( p ) == ter_t_orifice ) { g->place_critter_around( mon_dark_wyrm, p, 1 ); } } @@ -1969,7 +2001,7 @@ void iexamine::pedestal_wyrm( Character &you, const tripoint &examp ) sounds::sound( examp, 80, sounds::sound_t::combat, _( "an ominous grinding noise…" ), true, "misc", "stones_grinding" ); add_msg( _( "The pedestal sinks into the ground…" ) ); - here.ter_set( examp, t_rock_floor ); + here.ter_set( examp, ter_t_rock_floor ); get_timed_events().add( timed_event_type::SPAWN_WYRMS, calendar::turn + rng( 30_seconds, 60_seconds ) ); } else { @@ -1989,14 +2021,14 @@ void iexamine::pedestal_temple( Character &you, const tripoint &examp ) map_stack items = here.i_at( examp ); if( !items.empty() && items.only_item().typeId() == itype_petrified_eye ) { add_msg( _( "The pedestal sinks into the ground…" ) ); - here.ter_set( examp, t_dirt ); + here.ter_set( examp, ter_t_dirt ); here.i_clear( examp ); get_timed_events().add( timed_event_type::TEMPLE_OPEN, calendar::turn + 10_seconds ); } else if( you.has_amount( itype_petrified_eye, 1 ) && query_yn( _( "Place your petrified eye on the pedestal?" ) ) ) { you.use_amount( itype_petrified_eye, 1 ); add_msg( _( "The pedestal sinks into the ground…" ) ); - here.ter_set( examp, t_dirt ); + here.ter_set( examp, ter_t_dirt ); get_timed_events().add( timed_event_type::TEMPLE_OPEN, calendar::turn + 10_seconds ); } else { add_msg( _( "This pedestal is engraved in eye-shaped diagrams, and has a " @@ -2051,50 +2083,51 @@ void iexamine::fswitch( Character &you, const tripoint &examp ) tmp.z = examp.z; for( tmp.y = examp.y; tmp.y <= examp.y + 5; tmp.y++ ) { for( tmp.x = 0; tmp.x < MAPSIZE_X; tmp.x++ ) { - if( terid == t_switch_rg ) { - if( here.ter( tmp ) == t_rock_red ) { - here.ter_set( tmp, t_floor_red ); - } else if( here.ter( tmp ) == t_floor_red ) { - here.ter_set( tmp, t_rock_red ); - } else if( here.ter( tmp ) == t_rock_green ) { - here.ter_set( tmp, t_floor_green ); - } else if( here.ter( tmp ) == t_floor_green ) { - here.ter_set( tmp, t_rock_green ); + const ter_id &nearby_ter = here.ter( tmp ); + if( terid == ter_t_switch_rg ) { + if( nearby_ter == ter_t_rock_red ) { + here.ter_set( tmp, ter_t_floor_red ); + } else if( nearby_ter == ter_t_floor_red ) { + here.ter_set( tmp, ter_t_rock_red ); + } else if( nearby_ter == ter_t_rock_green ) { + here.ter_set( tmp, ter_t_floor_green ); + } else if( nearby_ter == ter_t_floor_green ) { + here.ter_set( tmp, ter_t_rock_green ); } - } else if( terid == t_switch_gb ) { - if( here.ter( tmp ) == t_rock_blue ) { - here.ter_set( tmp, t_floor_blue ); - } else if( here.ter( tmp ) == t_floor_blue ) { - here.ter_set( tmp, t_rock_blue ); - } else if( here.ter( tmp ) == t_rock_green ) { - here.ter_set( tmp, t_floor_green ); - } else if( here.ter( tmp ) == t_floor_green ) { - here.ter_set( tmp, t_rock_green ); + } else if( terid == ter_t_switch_gb ) { + if( nearby_ter == ter_t_rock_blue ) { + here.ter_set( tmp, ter_t_floor_blue ); + } else if( nearby_ter == ter_t_floor_blue ) { + here.ter_set( tmp, ter_t_rock_blue ); + } else if( nearby_ter == ter_t_rock_green ) { + here.ter_set( tmp, ter_t_floor_green ); + } else if( nearby_ter == ter_t_floor_green ) { + here.ter_set( tmp, ter_t_rock_green ); } - } else if( terid == t_switch_rb ) { - if( here.ter( tmp ) == t_rock_blue ) { - here.ter_set( tmp, t_floor_blue ); - } else if( here.ter( tmp ) == t_floor_blue ) { - here.ter_set( tmp, t_rock_blue ); - } else if( here.ter( tmp ) == t_rock_red ) { - here.ter_set( tmp, t_floor_red ); - } else if( here.ter( tmp ) == t_floor_red ) { - here.ter_set( tmp, t_rock_red ); + } else if( terid == ter_t_switch_rb ) { + if( nearby_ter == ter_t_rock_blue ) { + here.ter_set( tmp, ter_t_floor_blue ); + } else if( nearby_ter == ter_t_floor_blue ) { + here.ter_set( tmp, ter_t_rock_blue ); + } else if( nearby_ter == ter_t_rock_red ) { + here.ter_set( tmp, ter_t_floor_red ); + } else if( nearby_ter == ter_t_floor_red ) { + here.ter_set( tmp, ter_t_rock_red ); } - } else if( terid == t_switch_even ) { + } else if( terid == ter_t_switch_even ) { if( ( tmp.y - examp.y ) % 2 == 1 ) { - if( here.ter( tmp ) == t_rock_red ) { - here.ter_set( tmp, t_floor_red ); - } else if( here.ter( tmp ) == t_floor_red ) { - here.ter_set( tmp, t_rock_red ); - } else if( here.ter( tmp ) == t_rock_green ) { - here.ter_set( tmp, t_floor_green ); - } else if( here.ter( tmp ) == t_floor_green ) { - here.ter_set( tmp, t_rock_green ); - } else if( here.ter( tmp ) == t_rock_blue ) { - here.ter_set( tmp, t_floor_blue ); - } else if( here.ter( tmp ) == t_floor_blue ) { - here.ter_set( tmp, t_rock_blue ); + if( nearby_ter == ter_t_rock_red ) { + here.ter_set( tmp, ter_t_floor_red ); + } else if( nearby_ter == ter_t_floor_red ) { + here.ter_set( tmp, ter_t_rock_red ); + } else if( nearby_ter == ter_t_rock_green ) { + here.ter_set( tmp, ter_t_floor_green ); + } else if( nearby_ter == ter_t_floor_green ) { + here.ter_set( tmp, ter_t_rock_green ); + } else if( nearby_ter == ter_t_rock_blue ) { + here.ter_set( tmp, ter_t_floor_blue ); + } else if( nearby_ter == ter_t_floor_blue ) { + here.ter_set( tmp, ter_t_rock_blue ); } } } @@ -2627,7 +2660,7 @@ void iexamine::harvest_plant( Character &you, const tripoint &examp, bool from_a here.i_clear( examp ); if( you.has_trait( trait_M_DEPENDENT ) && ( you.get_kcal_percent() < 0.8f || you.get_thirst() > 300 ) ) { - here.ter_set( examp, t_marloss ); + here.ter_set( examp, ter_t_marloss ); add_msg( m_info, _( "We have altered this unit's configuration to extract and provide local nutriment. The Mycus provides." ) ); } else if( you.has_trait( trait_M_DEFENDER ) || ( ( you.has_trait( trait_M_SPORES ) || @@ -3946,7 +3979,7 @@ void iexamine::tree_hickory( Character &you, const tripoint &examp ) round( 3 + you.get_skill_level( skill_survival ) ) ), 0, calendar::turn ); - here.ter_set( examp, t_tree_hickory_dead ); + here.ter_set( examp, ter_t_tree_hickory_dead ); /** @EFFECT_SURVIVAL speeds up hickory root digging */ you.mod_moves( -to_moves( 20_seconds ) / ( you.get_skill_level( skill_survival ) + 1 ) + 100 ); } @@ -3988,7 +4021,7 @@ void iexamine::tree_maple( Character &you, const tripoint &examp ) map &here = get_map(); item_location spile_loc = g->inv_map_splice( [&here]( const item_location & it ) { return it->get_quality_nonrecursive( qual_TREE_TAP ) > 0 && - t_tree_maple_tapped != here.ter( it.position() ); + !( here.ter( it.position() ) == ter_t_tree_maple_tapped ); }, _( "Use which tapping tool?" ), PICKUP_RANGE, _( "You don't have a tapping tool at hand." ) ); item *spile = spile_loc.get_item(); @@ -3998,7 +4031,7 @@ void iexamine::tree_maple( Character &you, const tripoint &examp ) std::string spile_name = spile->tname(); you.mod_moves( -to_moves( 20_seconds ) ); - here.ter_set( examp, t_tree_maple_tapped ); + here.ter_set( examp, ter_t_tree_maple_tapped ); here.add_item_or_charges( examp, *spile, false ); spile_loc.remove_item(); add_msg( m_info, _( "You drill the maple tree crust and tap a %s into the prepared hole." ), @@ -4084,7 +4117,7 @@ void iexamine::tree_maple_tapped( Character &you, const tripoint &examp ) here.i_clear( examp ); you.mod_moves( -to_moves( 20_seconds ) ); - here.ter_set( examp, t_tree_maple ); + here.ter_set( examp, ter_t_tree_maple ); return; } @@ -4125,14 +4158,14 @@ void iexamine::tree_maple_tapped( Character &you, const tripoint &examp ) void iexamine::shrub_marloss( Character &you, const tripoint &examp ) { if( you.has_trait( trait_THRESH_MYCUS ) ) { - pick_plant( you, examp, itype_mycus_fruit, t_shrub_fungal ); + pick_plant( you, examp, itype_mycus_fruit, ter_t_shrub_fungal ); } else if( you.has_trait( trait_THRESH_MARLOSS ) ) { map &here = get_map(); here.spawn_item( you.pos(), itype_mycus_fruit, 1, 0, calendar::turn ); - here.ter_set( examp, t_fungus ); + here.ter_set( examp, ter_t_fungus ); add_msg( m_info, _( "The shrub offers up a fruit, then crumbles into a fungal bed." ) ); } else { - pick_plant( you, examp, itype_marloss_berry, t_shrub_fungal ); + pick_plant( you, examp, itype_marloss_berry, ter_t_shrub_fungal ); } } @@ -4140,20 +4173,20 @@ void iexamine::tree_marloss( Character &you, const tripoint &examp ) { map &here = get_map(); if( you.has_trait( trait_THRESH_MYCUS ) ) { - pick_plant( you, examp, itype_mycus_fruit, t_tree_fungal ); + pick_plant( you, examp, itype_mycus_fruit, ter_t_tree_fungal ); if( you.has_trait( trait_M_DEPENDENT ) && one_in( 3 ) ) { // Folks have a better shot at keeping fed. add_msg( m_info, _( "We have located a particularly vital nutrient deposit underneath this location." ) ); add_msg( m_good, _( "Additional nourishment is available." ) ); - here.ter_set( examp, t_marloss_tree ); + here.ter_set( examp, ter_t_marloss_tree ); } } else if( you.has_trait( trait_THRESH_MARLOSS ) ) { here.spawn_item( you.pos(), itype_mycus_fruit, 1, 0, calendar::turn ); - here.ter_set( examp, t_tree_fungal ); + here.ter_set( examp, ter_t_tree_fungal ); add_msg( m_info, _( "The tree offers up a fruit, then shrivels into a fungal tree." ) ); } else { - pick_plant( you, examp, itype_marloss_berry, t_tree_fungal ); + pick_plant( you, examp, itype_marloss_berry, ter_t_tree_fungal ); } } diff --git a/src/iuse.cpp b/src/iuse.cpp index 0057bb1dbe528..c834c78944c27 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -338,6 +338,7 @@ static const species_id species_ROBOT( "ROBOT" ); static const ter_str_id ter_t_grave( "t_grave" ); static const ter_str_id ter_t_grave_new( "t_grave_new" ); +static const ter_str_id ter_t_marloss( "t_marloss" ); static const ter_str_id ter_t_pit( "t_pit" ); static const ter_str_id ter_t_pit_corpsed( "t_pit_corpsed" ); static const ter_str_id ter_t_pit_covered( "t_pit_covered" ); @@ -345,6 +346,8 @@ static const ter_str_id ter_t_pit_glass( "t_pit_glass" ); static const ter_str_id ter_t_pit_shallow( "t_pit_shallow" ); static const ter_str_id ter_t_pit_spiked( "t_pit_spiked" ); static const ter_str_id ter_t_pit_spiked_covered( "t_pit_spiked_covered" ); +static const ter_str_id ter_t_stump( "t_stump" ); +static const ter_str_id ter_t_trunk( "t_trunk" ); static const ter_str_id ter_t_utility_light( "t_utility_light" ); static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" ); @@ -1336,7 +1339,7 @@ static void marloss_common( Character &p, item &it, const trait_id ¤t_colo } p.set_mutation( trait_THRESH_MARLOSS ); - get_map().ter_set( p.pos(), t_marloss ); + get_map().ter_set( p.pos(), ter_t_marloss ); get_event_bus().send( p.getID() ); p.add_msg_if_player( m_good, _( "You wake up in a Marloss bush. Almost *cradled* in it, actually, as though it grew there for you." ) ); @@ -4592,14 +4595,14 @@ std::optional iuse::chop_logs( Character *p, item *it, const tripoint & ) return std::nullopt; } - const std::set allowed_ter_id { - t_trunk, - t_stump + const std::set allowed_ter_id { + ter_t_trunk, + ter_t_stump }; map &here = get_map(); const std::function f = [&allowed_ter_id, &here]( const tripoint & pnt ) { const ter_id type = here.ter( pnt ); - const bool is_allowed_terrain = allowed_ter_id.find( type ) != allowed_ter_id.end(); + const bool is_allowed_terrain = allowed_ter_id.find( type.id() ) != allowed_ter_id.end(); return is_allowed_terrain; }; @@ -4825,7 +4828,7 @@ std::optional iuse::handle_ground_graffiti( Character &p, item *it, const s return std::nullopt; } - bool grave = here.ter( where ) == t_grave_new; + bool grave = here.ter( where ) == ter_t_grave_new; int move_cost; if( message.empty() ) { if( here.has_graffiti_at( where ) ) { diff --git a/src/map.cpp b/src/map.cpp index d361557c1fc25..459681f0435d1 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -147,13 +147,55 @@ static const oter_str_id oter_solid_earth( "solid_earth" ); static const species_id species_FERAL( "FERAL" ); +static const ter_str_id ter_t_bars( "t_bars" ); +static const ter_str_id ter_t_card_industrial( "t_card_industrial" ); +static const ter_str_id ter_t_card_military( "t_card_military" ); +static const ter_str_id ter_t_card_reader_broken( "t_card_reader_broken" ); +static const ter_str_id ter_t_card_science( "t_card_science" ); static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_door_b( "t_door_b" ); +static const ter_str_id ter_t_door_bar_c( "t_door_bar_c" ); +static const ter_str_id ter_t_door_bar_locked( "t_door_bar_locked" ); +static const ter_str_id ter_t_door_bar_o( "t_door_bar_o" ); +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_frame( "t_door_frame" ); +static const ter_str_id ter_t_door_locked( "t_door_locked" ); +static const ter_str_id ter_t_door_locked_alarm( "t_door_locked_alarm" ); +static const ter_str_id ter_t_door_locked_peep( "t_door_locked_peep" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_floor_wax( "t_floor_wax" ); +static const ter_str_id ter_t_gas_pump( "t_gas_pump" ); +static const ter_str_id ter_t_gas_pump_smashed( "t_gas_pump_smashed" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); +static const ter_str_id ter_t_reb_cage( "t_reb_cage" ); +static const ter_str_id ter_t_rock( "t_rock" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_rootcellar( "t_rootcellar" ); +static const ter_str_id ter_t_sewage( "t_sewage" ); static const ter_str_id ter_t_soil( "t_soil" ); +static const ter_str_id ter_t_tree_birch( "t_tree_birch" ); static const ter_str_id ter_t_tree_birch_harvested( "t_tree_birch_harvested" ); static const ter_str_id ter_t_tree_dead( "t_tree_dead" ); static const ter_str_id ter_t_tree_deadpine( "t_tree_deadpine" ); +static const ter_str_id ter_t_tree_hickory( "t_tree_hickory" ); static const ter_str_id ter_t_tree_hickory_dead( "t_tree_hickory_dead" ); +static const ter_str_id ter_t_tree_hickory_harvested( "t_tree_hickory_harvested" ); +static const ter_str_id ter_t_tree_maple_tapped( "t_tree_maple_tapped" ); +static const ter_str_id ter_t_tree_pine( "t_tree_pine" ); +static const ter_str_id ter_t_tree_willow( "t_tree_willow" ); static const ter_str_id ter_t_tree_willow_harvested( "t_tree_willow_harvested" ); +static const ter_str_id ter_t_tree_young( "t_tree_young" ); +static const ter_str_id ter_t_vat( "t_vat" ); +static const ter_str_id ter_t_wall_glass( "t_wall_glass" ); +static const ter_str_id ter_t_wall_glass_alarm( "t_wall_glass_alarm" ); +static const ter_str_id ter_t_water_sh( "t_water_sh" ); +static const ter_str_id ter_t_wax( "t_wax" ); +static const ter_str_id ter_t_window( "t_window" ); +static const ter_str_id ter_t_window_alarm( "t_window_alarm" ); +static const ter_str_id ter_t_window_empty( "t_window_empty" ); +static const ter_str_id ter_t_window_no_curtains( "t_window_no_curtains" ); static const trait_id trait_SCHIZOPHRENIC( "SCHIZOPHRENIC" ); @@ -835,8 +877,8 @@ vehicle *map::move_vehicle( vehicle &veh, const tripoint &dp, const tileray &fac veh.velocity -= std::clamp( veh.velocity, -2000, 2000 ); // extra drag for( const tripoint &p : veh.get_points() ) { const ter_id &pter = ter( p ); - if( pter == t_dirt || pter == t_grass ) { - ter_set( p, t_dirtmound ); + if( pter == ter_t_dirt || pter == ter_t_grass ) { + ter_set( p, ter_t_dirtmound ); } } } @@ -1611,8 +1653,8 @@ bool map::displace_water( const tripoint &p ) continue; } if( pass != 0 && dis_places == sel_place ) { - ter_set( temp, t_water_sh ); - ter_set( temp, t_dirt ); + ter_set( temp, ter_t_water_sh ); + ter_set( temp, ter_t_dirt ); return true; } @@ -1737,8 +1779,8 @@ bool map::furn_set( const tripoint &p, const furn_id &new_furniture, const bool } if( new_f.has_flag( ter_furn_flag::TFLAG_PLANT ) ) { - if( current_submap->get_ter( l ) == t_dirtmound ) { - ter_set( p, t_dirt ); + if( current_submap->get_ter( l ) == ter_t_dirtmound ) { + ter_set( p, ter_t_dirt ); } } @@ -1871,14 +1913,14 @@ std::string map::furnname( const tripoint_bub_ms &p ) ter_id map::ter( const tripoint &p ) const { if( !inbounds( p ) ) { - return t_null; + return ter_str_id::NULL_ID().id(); } point l; const submap *const current_submap = unsafe_get_submap_at( p, l ); if( current_submap == nullptr ) { debugmsg( "Tried to process terrain at (%d,%d) but the submap is not loaded", l.x, l.y ); - return t_null; + return ter_str_id::NULL_ID().id(); } return current_submap->get_ter( l ); @@ -3766,7 +3808,7 @@ void map::collapse_at( const tripoint &p, const bool silent, const bool was_supp // a wall which doesn't make sense. if( !has_flag( ter_furn_flag::TFLAG_WALL, t ) ) { furn_set( tz, f_null ); - ter_set( tz, t_open_air ); + ter_set( tz, ter_t_open_air ); Creature *critter = get_creature_tracker().creature_at( tz ); if( critter != nullptr ) { creature_on_trap( *critter ); @@ -3900,7 +3942,7 @@ void map::smash_items( const tripoint &p, const int power, const std::string &ca } } -ter_id map::get_roof( const tripoint &p, const bool allow_air ) const +ter_str_id map::get_roof( const tripoint &p, const bool allow_air ) const { // This function should not be called from the 2D mode // Just use t_dirt instead @@ -3908,7 +3950,7 @@ ter_id map::get_roof( const tripoint &p, const bool allow_air ) const if( p.z <= -OVERMAP_DEPTH ) { // Could be magma/"void" instead - return t_rock_floor; + return ter_t_rock_floor; } const ter_t &ter_there = ter( p ).obj(); @@ -3917,25 +3959,23 @@ ter_id map::get_roof( const tripoint &p, const bool allow_air ) const // No roof // Not acceptable if the tile is not passable if( !allow_air ) { - return t_dirt; + return ter_t_dirt; } - return t_open_air; + return ter_t_open_air; } - - ter_id new_ter = roof.id(); - if( new_ter == t_null ) { + if( roof == ter_str_id::NULL_ID() ) { debugmsg( "map::get_new_floor: %d,%d,%d has invalid roof type %s", p.x, p.y, p.z, roof.c_str() ); - return t_dirt; + return ter_t_dirt; } - if( p.z == -1 && new_ter == t_rock_floor ) { + if( p.z == -1 && roof == ter_t_rock_floor ) { // HACK: A hack to work around not having a "solid earth" tile - new_ter = t_dirt; + return ter_t_dirt; } - return new_ter; + return roof; } // Check if there is supporting furniture cardinally adjacent to the bashed furniture @@ -3988,12 +4028,12 @@ void map::bash_ter_furn( const tripoint &p, bash_params ¶ms ) // HACK: A hack for destroy && !bash_floor // We have to check what would we create and cancel if it is what we have now tripoint below( p.xy(), p.z - 1 ); - const ter_id roof = get_roof( below, false ); - if( roof == ter( p ) ) { + const ter_str_id roof = get_roof( below, false ); + if( ter( p ) == roof ) { smash_ter = false; bash = nullptr; } - } else if( !bash->ter_set && ter( p ) == t_dirt ) { + } else if( !bash->ter_set && ter( p ) == ter_t_dirt ) { // As above, except for no-z-levels case smash_ter = false; bash = nullptr; @@ -4194,16 +4234,16 @@ void map::bash_ter_furn( const tripoint &p, bash_params ¶ms ) } furn_set( p, f_null ); - ter_set( p, t_open_air ); + ter_set( p, ter_t_open_air ); } if( !tent ) { spawn_items( p, item_group::items_from( bash->drop_group, calendar::turn ) ); } - if( smash_ter && ter( p ) == t_open_air && zlevels ) { + if( smash_ter && ter( p ) == ter_t_open_air && zlevels ) { tripoint below( p.xy(), p.z - 1 ); - const ter_id roof = get_roof( below, params.bash_floor && ter( below ).obj().movecost != 0 ); + const ter_str_id roof = get_roof( below, params.bash_floor && ter( below ).obj().movecost != 0 ); ter_set( p, roof ); } @@ -4568,32 +4608,33 @@ bool map::hit_with_acid( const tripoint &p ) return false; // Didn't hit the tile! } const ter_id t = ter( p ); - if( t == t_wall_glass || t == t_wall_glass_alarm || - t == t_vat ) { - ter_set( p, t_floor ); - } else if( t == t_door_c || t == t_door_locked || t == t_door_locked_peep || - t == t_door_locked_alarm ) { + if( t == ter_t_wall_glass || t == ter_t_wall_glass_alarm || + t == ter_t_vat ) { + ter_set( p, ter_t_floor ); + } else if( t == ter_t_door_c || t == ter_t_door_locked || t == ter_t_door_locked_peep || + t == ter_t_door_locked_alarm ) { if( one_in( 3 ) ) { - ter_set( p, t_door_b ); + ter_set( p, ter_t_door_b ); } - } else if( t == t_door_bar_c || t == t_door_bar_o || t == t_door_bar_locked || t == t_bars || - t == t_reb_cage ) { - ter_set( p, t_floor ); + } else if( t == ter_t_door_bar_c || t == ter_t_door_bar_o || t == ter_t_door_bar_locked || + t == ter_t_bars || + t == ter_t_reb_cage ) { + ter_set( p, ter_t_floor ); add_msg_if_player_sees( p, m_warning, _( "The metal bars melt!" ) ); - } else if( t == t_door_b ) { + } else if( t == ter_t_door_b ) { if( one_in( 4 ) ) { - ter_set( p, t_door_frame ); + ter_set( p, ter_t_door_frame ); } else { return false; } - } else if( t == t_window || t == t_window_alarm || t == t_window_no_curtains ) { - ter_set( p, t_window_empty ); - } else if( t == t_wax ) { - ter_set( p, t_floor_wax ); - } else if( t == t_gas_pump || t == t_gas_pump_smashed ) { + } else if( t == ter_t_window || t == ter_t_window_alarm || t == ter_t_window_no_curtains ) { + ter_set( p, ter_t_window_empty ); + } else if( t == ter_t_wax ) { + ter_set( p, ter_t_floor_wax ); + } else if( t == ter_t_gas_pump || t == ter_t_gas_pump_smashed ) { return false; - } else if( t == t_card_science || t == t_card_military || t == t_card_industrial ) { - ter_set( p, t_card_reader_broken ); + } else if( t == ter_t_card_science || t == ter_t_card_military || t == ter_t_card_industrial ) { + ter_set( p, ter_t_card_reader_broken ); } return true; } @@ -5364,7 +5405,7 @@ item map::water_from( const tripoint &p ) } const ter_id terrain_id = ter( p ); - if( terrain_id == t_sewage ) { + if( terrain_id == ter_t_sewage ) { item ret( "water_sewage", calendar::turn, item::INFINITE_CHARGES ); ret.set_item_temperature( std::max( weather.get_temperature( p ), temperatures::cold ) ); @@ -5640,7 +5681,7 @@ void map::process_items_in_submap( submap ¤t_submap, const tripoint &gridp } // root cellars are special temperature_flag flag = temperature_flag::NORMAL; - if( ter( map_location ) == t_rootcellar ) { + if( ter( map_location ) == ter_t_rootcellar ) { flag = temperature_flag::ROOT_CELLAR; } @@ -8094,7 +8135,7 @@ void map::saven( const tripoint &grid ) debugmsg( "Tried to save submap node (%d) but it's not loaded", gridn ); return; } - if( submap_to_save->get_ter( point_zero ) == t_null ) { + if( submap_to_save->get_ter( point_zero ) == ter_str_id::NULL_ID() ) { // This is a serious error and should be signaled as soon as possible debugmsg( "map::saven grid %s uninitialized!", grid.to_string() ); return; @@ -8119,9 +8160,9 @@ bool generate_uniform( const tripoint_abs_sm &p, const oter_id &oter ) { std::unique_ptr sm = std::make_unique(); if( oter == oter_open_air ) { - sm->set_all_ter( t_open_air, true ); + sm->set_all_ter( ter_t_open_air, true ); } else if( oter == oter_empty_rock || oter == oter_deep_rock ) { - sm->set_all_ter( t_rock, true ); + sm->set_all_ter( ter_t_rock, true ); } else if( oter == oter_solid_earth ) { sm->set_all_ter( ter_t_soil, true ); } else { @@ -8414,7 +8455,7 @@ void map::produce_sap( const tripoint &p, const time_duration &time_since_last_a return; } - if( t_tree_maple_tapped != ter( p ) ) { + if( !( ter( p ) == ter_t_tree_maple_tapped ) ) { return; } @@ -8526,13 +8567,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 dies_into {{ - {t_grass, ter_t_dirt}, - {t_tree_young, ter_t_dirt}, - {t_tree_pine, ter_t_tree_deadpine}, - {t_tree_birch, ter_t_tree_birch_harvested}, - {t_tree_willow, ter_t_tree_willow_harvested}, - {t_tree_hickory, ter_t_tree_hickory_dead}, - {t_tree_hickory_harvested, ter_t_tree_hickory_dead}, + {ter_t_grass, ter_t_dirt}, + {ter_t_tree_young, ter_t_dirt}, + {ter_t_tree_pine, ter_t_tree_deadpine}, + {ter_t_tree_birch, ter_t_tree_birch_harvested}, + {ter_t_tree_willow, ter_t_tree_willow_harvested}, + {ter_t_tree_hickory, ter_t_tree_hickory_dead}, + {ter_t_tree_hickory_harvested, ter_t_tree_hickory_dead}, }}; const auto iter = dies_into.find( tid ); @@ -8543,7 +8584,7 @@ void map::rad_scorch( const tripoint &p, const time_duration &time_since_last_ac const ter_t &tr = tid.obj(); if( tr.has_flag( ter_furn_flag::TFLAG_SHRUB ) ) { - ter_set( p, t_dirt ); + ter_set( p, ter_t_dirt ); } else if( tr.has_flag( ter_furn_flag::TFLAG_TREE ) ) { ter_set( p, ter_t_tree_dead ); } @@ -8663,13 +8704,13 @@ void map::add_roofs( const tripoint &grid ) for( int x = 0; x < SEEX; x++ ) { for( int y = 0; y < SEEY; y++ ) { const ter_id ter_here = sub_here->get_ter( { x, y } ); - if( ter_here != t_open_air ) { + if( ter_here != ter_t_open_air ) { continue; } if( !check_roof ) { // Make sure we don't have open air at lowest z-level - sub_here->set_ter( { x, y }, t_rock_floor ); + sub_here->set_ter( { x, y }, ter_t_rock_floor ); continue; } @@ -9764,7 +9805,7 @@ void map::draw_square_ter( const weighted_int_list &f, const point &p1, { draw_square( [this, f, avoid_creatures]( const point & p ) { const ter_id *tid = f.pick(); - this->ter_set( p, tid != nullptr ? *tid : t_null, avoid_creatures ); + this->ter_set( p, tid != nullptr ? *tid : ter_str_id::NULL_ID(), avoid_creatures ); }, p1, p2 ); } diff --git a/src/map.h b/src/map.h index 349078b0a6921..34a7ae9bab8c3 100644 --- a/src/map.h +++ b/src/map.h @@ -1083,10 +1083,10 @@ class map void make_rubble( const tripoint &p, const furn_id &rubble_type, bool items, const ter_id &floor_type, bool overwrite = false ); void make_rubble( const tripoint &p, const furn_id &rubble_type, bool items ) { - make_rubble( p, rubble_type, items, t_dirt, false ); + make_rubble( p, rubble_type, items, ter_str_id( "t_dirt" ).id(), false ); } void make_rubble( const tripoint &p ) { - make_rubble( p, f_rubble, false, t_dirt, false ); + make_rubble( p, f_rubble, false, ter_str_id( "t_dirt" ).id(), false ); } bool is_outside( const tripoint &p ) const; @@ -2206,7 +2206,7 @@ class map // Gets the roof type of the tile at p // Second argument refers to whether we have to get a roof (we're over an unpassable tile) // or can just return air because we bashed down an entire floor tile - ter_id get_roof( const tripoint &p, bool allow_air ) const; + ter_str_id get_roof( const tripoint &p, bool allow_air ) const; public: void process_items(); @@ -2636,7 +2636,7 @@ class fake_map : public tinymap private: std::vector> temp_submaps_; public: - explicit fake_map( const ter_id &ter_type = t_dirt ); + explicit fake_map( const ter_id &ter_type = ter_str_id( "t_dirt" ).id() ); ~fake_map() override; static constexpr int fake_map_z = -OVERMAP_DEPTH; }; diff --git a/src/map_extras.cpp b/src/map_extras.cpp index 023bd89a4b5fa..8b054beb0acc4 100644 --- a/src/map_extras.cpp +++ b/src/map_extras.cpp @@ -136,14 +136,38 @@ static const oter_type_str_id oter_type_road( "road" ); static const relic_procgen_id relic_procgen_data_alien_reality( "alien_reality" ); +static const ter_str_id ter_t_clay( "t_clay" ); static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_fence_barbed( "t_fence_barbed" ); +static const ter_str_id ter_t_fungus( "t_fungus" ); +static const ter_str_id ter_t_grass( "t_grass" ); static const ter_str_id ter_t_grass_dead( "t_grass_dead" ); +static const ter_str_id ter_t_grass_golf( "t_grass_golf" ); +static const ter_str_id ter_t_grass_long( "t_grass_long" ); +static const ter_str_id ter_t_grass_tall( "t_grass_tall" ); +static const ter_str_id ter_t_grass_white( "t_grass_white" ); +static const ter_str_id ter_t_lava( "t_lava" ); +static const ter_str_id ter_t_moss( "t_moss" ); +static const ter_str_id ter_t_pavement( "t_pavement" ); +static const ter_str_id ter_t_pavement_y( "t_pavement_y" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_shallow( "t_pit_shallow" ); static const ter_str_id ter_t_stump( "t_stump" ); +static const ter_str_id ter_t_tree_birch( "t_tree_birch" ); static const ter_str_id ter_t_tree_birch_harvested( "t_tree_birch_harvested" ); static const ter_str_id ter_t_tree_dead( "t_tree_dead" ); static const ter_str_id ter_t_tree_deadpine( "t_tree_deadpine" ); +static const ter_str_id ter_t_tree_hickory( "t_tree_hickory" ); static const ter_str_id ter_t_tree_hickory_dead( "t_tree_hickory_dead" ); +static const ter_str_id ter_t_tree_hickory_harvested( "t_tree_hickory_harvested" ); +static const ter_str_id ter_t_tree_pine( "t_tree_pine" ); +static const ter_str_id ter_t_tree_willow( "t_tree_willow" ); static const ter_str_id ter_t_trunk( "t_trunk" ); +static const ter_str_id ter_t_water_dp( "t_water_dp" ); +static const ter_str_id ter_t_water_moving_dp( "t_water_moving_dp" ); +static const ter_str_id ter_t_water_moving_sh( "t_water_moving_sh" ); +static const ter_str_id ter_t_water_sh( "t_water_sh" ); static const trap_str_id tr_engine( "tr_engine" ); @@ -231,17 +255,17 @@ static void dead_vegetation_parser( map &m, const tripoint &loc ) // terrain specific conversions const ter_id tid = m.ter( loc ); static const std::map dies_into {{ - {t_grass, ter_t_grass_dead}, - {t_grass_long, ter_t_grass_dead}, - {t_grass_tall, ter_t_grass_dead}, - {t_moss, ter_t_grass_dead}, - {t_tree_pine, ter_t_tree_deadpine}, - {t_tree_birch, ter_t_tree_birch_harvested}, - {t_tree_willow, ter_t_tree_dead}, - {t_tree_hickory, ter_t_tree_hickory_dead}, - {t_tree_hickory_harvested, ter_t_tree_hickory_dead}, - {t_grass_golf, ter_t_grass_dead}, - {t_grass_white, ter_t_grass_dead}, + {ter_t_grass, ter_t_grass_dead}, + {ter_t_grass_long, ter_t_grass_dead}, + {ter_t_grass_tall, ter_t_grass_dead}, + {ter_t_moss, ter_t_grass_dead}, + {ter_t_tree_pine, ter_t_tree_deadpine}, + {ter_t_tree_birch, ter_t_tree_birch_harvested}, + {ter_t_tree_willow, ter_t_tree_dead}, + {ter_t_tree_hickory, ter_t_tree_hickory_dead}, + {ter_t_tree_hickory_harvested, ter_t_tree_hickory_dead}, + {ter_t_grass_golf, ter_t_grass_dead}, + {ter_t_grass_white, ter_t_grass_dead}, }}; const auto iter = dies_into.find( tid ); @@ -251,7 +275,7 @@ static void dead_vegetation_parser( map &m, const tripoint &loc ) // non-specific small vegetation falls into sticks, large dies and randomly falls const ter_t &tr = tid.obj(); if( tr.has_flag( ter_furn_flag::TFLAG_SHRUB ) ) { - m.ter_set( loc, t_dirt ); + m.ter_set( loc, ter_t_dirt ); if( one_in( 2 ) ) { m.spawn_item( loc, itype_stick ); } @@ -287,13 +311,13 @@ static bool mx_helicopter( map &m, const tripoint &abs_sub ) for( int y = 0; y < SEEY * 2; y++ ) { if( m.veh_at( tripoint( x, y, abs_sub.z ) ) && m.ter( tripoint( x, y, abs_sub.z ) )->has_flag( ter_furn_flag::TFLAG_DIGGABLE ) ) { - m.ter_set( tripoint( x, y, abs_sub.z ), t_dirtmound ); + m.ter_set( tripoint( x, y, abs_sub.z ), ter_t_dirtmound ); } else { if( x >= c.x - dice( 1, 5 ) && x <= c.x + dice( 1, 5 ) && y >= c.y - dice( 1, 5 ) && y <= c.y + dice( 1, 5 ) ) { if( one_in( 7 ) && m.ter( tripoint( x, y, abs_sub.z ) )->has_flag( ter_furn_flag::TFLAG_DIGGABLE ) ) { - m.ter_set( tripoint( x, y, abs_sub.z ), t_dirtmound ); + m.ter_set( tripoint( x, y, abs_sub.z ), ter_t_dirtmound ); } } if( x >= c.x - dice( 1, 6 ) && x <= c.x + dice( 1, 6 ) && y >= c.y - dice( 1, 6 ) && @@ -301,12 +325,12 @@ static bool mx_helicopter( map &m, const tripoint &abs_sub ) if( !one_in( 5 ) ) { m.make_rubble( tripoint( x, y, abs_sub.z ), f_wreckage, true ); if( m.ter( tripoint( x, y, abs_sub.z ) )->has_flag( ter_furn_flag::TFLAG_DIGGABLE ) ) { - m.ter_set( tripoint( x, y, abs_sub.z ), t_dirtmound ); + m.ter_set( tripoint( x, y, abs_sub.z ), ter_t_dirtmound ); } } else if( m.is_bashable( point( x, y ) ) ) { m.destroy( tripoint( x, y, abs_sub.z ), true ); if( m.ter( tripoint( x, y, abs_sub.z ) )->has_flag( ter_furn_flag::TFLAG_DIGGABLE ) ) { - m.ter_set( tripoint( x, y, abs_sub.z ), t_dirtmound ); + m.ter_set( tripoint( x, y, abs_sub.z ), ter_t_dirtmound ); } } @@ -315,7 +339,7 @@ static bool mx_helicopter( map &m, const tripoint &abs_sub ) m.make_rubble( tripoint( x, y, abs_sub.z ), f_wreckage, true ); if( !one_in( 3 ) ) { if( m.ter( tripoint( x, y, abs_sub.z ) )->has_flag( ter_furn_flag::TFLAG_DIGGABLE ) ) { - m.ter_set( tripoint( x, y, abs_sub.z ), t_dirtmound ); + m.ter_set( tripoint( x, y, abs_sub.z ), ter_t_dirtmound ); } } } @@ -501,7 +525,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) } //Horizontal line of barbed wire fence - line( &m, t_fence_barbed, point( 3, 9 ), point( SEEX * 2 - 4, 9 ) ); + line( &m, ter_t_fence_barbed, point( 3, 9 ), point( SEEX * 2 - 4, 9 ) ); std::vector barbed_wire = line_to( point( 3, 9 ), point( SEEX * 2 - 4, 9 ) ); for( point &i : barbed_wire ) { @@ -559,7 +583,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) line_furn( &m, f_sandbag_half, point( 13, 15 ), point( 18, 15 ) ); //Section of barbed wire fence - line( &m, t_fence_barbed, point( 3, 13 ), point( SEEX * 2 - 4, 13 ) ); + line( &m, ter_t_fence_barbed, point( 3, 13 ), point( SEEX * 2 - 4, 13 ) ); std::vector barbed_wire = line_to( point( 3, 13 ), point( SEEX * 2 - 4, 13 ) ); for( point &i : barbed_wire ) { @@ -725,9 +749,9 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) } //Add sandbags and barbed wire fence barricades - line( &m, t_fence_barbed, point( 12, 3 ), point( 12, 13 ) ); + line( &m, ter_t_fence_barbed, point( 12, 3 ), point( 12, 13 ) ); line_furn( &m, f_sandbag_half, point( 10, 16 ), point( 10, 20 ) ); - line( &m, t_fence_barbed, point( 12, 16 ), point( 12, 20 ) ); + line( &m, ter_t_fence_barbed, point( 12, 16 ), point( 12, 20 ) ); //Place second tent square_furn( &m, f_canvas_wall, point( 0, 16 ), point( 4, 20 ) ); @@ -952,7 +976,7 @@ static void place_fumarole( map &m, const point &p1, const point &p2, std::set

fumarole = line_to( p1, p2, 0 ); for( point &i : fumarole ) { - m.ter_set( i, t_lava ); + m.ter_set( i, ter_t_lava ); // Add all adjacent tiles (even on diagonals) for possible ignition // Since they're being added to a set, duplicates won't occur @@ -1014,7 +1038,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) tripoint end_location = { rng( 0, SEEX * 2 - 1 ), rng( 0, SEEY * 2 - 1 ), abs_sub.z }; std::vector failure = line_to( portal_location, end_location ); for( tripoint &i : failure ) { - m.ter_set( { i.xy(), abs_sub.z }, t_pit ); + m.ter_set( { i.xy(), abs_sub.z }, ter_t_pit ); } } break; @@ -1071,7 +1095,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) for( const point &i : ignited ) { // Don't need to do anything to tiles that already have lava on them - if( m.ter( i ) != t_lava ) { + if( m.ter( i ) != ter_t_lava ) { // Spawn an intense but short-lived fire // Any furniture or buildings will catch fire, otherwise it will burn out quickly m.add_field( tripoint( i, abs_sub.z ), fd_fire, 15, 1_minutes ); @@ -1208,17 +1232,17 @@ static bool mx_pond( map &m, const tripoint &abs_sub ) switch( lake_type ) { case 1: - m.ter_set( location, t_water_sh ); + m.ter_set( location, ter_t_water_sh ); break; case 2: - m.ter_set( location, t_water_dp ); + m.ter_set( location, ter_t_water_dp ); break; case 3: const int neighbors = CellularAutomata::neighbor_count( current, width, height, point( i, j ) ); if( neighbors == 8 ) { - m.ter_set( location, t_water_dp ); + m.ter_set( location, ter_t_water_dp ); } else { - m.ter_set( location, t_water_sh ); + m.ter_set( location, ter_t_water_sh ); } break; } @@ -1263,7 +1287,7 @@ static bool mx_clay_deposit( map &m, const tripoint &abs_sub ) if( current[i][j] == 1 ) { const tripoint location( i, j, abs_sub.z ); m.furn_set( location, f_null ); - m.ter_set( location, t_clay ); + m.ter_set( location, ter_t_clay ); } } } @@ -1359,19 +1383,19 @@ static void burned_ground_parser( map &m, const tripoint &loc ) // this method is deliberate to allow adding new post-terrains // (TODO: expand this list when new destroyed terrain is added) static const std::map dies_into {{ - {t_grass, ter_t_grass_dead}, - {t_grass_long, ter_t_grass_dead}, - {t_grass_tall, ter_t_grass_dead}, - {t_moss, ter_t_grass_dead}, - {t_fungus, ter_t_dirt}, - {t_grass_golf, ter_t_grass_dead}, - {t_grass_white, ter_t_grass_dead}, + {ter_t_grass, ter_t_grass_dead}, + {ter_t_grass_long, ter_t_grass_dead}, + {ter_t_grass_tall, ter_t_grass_dead}, + {ter_t_moss, ter_t_grass_dead}, + {ter_t_fungus, ter_t_dirt}, + {ter_t_grass_golf, ter_t_grass_dead}, + {ter_t_grass_white, ter_t_grass_dead}, }}; const auto iter = dies_into.find( tid ); if( iter != dies_into.end() ) { if( one_in( 6 ) ) { - m.ter_set( loc, t_dirt ); + m.ter_set( loc, ter_t_dirt ); m.spawn_item( loc, itype_ash, 1, rng( 10, 50 ) ); } else if( one_in( 10 ) ) { // do nothing, save some spots from fire @@ -1387,7 +1411,7 @@ static void burned_ground_parser( map &m, const tripoint &loc ) } } if( tr.has_flag( ter_furn_flag::TFLAG_FUNGUS ) ) { - m.ter_set( loc, t_dirt ); + m.ter_set( loc, ter_t_dirt ); if( one_in( 5 ) ) { m.spawn_item( loc, itype_ash, 1, rng( 10, 50 ) ); } @@ -1516,8 +1540,8 @@ static bool mx_reed( map &m, const tripoint &abs_sub ) if( p == loc ) { continue; } - if( m.ter( p ) == t_water_moving_sh || m.ter( p ) == t_water_sh || - m.ter( p ) == t_water_moving_dp || m.ter( p ) == t_water_dp ) { + if( m.ter( p ) == ter_t_water_moving_sh || m.ter( p ) == ter_t_water_sh || + m.ter( p ) == ter_t_water_moving_dp || m.ter( p ) == ter_t_water_dp ) { return true; } } @@ -1532,14 +1556,15 @@ static bool mx_reed( map &m, const tripoint &abs_sub ) for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { const tripoint loc( i, j, abs_sub.z ); - if( ( m.ter( loc ) == t_water_sh || m.ter( loc ) == t_water_moving_sh ) && + const ter_id &ter_loc = m.ter( loc ); + if( ( ter_loc == ter_t_water_sh || ter_loc == ter_t_water_moving_sh ) && one_in( intensity ) ) { m.furn_set( loc, vegetation.pick()->id() ); } // tall grass imitates reed - if( ( m.ter( loc ) == t_dirt || m.ter( loc ) == t_grass ) && + if( ( ter_loc == ter_t_dirt || ter_loc == ter_t_grass ) && one_in( near_water( loc ) ? intensity : 7 ) ) { - m.ter_set( loc, t_grass_tall ); + m.ter_set( loc, ter_t_grass_tall ); } } } @@ -1567,10 +1592,10 @@ static bool mx_roadworks( map &m, const tripoint &abs_sub ) // defect types weighted_int_list road_defects; - road_defects.add( t_pit_shallow, 15 ); - road_defects.add( t_dirt, 15 ); - road_defects.add( t_dirtmound, 15 ); - road_defects.add( t_pavement, 55 ); + road_defects.add( ter_t_pit_shallow, 15 ); + road_defects.add( ter_t_dirt, 15 ); + road_defects.add( ter_t_dirtmound, 15 ); + road_defects.add( ter_t_pavement, 55 ); const weighted_int_list defects = road_defects; // location holders @@ -1810,16 +1835,16 @@ static bool mx_roadworks( map &m, const tripoint &abs_sub ) defects_to ); break; case 2: - rough_circle( &m, t_pit_shallow, defects_centered, rng( 2, 4 ) ); + rough_circle( &m, ter_t_pit_shallow, defects_centered, rng( 2, 4 ) ); break; case 3: - circle( &m, t_pit_shallow, defects_centered, rng( 2, 4 ) ); + circle( &m, ter_t_pit_shallow, defects_centered, rng( 2, 4 ) ); break; case 4: - rough_circle( &m, t_dirtmound, defects_centered, rng( 2, 4 ) ); + rough_circle( &m, ter_t_dirtmound, defects_centered, rng( 2, 4 ) ); break; case 5: - circle( &m, t_dirtmound, defects_centered, rng( 2, 4 ) ); + circle( &m, ter_t_dirtmound, defects_centered, rng( 2, 4 ) ); break; } // soil generator @@ -2098,7 +2123,7 @@ static bool mx_city_trap( map &/*m*/, const tripoint &abs_sub ) //Then find an empty 3x3 pavement square (no other traps, furniture, or vehicles) for( const tripoint &p : points_in_radius( trap_center, 1 ) ) { - if( ( compmap.ter( p ) == t_pavement || compmap.ter( p ) == t_pavement_y ) && + if( ( compmap.ter( p ) == ter_t_pavement || compmap.ter( p ) == ter_t_pavement_y ) && compmap.tr_at( p ).is_null() && compmap.furn( p ) == f_null && !compmap.veh_at( p ) ) { diff --git a/src/map_field.cpp b/src/map_field.cpp index 29efc38bb945b..a207063e43c55 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -92,6 +92,11 @@ static const material_id material_veggy( "veggy" ); static const species_id species_FUNGUS( "FUNGUS" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); + static const trait_id trait_ACIDPROOF( "ACIDPROOF" ); static const trait_id trait_GASTROPOD_FOOT( "GASTROPOD_FOOT" ); static const trait_id trait_M_IMMUNE( "M_IMMUNE" ); @@ -910,7 +915,7 @@ static void field_processor_fd_fungicidal_gas( const tripoint &p, field_entry &c const furn_t &frn = pd.map_tile.get_furn_t(); const int intensity = cur.get_field_intensity(); if( ter.has_flag( ter_furn_flag::TFLAG_FUNGUS ) && one_in( 10 / intensity ) ) { - pd.here.ter_set( p, t_dirt ); + pd.here.ter_set( p, ter_t_dirt ); } if( frn.has_flag( ter_furn_flag::TFLAG_FUNGUS ) && one_in( 10 / intensity ) ) { pd.here.furn_set( p, f_null ); @@ -1054,14 +1059,14 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da if( p.z > 0 ) { // We're in the air. Need to invalidate the furniture otherwise it'll cause problems here.furn_set( p, f_null ); - here.ter_set( p, t_open_air ); + here.ter_set( p, ter_t_open_air ); } else if( p.z < -1 ) { // We're deep underground, in bedrock. Whatever terrain was here is burned to the ground, leaving only the carved out rock (including ceiling) - here.ter_set( p, t_rock_floor ); + here.ter_set( p, ter_t_rock_floor ); } else { // Need to invalidate the furniture otherwise it'll cause problems when supporting terrain collapses here.furn_set( p, f_null ); - here.ter_set( p, t_dirt ); + here.ter_set( p, ter_t_dirt ); } } @@ -1140,7 +1145,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da } } // If the flames are in a pit, it can't spread to non-pit - const bool in_pit = ter.id.id() == t_pit; + const bool in_pit = ter.id.id() == ter_t_pit; // Count adjacent fires, to optimize out needless smoke and hot air int adjacent_fires = 0; @@ -1163,7 +1168,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da if( dstfld && ( dstfld->get_field_intensity() <= cur.get_field_intensity() || dstfld->get_field_age() > cur.get_field_age() ) && - ( in_pit == ( dst.get_ter() == t_pit ) ) ) { + ( in_pit == ( dst.get_ter() == ter_t_pit ) ) ) { if( dstfld->get_field_intensity() < 2 ) { // HACK: ignoring all map field caches, since field already exists // and intensity is increased, not decreased @@ -1188,7 +1193,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da if( dstfld && ( dstfld->get_field_intensity() <= cur.get_field_intensity() || dstfld->get_field_age() > cur.get_field_age() ) && - ( in_pit == ( dst.get_ter() == t_pit ) ) ) { + ( in_pit == ( dst.get_ter() == ter_t_pit ) ) ) { if( dstfld->get_field_intensity() < 2 ) { // HACK: ignoring all map field caches, since field already exists // and intensity is increased, not decreased @@ -1297,7 +1302,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da // Allow weaker fires to spread occasionally const int power = cur.get_field_intensity() + one_in( 5 ); if( can_spread && rng( 1, 100 ) < spread_chance && - ( in_pit == ( dster.id.id() == t_pit ) ) && + ( in_pit == ( dster.id.id() == ter_t_pit ) ) && ( ( power >= 2 && ( ter_furn_has_flag( dster, dsfrn, ter_furn_flag::TFLAG_FLAMMABLE ) && one_in( 2 ) ) ) || @@ -1357,7 +1362,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da // Allow weaker fires to spread occasionally const int power = cur.get_field_intensity() + one_in( 5 ); if( can_spread && rng( 1, 100 ) < spread_chance && - ( in_pit == ( dster.id.id() == t_pit ) ) && + ( in_pit == ( dster.id.id() == ter_t_pit ) ) && ( ( power >= 2 && ( ter_furn_has_flag( dster, dsfrn, ter_furn_flag::TFLAG_FLAMMABLE ) && one_in( 2 ) ) ) || diff --git a/src/mapdata.cpp b/src/mapdata.cpp index 77efe7cafe4b9..1356494697264 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -742,423 +742,12 @@ void map_data_common_t::set_groups( std::bitset &bits, } } -ter_id t_null, - t_hole, // Real nothingness; makes you fall a z-level - // Ground - t_dirt, t_sand, t_clay, t_dirtmound, t_pit_shallow, t_pit, t_grave, t_grave_new, - t_pit_corpsed, t_pit_covered, t_pit_spiked, t_pit_spiked_covered, t_pit_glass, t_pit_glass_covered, - t_rock_floor, - t_grass, t_grass_long, t_grass_tall, t_grass_golf, t_grass_dead, t_grass_white, t_moss, - t_grass_alien, - t_metal_floor, - t_pavement, t_pavement_y, t_sidewalk, t_concrete, t_zebra, - t_thconc_floor, t_thconc_floor_olight, t_strconc_floor, - t_floor, t_floor_waxed, - t_dirtfloor,//Dirt floor(Has roof) - t_carpet_red, t_carpet_yellow, t_carpet_purple, t_carpet_green, - t_linoleum_white, t_linoleum_gray, - t_grate, - t_slime, - t_bridge, - t_covered_well, - // Lighting related - t_utility_light, - // Walls - t_wall_log_half, t_wall_log, t_wall_log_chipped, t_wall_log_broken, t_palisade, t_palisade_gate, - t_palisade_gate_o, - t_wall_half, t_wall_wood, t_wall_wood_chipped, t_wall_wood_broken, - t_wall, t_concrete_wall, t_brick_wall, - t_wall_metal, - t_scrap_wall, - t_scrap_wall_halfway, - t_wall_glass, - t_wall_glass_alarm, - t_reinforced_glass, t_reinforced_glass_shutter, t_reinforced_glass_shutter_open, - t_laminated_glass, t_ballistic_glass, - t_reinforced_door_glass_o, t_reinforced_door_glass_c, - t_bars, - t_reb_cage, - t_door_c, t_door_c_peep, t_door_b, t_door_b_peep, t_door_o, t_door_o_peep, t_rdoor_c, t_rdoor_b, - t_rdoor_o, t_door_locked_interior, t_door_locked, t_door_locked_peep, t_door_locked_alarm, - t_door_frame, - t_chaingate_l, t_fencegate_c, t_fencegate_o, t_chaingate_c, t_chaingate_o, - t_retractable_gate_c, t_retractable_gate_l, t_retractable_gate_o, - t_door_boarded, t_door_boarded_damaged, t_door_boarded_peep, t_rdoor_boarded, - t_rdoor_boarded_damaged, t_door_boarded_damaged_peep, - t_door_metal_c, t_door_metal_o, t_door_metal_locked, t_door_metal_pickable, t_mdoor_frame, - t_door_bar_c, t_door_bar_o, t_door_bar_locked, - t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, - t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, - t_curtains, t_window_bars_curtains, t_window_bars_domestic, - t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, - t_window_boarded_noglass, t_window_reinforced, t_window_reinforced_noglass, t_window_enhanced, - t_window_enhanced_noglass, t_window_bars_alarm, t_window_bars, - t_metal_grate_window, t_metal_grate_window_with_curtain, t_metal_grate_window_with_curtain_open, - t_metal_grate_window_noglass, t_metal_grate_window_with_curtain_noglass, - t_metal_grate_window_with_curtain_open_noglass, - t_window_stained_green, t_window_stained_red, t_window_stained_blue, - t_window_no_curtains, t_window_no_curtains_open, t_window_no_curtains_taped, - t_rock, t_fault, - t_paper, - t_rock_wall, t_rock_wall_half, - // Tree - t_tree, t_tree_young, t_tree_apple, t_tree_apple_harvested, t_tree_coffee, t_tree_coffee_harvested, - t_tree_pear, t_tree_pear_harvested, t_tree_cherry, t_tree_cherry_harvested, - t_tree_peach, t_tree_peach_harvested, t_tree_apricot, t_tree_apricot_harvested, t_tree_plum, - t_tree_plum_harvested, - t_tree_pine, t_tree_blackjack, t_tree_birch, t_tree_willow, t_tree_maple, t_tree_maple_tapped, - t_tree_hickory, t_tree_hickory_dead, t_tree_hickory_harvested, t_tree_deadpine, t_underbrush, - t_shrub, t_shrub_blueberry, t_shrub_strawberry, t_trunk, t_stump, - t_root_wall, - t_wax, t_floor_wax, - t_fence, t_chainfence, t_chainfence_posts, - t_fence_post, t_fence_wire, t_fence_barbed, t_fence_rope, - t_railing, - // Nether - t_marloss, t_fungus_floor_in, t_fungus_floor_sup, t_fungus_floor_out, t_fungus_wall, - t_fungus_mound, t_fungus, t_shrub_fungal, t_tree_fungal, t_tree_fungal_young, t_marloss_tree, - // Water, lava, etc. - t_water_moving_dp, t_water_moving_sh, t_water_sh, t_water_dp, t_swater_sh, t_swater_dp, - t_swater_surf, t_water_pool, t_sewage, - t_lava, - // More embellishments than you can shake a stick at. - t_sandbox, t_slide, t_monkey_bars, t_backboard, - t_gas_pump, t_gas_pump_smashed, - t_diesel_pump, t_diesel_pump_smashed, - t_atm, - t_missile, t_missile_exploded, - t_radio_tower, t_radio_controls, - t_gates_mech_control, t_gates_control_concrete, t_gates_control_brick, - t_barndoor, t_palisade_pulley, - t_gates_control_metal, - t_sewage_pipe, t_sewage_pump, - t_column, - t_vat, - t_rootcellar, - t_cvdbody, t_cvdmachine, - t_water_pump, - t_conveyor, - t_improvised_shelter, - // Staircases etc. - t_stairs_down, t_stairs_up, t_manhole, t_ladder_up, t_ladder_down, t_slope_down, - t_slope_up, t_rope_up, - t_manhole_cover, - // Special - t_card_science, t_card_military, t_card_industrial, t_card_reader_broken, t_slot_machine, - t_elevator_control, t_elevator_control_off, t_elevator, t_pedestal_wyrm, - t_pedestal_temple, - // Temple tiles - t_rock_red, t_rock_green, t_rock_blue, t_floor_red, t_floor_green, t_floor_blue, - t_switch_rg, t_switch_gb, t_switch_rb, t_switch_even, t_open_air, - t_pavement_bg_dp, t_pavement_y_bg_dp, t_sidewalk_bg_dp, t_guardrail_bg_dp, - t_rad_platform, - // Railroad and subway - t_railroad_rubble, - t_buffer_stop, t_railroad_crossing_signal, t_crossbuck_wood, t_crossbuck_metal, - t_railroad_tie, t_railroad_tie_h, t_railroad_tie_v, t_railroad_tie_d, - t_railroad_track, t_railroad_track_h, t_railroad_track_v, t_railroad_track_d, t_railroad_track_d1, - t_railroad_track_d2, - t_railroad_track_on_tie, t_railroad_track_h_on_tie, t_railroad_track_v_on_tie, - t_railroad_track_d_on_tie; - -// TODO: Put this crap into an inclusion, which should be generated automatically using JSON data +ter_id t_null; void set_ter_ids() { t_null = ter_id( "t_null" ); - t_hole = ter_id( "t_hole" ); - t_dirt = ter_id( "t_dirt" ); - t_sand = ter_id( "t_sand" ); - t_clay = ter_id( "t_clay" ); - t_dirtmound = ter_id( "t_dirtmound" ); - t_grave = ter_id( "t_grave" ); - t_grave_new = ter_id( "t_grave_new" ); - t_pit_shallow = ter_id( "t_pit_shallow" ); - t_pit = ter_id( "t_pit" ); - t_pit_corpsed = ter_id( "t_pit_corpsed" ); - t_pit_covered = ter_id( "t_pit_covered" ); - t_pit_spiked = ter_id( "t_pit_spiked" ); - t_pit_spiked_covered = ter_id( "t_pit_spiked_covered" ); - t_pit_glass = ter_id( "t_pit_glass" ); - t_pit_glass_covered = ter_id( "t_pit_glass_covered" ); - t_rock_floor = ter_id( "t_rock_floor" ); - t_grass = ter_id( "t_grass" ); - t_grass_dead = ter_id( "t_grass_dead" ); - t_grass_long = ter_id( "t_grass_long" ); - t_grass_tall = ter_id( "t_grass_tall" ); - t_moss = ter_id( "t_moss" ); - t_metal_floor = ter_id( "t_metal_floor" ); - t_pavement = ter_id( "t_pavement" ); - t_pavement_y = ter_id( "t_pavement_y" ); - t_zebra = ter_id( "t_zebra" ); - t_sidewalk = ter_id( "t_sidewalk" ); - t_concrete = ter_id( "t_concrete" ); - t_thconc_floor = ter_id( "t_thconc_floor" ); - t_thconc_floor_olight = ter_id( "t_thconc_floor_olight" ); - t_strconc_floor = ter_id( "t_strconc_floor" ); - t_floor = ter_id( "t_floor" ); - t_floor_waxed = ter_id( "t_floor_waxed" ); - t_dirtfloor = ter_id( "t_dirtfloor" ); - t_carpet_red = ter_id( "t_carpet_red" ); - t_carpet_yellow = ter_id( "t_carpet_yellow" ); - t_carpet_purple = ter_id( "t_carpet_purple" ); - t_carpet_green = ter_id( "t_carpet_green" ); - t_linoleum_white = ter_id( "t_linoleum_white" ); - t_linoleum_gray = ter_id( "t_linoleum_gray" ); - t_grate = ter_id( "t_grate" ); - t_slime = ter_id( "t_slime" ); - t_bridge = ter_id( "t_bridge" ); - t_utility_light = ter_id( "t_utility_light" ); - t_wall_log_half = ter_id( "t_wall_log_half" ); - t_wall_log = ter_id( "t_wall_log" ); - t_wall_log_chipped = ter_id( "t_wall_log_chipped" ); - t_wall_log_broken = ter_id( "t_wall_log_broken" ); - t_palisade = ter_id( "t_palisade" ); - t_palisade_gate = ter_id( "t_palisade_gate" ); - t_palisade_gate_o = ter_id( "t_palisade_gate_o" ); - t_wall_half = ter_id( "t_wall_half" ); - t_wall_wood = ter_id( "t_wall_wood" ); - t_wall_wood_chipped = ter_id( "t_wall_wood_chipped" ); - t_wall_wood_broken = ter_id( "t_wall_wood_broken" ); - t_wall = ter_id( "t_wall" ); - t_concrete_wall = ter_id( "t_concrete_wall" ); - t_brick_wall = ter_id( "t_brick_wall" ); - t_wall_metal = ter_id( "t_wall_metal" ); - t_scrap_wall = ter_id( "t_scrap_wall" ); - t_scrap_wall_halfway = ter_id( "t_scrap_wall_halfway" ); - t_wall_glass = ter_id( "t_wall_glass" ); - t_wall_glass_alarm = ter_id( "t_wall_glass_alarm" ); - t_reinforced_glass = ter_id( "t_reinforced_glass" ); - t_reinforced_glass_shutter = ter_id( "t_reinforced_glass_shutter" ); - t_reinforced_glass_shutter_open = ter_id( "t_reinforced_glass_shutter_open" ); - t_laminated_glass = ter_id( "t_laminated_glass" ); - t_ballistic_glass = ter_id( "t_ballistic_glass" ); - t_reinforced_door_glass_c = ter_id( "t_reinforced_door_glass_c" ); - t_reinforced_door_glass_o = ter_id( "t_reinforced_door_glass_o" ); - t_bars = ter_id( "t_bars" ); - t_reb_cage = ter_id( "t_reb_cage" ); - t_door_c = ter_id( "t_door_c" ); - t_door_c_peep = ter_id( "t_door_c_peep" ); - t_door_b = ter_id( "t_door_b" ); - t_door_b_peep = ter_id( "t_door_b_peep" ); - t_door_o = ter_id( "t_door_o" ); - t_door_o_peep = ter_id( "t_door_o_peep" ); - t_rdoor_c = ter_id( "t_rdoor_c" ); - t_rdoor_b = ter_id( "t_rdoor_b" ); - t_rdoor_o = ter_id( "t_rdoor_o" ); - t_door_locked_interior = ter_id( "t_door_locked_interior" ); - t_door_locked = ter_id( "t_door_locked" ); - t_door_locked_peep = ter_id( "t_door_locked_peep" ); - t_door_locked_alarm = ter_id( "t_door_locked_alarm" ); - t_door_frame = ter_id( "t_door_frame" ); - t_mdoor_frame = ter_id( "t_mdoor_frame" ); - t_chaingate_l = ter_id( "t_chaingate_l" ); - t_fencegate_c = ter_id( "t_fencegate_c" ); - t_fencegate_o = ter_id( "t_fencegate_o" ); - t_chaingate_c = ter_id( "t_chaingate_c" ); - t_chaingate_o = ter_id( "t_chaingate_o" ); - t_retractable_gate_l = ter_id( "t_retractable_gate_l" ); - t_retractable_gate_c = ter_id( "t_retractable_gate_c" ); - t_retractable_gate_o = ter_id( "t_retractable_gate_o" ); - t_door_boarded = ter_id( "t_door_boarded" ); - t_door_boarded_damaged = ter_id( "t_door_boarded_damaged" ); - t_door_boarded_peep = ter_id( "t_door_boarded_peep" ); - t_rdoor_boarded = ter_id( "t_rdoor_boarded" ); - t_rdoor_boarded_damaged = ter_id( "t_rdoor_boarded_damaged" ); - t_door_boarded_damaged_peep = ter_id( "t_door_boarded_damaged_peep" ); - t_door_metal_c = ter_id( "t_door_metal_c" ); - t_door_metal_o = ter_id( "t_door_metal_o" ); - t_door_metal_locked = ter_id( "t_door_metal_locked" ); - t_door_metal_pickable = ter_id( "t_door_metal_pickable" ); - t_door_bar_c = ter_id( "t_door_bar_c" ); - t_door_bar_o = ter_id( "t_door_bar_o" ); - t_door_bar_locked = ter_id( "t_door_bar_locked" ); - t_door_glass_c = ter_id( "t_door_glass_c" ); - t_door_glass_o = ter_id( "t_door_glass_o" ); - t_door_glass_frosted_c = ter_id( "t_door_glass_frosted_c" ); - t_door_glass_frosted_o = ter_id( "t_door_glass_frosted_o" ); - t_portcullis = ter_id( "t_portcullis" ); - t_recycler = ter_id( "t_recycler" ); - t_window = ter_id( "t_window" ); - t_window_taped = ter_id( "t_window_taped" ); - t_window_domestic = ter_id( "t_window_domestic" ); - t_window_domestic_taped = ter_id( "t_window_domestic_taped" ); - t_window_bars_domestic = ter_id( "t_window_bars_domestic" ); - t_window_open = ter_id( "t_window_open" ); - t_curtains = ter_id( "t_curtains" ); - t_window_bars_curtains = ter_id( "t_window_bars_curtains" ); - t_window_alarm = ter_id( "t_window_alarm" ); - t_window_alarm_taped = ter_id( "t_window_alarm_taped" ); - t_window_empty = ter_id( "t_window_empty" ); - t_window_frame = ter_id( "t_window_frame" ); - t_window_boarded = ter_id( "t_window_boarded" ); - t_window_boarded_noglass = ter_id( "t_window_boarded_noglass" ); - t_window_reinforced = ter_id( "t_window_reinforced" ); - t_window_reinforced_noglass = ter_id( "t_window_reinforced_noglass" ); - t_window_enhanced = ter_id( "t_window_enhanced" ); - t_window_enhanced_noglass = ter_id( "t_window_enhanced_noglass" ); - t_window_bars_alarm = ter_id( "t_window_bars_alarm" ); - t_window_bars = ter_id( "t_window_bars" ); - t_window_stained_green = ter_id( "t_window_stained_green" ); - t_window_stained_red = ter_id( "t_window_stained_red" ); - t_window_stained_blue = ter_id( "t_window_stained_blue" ); - t_window_no_curtains = ter_id( "t_window_no_curtains" ); - t_window_no_curtains_open = ter_id( "t_window_no_curtains_open" ); - t_window_no_curtains_taped = ter_id( "t_window_no_curtains_taped" ); - t_rock = ter_id( "t_rock" ); - t_fault = ter_id( "t_fault" ); - t_paper = ter_id( "t_paper" ); - t_rock_wall = ter_id( "t_rock_wall" ); - t_rock_wall_half = ter_id( "t_rock_wall_half" ); - t_tree = ter_id( "t_tree" ); - t_tree_young = ter_id( "t_tree_young" ); - t_tree_apple = ter_id( "t_tree_apple" ); - t_tree_apple_harvested = ter_id( "t_tree_apple_harvested" ); - t_tree_coffee = ter_id( "t_tree_coffee" ); - t_tree_coffee_harvested = ter_id( "t_tree_coffee_harvested" ); - t_tree_pear = ter_id( "t_tree_pear" ); - t_tree_pear_harvested = ter_id( "t_tree_pear_harvested" ); - t_tree_cherry = ter_id( "t_tree_cherry" ); - t_tree_cherry_harvested = ter_id( "t_tree_cherry_harvested" ); - t_tree_peach = ter_id( "t_tree_peach" ); - t_tree_peach_harvested = ter_id( "t_tree_peach_harvested" ); - t_tree_apricot = ter_id( "t_tree_apricot" ); - t_tree_apricot_harvested = ter_id( "t_tree_apricot_harvested" ); - t_tree_plum = ter_id( "t_tree_plum" ); - t_tree_plum_harvested = ter_id( "t_tree_plum_harvested" ); - t_tree_pine = ter_id( "t_tree_pine" ); - t_tree_blackjack = ter_id( "t_tree_blackjack" ); - t_tree_birch = ter_id( "t_tree_birch" ); - t_tree_willow = ter_id( "t_tree_willow" ); - t_tree_maple = ter_id( "t_tree_maple" ); - t_tree_maple_tapped = ter_id( "t_tree_maple_tapped" ); - t_tree_deadpine = ter_id( "t_tree_deadpine" ); - t_tree_hickory = ter_id( "t_tree_hickory" ); - t_tree_hickory_dead = ter_id( "t_tree_hickory_dead" ); - t_tree_hickory_harvested = ter_id( "t_tree_hickory_harvested" ); - t_underbrush = ter_id( "t_underbrush" ); - t_shrub = ter_id( "t_shrub" ); - t_shrub_blueberry = ter_id( "t_shrub_blueberry" ); - t_shrub_strawberry = ter_id( "t_shrub_strawberry" ); - t_trunk = ter_id( "t_trunk" ); - t_stump = ter_id( "t_stump" ); - t_root_wall = ter_id( "t_root_wall" ); - t_wax = ter_id( "t_wax" ); - t_floor_wax = ter_id( "t_floor_wax" ); - t_fence = ter_id( "t_fence" ); - t_chainfence = ter_id( "t_chainfence" ); - t_chainfence_posts = ter_id( "t_chainfence_posts" ); - t_fence_post = ter_id( "t_fence_post" ); - t_fence_wire = ter_id( "t_fence_wire" ); - t_fence_barbed = ter_id( "t_fence_barbed" ); - t_fence_rope = ter_id( "t_fence_rope" ); - t_railing = ter_id( "t_railing" ); - t_marloss = ter_id( "t_marloss" ); - t_fungus_floor_in = ter_id( "t_fungus_floor_in" ); - t_fungus_floor_sup = ter_id( "t_fungus_floor_sup" ); - t_fungus_floor_out = ter_id( "t_fungus_floor_out" ); - t_fungus_wall = ter_id( "t_fungus_wall" ); - t_fungus_mound = ter_id( "t_fungus_mound" ); - t_fungus = ter_id( "t_fungus" ); - t_shrub_fungal = ter_id( "t_shrub_fungal" ); - t_tree_fungal = ter_id( "t_tree_fungal" ); - t_tree_fungal_young = ter_id( "t_tree_fungal_young" ); - t_marloss_tree = ter_id( "t_marloss_tree" ); - t_water_moving_dp = ter_id( "t_water_moving_dp" ); - t_water_moving_sh = ter_id( "t_water_moving_sh" ); - t_water_sh = ter_id( "t_water_sh" ); - t_water_dp = ter_id( "t_water_dp" ); - t_swater_sh = ter_id( "t_swater_sh" ); - t_swater_dp = ter_id( "t_swater_dp" ); - t_swater_surf = ter_id( "t_swater_surf" ); - t_water_pool = ter_id( "t_water_pool" ); - t_sewage = ter_id( "t_sewage" ); - t_lava = ter_id( "t_lava" ); - t_sandbox = ter_id( "t_sandbox" ); - t_slide = ter_id( "t_slide" ); - t_monkey_bars = ter_id( "t_monkey_bars" ); - t_backboard = ter_id( "t_backboard" ); - t_gas_pump = ter_id( "t_gas_pump" ); - t_gas_pump_smashed = ter_id( "t_gas_pump_smashed" ); - t_diesel_pump = ter_id( "t_diesel_pump" ); - t_diesel_pump_smashed = ter_id( "t_diesel_pump_smashed" ); - t_atm = ter_id( "t_atm" ); - t_missile = ter_id( "t_missile" ); - t_missile_exploded = ter_id( "t_missile_exploded" ); - t_radio_tower = ter_id( "t_radio_tower" ); - t_radio_controls = ter_id( "t_radio_controls" ); - t_gates_mech_control = ter_id( "t_gates_mech_control" ); - t_gates_control_brick = ter_id( "t_gates_control_brick" ); - t_gates_control_concrete = ter_id( "t_gates_control_concrete" ); - t_barndoor = ter_id( "t_barndoor" ); - t_palisade_pulley = ter_id( "t_palisade_pulley" ); - t_gates_control_metal = ter_id( "t_gates_control_metal" ); - t_sewage_pipe = ter_id( "t_sewage_pipe" ); - t_sewage_pump = ter_id( "t_sewage_pump" ); - t_column = ter_id( "t_column" ); - t_vat = ter_id( "t_vat" ); - t_rootcellar = ter_id( "t_rootcellar" ); - t_cvdbody = ter_id( "t_cvdbody" ); - t_cvdmachine = ter_id( "t_cvdmachine" ); - t_stairs_down = ter_id( "t_stairs_down" ); - t_stairs_up = ter_id( "t_stairs_up" ); - t_manhole = ter_id( "t_manhole" ); - t_ladder_up = ter_id( "t_ladder_up" ); - t_ladder_down = ter_id( "t_ladder_down" ); - t_slope_down = ter_id( "t_slope_down" ); - t_slope_up = ter_id( "t_slope_up" ); - t_rope_up = ter_id( "t_rope_up" ); - t_manhole_cover = ter_id( "t_manhole_cover" ); - t_card_science = ter_id( "t_card_science" ); - t_card_military = ter_id( "t_card_military" ); - t_card_industrial = ter_id( "t_card_industrial" ); - t_card_reader_broken = ter_id( "t_card_reader_broken" ); - t_slot_machine = ter_id( "t_slot_machine" ); - t_elevator_control = ter_id( "t_elevator_control" ); - t_elevator_control_off = ter_id( "t_elevator_control_off" ); - t_elevator = ter_id( "t_elevator" ); - t_pedestal_wyrm = ter_id( "t_pedestal_wyrm" ); - t_pedestal_temple = ter_id( "t_pedestal_temple" ); - t_rock_red = ter_id( "t_rock_red" ); - t_rock_green = ter_id( "t_rock_green" ); - t_rock_blue = ter_id( "t_rock_blue" ); - t_floor_red = ter_id( "t_floor_red" ); - t_floor_green = ter_id( "t_floor_green" ); - t_floor_blue = ter_id( "t_floor_blue" ); - t_switch_rg = ter_id( "t_switch_rg" ); - t_switch_gb = ter_id( "t_switch_gb" ); - t_switch_rb = ter_id( "t_switch_rb" ); - t_switch_even = ter_id( "t_switch_even" ); - t_covered_well = ter_id( "t_covered_well" ); - t_water_pump = ter_id( "t_water_pump" ); - t_conveyor = ter_id( "t_conveyor" ); - t_open_air = ter_id( "t_open_air" ); - t_pavement_bg_dp = ter_id( "t_pavement_bg_dp" ); - t_pavement_y_bg_dp = ter_id( "t_pavement_y_bg_dp" ); - t_sidewalk_bg_dp = ter_id( "t_sidewalk_bg_dp" ); - t_guardrail_bg_dp = ter_id( "t_guardrail_bg_dp" ); - t_rad_platform = ter_id( "t_rad_platform" ); - t_improvised_shelter = ter_id( "t_improvised_shelter" ); - t_railroad_rubble = ter_id( "t_railroad_rubble" ); - t_buffer_stop = ter_id( "t_buffer_stop" ); - t_railroad_crossing_signal = ter_id( "t_railroad_crossing_signal" ); - t_crossbuck_metal = ter_id( "t_crossbuck_metal" ); - t_crossbuck_wood = ter_id( "t_crossbuck_wood" ); - t_railroad_tie = ter_id( "t_railroad_tie" ); - t_railroad_tie_h = ter_id( "t_railroad_tie_h" ); - t_railroad_tie_v = ter_id( "t_railroad_tie_v" ); - t_railroad_tie_d = ter_id( "t_railroad_tie_d" ); - t_railroad_track = ter_id( "t_railroad_track" ); - t_railroad_track_h = ter_id( "t_railroad_track_h" ); - t_railroad_track_v = ter_id( "t_railroad_track_v" ); - t_railroad_track_d = ter_id( "t_railroad_track_d" ); - t_railroad_track_d1 = ter_id( "t_railroad_track_d1" ); - t_railroad_track_d2 = ter_id( "t_railroad_track_d2" ); - t_railroad_track_on_tie = ter_id( "t_railroad_track_on_tie" ); - t_railroad_track_h_on_tie = ter_id( "t_railroad_track_h_on_tie" ); - t_railroad_track_v_on_tie = ter_id( "t_railroad_track_v_on_tie" ); - t_railroad_track_d_on_tie = ter_id( "t_railroad_track_d_on_tie" ); + for( const ter_t &elem : terrain_data.get_all() ) { ter_t &ter = const_cast( elem ); if( ter.trap_id_str.empty() ) { diff --git a/src/mapdata.h b/src/mapdata.h index 61193a5b74abb..a75cf4e6d6663 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -698,126 +698,7 @@ t_basalt "t_basalt" */ // NOLINTNEXTLINE(cata-static-int_id-constants) -extern ter_id t_null, - t_hole, // Real nothingness; makes you fall a z-level - // Ground - t_dirt, t_sand, t_clay, t_dirtmound, t_pit_shallow, t_pit, t_grave, t_grave_new, - t_pit_corpsed, t_pit_covered, t_pit_spiked, t_pit_spiked_covered, t_pit_glass, t_pit_glass_covered, - t_rock_floor, - t_grass, t_grass_long, t_grass_tall, t_grass_golf, t_grass_dead, t_grass_white, t_moss, - t_grass_alien, - t_metal_floor, - t_pavement, t_pavement_y, t_sidewalk, t_concrete, t_zebra, - t_thconc_floor, t_thconc_floor_olight, t_strconc_floor, - t_floor, t_floor_waxed, - t_dirtfloor,//Dirt floor(Has roof) - t_carpet_red, t_carpet_yellow, t_carpet_purple, t_carpet_green, - t_grate, - t_slime, - t_bridge, - t_covered_well, - // Lighting related - t_utility_light, - // Walls - t_wall_log_half, t_wall_log, t_wall_log_chipped, t_wall_log_broken, t_palisade, t_palisade_gate, - t_palisade_gate_o, - t_wall_half, t_wall_wood, t_wall_wood_chipped, t_wall_wood_broken, - t_wall, t_concrete_wall, t_brick_wall, - t_wall_metal, - t_scrap_wall, - t_scrap_wall_halfway, - t_wall_glass, - t_wall_glass_alarm, - t_reinforced_glass, t_reinforced_glass_shutter, t_reinforced_glass_shutter_open, - t_laminated_glass, t_ballistic_glass, - t_reinforced_door_glass_o, t_reinforced_door_glass_c, - t_bars, - t_reb_cage, - t_door_c, t_door_c_peep, t_door_b, t_door_b_peep, t_door_o, t_door_o_peep, - t_door_locked_interior, t_door_locked, t_door_locked_peep, t_door_locked_alarm, t_door_frame, - t_chaingate_l, t_fencegate_c, t_fencegate_o, t_chaingate_c, t_chaingate_o, - t_retractable_gate_l, t_retractable_gate_c, t_retractable_gate_o, - t_door_boarded, t_door_boarded_damaged, t_door_boarded_peep, t_rdoor_boarded, - t_rdoor_boarded_damaged, t_door_boarded_damaged_peep, - t_door_metal_c, t_door_metal_o, t_door_metal_locked, t_door_metal_pickable, - t_door_bar_c, t_door_bar_o, t_door_bar_locked, - t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, - t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, - t_curtains, t_window_bars_curtains, t_window_bars_domestic, - t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, - t_window_boarded_noglass, t_window_bars_alarm, t_window_bars, - t_metal_grate_window, t_metal_grate_window_with_curtain, t_metal_grate_window_with_curtain_open, - t_metal_grate_window_noglass, t_metal_grate_window_with_curtain_noglass, - t_metal_grate_window_with_curtain_open_noglass, - t_window_stained_green, t_window_stained_red, t_window_stained_blue, - t_window_no_curtains, t_window_no_curtains_open, t_window_no_curtains_taped, - t_rock, t_fault, - t_paper, - t_rock_wall, t_rock_wall_half, - // Tree - t_tree, t_tree_young, t_tree_apple, t_tree_apple_harvested, t_tree_coffee, t_tree_coffee_harvested, - t_tree_pear, t_tree_pear_harvested, - t_tree_cherry, t_tree_cherry_harvested, t_tree_peach, t_tree_peach_harvested, t_tree_apricot, - t_tree_apricot_harvested, - t_tree_plum, t_tree_plum_harvested, t_tree_pine, t_tree_blackjack, t_tree_birch, - t_tree_birch_harvested, t_tree_willow, t_tree_willow_harvested, t_tree_maple, t_tree_maple_tapped, - t_tree_deadpine, t_tree_hickory, t_tree_hickory_dead, t_tree_hickory_harvested, t_underbrush, - t_shrub, t_shrub_blueberry, t_shrub_strawberry, t_trunk, t_stump, - t_root_wall, - t_wax, t_floor_wax, - t_fence, t_chainfence, t_chainfence_posts, - t_fence_post, t_fence_wire, t_fence_barbed, t_fence_rope, - t_railing, - // Nether - t_marloss, t_fungus_floor_in, t_fungus_floor_sup, t_fungus_floor_out, t_fungus_wall, - t_fungus_mound, t_fungus, t_shrub_fungal, t_tree_fungal, t_tree_fungal_young, t_marloss_tree, - // Water, lava, etc. - t_water_moving_dp, t_water_moving_sh, t_water_sh, t_swater_sh, t_water_dp, t_swater_dp, - t_swater_surf, t_water_pool, t_sewage, - t_lava, - // More embellishments than you can shake a stick at. - t_sandbox, t_slide, t_monkey_bars, t_backboard, - t_gas_pump, t_gas_pump_smashed, - t_diesel_pump, t_diesel_pump_smashed, - t_atm, - t_missile, t_missile_exploded, - t_radio_tower, t_radio_controls, - t_gates_mech_control, t_gates_control_concrete, t_gates_control_brick, - t_barndoor, t_palisade_pulley, - t_gates_control_metal, - t_sewage_pipe, t_sewage_pump, - t_column, - t_vat, - t_rootcellar, - t_cvdbody, t_cvdmachine, - t_water_pump, - t_conveyor, - t_improvised_shelter, - // Staircases etc. - t_stairs_down, t_stairs_up, t_manhole, t_ladder_up, t_ladder_down, t_slope_down, - t_slope_up, t_rope_up, - t_manhole_cover, - // Special - t_card_science, t_card_military, t_card_industrial, t_card_reader_broken, t_slot_machine, - t_elevator_control, t_elevator_control_off, t_elevator, t_pedestal_wyrm, - t_pedestal_temple, - // Temple tiles - t_rock_red, t_rock_green, t_rock_blue, t_floor_red, t_floor_green, t_floor_blue, - t_switch_rg, t_switch_gb, t_switch_rb, t_switch_even, - t_rdoor_c, t_rdoor_b, t_rdoor_o, t_mdoor_frame, t_window_reinforced, t_window_reinforced_noglass, - t_window_enhanced, t_window_enhanced_noglass, t_open_air, - t_pavement_bg_dp, t_pavement_y_bg_dp, t_sidewalk_bg_dp, t_guardrail_bg_dp, - t_linoleum_white, t_linoleum_gray, t_rad_platform, - // Railroad and subway - t_railroad_rubble, - t_buffer_stop, t_railroad_crossing_signal, t_crossbuck_wood, t_crossbuck_metal, - t_railroad_tie, t_railroad_tie_h, t_railroad_tie_v, t_railroad_tie_d, - t_railroad_track, t_railroad_track_h, t_railroad_track_v, t_railroad_track_d, t_railroad_track_d1, - t_railroad_track_d2, - t_railroad_track_on_tie, t_railroad_track_h_on_tie, t_railroad_track_v_on_tie, - t_railroad_track_d_on_tie; - +extern ter_id t_null; /* runtime index: furn_id furn_id refers to a position in the furnlist[] where the furn_t struct is stored. See note diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 21ef838c60967..45479046169e5 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -151,6 +151,36 @@ static const oter_str_id oter_tower_lab_stairs( "tower_lab_stairs" ); static const oter_type_str_id oter_type_road( "road" ); static const oter_type_str_id oter_type_sewer( "sewer" ); +static const ter_str_id ter_t_bars( "t_bars" ); +static const ter_str_id ter_t_card_science( "t_card_science" ); +static const ter_str_id ter_t_concrete_wall( "t_concrete_wall" ); +static const ter_str_id ter_t_cvdbody( "t_cvdbody" ); +static const ter_str_id ter_t_cvdmachine( "t_cvdmachine" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_door_glass_frosted_c( "t_door_glass_frosted_c" ); +static const ter_str_id ter_t_door_metal_c( "t_door_metal_c" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_fungus_floor_in( "t_fungus_floor_in" ); +static const ter_str_id ter_t_fungus_wall( "t_fungus_wall" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_marloss( "t_marloss" ); +static const ter_str_id ter_t_radio_tower( "t_radio_tower" ); +static const ter_str_id ter_t_reinforced_door_glass_c( "t_reinforced_door_glass_c" ); +static const ter_str_id ter_t_reinforced_glass( "t_reinforced_glass" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_sewage( "t_sewage" ); +static const ter_str_id ter_t_slime( "t_slime" ); +static const ter_str_id ter_t_slope_down( "t_slope_down" ); +static const ter_str_id ter_t_slope_up( "t_slope_up" ); +static const ter_str_id ter_t_stairs_down( "t_stairs_down" ); +static const ter_str_id ter_t_stairs_up( "t_stairs_up" ); +static const ter_str_id ter_t_strconc_floor( "t_strconc_floor" ); +static const ter_str_id ter_t_thconc_floor( "t_thconc_floor" ); +static const ter_str_id ter_t_thconc_floor_olight( "t_thconc_floor_olight" ); +static const ter_str_id ter_t_vat( "t_vat" ); +static const ter_str_id ter_t_water_sh( "t_water_sh" ); + static const trait_id trait_NPC_STATIC_NPC( "NPC_STATIC_NPC" ); static const vproto_id vehicle_prototype_shopping_cart( "shopping_cart" ); @@ -3009,7 +3039,7 @@ class jmapgen_make_rubble : public jmapgen_piece public: mapgen_value rubble_type = mapgen_value( f_rubble ); bool items = false; - mapgen_value floor_type = mapgen_value( t_dirt ); + mapgen_value floor_type = mapgen_value( ter_t_dirt ); bool overwrite = false; jmapgen_make_rubble( const JsonObject &jsi, const std::string_view/*context*/ ) { if( jsi.has_member( "rubble_type" ) ) { @@ -3030,7 +3060,7 @@ class jmapgen_make_rubble : public jmapgen_piece } if( chosen_floor_type.id().is_null() ) { debugmsg( "null floor type when making rubble" ); - chosen_floor_type = t_dirt; + chosen_floor_type = ter_t_dirt; } dat.m.make_rubble( tripoint( x.get(), y.get(), dat.m.get_abs_sub().z() ), chosen_rubble_type, items, chosen_floor_type, overwrite ); @@ -5283,7 +5313,7 @@ void map::draw_map( mapgendata &dat ) // load from JSON??? debugmsg( "Error: tried to generate map for omtype %s, \"%s\" (id_mapgen %s)", terrain_type.id().c_str(), terrain_type->get_name(), function_key.c_str() ); - fill_background( this, t_floor ); + fill_background( this, ter_t_floor ); } resolve_regional_terrain_and_furniture( dat ); @@ -5355,23 +5385,23 @@ void map::draw_lab( mapgendata &dat ) if( i <= 1 || i >= SEEX * 2 - 2 || j <= 1 || j >= SEEY * 2 - 2 || i == SEEX - 2 || i == SEEX + 1 ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_floor ); + ter_set( point( i, j ), ter_t_floor ); } } } - ter_set( point( SEEX - 1, 0 ), t_door_metal_locked ); - ter_set( point( SEEX - 1, 1 ), t_floor ); - ter_set( point( SEEX, 0 ), t_door_metal_locked ); - ter_set( point( SEEX, 1 ), t_floor ); - ter_set( point( SEEX - 2 + rng( 0, 1 ) * 3, 0 ), t_card_science ); - ter_set( point( SEEX - 2, SEEY ), t_door_metal_c ); - ter_set( point( SEEX + 1, SEEY ), t_door_metal_c ); - ter_set( point( SEEX - 2, SEEY - 1 ), t_door_metal_c ); - ter_set( point( SEEX + 1, SEEY - 1 ), t_door_metal_c ); - ter_set( point( SEEX - 1, SEEY * 2 - 3 ), t_stairs_down ); - ter_set( point( SEEX, SEEY * 2 - 3 ), t_stairs_down ); + ter_set( point( SEEX - 1, 0 ), ter_t_door_metal_locked ); + ter_set( point( SEEX - 1, 1 ), ter_t_floor ); + ter_set( point( SEEX, 0 ), ter_t_door_metal_locked ); + ter_set( point( SEEX, 1 ), ter_t_floor ); + ter_set( point( SEEX - 2 + rng( 0, 1 ) * 3, 0 ), ter_t_card_science ); + ter_set( point( SEEX - 2, SEEY ), ter_t_door_metal_c ); + ter_set( point( SEEX + 1, SEEY ), ter_t_door_metal_c ); + ter_set( point( SEEX - 2, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( SEEX + 1, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( SEEX - 1, SEEY * 2 - 3 ), ter_t_stairs_down ); + ter_set( point( SEEX, SEEY * 2 - 3 ), ter_t_stairs_down ); science_room( this, point( 2, 2 ), point( SEEX - 3, SEEY * 2 - 3 ), dat.zlevel(), 1 ); science_room( this, point( SEEX + 2, 2 ), point( SEEX * 2 - 3, SEEY * 2 - 3 ), dat.zlevel(), 3 ); @@ -5387,27 +5417,27 @@ void map::draw_lab( mapgendata &dat ) } else if( tw != 0 || rw != 0 || lw != 0 || bw != 0 ) { // Sewers! for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { - ter_set( point( i, j ), t_thconc_floor ); + ter_set( point( i, j ), ter_t_thconc_floor ); if( ( ( i < lw || i > EAST_EDGE - rw ) && j > SEEY - 3 && j < SEEY + 2 ) || ( ( j < tw || j > SOUTH_EDGE - bw ) && i > SEEX - 3 && i < SEEX + 2 ) ) { - ter_set( point( i, j ), t_sewage ); + ter_set( point( i, j ), ter_t_sewage ); } if( ( i == 0 && is_ot_match( "lab", dat.east(), ot_match_type::contains ) ) || i == EAST_EDGE ) { - if( ter( point( i, j ) ) == t_sewage ) { - ter_set( point( i, j ), t_bars ); + if( ter( point( i, j ) ) == ter_t_sewage ) { + ter_set( point( i, j ), ter_t_bars ); } else if( j == SEEY - 1 || j == SEEY ) { - ter_set( point( i, j ), t_door_metal_c ); + ter_set( point( i, j ), ter_t_door_metal_c ); } else { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } } else if( ( j == 0 && is_ot_match( "lab", dat.north(), ot_match_type::contains ) ) || j == SOUTH_EDGE ) { - if( ter( point( i, j ) ) == t_sewage ) { - ter_set( point( i, j ), t_bars ); + if( ter( point( i, j ) ) == ter_t_sewage ) { + ter_set( point( i, j ), ter_t_bars ); } else if( i == SEEX - 1 || i == SEEX ) { - ter_set( point( i, j ), t_door_metal_c ); + ter_set( point( i, j ), ter_t_door_metal_c ); } else { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } } } @@ -5440,7 +5470,7 @@ void map::draw_lab( mapgendata &dat ) const auto maybe_insert_stairs = [this]( const oter_id & terrain, const ter_id & t_stair_type ) { if( is_ot_match( "stairs", terrain, ot_match_type::contains ) ) { const auto predicate = [this]( const tripoint & p ) { - return ter( p ) == t_thconc_floor && furn( p ) == f_null && tr_at( p ).is_null(); + return ter( p ) == ter_t_thconc_floor && furn( p ) == f_null && tr_at( p ).is_null(); }; const auto range = points_in_rectangle( { 0, 0, abs_sub.z() }, @@ -5468,8 +5498,8 @@ void map::draw_lab( mapgendata &dat ) } else { debugmsg( "Error: Tried to generate 1-sided lab but no lab_1side json exists." ); } - maybe_insert_stairs( dat.above(), t_stairs_up ); - maybe_insert_stairs( terrain_type, t_stairs_down ); + maybe_insert_stairs( dat.above(), ter_t_stairs_up ); + maybe_insert_stairs( terrain_type, ter_t_stairs_down ); } else { const int hardcoded_4side_map_weight = 1500; // weight of all hardcoded maps. // If you remove the usage of "lab_4side" here, remove it from mapgen_factory::get_usages above as well. @@ -5483,12 +5513,12 @@ void map::draw_lab( mapgendata &dat ) !has_flag_ter( ter_furn_flag::TFLAG_DOOR, east_border ) ) { // TODO: create a ter_reset function that does ter_set, // furn_set, and i_clear? - ter_id lw_type = tower_lab ? t_reinforced_glass : t_concrete_wall; - ter_id tw_type = tower_lab ? t_reinforced_glass : t_concrete_wall; - ter_id rw_type = tower_lab && rw == 2 ? t_reinforced_glass : - t_concrete_wall; - ter_id bw_type = tower_lab && bw == 2 ? t_reinforced_glass : - t_concrete_wall; + ter_str_id lw_type = tower_lab ? ter_t_reinforced_glass : ter_t_concrete_wall; + ter_str_id tw_type = tower_lab ? ter_t_reinforced_glass : ter_t_concrete_wall; + ter_str_id rw_type = tower_lab && rw == 2 ? ter_t_reinforced_glass : + ter_t_concrete_wall; + ter_str_id bw_type = tower_lab && bw == 2 ? ter_t_reinforced_glass : + ter_t_concrete_wall; for( int i = 0; i < SEEX * 2; i++ ) { ter_set( point( 23, i ), rw_type ); furn_set( point( 23, i ), f_null ); @@ -5510,17 +5540,17 @@ void map::draw_lab( mapgendata &dat ) } } if( rw != 2 ) { - ter_set( point( 23, 11 ), t_door_metal_c ); - ter_set( point( 23, 12 ), t_door_metal_c ); + ter_set( point( 23, 11 ), ter_t_door_metal_c ); + ter_set( point( 23, 12 ), ter_t_door_metal_c ); } if( bw != 2 ) { - ter_set( point( 11, 23 ), t_door_metal_c ); - ter_set( point( 12, 23 ), t_door_metal_c ); + ter_set( point( 11, 23 ), ter_t_door_metal_c ); + ter_set( point( 12, 23 ), ter_t_door_metal_c ); } } - maybe_insert_stairs( dat.above(), t_stairs_up ); - maybe_insert_stairs( terrain_type, t_stairs_down ); + maybe_insert_stairs( dat.above(), ter_t_stairs_up ); + maybe_insert_stairs( terrain_type, ter_t_stairs_down ); } else { // then no json maps for lab_4side were found switch( rng( 1, 3 ) ) { case 1: @@ -5533,61 +5563,61 @@ void map::draw_lab( mapgendata &dat ) ( j < tw || j > SOUTH_EDGE - bw ) || ( ( i < SEEX - 1 || i > SEEX ) && ( j == SEEY - 2 || j == SEEY + 1 ) ) ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_thconc_floor ); + ter_set( point( i, j ), ter_t_thconc_floor ); } } } if( is_ot_match( "stairs", dat.above(), ot_match_type::contains ) ) { ter_set( point( rng( SEEX - 1, SEEX ), rng( SEEY - 1, SEEY ) ), - t_stairs_up ); + ter_t_stairs_up ); } // Top left if( one_in( 2 ) ) { - ter_set( point( SEEX - 2, static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); + ter_set( point( SEEX - 2, static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); science_room( this, point( lw, tw ), point( SEEX - 3, SEEY - 3 ), dat.zlevel(), 1 ); } else { - ter_set( point( SEEX / 2, SEEY - 2 ), t_door_glass_frosted_c ); + ter_set( point( SEEX / 2, SEEY - 2 ), ter_t_door_glass_frosted_c ); science_room( this, point( lw, tw ), point( SEEX - 3, SEEY - 3 ), dat.zlevel(), 2 ); } // Top right if( one_in( 2 ) ) { - ter_set( point( SEEX + 1, static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); + ter_set( point( SEEX + 1, static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); science_room( this, point( SEEX + 2, tw ), point( EAST_EDGE - rw, SEEY - 3 ), dat.zlevel(), 3 ); } else { - ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY - 2 ), t_door_glass_frosted_c ); + ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY - 2 ), ter_t_door_glass_frosted_c ); science_room( this, point( SEEX + 2, tw ), point( EAST_EDGE - rw, SEEY - 3 ), dat.zlevel(), 2 ); } // Bottom left if( one_in( 2 ) ) { - ter_set( point( SEEX / 2, SEEY + 1 ), t_door_glass_frosted_c ); + ter_set( point( SEEX / 2, SEEY + 1 ), ter_t_door_glass_frosted_c ); science_room( this, point( lw, SEEY + 2 ), point( SEEX - 3, SOUTH_EDGE - bw ), dat.zlevel(), 0 ); } else { - ter_set( point( SEEX - 2, SEEY + static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); + ter_set( point( SEEX - 2, SEEY + static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); science_room( this, point( lw, SEEY + 2 ), point( SEEX - 3, SOUTH_EDGE - bw ), dat.zlevel(), 1 ); } // Bottom right if( one_in( 2 ) ) { - ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY + 1 ), t_door_glass_frosted_c ); + ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY + 1 ), ter_t_door_glass_frosted_c ); science_room( this, point( SEEX + 2, SEEY + 2 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), dat.zlevel(), 0 ); } else { - ter_set( point( SEEX + 1, SEEY + static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); + ter_set( point( SEEX + 1, SEEY + static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); science_room( this, point( SEEX + 2, SEEY + 2 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), dat.zlevel(), 3 ); } if( rw == 1 ) { - ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); - ter_set( point( EAST_EDGE, SEEY ), t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY ), ter_t_door_metal_c ); } if( bw == 1 ) { - ter_set( point( SEEX - 1, SOUTH_EDGE ), t_door_metal_c ); - ter_set( point( SEEX, SOUTH_EDGE ), t_door_metal_c ); + ter_set( point( SEEX - 1, SOUTH_EDGE ), ter_t_door_metal_c ); + ter_set( point( SEEX, SOUTH_EDGE ), ter_t_door_metal_c ); } if( is_ot_match( "stairs", terrain_type, ot_match_type::contains ) ) { // Stairs going down std::vector stair_points; @@ -5624,7 +5654,7 @@ void map::draw_lab( mapgendata &dat ) stair_points.emplace_back( SEEX, static_cast( SEEY / 2 ) + SEEY ); stair_points.emplace_back( SEEX + 2, static_cast( SEEY / 2 ) + SEEY ); const point p = random_entry( stair_points ); - ter_set( p, t_stairs_down ); + ter_set( p, ter_t_stairs_down ); } break; @@ -5637,30 +5667,30 @@ void map::draw_lab( mapgendata &dat ) i == SEEX - 4 || i == SEEX + 3 || j < tw || j > SOUTH_EDGE - bw || j == SEEY - 4 || j == SEEY + 3 ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_thconc_floor ); + ter_set( point( i, j ), ter_t_thconc_floor ); } } } if( is_ot_match( "stairs", dat.above(), ot_match_type::contains ) ) { - ter_set( point( SEEX - 1, SEEY - 1 ), t_stairs_up ); - ter_set( point( SEEX, SEEY - 1 ), t_stairs_up ); - ter_set( point( SEEX - 1, SEEY ), t_stairs_up ); - ter_set( point( SEEX, SEEY ), t_stairs_up ); + ter_set( point( SEEX - 1, SEEY - 1 ), ter_t_stairs_up ); + ter_set( point( SEEX, SEEY - 1 ), ter_t_stairs_up ); + ter_set( point( SEEX - 1, SEEY ), ter_t_stairs_up ); + ter_set( point( SEEX, SEEY ), ter_t_stairs_up ); } - ter_set( point( SEEX - rng( 0, 1 ), SEEY - 4 ), t_door_glass_frosted_c ); - ter_set( point( SEEX - rng( 0, 1 ), SEEY + 3 ), t_door_glass_frosted_c ); - ter_set( point( SEEX - 4, SEEY + rng( 0, 1 ) ), t_door_glass_frosted_c ); - ter_set( point( SEEX + 3, SEEY + rng( 0, 1 ) ), t_door_glass_frosted_c ); - ter_set( point( SEEX - 4, static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); - ter_set( point( SEEX + 3, static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); - ter_set( point( SEEX / 2, SEEY - 4 ), t_door_glass_frosted_c ); - ter_set( point( SEEX / 2, SEEY + 3 ), t_door_glass_frosted_c ); - ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY - 4 ), t_door_glass_frosted_c ); - ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY + 3 ), t_door_glass_frosted_c ); - ter_set( point( SEEX - 4, SEEY + static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); - ter_set( point( SEEX + 3, SEEY + static_cast( SEEY / 2 ) ), t_door_glass_frosted_c ); + ter_set( point( SEEX - rng( 0, 1 ), SEEY - 4 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX - rng( 0, 1 ), SEEY + 3 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX - 4, SEEY + rng( 0, 1 ) ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX + 3, SEEY + rng( 0, 1 ) ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX - 4, static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX + 3, static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX / 2, SEEY - 4 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX / 2, SEEY + 3 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY - 4 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX + static_cast( SEEX / 2 ), SEEY + 3 ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX - 4, SEEY + static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); + ter_set( point( SEEX + 3, SEEY + static_cast( SEEY / 2 ) ), ter_t_door_glass_frosted_c ); science_room( this, point( lw, tw ), point( SEEX - 5, SEEY - 5 ), dat.zlevel(), rng( 1, 2 ) ); science_room( this, point( SEEX - 3, tw ), point( SEEX + 2, SEEY - 5 ), dat.zlevel(), 2 ); @@ -5676,16 +5706,16 @@ void map::draw_lab( mapgendata &dat ) science_room( this, point( SEEX + 4, SEEX + 4 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), dat.zlevel(), 3 * rng( 0, 1 ) ); if( rw == 1 ) { - ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); - ter_set( point( EAST_EDGE, SEEY ), t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY ), ter_t_door_metal_c ); } if( bw == 1 ) { - ter_set( point( SEEX - 1, SOUTH_EDGE ), t_door_metal_c ); - ter_set( point( SEEX, SOUTH_EDGE ), t_door_metal_c ); + ter_set( point( SEEX - 1, SOUTH_EDGE ), ter_t_door_metal_c ); + ter_set( point( SEEX, SOUTH_EDGE ), ter_t_door_metal_c ); } if( is_ot_match( "stairs", terrain_type, ot_match_type::contains ) ) { ter_set( point( SEEX - 3 + 5 * rng( 0, 1 ), SEEY - 3 + 5 * rng( 0, 1 ) ), - t_stairs_down ); + ter_t_stairs_down ); } break; @@ -5695,9 +5725,9 @@ void map::draw_lab( mapgendata &dat ) for( int j = 0; j < SEEY * 2; j++ ) { if( i < lw || i >= EAST_EDGE - rw || j < tw || j >= SOUTH_EDGE - bw ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_thconc_floor ); + ter_set( point( i, j ), ter_t_thconc_floor ); } } } @@ -5705,15 +5735,15 @@ void map::draw_lab( mapgendata &dat ) dat.zlevel(), rng( 0, 3 ) ); if( rw == 1 ) { - ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); - ter_set( point( EAST_EDGE, SEEY ), t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY ), ter_t_door_metal_c ); } if( bw == 1 ) { - ter_set( point( SEEX - 1, SOUTH_EDGE ), t_door_metal_c ); - ter_set( point( SEEX, SOUTH_EDGE ), t_door_metal_c ); + ter_set( point( SEEX - 1, SOUTH_EDGE ), ter_t_door_metal_c ); + ter_set( point( SEEX, SOUTH_EDGE ), ter_t_door_metal_c ); } - maybe_insert_stairs( dat.above(), t_stairs_up ); - maybe_insert_stairs( terrain_type, t_stairs_down ); + maybe_insert_stairs( dat.above(), ter_t_stairs_up ); + maybe_insert_stairs( terrain_type, ter_t_stairs_down ); break; } } // endif use_hardcoded_4side_map @@ -5735,7 +5765,7 @@ void map::draw_lab( mapgendata &dat ) one_in( 4 ) ) { // bash and usually remove the rubble. make_rubble( { i, j, abs_sub.z() } ); - ter_set( point( i, j ), t_rock_floor ); + ter_set( point( i, j ), ter_t_rock_floor ); if( !one_in( 3 ) ) { furn_set( point( i, j ), f_null ); } @@ -5746,8 +5776,9 @@ void map::draw_lab( mapgendata &dat ) !has_flag_ter( ter_furn_flag::TFLAG_GOES_UP, p2 ) ) { destroy( { i, j, abs_sub.z() } ); // bashed squares can create dirt & floors, but we want rock floors. - if( t_dirt == ter( point( i, j ) ) || t_floor == ter( point( i, j ) ) ) { - ter_set( point( i, j ), t_rock_floor ); + const ter_id &floor_to_check_ter = ter( point( i, j ) ); + if( floor_to_check_ter == ter_t_dirt || floor_to_check_ter == ter_t_floor ) { + ter_set( point( i, j ), ter_t_rock_floor ); } } } @@ -5767,9 +5798,9 @@ void map::draw_lab( mapgendata &dat ) ( ( j >= bw || i <= lw ) && i <= j && ( SOUTH_EDGE - j ) <= i ) ) { if( one_in( 5 ) ) { make_rubble( tripoint( i, j, abs_sub.z() ), f_rubble_rock, true, - t_slime ); + ter_t_slime ); } else if( !one_in( 5 ) ) { - ter_set( point( i, j ), t_slime ); + ter_set( point( i, j ), ter_t_slime ); } } } @@ -5789,8 +5820,9 @@ void map::draw_lab( mapgendata &dat ) for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { if( !( ( i * j ) % 2 || ( i + j ) % 4 ) && one_in( light_odds ) ) { - if( t_thconc_floor == ter( point( i, j ) ) || t_strconc_floor == ter( point( i, j ) ) ) { - ter_set( point( i, j ), t_thconc_floor_olight ); + const ter_id &nearby_ter = ter( point( i, j ) ); + if( nearby_ter == ter_t_thconc_floor || nearby_ter == ter_t_strconc_floor ) { + ter_set( point( i, j ), ter_t_thconc_floor_olight ); } } } @@ -5814,13 +5846,14 @@ void map::draw_lab( mapgendata &dat ) // liquid floors. break; } - ter_id fluid_type = one_in( 3 ) ? t_sewage : t_water_sh; + ter_id fluid_type = one_in( 3 ) ? ter_t_sewage : ter_t_water_sh; for( int i = 0; i < EAST_EDGE; i++ ) { for( int j = 0; j < SOUTH_EDGE; j++ ) { // We spare some terrain to make it look better visually. - if( !one_in( 10 ) && ( t_thconc_floor == ter( point( i, j ) ) || - t_strconc_floor == ter( point( i, j ) ) || - t_thconc_floor_olight == ter( point( i, j ) ) ) ) { + const ter_id &nearby_ter = ter( point( i, j ) ); + if( !one_in( 10 ) && ( nearby_ter == ter_t_thconc_floor || + nearby_ter == ter_t_strconc_floor || + nearby_ter == ter_t_thconc_floor_olight ) ) { ter_set( point( i, j ), fluid_type ); } else if( has_flag_ter( ter_furn_flag::TFLAG_DOOR, point( i, j ) ) && !one_in( 3 ) ) { // We want the actual debris, but not the rubble marker or dirt. @@ -5841,11 +5874,12 @@ void map::draw_lab( mapgendata &dat ) // liquid floors. break; } - ter_id fluid_type = one_in( 3 ) ? t_sewage : t_water_sh; + ter_id fluid_type = one_in( 3 ) ? ter_t_sewage : ter_t_water_sh; for( int i = 0; i < 2; ++i ) { draw_rough_circle( [this, fluid_type]( const point & p ) { - if( t_thconc_floor == ter( p ) || t_strconc_floor == ter( p ) || - t_thconc_floor_olight == ter( p ) ) { + const ter_id &maybe_flood_ter = ter( p ); + if( maybe_flood_ter == ter_t_thconc_floor || maybe_flood_ter == ter_t_strconc_floor || + maybe_flood_ter == ter_t_thconc_floor_olight ) { ter_set( p, fluid_type ); } else if( has_flag_ter( ter_furn_flag::TFLAG_DOOR, p ) ) { // We want the actual debris, but not the rubble marker or dirt. @@ -5863,8 +5897,9 @@ void map::draw_lab( mapgendata &dat ) bool is_toxic = one_in( 3 ); for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { - if( one_in( 200 ) && ( t_thconc_floor == ter( point( i, j ) ) || - t_strconc_floor == ter( point( i, j ) ) ) ) { + const ter_id &nearby_ter = ter( point( i, j ) ); + if( one_in( 200 ) && ( nearby_ter == ter_t_thconc_floor || + nearby_ter == ter_t_strconc_floor ) ) { if( is_toxic ) { add_field( tripoint_bub_ms{i, j, abs_sub.z()}, fd_gas_vent, 1 ); } else { @@ -5902,7 +5937,7 @@ void map::draw_lab( mapgendata &dat ) return; // spare stairs and consoles. } make_rubble( {p, abs_sub.z() } ); - ter_set( p, t_thconc_floor ); + ter_set( p, ter_t_thconc_floor ); }, center->xy(), 4 ); furn_set( center->xy(), f_null ); if( !is_open_air( *center ) ) { @@ -5917,14 +5952,14 @@ void map::draw_lab( mapgendata &dat ) for( int j = 0; j < SOUTH_EDGE; j++ ) { // Create a mostly spread fungal area throughout entire lab. if( !one_in( 5 ) && has_flag( ter_furn_flag::TFLAG_FLAT, point( i, j ) ) ) { - ter_set( point( i, j ), t_fungus_floor_in ); + ter_set( point( i, j ), ter_t_fungus_floor_in ); if( has_flag_furn( ter_furn_flag::TFLAG_ORGANIC, point( i, j ) ) ) { furn_set( point( i, j ), f_fungal_clump ); } } else if( has_flag_ter( ter_furn_flag::TFLAG_DOOR, point( i, j ) ) && !one_in( 5 ) ) { - ter_set( point( i, j ), t_fungus_floor_in ); + ter_set( point( i, j ), ter_t_fungus_floor_in ); } else if( has_flag_ter( ter_furn_flag::TFLAG_WALL, point( i, j ) ) && one_in( 3 ) ) { - ter_set( point( i, j ), t_fungus_wall ); + ter_set( point( i, j ), ter_t_fungus_wall ); } } } @@ -5938,17 +5973,17 @@ void map::draw_lab( mapgendata &dat ) return; // spare stairs and consoles. } if( has_flag_ter( ter_furn_flag::TFLAG_WALL, p ) ) { - ter_set( p, t_fungus_wall ); + ter_set( p, ter_t_fungus_wall ); } else { - ter_set( p, t_fungus_floor_in ); + ter_set( p, ter_t_fungus_floor_in ); if( one_in( 3 ) ) { furn_set( p, f_flower_fungal ); } else if( one_in( 10 ) ) { - ter_set( p, t_marloss ); + ter_set( p, ter_t_marloss ); } } }, center.xy(), 3 ); - ter_set( center.xy(), t_fungus_floor_in ); + ter_set( center.xy(), ter_t_fungus_floor_in ); furn_set( center.xy(), f_null ); trap_set( center, tr_portal ); place_spawns( GROUP_FUNGI_FUNGALOID, 1, center.xy() + point( -2, -2 ), @@ -5993,10 +6028,10 @@ void map::draw_lab( mapgendata &dat ) if( !has_flag_ter( ter_furn_flag::TFLAG_WALL, east_border ) && !has_flag_ter( ter_furn_flag::TFLAG_DOOR, east_border ) ) { // TODO: create a ter_reset function that does ter_set, furn_set, and i_clear? - ter_id lw_type = tower_lab ? t_reinforced_glass : t_concrete_wall; - ter_id tw_type = tower_lab ? t_reinforced_glass : t_concrete_wall; - ter_id rw_type = tower_lab && rw == 2 ? t_reinforced_glass : t_concrete_wall; - ter_id bw_type = tower_lab && bw == 2 ? t_reinforced_glass : t_concrete_wall; + ter_str_id lw_type = tower_lab ? ter_t_reinforced_glass : ter_t_concrete_wall; + ter_str_id tw_type = tower_lab ? ter_t_reinforced_glass : ter_t_concrete_wall; + ter_str_id rw_type = tower_lab && rw == 2 ? ter_t_reinforced_glass : ter_t_concrete_wall; + ter_str_id bw_type = tower_lab && bw == 2 ? ter_t_reinforced_glass : ter_t_concrete_wall; for( int i = 0; i < SEEX * 2; i++ ) { ter_set( point( 23, i ), rw_type ); furn_set( point( 23, i ), f_null ); @@ -6018,12 +6053,12 @@ void map::draw_lab( mapgendata &dat ) } } if( rw != 2 ) { - ter_set( point( 23, 11 ), t_door_metal_c ); - ter_set( point( 23, 12 ), t_door_metal_c ); + ter_set( point( 23, 11 ), ter_t_door_metal_c ); + ter_set( point( 23, 12 ), ter_t_door_metal_c ); } if( bw != 2 ) { - ter_set( point( 11, 23 ), t_door_metal_c ); - ter_set( point( 12, 23 ), t_door_metal_c ); + ter_set( point( 11, 23 ), ter_t_door_metal_c ); + ter_set( point( 12, 23 ), ter_t_door_metal_c ); } } } else { // then no json maps for lab_finale_1level were found @@ -6031,19 +6066,19 @@ void map::draw_lab( mapgendata &dat ) for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { if( i < lw || i > EAST_EDGE - rw || j < tw || j > SOUTH_EDGE - bw ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_thconc_floor ); + ter_set( point( i, j ), ter_t_thconc_floor ); } } } if( rw == 1 ) { - ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); - ter_set( point( EAST_EDGE, SEEY ), t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY - 1 ), ter_t_door_metal_c ); + ter_set( point( EAST_EDGE, SEEY ), ter_t_door_metal_c ); } if( bw == 1 ) { - ter_set( point( SEEX - 1, SOUTH_EDGE ), t_door_metal_c ); - ter_set( point( SEEX, SOUTH_EDGE ), t_door_metal_c ); + ter_set( point( SEEX - 1, SOUTH_EDGE ), ter_t_door_metal_c ); + ter_set( point( SEEX, SOUTH_EDGE ), ter_t_door_metal_c ); } int loot_variant; //only used for weapons testing variant. @@ -6066,11 +6101,11 @@ void map::draw_lab( mapgendata &dat ) mtrap_set( this, point( SEEX + 2, SEEY - 3 ), tr_dissector ); mtrap_set( this, point( SEEX - 3, SEEY + 2 ), tr_dissector ); mtrap_set( this, point( SEEX + 2, SEEY + 2 ), tr_dissector ); - line( this, t_reinforced_glass, point( SEEX + 1, SEEY + 1 ), point( SEEX - 2, SEEY + 1 ) ); - line( this, t_reinforced_glass, point( SEEX - 2, SEEY ), point( SEEX - 2, SEEY - 2 ) ); - line( this, t_reinforced_glass, point( SEEX - 1, SEEY - 2 ), point( SEEX + 1, SEEY - 2 ) ); - ter_set( point( SEEX + 1, SEEY - 1 ), t_reinforced_glass ); - ter_set( point( SEEX + 1, SEEY ), t_reinforced_door_glass_c ); + line( this, ter_t_reinforced_glass, point( SEEX + 1, SEEY + 1 ), point( SEEX - 2, SEEY + 1 ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 2, SEEY ), point( SEEX - 2, SEEY - 2 ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 1, SEEY - 2 ), point( SEEX + 1, SEEY - 2 ) ); + ter_set( point( SEEX + 1, SEEY - 1 ), ter_t_reinforced_glass ); + ter_set( point( SEEX + 1, SEEY ), ter_t_reinforced_door_glass_c ); furn_set( point( SEEX - 1, SEEY - 1 ), f_table ); furn_set( point( SEEX, SEEY - 1 ), f_table ); furn_set( point( SEEX - 1, SEEY ), f_table ); @@ -6107,12 +6142,12 @@ void map::draw_lab( mapgendata &dat ) furn_set( point( SEEX - 1, SEEY ), f_rack ); furn_set( point( SEEX, SEEY ), f_rack ); furn_set( point( SEEX + 1, SEEY ), f_rack ); - line( this, t_reinforced_door_glass_c, point( SEEX - 2, SEEY - 2 ), + line( this, ter_t_reinforced_door_glass_c, point( SEEX - 2, SEEY - 2 ), point( SEEX + 1, SEEY - 2 ) ); - line( this, t_reinforced_door_glass_c, point( SEEX - 2, SEEY + 1 ), + line( this, ter_t_reinforced_door_glass_c, point( SEEX - 2, SEEY + 1 ), point( SEEX + 1, SEEY + 1 ) ); - line( this, t_reinforced_glass, point( SEEX - 3, SEEY - 2 ), point( SEEX - 3, SEEY + 1 ) ); - line( this, t_reinforced_glass, point( SEEX + 2, SEEY - 2 ), point( SEEX + 2, SEEY + 1 ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 3, SEEY - 2 ), point( SEEX - 3, SEEY + 1 ) ); + line( this, ter_t_reinforced_glass, point( SEEX + 2, SEEY - 2 ), point( SEEX + 2, SEEY + 1 ) ); place_items( Item_spawn_data_ammo_rare, 96, point( SEEX - 2, SEEY - 1 ), point( SEEX + 1, SEEY - 1 ), false, @@ -6136,12 +6171,12 @@ void map::draw_lab( mapgendata &dat ) for( int j = tw; j <= bw; j++ ) { if( j == tw || j == bw ) { if( ( i - lw ) % 2 == 0 ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { - ter_set( point( i, j ), t_reinforced_glass ); + ter_set( point( i, j ), ter_t_reinforced_glass ); } } else if( ( i - lw ) % 2 == 0 || j == tw + 2 ) { - ter_set( point( i, j ), t_concrete_wall ); + ter_set( point( i, j ), ter_t_concrete_wall ); } else { // Empty space holds monsters! place_spawns( GROUP_NETHER, 1, point( i, j ), point( i, j ), 1, true ); } @@ -6162,10 +6197,10 @@ void map::draw_lab( mapgendata &dat ) tmpcomp->add_failure( COMPFAIL_SECUBOTS ); tmpcomp->set_access_denied_msg( _( "ERROR! Access denied! Unauthorized access will be met with lethal force!" ) ); - ter_set( point( SEEX - 2, 4 ), t_radio_tower ); - ter_set( point( SEEX + 1, 4 ), t_radio_tower ); - ter_set( point( SEEX - 2, 7 ), t_radio_tower ); - ter_set( point( SEEX + 1, 7 ), t_radio_tower ); + ter_set( point( SEEX - 2, 4 ), ter_t_radio_tower ); + ter_set( point( SEEX + 1, 4 ), ter_t_radio_tower ); + ter_set( point( SEEX - 2, 7 ), ter_t_radio_tower ); + ter_set( point( SEEX + 1, 7 ), ter_t_radio_tower ); } break; @@ -6190,10 +6225,10 @@ void map::draw_lab( mapgendata &dat ) Item_spawn_data_bionics, 75, point( SEEX - 1, SEEY - 1 ), point( SEEX, SEEY ), false, calendar::start_of_cataclysm ).size(); } - line( this, t_reinforced_glass, point( SEEX - 2, SEEY - 2 ), point( SEEX + 1, SEEY - 2 ) ); - line( this, t_reinforced_glass, point( SEEX - 2, SEEY + 1 ), point( SEEX + 1, SEEY + 1 ) ); - line( this, t_reinforced_glass, point( SEEX - 2, SEEY - 1 ), point( SEEX - 2, SEEY ) ); - line( this, t_reinforced_glass, point( SEEX + 1, SEEY - 1 ), point( SEEX + 1, SEEY ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 2, SEEY - 2 ), point( SEEX + 1, SEEY - 2 ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 2, SEEY + 1 ), point( SEEX + 1, SEEY + 1 ) ); + line( this, ter_t_reinforced_glass, point( SEEX - 2, SEEY - 1 ), point( SEEX - 2, SEEY ) ); + line( this, ter_t_reinforced_glass, point( SEEX + 1, SEEY - 1 ), point( SEEX + 1, SEEY ) ); spawn_item( point( SEEX - 4, SEEY - 3 ), "id_science" ); furn_set( point( SEEX - 3, SEEY - 3 ), furn_f_console ); tmpcomp = add_computer( tripoint( SEEX - 3, SEEY - 3, abs_sub.z() ), @@ -6216,11 +6251,11 @@ void map::draw_lab( mapgendata &dat ) point( 6, SEEY * 2 - 7 ), 1, true ); place_spawns( GROUP_ROBOT_SECUBOT, 1, point( SEEX * 2 - 7, SEEY * 2 - 7 ), point( SEEX * 2 - 7, SEEY * 2 - 7 ), 1, true ); - line( this, t_cvdbody, point( SEEX - 2, SEEY - 2 ), point( SEEX - 2, SEEY + 1 ) ); - line( this, t_cvdbody, point( SEEX - 1, SEEY - 2 ), point( SEEX - 1, SEEY + 1 ) ); - line( this, t_cvdbody, point( SEEX, SEEY - 1 ), point( SEEX, SEEY + 1 ) ); - line( this, t_cvdbody, point( SEEX + 1, SEEY - 2 ), point( SEEX + 1, SEEY + 1 ) ); - ter_set( point( SEEX, SEEY - 2 ), t_cvdmachine ); + line( this, ter_t_cvdbody, point( SEEX - 2, SEEY - 2 ), point( SEEX - 2, SEEY + 1 ) ); + line( this, ter_t_cvdbody, point( SEEX - 1, SEEY - 2 ), point( SEEX - 1, SEEY + 1 ) ); + line( this, ter_t_cvdbody, point( SEEX, SEEY - 1 ), point( SEEX, SEEY + 1 ) ); + line( this, ter_t_cvdbody, point( SEEX + 1, SEEY - 2 ), point( SEEX + 1, SEEY + 1 ) ); + ter_set( point( SEEX, SEEY - 2 ), ter_t_cvdmachine ); spawn_item( point( SEEX, SEEY - 3 ), "id_science" ); break; } @@ -6228,10 +6263,11 @@ void map::draw_lab( mapgendata &dat ) // Handle stairs in the unlikely case they are needed. - const auto maybe_insert_stairs = [this]( const oter_id & terrain, const ter_id & t_stair_type ) { + const auto maybe_insert_stairs = [this]( const oter_id & terrain, + const ter_str_id & t_stair_type ) { if( is_ot_match( "stairs", terrain, ot_match_type::contains ) ) { const auto predicate = [this]( const tripoint & p ) { - return ter( p ) == t_thconc_floor && furn( p ) == f_null && + return ter( p ) == ter_t_thconc_floor && furn( p ) == f_null && tr_at( p ).is_null(); }; const auto range = points_in_rectangle( { 0, 0, abs_sub.z() }, @@ -6241,8 +6277,8 @@ void map::draw_lab( mapgendata &dat ) } } }; - maybe_insert_stairs( dat.above(), t_stairs_up ); - maybe_insert_stairs( terrain_type, t_stairs_down ); + maybe_insert_stairs( dat.above(), ter_t_stairs_up ); + maybe_insert_stairs( terrain_type, ter_t_stairs_down ); int light_odds = 0; // central labs are always fully lit, other labs have half chance of some lights. @@ -6255,8 +6291,9 @@ void map::draw_lab( mapgendata &dat ) for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { if( !( ( i * j ) % 2 || ( i + j ) % 4 ) && one_in( light_odds ) ) { - if( t_thconc_floor == ter( point( i, j ) ) || t_strconc_floor == ter( point( i, j ) ) ) { - ter_set( point( i, j ), t_thconc_floor_olight ); + const ter_id &nearby_ter = ter( point( i, j ) ); + if( nearby_ter == ter_t_thconc_floor || nearby_ter == ter_t_strconc_floor ) { + ter_set( point( i, j ), ter_t_thconc_floor_olight ); } } } @@ -6275,36 +6312,36 @@ void map::draw_slimepit( const mapgendata &dat ) i < dat.w_fac * SEEX || j > SEEY * 2 - dat.s_fac * SEEY || i > SEEX * 2 - dat.e_fac * SEEX ) ) { - ter_set( point( i, j ), ( !one_in( 10 ) ? t_slime : t_rock_floor ) ); + ter_set( point( i, j ), ( !one_in( 10 ) ? ter_t_slime : ter_t_rock_floor ) ); } else if( rng( 0, SEEX ) > std::abs( i - SEEX ) && rng( 0, SEEY ) > std::abs( j - SEEY ) ) { - ter_set( point( i, j ), t_slime ); + ter_set( point( i, j ), ter_t_slime ); } else if( dat.zlevel() == 0 ) { - ter_set( point( i, j ), t_dirt ); + ter_set( point( i, j ), ter_t_dirt ); } else { - ter_set( point( i, j ), t_rock_floor ); + ter_set( point( i, j ), ter_t_rock_floor ); } } } if( terrain_type == oter_slimepit_down ) { - ter_set( point( rng( 3, SEEX * 2 - 4 ), rng( 3, SEEY * 2 - 4 ) ), t_slope_down ); + ter_set( point( rng( 3, SEEX * 2 - 4 ), rng( 3, SEEY * 2 - 4 ) ), ter_t_slope_down ); } if( dat.above() == oter_slimepit_down ) { switch( rng( 1, 4 ) ) { case 1: - ter_set( point( rng( 0, 2 ), rng( 0, 2 ) ), t_slope_up ); + ter_set( point( rng( 0, 2 ), rng( 0, 2 ) ), ter_t_slope_up ); break; case 2: - ter_set( point( rng( 0, 2 ), SEEY * 2 - rng( 1, 3 ) ), t_slope_up ); + ter_set( point( rng( 0, 2 ), SEEY * 2 - rng( 1, 3 ) ), ter_t_slope_up ); break; case 3: - ter_set( point( SEEX * 2 - rng( 1, 3 ), rng( 0, 2 ) ), t_slope_up ); + ter_set( point( SEEX * 2 - rng( 1, 3 ), rng( 0, 2 ) ), ter_t_slope_up ); break; case 4: - ter_set( point( SEEX * 2 - rng( 1, 3 ), SEEY * 2 - rng( 1, 3 ) ), t_slope_up ); + ter_set( point( SEEX * 2 - rng( 1, 3 ), SEEY * 2 - rng( 1, 3 ) ), ter_t_slope_up ); } } else if( dat.above() == oter_slimepit_bottom ) { // Align the stairs - ter_set( point( 7, 9 ), t_slope_up ); + ter_set( point( 7, 9 ), ter_t_slope_up ); } place_spawns( GROUP_SLIME, 1, point( SEEX, SEEY ), point( SEEX, SEEY ), 0.15 ); place_items( Item_spawn_data_sewer, 40, point_zero, point( EAST_EDGE, SOUTH_EDGE ), true, @@ -7077,7 +7114,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) } for( int i = p1.x; i <= p2.x; i++ ) { for( int j = p1.y; j <= p2.y; j++ ) { - m->ter_set( point( i, j ), t_thconc_floor ); + m->ter_set( point( i, j ), ter_t_thconc_floor ); } } int area = height * width; @@ -7238,7 +7275,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) for( int x = p1.x + 1; x <= p2.x - 1; x++ ) { for( int y = p1.y + 1; y <= p2.y - 1; y++ ) { if( x % 3 == 0 && y % 3 == 0 ) { - m->ter_set( point( x, y ), t_vat ); + m->ter_set( point( x, y ), ter_t_vat ); m->place_items( Item_spawn_data_cloning_vat, 20, point( x, y ), point( x, y ), false, calendar::start_of_cataclysm ); } @@ -7287,7 +7324,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) "---\n" "|c|\n" "-=-\n", - mapf::ter_bind( "- | =", t_concrete_wall, t_concrete_wall, t_reinforced_glass ), + mapf::ter_bind( "- | =", ter_t_concrete_wall, ter_t_concrete_wall, ter_t_reinforced_glass ), mapf::furn_bind( "c", f_counter ) ); m->place_items( Item_spawn_data_bionics_common, 70, bio, bio, false, calendar::start_of_cataclysm ); @@ -7306,7 +7343,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) "-=-\n" "|c|\n" "---\n", - mapf::ter_bind( "- | =", t_concrete_wall, t_concrete_wall, t_reinforced_glass ), + mapf::ter_bind( "- | =", ter_t_concrete_wall, ter_t_concrete_wall, ter_t_reinforced_glass ), mapf::furn_bind( "c", f_counter ) ); m->place_items( Item_spawn_data_bionics_common, 70, bio, bio, false, calendar::start_of_cataclysm ); @@ -7326,7 +7363,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) "|-|\n" "|c=\n" "|-|\n", - mapf::ter_bind( "- | =", t_concrete_wall, t_concrete_wall, t_reinforced_glass ), + mapf::ter_bind( "- | =", ter_t_concrete_wall, ter_t_concrete_wall, ter_t_reinforced_glass ), mapf::furn_bind( "c", f_counter ) ); m->place_items( Item_spawn_data_bionics_common, 70, point( biox, bioy ), point( biox, bioy ), false, calendar::start_of_cataclysm ); @@ -7345,7 +7382,7 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) "|-|\n" "=c|\n" "|-|\n", - mapf::ter_bind( "- | =", t_concrete_wall, t_concrete_wall, t_reinforced_glass ), + mapf::ter_bind( "- | =", ter_t_concrete_wall, ter_t_concrete_wall, ter_t_reinforced_glass ), mapf::furn_bind( "c", f_counter ) ); m->place_items( Item_spawn_data_bionics_common, 70, point( biox, bioy ), point( biox, bioy ), false, calendar::turn_zero ); @@ -7412,22 +7449,22 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) int w1 = static_cast( ( p1.x + p2.x ) / 2 ) - 2; int w2 = static_cast( ( p1.x + p2.x ) / 2 ) + 2; for( int y = p1.y; y <= p2.y; y++ ) { - m->ter_set( point( w1, y ), t_concrete_wall ); - m->ter_set( point( w2, y ), t_concrete_wall ); + m->ter_set( point( w1, y ), ter_t_concrete_wall ); + m->ter_set( point( w2, y ), ter_t_concrete_wall ); } - m->ter_set( point( w1, static_cast( ( p1.y + p2.y ) / 2 ) ), t_door_glass_frosted_c ); - m->ter_set( point( w2, static_cast( ( p1.y + p2.y ) / 2 ) ), t_door_glass_frosted_c ); + m->ter_set( point( w1, static_cast( ( p1.y + p2.y ) / 2 ) ), ter_t_door_glass_frosted_c ); + m->ter_set( point( w2, static_cast( ( p1.y + p2.y ) / 2 ) ), ter_t_door_glass_frosted_c ); science_room( m, p1, point( w1 - 1, p2.y ), z, 1 ); science_room( m, point( w2 + 1, p1.y ), p2, z, 3 ); } else { int w1 = static_cast( ( p1.y + p2.y ) / 2 ) - 2; int w2 = static_cast( ( p1.y + p2.y ) / 2 ) + 2; for( int x = p1.x; x <= p2.x; x++ ) { - m->ter_set( point( x, w1 ), t_concrete_wall ); - m->ter_set( point( x, w2 ), t_concrete_wall ); + m->ter_set( point( x, w1 ), ter_t_concrete_wall ); + m->ter_set( point( x, w2 ), ter_t_concrete_wall ); } - m->ter_set( point( ( p1.x + p2.x ) / 2, w1 ), t_door_glass_frosted_c ); - m->ter_set( point( ( p1.x + p2.x ) / 2, w2 ), t_door_glass_frosted_c ); + m->ter_set( point( ( p1.x + p2.x ) / 2, w1 ), ter_t_door_glass_frosted_c ); + m->ter_set( point( ( p1.x + p2.x ) / 2, w2 ), ter_t_door_glass_frosted_c ); science_room( m, p1, point( p2.x, w1 - 1 ), z, 2 ); science_room( m, point( p1.x, w2 + 1 ), p2, z, 0 ); } @@ -7442,7 +7479,7 @@ void map::create_anomaly( const tripoint &cp, artifact_natural_property prop, bo // TODO: Z point c( cp.xy() ); if( create_rubble ) { - rough_circle( this, t_dirt, c, 11 ); + rough_circle( this, ter_t_dirt, c, 11 ); rough_circle_furn( this, f_rubble, c, 5 ); furn_set( c, f_null ); } @@ -7832,7 +7869,7 @@ bool apply_construction_marker( const update_mapgen_id &update_mapgen_id, return false; } - fake_map tmp_map( t_grass ); + fake_map tmp_map( ter_t_grass ); mapgendata base_fake_md( *tmp_map.cast_to_map(), mapgendata::dummy_settings ); mapgendata fake_md( base_fake_md, args ); @@ -7858,10 +7895,8 @@ bool apply_construction_marker( const update_mapgen_id &update_mapgen_id, if( update_function->second.funcs()[0]->update_map( fake_md ) ) { for( const tripoint &pos : tmp_map.points_on_zlevel( fake_map::fake_map_z ) ) { - ter_id ter_at_pos = tmp_map.ter( pos ); const tripoint level_pos = tripoint( pos.xy(), omt_pos.z() ); - - if( ter_at_pos != t_grass || tmp_map.has_furn( level_pos ) ) { + if( tmp_map.ter( pos ) != ter_t_grass || tmp_map.has_furn( level_pos ) ) { if( apply ) { update_tmap.add_field( level_pos, fd_construction_site, 1, time_duration::from_turns( 0 ), false ); } else { diff --git a/src/mapgen_functions.cpp b/src/mapgen_functions.cpp index 3a26a387891e8..c00cdf9830f7b 100644 --- a/src/mapgen_functions.cpp +++ b/src/mapgen_functions.cpp @@ -52,6 +52,30 @@ static const oter_str_id oter_river_west( "river_west" ); static const oter_str_id oter_slimepit( "slimepit" ); static const oter_str_id oter_slimepit_down( "slimepit_down" ); +static const ter_str_id ter_t_buffer_stop( "t_buffer_stop" ); +static const ter_str_id ter_t_clay( "t_clay" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_lava( "t_lava" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); +static const ter_str_id ter_t_railroad_rubble( "t_railroad_rubble" ); +static const ter_str_id ter_t_railroad_tie( "t_railroad_tie" ); +static const ter_str_id ter_t_railroad_tie_d( "t_railroad_tie_d" ); +static const ter_str_id ter_t_railroad_track( "t_railroad_track" ); +static const ter_str_id ter_t_railroad_track_d( "t_railroad_track_d" ); +static const ter_str_id ter_t_railroad_track_on_tie( "t_railroad_track_on_tie" ); +static const ter_str_id ter_t_rock( "t_rock" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_sand( "t_sand" ); +static const ter_str_id ter_t_slope_down( "t_slope_down" ); +static const ter_str_id ter_t_swater_dp( "t_swater_dp" ); +static const ter_str_id ter_t_swater_sh( "t_swater_sh" ); +static const ter_str_id ter_t_swater_surf( "t_swater_surf" ); +static const ter_str_id ter_t_water_dp( "t_water_dp" ); +static const ter_str_id ter_t_water_moving_dp( "t_water_moving_dp" ); +static const ter_str_id ter_t_water_moving_sh( "t_water_moving_sh" ); +static const ter_str_id ter_t_water_sh( "t_water_sh" ); + static const vspawn_id VehicleSpawn_default_subway_deadend( "default_subway_deadend" ); class npc_template; @@ -121,20 +145,20 @@ building_gen_pointer get_mapgen_cfunction( const std::string &ident ) return iter == pointers.end() ? nullptr : iter->second; } -ter_id grass_or_dirt() +ter_str_id grass_or_dirt() { if( one_in( 4 ) ) { - return t_grass; + return ter_t_grass; } - return t_dirt; + return ter_t_dirt; } -ter_id clay_or_sand() +ter_str_id clay_or_sand() { if( one_in( 16 ) ) { - return t_sand; + return ter_t_sand; } - return t_clay; + return ter_t_clay; } ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -146,7 +170,7 @@ void mapgen_null( mapgendata &dat ) debugmsg( "Generating null terrain, please report this as a bug" ); for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { - dat.m.ter_set( point( i, j ), t_null ); + dat.m.ter_set( point( i, j ), ter_str_id::NULL_ID() ); dat.m.set_radiation( point( i, j ), 0 ); } } @@ -361,12 +385,12 @@ void mapgen_subway( mapgendata &dat ) ".^/DX^/DX......XD/^XD/^.\n" "..^/D^^/D^....^D/^^D/^..", mapf::ter_bind( ". # ^ / D X", - t_rock_floor, - t_rock, - t_railroad_rubble, - t_railroad_tie_d, - t_railroad_track_d, - t_railroad_track ), + ter_t_rock_floor, + ter_t_rock, + ter_t_railroad_rubble, + ter_t_railroad_tie_d, + ter_t_railroad_track_d, + ter_t_railroad_track ), mapf::furn_bind( ". # ^ / D X", f_null, f_null, @@ -403,14 +427,14 @@ void mapgen_subway( mapgendata &dat ) "........................\n" "........................", mapf::ter_bind( ". # ^ | X x / D", - t_rock_floor, - t_rock, - t_railroad_rubble, - t_railroad_tie, - t_railroad_track, - t_railroad_track_on_tie, - t_railroad_tie_d, - t_railroad_track_d ), + ter_t_rock_floor, + ter_t_rock, + ter_t_railroad_rubble, + ter_t_railroad_tie, + ter_t_railroad_track, + ter_t_railroad_track_on_tie, + ter_t_railroad_tie_d, + ter_t_railroad_track_d ), mapf::furn_bind( ". # ^ | X x / D", f_null, f_null, @@ -450,10 +474,10 @@ void mapgen_subway( mapgendata &dat ) "##################......\n" "###################.....", mapf::ter_bind( ". # ^ D", - t_rock_floor, - t_rock, - t_railroad_rubble, - t_railroad_track_d ), + ter_t_rock_floor, + ter_t_rock, + ter_t_railroad_rubble, + ter_t_railroad_track_d ), mapf::furn_bind( ". # ^ D", f_null, f_null, @@ -486,12 +510,12 @@ void mapgen_subway( mapgendata &dat ) "...-x---x-....-x---x-...\n" "...^X^^^X^....^X^^^X^...", mapf::ter_bind( ". # ^ - X x", - t_rock_floor, - t_rock, - t_railroad_rubble, - t_railroad_tie, - t_railroad_track, - t_railroad_track_on_tie ), + ter_t_rock_floor, + ter_t_rock, + ter_t_railroad_rubble, + ter_t_railroad_tie, + ter_t_railroad_track, + ter_t_railroad_track_on_tie ), mapf::furn_bind( ". # ^ - X x", f_null, f_null, @@ -529,15 +553,15 @@ void mapgen_subway( mapgendata &dat ) "##....................##\n" "########################", mapf::ter_bind( ". # S ^ - / D X x", - t_rock_floor, - t_rock, - t_buffer_stop, - t_railroad_rubble, - t_railroad_tie, - t_railroad_tie_d, - t_railroad_track_d, - t_railroad_track, - t_railroad_track_on_tie ), + ter_t_rock_floor, + ter_t_rock, + ter_t_buffer_stop, + ter_t_railroad_rubble, + ter_t_railroad_tie, + ter_t_railroad_tie_d, + ter_t_railroad_track_d, + ter_t_railroad_track, + ter_t_railroad_track_on_tie ), mapf::furn_bind( ". # S ^ - / D X x", f_null, f_null, @@ -558,13 +582,13 @@ void mapgen_subway( mapgendata &dat ) void mapgen_river_center( mapgendata &dat ) { - fill_background( &dat.m, t_water_moving_dp ); + fill_background( &dat.m, ter_t_water_moving_dp ); } void mapgen_river_curved_not( mapgendata &dat ) { map *const m = &dat.m; - fill_background( m, t_water_moving_dp ); + fill_background( m, ter_t_water_moving_dp ); // this is not_ne, so deep on all sides except ne corner, which is shallow // shallow is 20,0, 23,4 int north_edge = rng( 16, 18 ); @@ -579,7 +603,7 @@ void mapgen_river_curved_not( mapgendata &dat ) if( circle_edge == 9 && one_in( 25 ) ) { m->ter_set( point( x, y ), clay_or_sand() ); } else if( circle_edge <= 36 ) { - m->ter_set( point( x, y ), t_water_moving_sh ); + m->ter_set( point( x, y ), ter_t_water_moving_sh ); } } } @@ -598,7 +622,7 @@ void mapgen_river_curved_not( mapgendata &dat ) void mapgen_river_straight( mapgendata &dat ) { map *const m = &dat.m; - fill_background( m, t_water_moving_dp ); + fill_background( m, ter_t_water_moving_dp ); for( int x = 0; x < SEEX * 2; x++ ) { int ground_edge = rng( 1, 3 ); @@ -607,7 +631,7 @@ void mapgen_river_straight( mapgendata &dat ) if( one_in( 25 ) ) { m->ter_set( point( x, ++ground_edge ), clay_or_sand() ); } - line( m, t_water_moving_sh, point( x, ++ground_edge ), point( x, shallow_edge ) ); + line( m, ter_t_water_moving_sh, point( x, ++ground_edge ), point( x, shallow_edge ) ); } if( dat.terrain_type() == oter_river_east ) { @@ -624,7 +648,7 @@ void mapgen_river_straight( mapgendata &dat ) void mapgen_river_curved( mapgendata &dat ) { map *const m = &dat.m; - fill_background( m, t_water_moving_dp ); + fill_background( m, ter_t_water_moving_dp ); // NE corner deep, other corners are shallow. do 2 passes: one x, one y for( int x = 0; x < SEEX * 2; x++ ) { int ground_edge = rng( 1, 3 ); @@ -633,7 +657,7 @@ void mapgen_river_curved( mapgendata &dat ) if( one_in( 25 ) ) { m->ter_set( point( x, ++ground_edge ), clay_or_sand() ); } - line( m, t_water_moving_sh, point( x, ++ground_edge ), point( x, shallow_edge ) ); + line( m, ter_t_water_moving_sh, point( x, ++ground_edge ), point( x, shallow_edge ) ); } for( int y = 0; y < SEEY * 2; y++ ) { int ground_edge = rng( 19, 21 ); @@ -642,7 +666,7 @@ void mapgen_river_curved( mapgendata &dat ) if( one_in( 25 ) ) { m->ter_set( point( --ground_edge, y ), clay_or_sand() ); } - line( m, t_water_moving_sh, point( shallow_edge, y ), point( --ground_edge, y ) ); + line( m, ter_t_water_moving_sh, point( shallow_edge, y ), point( --ground_edge, y ) ); } if( dat.terrain_type() == oter_river_se ) { @@ -659,7 +683,7 @@ void mapgen_river_curved( mapgendata &dat ) void mapgen_rock_partial( mapgendata &dat ) { map *const m = &dat.m; - fill_background( m, t_rock ); + fill_background( m, ter_t_rock ); for( int i = 0; i < 4; i++ ) { if( dat.t_nesw[i] == oter_slimepit || dat.t_nesw[i] == oter_slimepit_down ) { dat.dir( i ) = 6; @@ -672,7 +696,7 @@ void mapgen_rock_partial( mapgendata &dat ) for( int j = 0; j < SEEY * 2; j++ ) { if( rng( 0, dat.n_fac ) > j || rng( 0, dat.s_fac ) > SEEY * 2 - 1 - j || rng( 0, dat.w_fac ) > i || rng( 0, dat.e_fac ) > SEEX * 2 - 1 - i ) { - m->ter_set( point( i, j ), t_rock_floor ); + m->ter_set( point( i, j ), ter_t_rock_floor ); } } } @@ -680,12 +704,12 @@ void mapgen_rock_partial( mapgendata &dat ) void mapgen_rock( mapgendata &dat ) { - fill_background( &dat.m, t_rock ); + fill_background( &dat.m, ter_t_rock ); } void mapgen_open_air( mapgendata &dat ) { - fill_background( &dat.m, t_open_air ); + fill_background( &dat.m, ter_t_open_air ); } void mapgen_rift( mapgendata &dat ) @@ -727,12 +751,12 @@ void mapgen_rift( mapgendata &dat ) for( int j = 0; j < SEEY * 2; j++ ) { if( ( dat.n_fac < 0 && j < dat.n_fac * -1 ) || ( dat.s_fac < 0 && j >= SEEY * 2 - dat.s_fac ) || ( dat.w_fac < 0 && i < dat.w_fac * -1 ) || ( dat.e_fac < 0 && i >= SEEX * 2 - dat.e_fac ) ) { - m->ter_set( point( i, j ), t_rock_floor ); + m->ter_set( point( i, j ), ter_t_rock_floor ); } else if( j < dat.n_fac || j >= SEEY * 2 - dat.s_fac || i < dat.w_fac || i >= SEEX * 2 - dat.e_fac ) { - m->ter_set( point( i, j ), t_rock ); + m->ter_set( point( i, j ), ter_t_rock ); } else { - m->ter_set( point( i, j ), t_lava ); + m->ter_set( point( i, j ), ter_t_lava ); } } } @@ -754,90 +778,90 @@ void mapgen_hellmouth( mapgendata &dat ) for( int j = 0; j < SEEY * 2; j++ ) { if( j < dat.n_fac || j >= SEEY * 2 - dat.s_fac || i < dat.w_fac || i >= SEEX * 2 - dat.e_fac || ( i >= 6 && i < SEEX * 2 - 6 && j >= 6 && j < SEEY * 2 - 6 ) ) { - m->ter_set( point( i, j ), t_rock_floor ); + m->ter_set( point( i, j ), ter_t_rock_floor ); } else { - m->ter_set( point( i, j ), t_lava ); + m->ter_set( point( i, j ), ter_t_lava ); } if( i >= SEEX - 1 && i <= SEEX && j >= SEEY - 1 && j <= SEEY ) { - m->ter_set( point( i, j ), t_slope_down ); + m->ter_set( point( i, j ), ter_t_slope_down ); } } } switch( rng( 0, 4 ) ) { // Randomly chosen "altar" design case 0: for( int i = 7; i <= 16; i += 3 ) { - m->ter_set( point( i, 6 ), t_rock ); - m->ter_set( point( i, 17 ), t_rock ); - m->ter_set( point( 6, i ), t_rock ); - m->ter_set( point( 17, i ), t_rock ); + m->ter_set( point( i, 6 ), ter_t_rock ); + m->ter_set( point( i, 17 ), ter_t_rock ); + m->ter_set( point( 6, i ), ter_t_rock ); + m->ter_set( point( 17, i ), ter_t_rock ); if( i > 7 && i < 16 ) { - m->ter_set( point( i, 10 ), t_rock ); - m->ter_set( point( i, 13 ), t_rock ); + m->ter_set( point( i, 10 ), ter_t_rock ); + m->ter_set( point( i, 13 ), ter_t_rock ); } else { - m->ter_set( point( i - 1, 6 ), t_rock ); - m->ter_set( point( i - 1, 10 ), t_rock ); - m->ter_set( point( i - 1, 13 ), t_rock ); - m->ter_set( point( i - 1, 17 ), t_rock ); + m->ter_set( point( i - 1, 6 ), ter_t_rock ); + m->ter_set( point( i - 1, 10 ), ter_t_rock ); + m->ter_set( point( i - 1, 13 ), ter_t_rock ); + m->ter_set( point( i - 1, 17 ), ter_t_rock ); } } break; case 1: for( int i = 6; i < 11; i++ ) { - m->ter_set( point( i, i ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, i ), t_lava ); - m->ter_set( point( i, SEEY * 2 - 1 - i ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - 1 - i ), t_lava ); + m->ter_set( point( i, i ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, i ), ter_t_lava ); + m->ter_set( point( i, SEEY * 2 - 1 - i ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - 1 - i ), ter_t_lava ); if( i < 10 ) { - m->ter_set( point( i + 1, i ), t_lava ); - m->ter_set( point( SEEX * 2 - i, i ), t_lava ); - m->ter_set( point( i + 1, SEEY * 2 - 1 - i ), t_lava ); - m->ter_set( point( SEEX * 2 - i, SEEY * 2 - 1 - i ), t_lava ); - - m->ter_set( point( i, i + 1 ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, i + 1 ), t_lava ); - m->ter_set( point( i, SEEY * 2 - i ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - i ), t_lava ); + m->ter_set( point( i + 1, i ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - i, i ), ter_t_lava ); + m->ter_set( point( i + 1, SEEY * 2 - 1 - i ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - i, SEEY * 2 - 1 - i ), ter_t_lava ); + + m->ter_set( point( i, i + 1 ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, i + 1 ), ter_t_lava ); + m->ter_set( point( i, SEEY * 2 - i ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - i ), ter_t_lava ); } if( i < 9 ) { - m->ter_set( point( i + 2, i ), t_rock ); - m->ter_set( point( SEEX * 2 - i + 1, i ), t_rock ); - m->ter_set( point( i + 2, SEEY * 2 - 1 - i ), t_rock ); - m->ter_set( point( SEEX * 2 - i + 1, SEEY * 2 - 1 - i ), t_rock ); - - m->ter_set( point( i, i + 2 ), t_rock ); - m->ter_set( point( SEEX * 2 - 1 - i, i + 2 ), t_rock ); - m->ter_set( point( i, SEEY * 2 - i + 1 ), t_rock ); - m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - i + 1 ), t_rock ); + m->ter_set( point( i + 2, i ), ter_t_rock ); + m->ter_set( point( SEEX * 2 - i + 1, i ), ter_t_rock ); + m->ter_set( point( i + 2, SEEY * 2 - 1 - i ), ter_t_rock ); + m->ter_set( point( SEEX * 2 - i + 1, SEEY * 2 - 1 - i ), ter_t_rock ); + + m->ter_set( point( i, i + 2 ), ter_t_rock ); + m->ter_set( point( SEEX * 2 - 1 - i, i + 2 ), ter_t_rock ); + m->ter_set( point( i, SEEY * 2 - i + 1 ), ter_t_rock ); + m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - i + 1 ), ter_t_rock ); } } break; case 2: for( int i = 7; i < 17; i++ ) { - m->ter_set( point( i, 6 ), t_rock ); - m->ter_set( point( 6, i ), t_rock ); - m->ter_set( point( i, 17 ), t_rock ); - m->ter_set( point( 17, i ), t_rock ); + m->ter_set( point( i, 6 ), ter_t_rock ); + m->ter_set( point( 6, i ), ter_t_rock ); + m->ter_set( point( i, 17 ), ter_t_rock ); + m->ter_set( point( 17, i ), ter_t_rock ); if( i != 7 && i != 16 && i != 11 && i != 12 ) { - m->ter_set( point( i, 8 ), t_rock ); - m->ter_set( point( 8, i ), t_rock ); - m->ter_set( point( i, 15 ), t_rock ); - m->ter_set( point( 15, i ), t_rock ); + m->ter_set( point( i, 8 ), ter_t_rock ); + m->ter_set( point( 8, i ), ter_t_rock ); + m->ter_set( point( i, 15 ), ter_t_rock ); + m->ter_set( point( 15, i ), ter_t_rock ); } if( i == 11 || i == 12 ) { - m->ter_set( point( i, 10 ), t_rock ); - m->ter_set( point( 10, i ), t_rock ); - m->ter_set( point( i, 13 ), t_rock ); - m->ter_set( point( 13, i ), t_rock ); + m->ter_set( point( i, 10 ), ter_t_rock ); + m->ter_set( point( 10, i ), ter_t_rock ); + m->ter_set( point( i, 13 ), ter_t_rock ); + m->ter_set( point( 13, i ), ter_t_rock ); } } break; case 3: for( int i = 6; i < 11; i++ ) { for( int j = 6; j < 11; j++ ) { - m->ter_set( point( i, j ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, j ), t_lava ); - m->ter_set( point( i, SEEY * 2 - 1 - j ), t_lava ); - m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - 1 - j ), t_lava ); + m->ter_set( point( i, j ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, j ), ter_t_lava ); + m->ter_set( point( i, SEEY * 2 - 1 - j ), ter_t_lava ); + m->ter_set( point( SEEX * 2 - 1 - i, SEEY * 2 - 1 - j ), ter_t_lava ); } } break; @@ -1688,7 +1712,7 @@ void mapgen_lake_shore( mapgendata &dat ) } // Use t_null for now instead of t_water_sh, because sometimes our extended terrain // has put down a t_water_sh, and we need to be able to flood-fill over that. - m->ter_set( bp, t_null ); + m->ter_set( bp, ter_str_id::NULL_ID() ); m->furn_set( bp, f_null ); } } @@ -1726,14 +1750,14 @@ void mapgen_lake_shore( mapgendata &dat ) if( !map_boundaries.contains( p ) ) { return false; } - return m->ter( p ) != t_null; + return m->ter( p ) != ter_str_id::NULL_ID(); }; const auto fill_deep_water = [&]( const point & starting_point ) { std::vector water_points = ff::point_flood_fill_4_connected( starting_point, visited, should_fill ); for( point &wp : water_points ) { - m->ter_set( wp, t_water_dp ); + m->ter_set( wp, ter_t_water_dp ); m->furn_set( wp, f_null ); } }; @@ -1758,7 +1782,7 @@ void mapgen_lake_shore( mapgendata &dat ) // We previously placed our shallow water but actually did a t_null instead to make sure that we didn't // pick up shallow water from our extended terrain. Now turn those nulls into t_water_sh. - m->translate( t_null, t_water_sh ); + m->translate( ter_str_id::NULL_ID(), ter_t_water_sh ); } void mapgen_ocean_shore( mapgendata &dat ) @@ -2124,7 +2148,7 @@ void mapgen_ocean_shore( mapgendata &dat ) if( !map_boundaries.contains( bp ) ) { continue; } - m->ter_set( bp, t_swater_sh ); + m->ter_set( bp, ter_t_swater_sh ); m->furn_set( bp, f_null ); } } @@ -2139,15 +2163,15 @@ void mapgen_ocean_shore( mapgendata &dat ) } // Use t_null for now instead of t_sand, because sometimes our extended terrain // has put down a t_sand, and we need to be able to flood-fill over that. - m->ter_set( bp, t_null ); + m->ter_set( bp, ter_str_id::NULL_ID() ); m->furn_set( bp, f_null ); } for( const point &bp : closest_points_first( p, sand_margin + 1 ) ) { if( !map_boundaries.contains( bp ) ) { continue; } - if( m->ter( bp ) == t_swater_sh ) { - m->ter_set( bp, t_swater_surf ); + if( m->ter( bp ) == ter_t_swater_sh ) { + m->ter_set( bp, ter_t_swater_surf ); } } } @@ -2191,14 +2215,15 @@ void mapgen_ocean_shore( mapgendata &dat ) if( !map_boundaries.contains( p ) ) { return false; } - return m->ter( p ) != t_null && m->ter( p ) != t_swater_sh && m->ter( p ) != t_swater_surf; + return m->ter( p ) != ter_str_id::NULL_ID() && m->ter( p ) != ter_t_swater_sh && + m->ter( p ) != ter_t_swater_surf; }; const auto fill_deep_water = [&]( const point & starting_point ) { std::vector water_points = ff::point_flood_fill_4_connected( starting_point, visited, should_fill ); for( point &wp : water_points ) { - m->ter_set( wp, t_swater_dp ); + m->ter_set( wp, ter_t_swater_dp ); m->furn_set( wp, f_null ); } }; @@ -2223,7 +2248,7 @@ void mapgen_ocean_shore( mapgendata &dat ) // We previously placed our sand but actually did a t_null instead to make sure that we didn't // pick up sand from our extended terrain. Now turn those nulls into t_sand. - m->translate( t_null, t_sand ); + m->translate( ter_str_id::NULL_ID(), ter_t_sand ); } void mapgen_ravine_edge( mapgendata &dat ) @@ -2272,7 +2297,7 @@ void mapgen_ravine_edge( mapgendata &dat ) if( straight ) { for( int x = 0; x < SEEX * 2; x++ ) { int ground_edge = 12 + rng( 1, 3 ); - line( m, t_null, point( x, ++ground_edge ), point( x, SEEY * 2 ) ); + line( m, ter_str_id::NULL_ID(), point( x, ++ground_edge ), point( x, SEEY * 2 ) ); } if( w_ravine ) { m->rotate( 1 ); @@ -2286,7 +2311,7 @@ void mapgen_ravine_edge( mapgendata &dat ) } else if( interior_corner ) { for( int x = 0; x < SEEX * 2; x++ ) { int ground_edge = 12 + rng( 1, 3 ) + x; - line( m, t_null, point( x, ++ground_edge ), point( x, SEEY * 2 ) ); + line( m, ter_str_id::NULL_ID(), point( x, ++ground_edge ), point( x, SEEY * 2 ) ); } if( nw_ravine ) { m->rotate( 1 ); @@ -2300,7 +2325,7 @@ void mapgen_ravine_edge( mapgendata &dat ) } else if( exterior_corner ) { for( int x = 0; x < SEEX * 2; x++ ) { int ground_edge = 12 + rng( 1, 3 ) - x; - line( m, t_null, point( x, --ground_edge ), point( x, SEEY * 2 - 1 ) ); + line( m, ter_str_id::NULL_ID(), point( x, --ground_edge ), point( x, SEEY * 2 - 1 ) ); } if( w_ravine && s_ravine ) { m->rotate( 1 ); @@ -2315,9 +2340,9 @@ void mapgen_ravine_edge( mapgendata &dat ) // The placed t_null terrains are converted into the regional groundcover in the ravine's bottom level, // in the other levels they are converted into open air to generate the cliffside. if( dat.zlevel() == dat.region.overmap_ravine.ravine_depth ) { - m->translate( t_null, dat.groundcover() ); + m->translate( ter_str_id::NULL_ID(), dat.groundcover() ); } else { - m->translate( t_null, t_open_air ); + m->translate( ter_str_id::NULL_ID(), ter_t_open_air ); } } diff --git a/src/mapgen_functions.h b/src/mapgen_functions.h index face8a8ee8da6..0c4b0939a88f6 100644 --- a/src/mapgen_functions.h +++ b/src/mapgen_functions.h @@ -33,8 +33,8 @@ int terrain_type_to_nesw_array( oter_id terrain_type, std::array &array using building_gen_pointer = void ( * )( mapgendata & ); building_gen_pointer get_mapgen_cfunction( const std::string &ident ); -ter_id grass_or_dirt(); -ter_id clay_or_sand(); +ter_str_id grass_or_dirt(); +ter_str_id clay_or_sand(); // helper functions for mapgen.cpp, so that we can avoid having a massive switch statement (sorta) void mapgen_null( mapgendata &dat ); @@ -75,10 +75,9 @@ bool apply_construction_marker( const update_mapgen_id &update_mapgen_id, const tripoint_abs_omt &omt_pos, const mapgen_arguments &args, bool mirror_horizontal, bool mirror_vertical, int rotation, bool apply ); -std::pair, std::map> - get_changed_ids_from_update( +std::pair, std::map> get_changed_ids_from_update( const update_mapgen_id &, const mapgen_arguments &, - ter_id const &base_ter = t_dirt ); + ter_id const &base_ter = ter_str_id( "t_dirt" ).id() ); mapgen_parameters get_map_special_params( const std::string &mapgen_id ); void resolve_regional_terrain_and_furniture( const mapgendata &dat ); diff --git a/src/mapgendata.cpp b/src/mapgendata.cpp index fd7e5916a11ec..a15148a79abff 100644 --- a/src/mapgendata.cpp +++ b/src/mapgendata.cpp @@ -247,7 +247,7 @@ bool mapgendata::has_flag( jmapgen_flags f ) const ter_id mapgendata::groundcover() const { const ter_id *tid = default_groundcover.pick(); - return tid != nullptr ? *tid : t_null; + return tid != nullptr ? *tid : ter_str_id::NULL_ID().id(); } const oter_id &mapgendata::neighbor_at( om_direction::type dir ) const diff --git a/src/mapgenformat.cpp b/src/mapgenformat.cpp index efab36943045c..3b133a928d792 100644 --- a/src/mapgenformat.cpp +++ b/src/mapgenformat.cpp @@ -21,7 +21,7 @@ void formatted_set_simple( map *m, const point &start, const char *cstr, } else { const ter_id ter = ter_b.translate( *p ); const furn_id furn = furn_b.translate( *p ); - if( ter != t_null ) { + if( ter != ter_str_id::NULL_ID() ) { m->ter_set( p2, ter ); } if( furn != f_null ) { diff --git a/src/mission_companion.cpp b/src/mission_companion.cpp index 1ab21b58aeca8..4aa0198a503d1 100644 --- a/src/mission_companion.cpp +++ b/src/mission_companion.cpp @@ -100,6 +100,42 @@ static const string_id npc_template_commune_guard( "commune_ static const string_id npc_template_thug( "thug" ); +static const ter_str_id ter_t_curtains( "t_curtains" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_door_b( "t_door_b" ); +static const ter_str_id ter_t_door_boarded( "t_door_boarded" ); +static const ter_str_id ter_t_door_boarded_damaged( "t_door_boarded_damaged" ); +static const ter_str_id ter_t_door_boarded_damaged_peep( "t_door_boarded_damaged_peep" ); +static const ter_str_id ter_t_door_boarded_peep( "t_door_boarded_peep" ); +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_c_peep( "t_door_c_peep" ); +static const ter_str_id ter_t_door_glass_c( "t_door_glass_c" ); +static const ter_str_id ter_t_door_glass_o( "t_door_glass_o" ); +static const ter_str_id ter_t_door_locked( "t_door_locked" ); +static const ter_str_id ter_t_door_locked_alarm( "t_door_locked_alarm" ); +static const ter_str_id ter_t_door_locked_peep( "t_door_locked_peep" ); +static const ter_str_id ter_t_door_metal_c( "t_door_metal_c" ); +static const ter_str_id ter_t_door_metal_locked( "t_door_metal_locked" ); +static const ter_str_id ter_t_door_metal_o( "t_door_metal_o" ); +static const ter_str_id ter_t_door_metal_pickable( "t_door_metal_pickable" ); +static const ter_str_id ter_t_door_o( "t_door_o" ); +static const ter_str_id ter_t_rdoor_boarded( "t_rdoor_boarded" ); +static const ter_str_id ter_t_rdoor_boarded_damaged( "t_rdoor_boarded_damaged" ); +static const ter_str_id ter_t_wall( "t_wall" ); +static const ter_str_id ter_t_wall_glass( "t_wall_glass" ); +static const ter_str_id ter_t_wall_glass_alarm( "t_wall_glass_alarm" ); +static const ter_str_id ter_t_window( "t_window" ); +static const ter_str_id ter_t_window_alarm( "t_window_alarm" ); +static const ter_str_id ter_t_window_alarm_taped( "t_window_alarm_taped" ); +static const ter_str_id ter_t_window_boarded( "t_window_boarded" ); +static const ter_str_id ter_t_window_boarded_noglass( "t_window_boarded_noglass" ); +static const ter_str_id ter_t_window_domestic( "t_window_domestic" ); +static const ter_str_id ter_t_window_domestic_taped( "t_window_domestic_taped" ); +static const ter_str_id ter_t_window_no_curtains( "t_window_no_curtains" ); +static const ter_str_id ter_t_window_no_curtains_taped( "t_window_no_curtains_taped" ); +static const ter_str_id ter_t_window_taped( "t_window_taped" ); + static const trait_id trait_DEBUG_HS( "DEBUG_HS" ); static const trait_id trait_NPC_CONSTRUCTION_LEV_2( "NPC_CONSTRUCTION_LEV_2" ); static const trait_id trait_NPC_MISSION_LEV_1( "NPC_MISSION_LEV_1" ); @@ -1554,7 +1590,7 @@ void talk_function::field_plant( npc &p, const std::string &place ) tinymap bay; bay.load( site, false ); for( const tripoint &plot : bay.points_on_zlevel() ) { - if( bay.ter( plot ) == t_dirtmound ) { + if( bay.ter( plot ) == ter_t_dirtmound ) { empty_plots++; } } @@ -1594,7 +1630,7 @@ void talk_function::field_plant( npc &p, const std::string &place ) //Plant the actual seeds for( const tripoint &plot : bay.points_on_zlevel() ) { - if( bay.ter( plot ) == t_dirtmound && limiting_number > 0 ) { + if( bay.ter( plot ) == ter_t_dirtmound && limiting_number > 0 ) { std::list used_seed; if( item::count_by_charges( seed_id ) ) { used_seed = player_character.use_charges( seed_id, 1 ); @@ -1603,7 +1639,7 @@ void talk_function::field_plant( npc &p, const std::string &place ) } used_seed.front().set_age( 0_turns ); bay.add_item_or_charges( plot, used_seed.front() ); - bay.set( plot, t_dirt, f_plant_seed ); + bay.set( plot, ter_t_dirt, f_plant_seed ); limiting_number--; } } @@ -1697,7 +1733,7 @@ void talk_function::field_harvest( npc &p, const std::string &place ) bay.i_clear( plot ); bay.furn_set( plot, f_null ); - bay.ter_set( plot, t_dirtmound ); + bay.ter_set( plot, ter_t_dirtmound ); } } } @@ -2773,12 +2809,10 @@ std::set talk_function::loot_building( const tripoint_abs_omt &site, for( const tripoint &p : bay.points_on_zlevel() ) { const ter_id t = bay.ter( p ); //Open all the doors, doesn't need to be exhaustive - if( t == t_door_c || t == t_door_c_peep || t == t_door_b - || t == t_door_boarded || t == t_door_boarded_damaged - || t == t_rdoor_boarded || t == t_rdoor_boarded_damaged - || t == t_door_boarded_peep || t == t_door_boarded_damaged_peep ) { - bay.ter_set( p, t_door_o ); - } else if( t == t_door_locked || t == t_door_locked_peep || t == t_door_locked_alarm ) { + const std::unordered_set openable_doors = {ter_t_door_c, ter_t_door_c_peep, ter_t_door_b, ter_t_door_boarded, ter_t_door_boarded_damaged, ter_t_rdoor_boarded, ter_t_rdoor_boarded_damaged, ter_t_door_boarded_peep, ter_t_door_boarded_damaged_peep }; + if( openable_doors.find( t.id() ) != openable_doors.end() ) { + bay.ter_set( p, ter_t_door_o ); + } else if( t == ter_t_door_locked || t == ter_t_door_locked_peep || t == ter_t_door_locked_alarm ) { const map_bash_info &bash = bay.ter( p ).obj().bash; bay.ter_set( p, bash.ter_set ); // Bash doors twice @@ -2786,27 +2820,24 @@ std::set talk_function::loot_building( const tripoint_abs_omt &site, bay.ter_set( p, bash_again.ter_set ); bay.spawn_items( p, item_group::items_from( bash.drop_group, calendar::turn ) ); bay.spawn_items( p, item_group::items_from( bash_again.drop_group, calendar::turn ) ); - } else if( t == t_door_metal_c || t == t_door_metal_locked || t == t_door_metal_pickable ) { - bay.ter_set( p, t_door_metal_o ); - } else if( t == t_door_glass_c ) { - bay.ter_set( p, t_door_glass_o ); - } else if( t == t_wall && one_in( 25 ) ) { + } else if( t == ter_t_door_metal_c || t == ter_t_door_metal_locked || + t == ter_t_door_metal_pickable ) { + bay.ter_set( p, ter_t_door_metal_o ); + } else if( t == ter_t_door_glass_c ) { + bay.ter_set( p, ter_t_door_glass_o ); + } else if( t == ter_t_wall && one_in( 25 ) ) { const map_bash_info &bash = bay.ter( p ).obj().bash; bay.ter_set( p, bash.ter_set ); bay.spawn_items( p, item_group::items_from( bash.drop_group, calendar::turn ) ); bay.collapse_at( p, false ); } //Smash easily breakable stuff - else if( ( t == t_window || t == t_window_taped || t == t_window_domestic || - t == t_window_boarded_noglass || t == t_window_domestic_taped || - t == t_window_alarm_taped || t == t_window_boarded || - t == t_curtains || t == t_window_alarm || - t == t_window_no_curtains || t == t_window_no_curtains_taped ) - && one_in( 4 ) ) { + else if( const std::unordered_set weak_window_ters = {ter_t_window, ter_t_window_taped, ter_t_window_domestic, ter_t_window_boarded_noglass, ter_t_window_domestic_taped, ter_t_window_alarm_taped, ter_t_window_boarded, ter_t_curtains, ter_t_window_alarm, ter_t_window_no_curtains, ter_t_window_no_curtains_taped }; + weak_window_ters.find( t.id() ) != weak_window_ters.end() && one_in( 4 ) ) { const map_bash_info &bash = bay.ter( p ).obj().bash; bay.ter_set( p, bash.ter_set ); bay.spawn_items( p, item_group::items_from( bash.drop_group, calendar::turn ) ); - } else if( ( t == t_wall_glass || t == t_wall_glass_alarm ) && one_in( 3 ) ) { + } else if( ( t == ter_t_wall_glass || t == ter_t_wall_glass_alarm ) && one_in( 3 ) ) { const map_bash_info &bash = bay.ter( p ).obj().bash; bay.ter_set( p, bash.ter_set ); bay.spawn_items( p, item_group::items_from( bash.drop_group, calendar::turn ) ); diff --git a/src/mission_start.cpp b/src/mission_start.cpp index 8c038c598b261..82bc241f4c319 100644 --- a/src/mission_start.cpp +++ b/src/mission_start.cpp @@ -38,6 +38,9 @@ static const itype_id itype_software_useless( "software_useless" ); static const mission_type_id mission_MISSION_GET_ZOMBIE_BLOOD_ANAL( "MISSION_GET_ZOMBIE_BLOOD_ANAL" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_wall_metal( "t_wall_metal" ); + /* These functions are responsible for making changes to the game at the moment * the mission is accepted by the player. They are also responsible for * updating *miss with the target and any other important information. @@ -89,7 +92,7 @@ static tripoint find_potential_computer_point( const tinymap &compmap ) for( const tripoint &p : compmap.points_on_zlevel() ) { if( compmap.furn( p ) == f_console_broken ) { broken.emplace_back( p ); - } else if( broken.empty() && compmap.ter( p ) == t_floor && compmap.furn( p ) == f_null ) { + } else if( broken.empty() && compmap.ter( p ) == ter_t_floor && compmap.furn( p ) == f_null ) { for( const tripoint &p2 : compmap.points_in_radius( p, 1 ) ) { if( compmap.furn( p2 ) == f_bed || compmap.furn( p2 ) == f_dresser ) { potential.emplace_back( p ); @@ -208,9 +211,9 @@ void mission_start::place_deposit_box( mission *miss ) compmap.load( site, false ); std::vector valid; for( const tripoint &p : compmap.points_on_zlevel() ) { - if( compmap.ter( p ) == t_floor ) { + if( compmap.ter( p ) == ter_t_floor ) { for( const tripoint &p2 : compmap.points_in_radius( p, 1 ) ) { - if( compmap.ter( p2 ) == t_wall_metal ) { + if( compmap.ter( p2 ) == ter_t_wall_metal ) { valid.push_back( p ); break; } diff --git a/src/monattack.cpp b/src/monattack.cpp index ab41b96dcf32e..b133e3e281bba 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -221,6 +221,14 @@ static const species_id species_LEECH_PLANT( "LEECH_PLANT" ); static const species_id species_SLIME( "SLIME" ); static const species_id species_ZOMBIE( "ZOMBIE" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); +static const ter_str_id ter_t_marloss( "t_marloss" ); +static const ter_str_id ter_t_root_wall( "t_root_wall" ); +static const ter_str_id ter_t_tree( "t_tree" ); +static const ter_str_id ter_t_tree_young( "t_tree_young" ); +static const ter_str_id ter_t_underbrush( "t_underbrush" ); + static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" ); static const trait_id trait_MARLOSS( "MARLOSS" ); static const trait_id trait_MARLOSS_BLUE( "MARLOSS_BLUE" ); @@ -555,7 +563,7 @@ bool mattack::graze( monster *z ) !here.has_flag( ter_furn_flag::TFLAG_GRAZER_INEDIBLE, p ) && ( z->amount_eaten <= z->stomach_size ) ) { add_msg_if_player_sees( *z, _( "The %1s eats the %2s." ), z->name(), here.tername( p ) ); - here.ter_set( p, t_dirt ); + here.ter_set( p, ter_t_dirt ); z->amount_eaten += 174; //Calorie amount is based on the "underbrush" dummy item, as with the grazer mutation. return true; @@ -1600,7 +1608,7 @@ bool mattack::growplants( monster *z ) // Only affect natural, dirtlike terrain or trees. if( !( here.has_flag_ter( ter_furn_flag::TFLAG_DIGGABLE, p ) || here.has_flag_ter( ter_furn_flag::TFLAG_TREE, p ) || - here.ter( p ) == t_tree_young ) ) { + here.ter( p ) == ter_t_tree_young ) ) { continue; } @@ -1608,7 +1616,7 @@ bool mattack::growplants( monster *z ) // Destroy everything here.destroy( p ); // And then make the ground fertile - here.ter_set( p, t_dirtmound ); + here.ter_set( p, ter_t_dirtmound ); continue; } @@ -1616,7 +1624,7 @@ bool mattack::growplants( monster *z ) if( !one_in( 4 ) ) { if( one_in( 3 ) ) { // If no tree, perhaps underbrush - here.ter_set( p, t_underbrush ); + here.ter_set( p, ter_t_underbrush ); } continue; @@ -1630,7 +1638,7 @@ bool mattack::growplants( monster *z ) continue; } - here.ter_set( p, t_tree_young ); + here.ter_set( p, ter_t_tree_young ); if( critter == nullptr || critter->uncanny_dodge() ) { continue; } @@ -1651,7 +1659,7 @@ bool mattack::growplants( monster *z ) } for( const tripoint &p : here.points_in_radius( z->pos(), 5 ) ) { const ter_id ter = here.ter( p ); - if( ter != t_tree_young && ter != t_underbrush ) { + if( ter != ter_t_tree_young && ter != ter_t_underbrush ) { // Skip as soon as possible to avoid all the checks continue; } @@ -1662,13 +1670,13 @@ bool mattack::growplants( monster *z ) continue; } - if( ter == t_tree_young ) { + if( ter == ter_t_tree_young ) { // Young tree => tree // TODO: Make this deal damage too - young tree can be walked on, tree can't - here.ter_set( p, t_tree ); - } else if( ter == t_underbrush ) { + here.ter_set( p, ter_t_tree ); + } else if( ter == ter_t_underbrush ) { // Underbrush => young tree - here.ter_set( p, t_tree_young ); + here.ter_set( p, ter_t_tree_young ); if( critter != nullptr && !critter->uncanny_dodge() ) { const bodypart_id &hit = body_part_hit_by_plant(); critter->add_msg_player_or_npc( m_bad, @@ -1821,9 +1829,9 @@ bool mattack::triffid_heartbeat( monster *z ) add_msg( m_warning, _( "The root walls creak around you." ) ); for( const tripoint &dest : here.points_in_radius( z->pos(), 3 ) ) { if( g->is_empty( dest ) && one_in( 4 ) ) { - here.ter_set( dest, t_root_wall ); - } else if( here.ter( dest ) == t_root_wall && one_in( 10 ) ) { - here.ter_set( dest, t_dirt ); + here.ter_set( dest, ter_t_root_wall ); + } else if( here.ter( dest ) == ter_t_root_wall && one_in( 10 ) ) { + here.ter_set( dest, ter_t_dirt ); } } // Open blank tiles as long as there's no possible route @@ -1834,7 +1842,7 @@ bool mattack::triffid_heartbeat( monster *z ) rng( player_character.posy(), z->posy() - 3 ) ); tripoint dest( p, z->posz() ); tries++; - here.ter_set( dest, t_dirt ); + here.ter_set( dest, ter_t_dirt ); if( rl_dist( dest, player_character.pos() ) > 3 && g->num_creatures() < 30 && !creatures.creature_at( dest ) && one_in( 20 ) ) { // Spawn an extra monster mtype_id montype = mon_triffid; @@ -2175,7 +2183,7 @@ bool mattack::fungus_fortify( monster *z ) player_character.unset_mutation( trait_MARLOSS_BLUE ); player_character.set_mutation( trait_THRESH_MARLOSS ); here.ter_set( player_character.pos(), - t_marloss ); // We only show you the door. You walk through it on your own. + ter_t_marloss ); // We only show you the door. You walk through it on your own. get_memorial().add( pgettext( "memorial_male", "Was shown to the Marloss Gateway." ), pgettext( "memorial_female", "Was shown to the Marloss Gateway." ) ); diff --git a/src/monmove.cpp b/src/monmove.cpp index a2161d2140201..cbda3a0a14b7f 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -85,6 +85,11 @@ static const material_id material_iflesh( "iflesh" ); static const species_id species_FUNGUS( "FUNGUS" ); static const species_id species_ZOMBIE( "ZOMBIE" ); +static const ter_str_id ter_t_lava( "t_lava" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_pit_glass( "t_pit_glass" ); +static const ter_str_id ter_t_pit_spiked( "t_pit_spiked" ); + bool monster::is_immune_field( const field_type_id &fid ) const { if( fid == fd_fungal_haze ) { @@ -264,7 +269,7 @@ bool monster::know_danger_at( const tripoint &p ) const const ter_id target = here.ter( p ); if( !here.has_vehicle_floor( p ) ) { // Don't enter lava if we have any concept of heat being bad - if( avoid_fire && target == t_lava ) { + if( avoid_fire && target == ter_t_lava ) { return false; } @@ -276,7 +281,7 @@ bool monster::know_danger_at( const tripoint &p ) const // Don't enter open pits ever unless tiny, can fly or climb well if( !( type->size == creature_size::tiny || can_climb() ) && - ( target == t_pit || target == t_pit_spiked || target == t_pit_glass ) ) { + ( target == ter_t_pit || target == ter_t_pit_spiked || target == ter_t_pit_glass ) ) { return false; } } diff --git a/src/npctrade_utils.cpp b/src/npctrade_utils.cpp index 62bfb4e520336..98eb063fea8c0 100644 --- a/src/npctrade_utils.cpp +++ b/src/npctrade_utils.cpp @@ -11,6 +11,8 @@ #include "vehicle.h" #include "vpart_position.h" +static const ter_str_id ter_t_floor( "t_floor" ); + static const zone_type_id zone_type_LOOT_UNSORTED( "LOOT_UNSORTED" ); namespace @@ -89,7 +91,7 @@ void add_fallback_zone( npc &guy ) for( tripoint_abs_ms const &t : closest_points_first( loc, PICKUP_RANGE ) ) { tripoint_bub_ms const t_here = here.bub_from_abs( t ); if( here.has_furn( t_here ) && - ( here.furn( t_here )->max_volume > t_floor->max_volume || + ( here.furn( t_here )->max_volume > ter_t_floor->max_volume || here.furn( t_here )->has_flag( ter_furn_flag::TFLAG_CONTAINER ) ) && here.can_put_items_ter_furn( t_here ) && !here.route( guy.pos_bub(), t_here, guy.get_pathfinding_settings(), diff --git a/src/recipe.cpp b/src/recipe.cpp index 0a3e990df91d7..811ef985458b7 100644 --- a/src/recipe.cpp +++ b/src/recipe.cpp @@ -46,6 +46,7 @@ static const itype_id itype_null( "null" ); static const std::string flag_FULL_MAGAZINE( "FULL_MAGAZINE" ); + recipe::recipe() : skill_used( skill_id::NULL_ID() ) {} int recipe::get_difficulty( const Character &crafter ) const diff --git a/src/regional_settings.cpp b/src/regional_settings.cpp index cfc9cb0a13013..0a8caff6f46da 100644 --- a/src/regional_settings.cpp +++ b/src/regional_settings.cpp @@ -18,7 +18,7 @@ #include "string_formatter.h" #include "translations.h" -ter_furn_id::ter_furn_id() : ter( t_null ), furn( f_null ) { } +ter_furn_id::ter_furn_id() : ter( ter_str_id::NULL_ID().id() ), furn( f_null ) { } template void read_and_set_or_throw( const JsonObject &jo, const std::string &member, T &target, @@ -761,7 +761,7 @@ void groundcover_extra::finalize() // FIXME: return bool for failure for( std::map::const_iterator it = percent_str.begin(); it != percent_str.end(); ++it ) { - tf_id.ter = t_null; + tf_id.ter = ter_str_id::NULL_ID().id(); tf_id.furn = f_null; if( it->second < 0.0001 ) { continue; @@ -782,7 +782,7 @@ void groundcover_extra::finalize() // FIXME: return bool for failure for( std::map::const_iterator it = boosted_percent_str.begin(); it != boosted_percent_str.end(); ++it ) { - tf_id.ter = t_null; + tf_id.ter = ter_str_id::NULL_ID().id(); tf_id.furn = f_null; if( it->second < 0.0001 ) { continue; @@ -844,7 +844,7 @@ void forest_biome_component::finalize() { for( const std::pair &pr : unfinalized_types ) { ter_furn_id tf_id; - tf_id.ter = t_null; + tf_id.ter = ter_str_id::NULL_ID().id(); tf_id.furn = f_null; const ter_str_id tid( pr.first ); const furn_str_id fid( pr.first ); diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 83f281d4af21b..9111dc2caf603 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -155,10 +155,14 @@ static const mtype_id mon_breather( "mon_breather" ); static const skill_id skill_chemistry( "chemistry" ); static const ter_str_id ter_t_ash( "t_ash" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); static const ter_str_id ter_t_pwr_sb_support_l( "t_pwr_sb_support_l" ); static const ter_str_id ter_t_pwr_sb_switchgear_l( "t_pwr_sb_switchgear_l" ); static const ter_str_id ter_t_pwr_sb_switchgear_s( "t_pwr_sb_switchgear_s" ); static const ter_str_id ter_t_rubble( "t_rubble" ); +static const ter_str_id ter_t_support_l( "t_support_l" ); +static const ter_str_id ter_t_switchgear_l( "t_switchgear_l" ); +static const ter_str_id ter_t_switchgear_s( "t_switchgear_s" ); static const ter_str_id ter_t_wreckage( "t_wreckage" ); static const std::array( object_type::NUM_OBJECT_TYPES )> @@ -4851,24 +4855,24 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers const ter_str_id tid( terrain_json.next_string() ); if( tid == ter_t_rubble ) { - m->ter[i][j] = ter_id( "t_dirt" ); + m->ter[i][j] = ter_t_dirt; m->frn[i][j] = furn_id( "f_rubble" ); m->itm[i][j].insert( rock ); m->itm[i][j].insert( rock ); } else if( tid == ter_t_wreckage ) { - m->ter[i][j] = ter_id( "t_dirt" ); + m->ter[i][j] = ter_t_dirt; m->frn[i][j] = furn_id( "f_wreckage" ); m->itm[i][j].insert( chunk ); m->itm[i][j].insert( chunk ); } else if( tid == ter_t_ash ) { - m->ter[i][j] = ter_id( "t_dirt" ); + m->ter[i][j] = ter_t_dirt; m->frn[i][j] = furn_id( "f_ash" ); } else if( tid == ter_t_pwr_sb_support_l ) { - m->ter[i][j] = ter_id( "t_support_l" ); + m->ter[i][j] = ter_t_support_l; } else if( tid == ter_t_pwr_sb_switchgear_l ) { - m->ter[i][j] = ter_id( "t_switchgear_l" ); + m->ter[i][j] = ter_t_switchgear_l; } else if( tid == ter_t_pwr_sb_switchgear_s ) { - m->ter[i][j] = ter_id( "t_switchgear_s" ); + m->ter[i][j] = ter_t_switchgear_s; } else { m->ter[i][j] = tid.id(); } @@ -4889,7 +4893,7 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers iid = terstr.id(); } else { debugmsg( "invalid ter_str_id '%s'", terstr.str() ); - iid = t_dirt; + iid = ter_t_dirt; } } else if( terrain_entry.test_array() ) { JsonArray terrain_rle = terrain_entry; @@ -4898,7 +4902,7 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers iid = terstr.id(); } else { debugmsg( "invalid ter_str_id '%s'", terstr.str() ); - iid = t_dirt; + iid = ter_t_dirt; } remaining = terrain_rle.next_int() - 1; if( terrain_rle.size() > 2 ) { diff --git a/src/start_location.cpp b/src/start_location.cpp index 0990b37ebf0f8..a6b9ebbc26daf 100644 --- a/src/start_location.cpp +++ b/src/start_location.cpp @@ -33,6 +33,18 @@ class item; static const efftype_id effect_bleed( "bleed" ); +static const ter_str_id ter_t_curtains( "t_curtains" ); +static const ter_str_id ter_t_door_boarded( "t_door_boarded" ); +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_c_peep( "t_door_c_peep" ); +static const ter_str_id ter_t_door_locked( "t_door_locked" ); +static const ter_str_id ter_t_door_o( "t_door_o" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_window( "t_window" ); +static const ter_str_id ter_t_window_boarded( "t_window_boarded" ); +static const ter_str_id ter_t_window_domestic( "t_window_domestic" ); +static const ter_str_id ter_t_window_no_curtains( "t_window_no_curtains" ); + static const zone_type_id zone_type_ZONE_START_POINT( "ZONE_START_POINT" ); namespace @@ -149,7 +161,7 @@ static void add_boardable( const tinymap &m, const tripoint &p, std::vector &range ) for( const tripoint &p : range ) { bool must_board_around = false; const ter_id t = m.ter( p ); - if( t == t_window_domestic || t == t_window || t == t_window_no_curtains ) { + if( t == ter_t_window_domestic || t == ter_t_window || t == ter_t_window_no_curtains ) { // Windows are always to the outside and must be boarded must_board_around = true; - m.ter_set( p, t_window_boarded ); - } else if( t == t_door_c || t == t_door_locked || t == t_door_c_peep ) { + m.ter_set( p, ter_t_window_boarded ); + } else if( t == ter_t_door_c || t == ter_t_door_locked || t == ter_t_door_c_peep ) { // Only board up doors that lead to the outside if( m.is_outside( p + tripoint_north ) || m.is_outside( p + tripoint_south ) || m.is_outside( p + tripoint_east ) || m.is_outside( p + tripoint_west ) ) { - m.ter_set( p, t_door_boarded ); + m.ter_set( p, ter_t_door_boarded ); must_board_around = true; } else { // internal doors are opened instead - m.ter_set( p, t_door_o ); + m.ter_set( p, ter_t_door_o ); } } if( must_board_around ) { @@ -238,7 +250,7 @@ void start_location::prepare_map( tinymap &m ) const m.build_outside_cache( z ); board_up( m, m.points_on_zlevel( z ) ); } else { - m.translate( t_window_domestic, t_curtains ); + m.translate( ter_t_window_domestic, ter_t_curtains ); } } diff --git a/src/timed_event.cpp b/src/timed_event.cpp index 45a152a3c357c..1b3ae9c68a842 100644 --- a/src/timed_event.cpp +++ b/src/timed_event.cpp @@ -51,6 +51,15 @@ static const mtype_id mon_spider_widow_giant( "mon_spider_widow_giant" ); static const spell_id spell_dks_summon_alrp( "dks_summon_alrp" ); +static const ter_str_id ter_t_fault( "t_fault" ); +static const ter_str_id ter_t_grate( "t_grate" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); +static const ter_str_id ter_t_root_wall( "t_root_wall" ); +static const ter_str_id ter_t_stairs_down( "t_stairs_down" ); +static const ter_str_id ter_t_underbrush( "t_underbrush" ); +static const ter_str_id ter_t_water_dp( "t_water_dp" ); +static const ter_str_id ter_t_water_sh( "t_water_sh" ); + timed_event::timed_event( timed_event_type e_t, const time_point &w, int f_id, tripoint_abs_ms p, int s, std::string key ) : type( e_t ) @@ -134,9 +143,10 @@ void timed_event::actualize() std::optional fault_point; bool horizontal = false; for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_fault ) { + if( here.ter( p ) == ter_t_fault ) { fault_point = p; - horizontal = here.ter( p + tripoint_east ) == t_fault || here.ter( p + tripoint_west ) == t_fault; + horizontal = here.ter( p + tripoint_east ) == ter_t_fault || + here.ter( p + tripoint_west ) == ter_t_fault; break; } } @@ -146,7 +156,7 @@ void timed_event::actualize() if( horizontal ) { monp.x = rng( fault_point->x, fault_point->x + 2 * SEEX - 8 ); for( int n = -1; n <= 1; n++ ) { - if( here.ter( point( monp.x, fault_point->y + n ) ) == t_rock_floor ) { + if( here.ter( point( monp.x, fault_point->y + n ) ) == ter_t_rock_floor ) { monp.y = fault_point->y + n; } } @@ -154,7 +164,7 @@ void timed_event::actualize() // Vertical fault monp.y = rng( fault_point->y, fault_point->y + 2 * SEEY - 8 ); for( int n = -1; n <= 1; n++ ) { - if( here.ter( point( fault_point->x + n, monp.y ) ) == t_rock_floor ) { + if( here.ter( point( fault_point->x + n, monp.y ) ) == ter_t_rock_floor ) { monp.x = fault_point->x + n; } } @@ -170,8 +180,8 @@ void timed_event::actualize() case timed_event_type::ROOTS_DIE: get_event_bus().send(); for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_root_wall && one_in( 3 ) ) { - here.ter_set( p, t_underbrush ); + if( here.ter( p ) == ter_t_root_wall && one_in( 3 ) ) { + here.ter_set( p, ter_t_underbrush ); } } break; @@ -180,8 +190,8 @@ void timed_event::actualize() get_event_bus().send(); bool saw_grate = false; for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_grate ) { - here.ter_set( p, t_stairs_down ); + if( here.ter( p ) == ter_t_grate ) { + here.ter_set( p, ter_t_stairs_down ); if( !saw_grate && player_character.sees( p ) ) { saw_grate = true; } @@ -201,28 +211,28 @@ void timed_event::actualize() flood_buf[p.x][p.y] = here.ter( p ); } for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_water_sh ) { + if( here.ter( p ) == ter_t_water_sh ) { bool deepen = false; for( const tripoint &w : points_in_radius( p, 1 ) ) { - if( here.ter( w ) == t_water_dp ) { + if( here.ter( w ) == ter_t_water_dp ) { deepen = true; break; } } if( deepen ) { - flood_buf[p.x][p.y] = t_water_dp; + flood_buf[p.x][p.y] = ter_t_water_dp; flooded = true; } - } else if( here.ter( p ) == t_rock_floor ) { + } else if( here.ter( p ) == ter_t_rock_floor ) { bool flood = false; for( const tripoint &w : points_in_radius( p, 1 ) ) { - if( here.ter( w ) == t_water_dp || here.ter( w ) == t_water_sh ) { + if( here.ter( w ) == ter_t_water_dp || here.ter( w ) == ter_t_water_sh ) { flood = true; break; } } if( flood ) { - flood_buf[p.x][p.y] = t_water_sh; + flood_buf[p.x][p.y] = ter_t_water_sh; flooded = true; } } @@ -234,7 +244,7 @@ void timed_event::actualize() // Check if we should print a message if( flood_buf[player_character.posx()][player_character.posy()] != here.ter( player_character.pos() ) ) { - if( flood_buf[player_character.posx()][player_character.posy()] == t_water_sh ) { + if( flood_buf[player_character.posx()][player_character.posy()] == ter_t_water_sh ) { add_msg( m_warning, _( "Water quickly floods up to your knees." ) ); get_memorial().add( pgettext( "memorial_male", "Water level reached knees." ), @@ -337,7 +347,7 @@ void timed_event::per_turn() case timed_event_type::AMIGARA_WHISPERS: { bool faults = false; for( const tripoint &p : here.points_on_zlevel() ) { - if( here.ter( p ) == t_fault ) { + if( here.ter( p ) == ter_t_fault ) { faults = true; break; } diff --git a/src/trapfunc.cpp b/src/trapfunc.cpp index f608ff65c5f2f..35dbaee5da17f 100644 --- a/src/trapfunc.cpp +++ b/src/trapfunc.cpp @@ -88,6 +88,14 @@ static const skill_id skill_throw( "throw" ); static const species_id species_ROBOT( "ROBOT" ); +static const ter_str_id ter_t_floor_blue( "t_floor_blue" ); +static const ter_str_id ter_t_floor_green( "t_floor_green" ); +static const ter_str_id ter_t_floor_red( "t_floor_red" ); +static const ter_str_id ter_t_pit( "t_pit" ); +static const ter_str_id ter_t_rock_blue( "t_rock_blue" ); +static const ter_str_id ter_t_rock_green( "t_rock_green" ); +static const ter_str_id ter_t_rock_red( "t_rock_red" ); + static const trait_id trait_INFRESIST( "INFRESIST" ); // A pit becomes less effective as it fills with corpses. @@ -946,7 +954,7 @@ bool trapfunc::pit_spikes( const tripoint &p, Creature *c, item * ) if( one_in( 4 ) ) { add_msg_if_player_sees( p, _( "The spears break!" ) ); map &here = get_map(); - here.ter_set( p, t_pit ); + here.ter_set( p, ter_t_pit ); // 4 spears to a pit for( int i = 0; i < 4; i++ ) { if( one_in( 3 ) ) { @@ -1037,7 +1045,7 @@ bool trapfunc::pit_glass( const tripoint &p, Creature *c, item * ) if( one_in( 5 ) ) { add_msg_if_player_sees( p, _( "The shards shatter!" ) ); map &here = get_map(); - here.ter_set( p, t_pit ); + here.ter_set( p, ter_t_pit ); // 20 shards in a pit. for( int i = 0; i < 20; i++ ) { if( one_in( 3 ) ) { @@ -1180,7 +1188,7 @@ bool trapfunc::sinkhole( const tripoint &p, Creature *c, item *i ) _( "A sinkhole under collapses!" ) ); if( success ) { here.remove_trap( p ); - here.ter_set( p, t_pit ); + here.ter_set( p, ter_t_pit ); return true; } you->add_msg_player_or_npc( m_bad, _( "You fall into the sinkhole!" ), @@ -1189,7 +1197,7 @@ bool trapfunc::sinkhole( const tripoint &p, Creature *c, item *i ) return false; } here.remove_trap( p ); - here.ter_set( p, t_pit ); + here.ter_set( p, ter_t_pit ); c->mod_moves( -c->get_speed() ); pit( p, c, i ); return true; @@ -1372,23 +1380,23 @@ bool trapfunc::temple_toggle( const tripoint &p, Creature *c, item * ) int &j = tmp.y; for( i = 0; i < MAPSIZE_X; i++ ) { for( j = 0; j < MAPSIZE_Y; j++ ) { - if( type == t_floor_red ) { - if( here.ter( tmp ) == t_rock_green ) { - here.ter_set( tmp, t_floor_green ); - } else if( here.ter( tmp ) == t_floor_green ) { - here.ter_set( tmp, t_rock_green ); + if( type == ter_t_floor_red ) { + if( here.ter( tmp ) == ter_t_rock_green ) { + here.ter_set( tmp, ter_t_floor_green ); + } else if( here.ter( tmp ) == ter_t_floor_green ) { + here.ter_set( tmp, ter_t_rock_green ); } - } else if( type == t_floor_green ) { - if( here.ter( tmp ) == t_rock_blue ) { - here.ter_set( tmp, t_floor_blue ); - } else if( here.ter( tmp ) == t_floor_blue ) { - here.ter_set( tmp, t_rock_blue ); + } else if( type == ter_t_floor_green ) { + if( here.ter( tmp ) == ter_t_rock_blue ) { + here.ter_set( tmp, ter_t_floor_blue ); + } else if( here.ter( tmp ) == ter_t_floor_blue ) { + here.ter_set( tmp, ter_t_rock_blue ); } - } else if( type == t_floor_blue ) { - if( here.ter( tmp ) == t_rock_red ) { - here.ter_set( tmp, t_floor_red ); - } else if( here.ter( tmp ) == t_floor_red ) { - here.ter_set( tmp, t_rock_red ); + } else if( type == ter_t_floor_blue ) { + if( here.ter( tmp ) == ter_t_rock_red ) { + here.ter_set( tmp, ter_t_floor_red ); + } else if( here.ter( tmp ) == ter_t_floor_red ) { + here.ter_set( tmp, ter_t_rock_red ); } } } @@ -1404,19 +1412,19 @@ bool trapfunc::temple_toggle( const tripoint &p, Creature *c, item * ) if( blocked_tiles.size() == 8 ) { for( int i = 7; i >= 0 ; --i ) { - if( here.ter( blocked_tiles.at( i ) ) != t_rock_red && - here.ter( blocked_tiles.at( i ) ) != t_rock_green && - here.ter( blocked_tiles.at( i ) ) != t_rock_blue ) { + if( here.ter( blocked_tiles.at( i ) ) != ter_t_rock_red && + here.ter( blocked_tiles.at( i ) ) != ter_t_rock_green && + here.ter( blocked_tiles.at( i ) ) != ter_t_rock_blue ) { blocked_tiles.erase( blocked_tiles.begin() + i ); } } const tripoint &pnt = random_entry( blocked_tiles ); - if( here.ter( pnt ) == t_rock_red ) { - here.ter_set( pnt, t_floor_red ); - } else if( here.ter( pnt ) == t_rock_green ) { - here.ter_set( pnt, t_floor_green ); - } else if( here.ter( pnt ) == t_rock_blue ) { - here.ter_set( pnt, t_floor_blue ); + if( here.ter( pnt ) == ter_t_rock_red ) { + here.ter_set( pnt, ter_t_floor_red ); + } else if( here.ter( pnt ) == ter_t_rock_green ) { + here.ter_set( pnt, ter_t_floor_green ); + } else if( here.ter( pnt ) == ter_t_rock_blue ) { + here.ter_set( pnt, ter_t_floor_blue ); } } diff --git a/src/vehicle_autodrive.cpp b/src/vehicle_autodrive.cpp index f3c3c870d0646..0698e72f21f6f 100644 --- a/src/vehicle_autodrive.cpp +++ b/src/vehicle_autodrive.cpp @@ -137,6 +137,8 @@ * coordinates. */ +static const ter_str_id ter_t_open_air( "t_open_air" ); + static constexpr int OMT_SIZE = coords::map_squares_per( coords::omt ); static constexpr int NAV_MAP_NUM_OMT = 2; static constexpr int NAV_MAP_SIZE_X = NAV_MAP_NUM_OMT * OMT_SIZE; @@ -723,7 +725,7 @@ bool vehicle::autodrive_controller::check_drivable( const tripoint_bub_ms &pt ) if( avatar.get_memorized_tile( pt_abs ) == mm_submap::default_tile ) { // apparently open air doesn't get memorized, so pretend it is or else // we can't fly helicopters due to the many unseen tiles behind the driver - if( !( data.air_ok && here.ter( pt ) == t_open_air ) ) { + if( !( data.air_ok && here.ter( pt ) == ter_t_open_air ) ) { return false; } } @@ -750,12 +752,12 @@ bool vehicle::autodrive_controller::check_drivable( const tripoint_bub_ms &pt ) } const ter_id terrain = here.ter( pt ); - if( terrain == t_null ) { + if( terrain == ter_str_id::NULL_ID() ) { return false; } // open air is an obstacle to non-flying vehicles; it is drivable // for flying vehicles - if( terrain == t_open_air ) { + if( terrain == ter_t_open_air ) { return data.air_ok; } const ter_t &terrain_type = terrain.obj(); diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp index 6327bc1dc534d..5c3a4d9cb9096 100644 --- a/src/vehicle_move.cpp +++ b/src/vehicle_move.cpp @@ -59,6 +59,17 @@ static const proficiency_id proficiency_prof_driver( "prof_driver" ); static const skill_id skill_driving( "driving" ); +static const ter_str_id ter_t_railroad_track( "t_railroad_track" ); +static const ter_str_id ter_t_railroad_track_d( "t_railroad_track_d" ); +static const ter_str_id ter_t_railroad_track_d1( "t_railroad_track_d1" ); +static const ter_str_id ter_t_railroad_track_d2( "t_railroad_track_d2" ); +static const ter_str_id ter_t_railroad_track_d_on_tie( "t_railroad_track_d_on_tie" ); +static const ter_str_id ter_t_railroad_track_h( "t_railroad_track_h" ); +static const ter_str_id ter_t_railroad_track_h_on_tie( "t_railroad_track_h_on_tie" ); +static const ter_str_id ter_t_railroad_track_on_tie( "t_railroad_track_on_tie" ); +static const ter_str_id ter_t_railroad_track_v( "t_railroad_track_v" ); +static const ter_str_id ter_t_railroad_track_v_on_tie( "t_railroad_track_v_on_tie" ); + static const trait_id trait_DEFT( "DEFT" ); static const trait_id trait_PROF_SKATER( "PROF_SKATER" ); @@ -1676,17 +1687,16 @@ void vehicle::precalculate_vehicle_turning( units::angle new_turn_dir, bool chec // special case for rails if( check_rail_direction ) { - ter_id terrain_at_wheel = here.ter( wheel_tripoint ); + const ter_str_id &terrain_at_wheel = here.ter( wheel_tripoint ).id(); // check is it correct tile to turn into - if( !is_diagonal_movement && - ( terrain_at_wheel == t_railroad_track_d || terrain_at_wheel == t_railroad_track_d1 || - terrain_at_wheel == t_railroad_track_d2 || terrain_at_wheel == t_railroad_track_d_on_tie ) ) { + if( !is_diagonal_movement ) { + const std::unordered_set diagonal_track_ters = { ter_t_railroad_track_d, ter_t_railroad_track_d1, ter_t_railroad_track_d2, ter_t_railroad_track_d_on_tie }; + if( diagonal_track_ters.find( terrain_at_wheel ) != diagonal_track_ters.end() ) { + incorrect_tiles_not_diagonal++; + } + } else if( const std::unordered_set straight_track_ters = { ter_t_railroad_track, ter_t_railroad_track_on_tie, ter_t_railroad_track_h, ter_t_railroad_track_v, ter_t_railroad_track_h_on_tie, ter_t_railroad_track_v_on_tie }; + straight_track_ters.find( terrain_at_wheel ) != straight_track_ters.end() ) { incorrect_tiles_not_diagonal++; - } else if( is_diagonal_movement && - ( terrain_at_wheel == t_railroad_track || terrain_at_wheel == t_railroad_track_on_tie || - terrain_at_wheel == t_railroad_track_h || terrain_at_wheel == t_railroad_track_v || - terrain_at_wheel == t_railroad_track_h_on_tie || terrain_at_wheel == t_railroad_track_v_on_tie ) ) { - incorrect_tiles_diagonal++; } if( incorrect_tiles_diagonal > allowed_incorrect_tiles_diagonal || incorrect_tiles_not_diagonal > allowed_incorrect_tiles_not_diagonal ) { diff --git a/src/vehicle_use.cpp b/src/vehicle_use.cpp index a2a06b0673c9e..98cbcb58960d7 100644 --- a/src/vehicle_use.cpp +++ b/src/vehicle_use.cpp @@ -97,6 +97,9 @@ static const quality_id qual_SCREW( "SCREW" ); static const skill_id skill_mechanics( "mechanics" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_dirtmound( "t_dirtmound" ); + static const vpart_id vpart_horn_bicycle( "horn_bicycle" ); static const zone_type_id zone_type_VEHICLE_PATROL( "VEHICLE_PATROL" ); @@ -998,7 +1001,7 @@ void vehicle::transform_terrain() } if( prereq_fulfilled ) { const ter_id new_ter = ter_id( ttd.post_terrain ); - if( new_ter != t_null ) { + if( new_ter != ter_str_id::NULL_ID() ) { here.ter_set( start_pos, new_ter ); } const furn_id new_furn = furn_id( ttd.post_furniture ); @@ -1073,11 +1076,11 @@ void vehicle::operate_planter() for( auto i = v.begin(); i != v.end(); i++ ) { if( i->is_seed() ) { // If it is an "advanced model" then it will avoid damaging itself or becoming damaged. It's a real feature. - if( here.ter( loc ) != t_dirtmound && vp.has_feature( "ADVANCED_PLANTER" ) ) { + if( here.ter( loc ) != ter_t_dirtmound && vp.has_feature( "ADVANCED_PLANTER" ) ) { //then don't put the item there. break; - } else if( here.ter( loc ) == t_dirtmound ) { - here.set( loc, t_dirt, f_plant_seed ); + } else if( here.ter( loc ) == ter_t_dirtmound ) { + here.set( loc, ter_t_dirt, f_plant_seed ); } else if( !here.has_flag( ter_furn_flag::TFLAG_PLOWABLE, loc ) ) { //If it isn't plowable terrain, then it will most likely be damaged. damage( here, planter_id, rng( 1, 10 ), damage_bash, false ); diff --git a/tests/act_build_test.cpp b/tests/act_build_test.cpp index f0ddf71de4f50..ed3780d7f87da 100644 --- a/tests/act_build_test.cpp +++ b/tests/act_build_test.cpp @@ -14,7 +14,15 @@ #include "player_helpers.h" static const activity_id ACT_MULTIPLE_CONSTRUCTION( "ACT_MULTIPLE_CONSTRUCTION" ); + static const faction_id faction_free_merchants( "free_merchants" ); + +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_metal_grate_window( "t_metal_grate_window" ); +static const ter_str_id ter_t_railroad_rubble( "t_railroad_rubble" ); +static const ter_str_id ter_t_window_boarded_noglass( "t_window_boarded_noglass" ); +static const ter_str_id ter_t_window_empty( "t_window_empty" ); + static const zone_type_id zone_type_CONSTRUCTION_BLUEPRINT( "CONSTRUCTION_BLUEPRINT" ); static const zone_type_id zone_type_LOOT_UNSORTED( "LOOT_UNSORTED" ); @@ -156,11 +164,11 @@ void run_test_case( Character &u ) construction const build = setup_testcase( u, "test_constr_remove_gravel", tri_gravel, tripoint_bub_ms() ); // first check that we don't get stuck in a loop - here.ter_set( tri_gravel, t_dirt ); + here.ter_set( tri_gravel, ter_t_dirt ); run_activities( u, 1 ); REQUIRE( here.partial_con_at( tri_gravel ) == nullptr ); - here.ter_set( tri_gravel, t_railroad_rubble ); + here.ter_set( tri_gravel, ter_t_railroad_rubble ); run_activities( u, build.time * 10 ); REQUIRE( here.ter( tri_gravel ) == ter_id( build.post_terrain ) ); } @@ -171,10 +179,10 @@ void run_test_case( Character &u ) tripoint_bub_ms const tri_window( tripoint_south ); construction const build = setup_testcase( u, "test_constr_window_boarded", tri_window, tripoint_bub_ms() ); - here.ter_set( tri_window, t_window_empty ); + here.ter_set( tri_window, ter_t_window_empty ); REQUIRE( build.pre_terrain != "t_window_empty" ); run_activities( u, build.time * 10 ); - REQUIRE( here.ter( tri_window ) == t_window_boarded_noglass ); + REQUIRE( here.ter( tri_window ) == ter_t_window_boarded_noglass ); } SECTION( "1-step construction activity with existing partial" ) { @@ -200,7 +208,7 @@ void run_test_case( Character &u ) pc.id = get_construction( "test_constr_window_boarded_noglass_empty" ).id; here.partial_con_set( tri_window, pc ); run_activities( u, build.time * 10 ); - REQUIRE( here.ter( tri_window ) == t_window_boarded_noglass ); + REQUIRE( here.ter( tri_window ) == ter_t_window_boarded_noglass ); } SECTION( "1-step construction activity with mismatched partial" ) { @@ -223,7 +231,7 @@ void run_test_case( Character &u ) here.build_map_cache( u.pos().z ); tripoint_bub_ms const tri_window = { 0, 5, 0 }; for( tripoint_bub_ms const &it : here.points_in_radius( tri_window, 1 ) ) { - here.ter_set( it, t_metal_grate_window ); + here.ter_set( it, ter_t_metal_grate_window ); } construction const build = setup_testcase( u, "test_constr_door", tri_window, tripoint_bub_ms() ); diff --git a/tests/cardio_test.cpp b/tests/cardio_test.cpp index f669055cd1398..d201a7820be32 100644 --- a/tests/cardio_test.cpp +++ b/tests/cardio_test.cpp @@ -37,6 +37,8 @@ static const move_mode_id move_mode_run( "run" ); static const skill_id skill_swimming( "swimming" ); +static const ter_str_id ter_t_pavement( "t_pavement" ); + // Base cardio for default character static const int base_cardio = 1000; // Base stamina @@ -53,7 +55,7 @@ static void verify_default_cardio_options() } // Count the number of steps (tiles) until character runs out of stamina or becomes winded. -static int running_steps( Character &they, const ter_id &terrain = t_pavement ) +static int running_steps( Character &they, const ter_str_id &terrain = ter_t_pavement ) { map &here = get_map(); // Please take off your shoes when entering, and no NPCs allowed diff --git a/tests/char_suffer_test.cpp b/tests/char_suffer_test.cpp index ad9a4183c9d26..ecabf79b12d8c 100644 --- a/tests/char_suffer_test.cpp +++ b/tests/char_suffer_test.cpp @@ -22,6 +22,8 @@ static const efftype_id effect_grabbed( "grabbed" ); +static const ter_str_id ter_t_rock_wall( "t_rock_wall" ); + static const trait_id trait_ALBINO( "ALBINO" ); static const trait_id trait_SUNBURN( "SUNBURN" ); @@ -507,8 +509,8 @@ TEST_CASE( "suffering_from_asphyxiation", "[char][suffer][oxygen][grab]" ) map &here = get_map(); WHEN( "crushed against two walls by two grabbers" ) { - here.ter_set( dummy.pos() + tripoint_south, t_rock_wall ); - here.ter_set( dummy.pos() + tripoint_north, t_rock_wall ); + here.ter_set( dummy.pos() + tripoint_south, ter_t_rock_wall ); + here.ter_set( dummy.pos() + tripoint_north, ter_t_rock_wall ); REQUIRE( here.impassable( dummy.pos() + tripoint_south ) ); REQUIRE( here.impassable( dummy.pos() + tripoint_north ) ); diff --git a/tests/connect_rotate_test.cpp b/tests/connect_rotate_test.cpp index fb1315ebb0920..832556b5ff3a9 100644 --- a/tests/connect_rotate_test.cpp +++ b/tests/connect_rotate_test.cpp @@ -10,6 +10,10 @@ #include "player_helpers.h" #include "sdltiles.h" +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_pavement( "t_pavement" ); +static const ter_str_id ter_t_wall( "t_wall" ); + class cata_tiles_test_helper { public: @@ -37,10 +41,10 @@ TEST_CASE( "walls_should_be_unconnected_without_nearby_walls", "[multitile][conn // Unconnected WHEN( "no connecting neighbours" ) { - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); THEN( "the wall should be unconnected" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -67,10 +71,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_end_pieces", "[multitile][connects] // End pieces WHEN( "connecting neighbour south" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as end_piece N" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -80,10 +84,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_end_pieces", "[multitile][connects] } } WHEN( "connecting neighbour east" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as end_piece W" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -93,10 +97,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_end_pieces", "[multitile][connects] } } WHEN( "connecting neighbour north" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as end_piece S" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -106,10 +110,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_end_pieces", "[multitile][connects] } } WHEN( "connecting neighbour west" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as end_piece E" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -136,10 +140,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_corners", "[multitile][connects]" ) // Corners WHEN( "connecting neighbour south and east" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as corner NW" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -149,10 +153,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_corners", "[multitile][connects]" ) } } WHEN( "connecting neighbour north and east" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as corner SW" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -162,10 +166,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_corners", "[multitile][connects]" ) } } WHEN( "connecting neighbour north and west" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as corner SE" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -175,10 +179,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_corners", "[multitile][connects]" ) } } WHEN( "connecting neighbour south and west" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as corner NE" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -205,10 +209,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_edges", "[multitile][connects]" ) // Edges WHEN( "connecting neighbour north and south" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as edge NS" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -218,10 +222,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_edges", "[multitile][connects]" ) } } WHEN( "connecting neighbour east and west" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as edge EW" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -248,10 +252,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_t-connections_and_fully", "[multiti // T connections WHEN( "connecting neighbour all but north" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as t-connection N" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -261,10 +265,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_t-connections_and_fully", "[multiti } } WHEN( "connecting neighbour all but west" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); THEN( "the wall should be connected as t-connection W" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -274,10 +278,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_t-connections_and_fully", "[multiti } } WHEN( "connecting neighbour all but south" ) { - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as t-connection S" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -287,10 +291,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_t-connections_and_fully", "[multiti } } WHEN( "connecting neighbour all but east" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as t-connection E" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -301,10 +305,10 @@ TEST_CASE( "walls_should_connect_to_walls_as_t-connections_and_fully", "[multiti } // All WHEN( "connecting neighbour all" ) { - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); THEN( "the wall should be connected as center" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -333,10 +337,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi // Edges WHEN( "connecting neighbours north and south, and rotate to west" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); THEN( "the window should be connected as NS, with W positive" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -346,10 +350,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours east and west, and rotate to north" ) { - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); THEN( "the window should be connected EW, with N positive" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -359,10 +363,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours north and south, and rotate to east" ) { - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); THEN( "the window should be connected as NS, with E positive" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -372,10 +376,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours east and west, and rotate to south" ) { - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window should be connected as EW, with S positive" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -386,10 +390,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } WHEN( "connecting neighbours north and south, and rotate to east and west" ) { - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); THEN( "the window should be connected as NS, with E and W negative" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -399,10 +403,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours east and west, and nothing to rotate to" ) { - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window should be connected as EW, with N and S negative" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -412,10 +416,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours north and south, and nothing to rotate to" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_wall ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_wall ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_wall ) ); THEN( "the window should be connected as NS, with E and W negative" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -425,10 +429,10 @@ TEST_CASE( "windows_should_connect_to_walls_and_rotate_to_indoor_floor", "[multi } } WHEN( "connecting neighbours east and west, and rotate to north and south" ) { - REQUIRE( here.ter_set( pos + point_east, t_wall ) ); - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_wall ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_wall ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); THEN( "the window should be connected as EW, with N and S positive" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -456,10 +460,10 @@ TEST_CASE( "unconnected_windows_rotate_to_indoor_floor", "[multitile][rotates]" // Unconnected WHEN( "nothing to rotate to" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window should be unconnected" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -470,10 +474,10 @@ TEST_CASE( "unconnected_windows_rotate_to_indoor_floor", "[multitile][rotates]" } WHEN( "indoor floor to the north" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_floor ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_floor ) ); THEN( "the window rotate to the north" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -483,10 +487,10 @@ TEST_CASE( "unconnected_windows_rotate_to_indoor_floor", "[multitile][rotates]" } } WHEN( "indoor floor to the east" ) { - REQUIRE( here.ter_set( pos + point_east, t_floor ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window rotate to the east" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -496,10 +500,10 @@ TEST_CASE( "unconnected_windows_rotate_to_indoor_floor", "[multitile][rotates]" } } WHEN( "indoor floor to the south" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_floor ) ); - REQUIRE( here.ter_set( pos + point_west, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window rotate to the south" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, @@ -509,10 +513,10 @@ TEST_CASE( "unconnected_windows_rotate_to_indoor_floor", "[multitile][rotates]" } } WHEN( "indoor floor to the west" ) { - REQUIRE( here.ter_set( pos + point_east, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_south, t_pavement ) ); - REQUIRE( here.ter_set( pos + point_west, t_floor ) ); - REQUIRE( here.ter_set( pos + point_north, t_pavement ) ); + REQUIRE( here.ter_set( pos + point_east, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_south, ter_t_pavement ) ); + REQUIRE( here.ter_set( pos + point_west, ter_t_floor ) ); + REQUIRE( here.ter_set( pos + point_north, ter_t_pavement ) ); THEN( "the window rotate to the west" ) { cata_tiles_test_helper::get_connect_values( pos, subtile, rotation, diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index 5c93659b10687..fce034c121eb5 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -137,6 +137,9 @@ static const skill_id skill_survival( "survival" ); static const spell_id spell_test_eoc_spell( "test_eoc_spell" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_grass( "t_grass" ); + static const trait_id trait_process_mutation( "process_mutation" ); static const trait_id trait_process_mutation_two( "process_mutation_two" ); @@ -284,19 +287,19 @@ TEST_CASE( "EOC_transform_radius", "[eoc][timed_event]" ) clear_map(); tripoint_abs_ms const start = get_avatar().get_location(); dialogue newDialog( get_talker_for( get_avatar() ), nullptr ); - check_ter_in_radius( start, eoc_range, t_grass ); + check_ter_in_radius( start, eoc_range, ter_t_grass ); effect_on_condition_EOC_TEST_TRANSFORM_RADIUS->activate( newDialog ); - check_ter_in_radius( start, eoc_range, t_dirt ); + check_ter_in_radius( start, eoc_range, ter_t_dirt ); g->place_player_overmap( project_to( start ) + point{ 60, 60 } ); REQUIRE( !get_map().inbounds( start ) ); calendar::turn += delay - 1_seconds; get_timed_events().process(); - check_ter_in_radius( start, eoc_range, t_dirt ); + check_ter_in_radius( start, eoc_range, ter_t_dirt ); calendar::turn += 2_seconds; get_timed_events().process(); - check_ter_in_radius( start, eoc_range, t_grass ); + check_ter_in_radius( start, eoc_range, ter_t_grass ); } TEST_CASE( "EOC_transform_line", "[eoc][timed_event]" ) @@ -313,9 +316,9 @@ TEST_CASE( "EOC_transform_line", "[eoc][timed_event]" ) tripoint_abs_ms const start = get_avatar().get_location(); tripoint_abs_ms const end = npc.get_location(); dialogue newDialog( get_talker_for( get_avatar() ), get_talker_for( npc ) ); - check_ter_in_line( start, end, t_grass ); + check_ter_in_line( start, end, ter_t_grass ); effect_on_condition_EOC_TEST_TRANSFORM_LINE->activate( newDialog ); - check_ter_in_line( start, end, t_dirt ); + check_ter_in_line( start, end, ter_t_dirt ); } TEST_CASE( "EOC_activity_finish", "[eoc][timed_event]" ) diff --git a/tests/field_test.cpp b/tests/field_test.cpp index 93884b15243eb..07783151ef9eb 100644 --- a/tests/field_test.cpp +++ b/tests/field_test.cpp @@ -23,6 +23,7 @@ static const efftype_id effect_test_rash( "test_rash" ); static const field_type_str_id field_fd_acid( "fd_acid" ); static const field_type_str_id field_fd_test( "fd_test" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); static const ter_str_id ter_t_tree_walnut( "t_tree_walnut" ); static int count_fields( const field_type_str_id &field_type ) @@ -183,7 +184,7 @@ TEST_CASE( "fd_acid_falls_down", "[field]" ) m.process_fields(); // remove floor under the acid field - m.ter_set( p, t_open_air ); + m.ter_set( p, ter_t_open_air ); m.build_floor_cache( 0 ); REQUIRE( m.valid_move( p, p + tripoint_below ) ); diff --git a/tests/gates_test.cpp b/tests/gates_test.cpp index 9e11b1ddfa8a5..ad774eb5905f5 100644 --- a/tests/gates_test.cpp +++ b/tests/gates_test.cpp @@ -10,6 +10,12 @@ #include "sounds.h" #include "type_id.h" +static const ter_str_id ter_t_door_c( "t_door_c" ); +static const ter_str_id ter_t_door_locked( "t_door_locked" ); +static const ter_str_id ter_t_door_o( "t_door_o" ); +static const ter_str_id ter_t_window_no_curtains( "t_window_no_curtains" ); +static const ter_str_id ter_t_window_no_curtains_open( "t_window_no_curtains_open" ); + TEST_CASE( "doors_should_be_able_to_open_and_close", "[gates]" ) { map &here = get_map(); @@ -19,25 +25,25 @@ TEST_CASE( "doors_should_be_able_to_open_and_close", "[gates]" ) WHEN( "the door is unlocked" ) { // create closed door on tile next to player - REQUIRE( here.ter_set( pos, t_door_c ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_c->id ); + REQUIRE( here.ter_set( pos, ter_t_door_c ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_c->id ); THEN( "the door should be able to open and close" ) { CHECK( here.open_door( get_avatar(), pos, true, false ) ); - CHECK( here.ter( pos ).obj().id == t_door_o->id ); + CHECK( here.ter( pos ).obj().id == ter_t_door_o->id ); CHECK( here.close_door( pos, true, false ) ); - CHECK( here.ter( pos ).obj().id == t_door_c->id ); + CHECK( here.ter( pos ).obj().id == ter_t_door_c->id ); } } WHEN( "the door is locked" ) { // create locked door on tile next to player - REQUIRE( here.ter_set( pos, t_door_locked ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_locked->id ); + REQUIRE( here.ter_set( pos, ter_t_door_locked ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_locked->id ); THEN( "the door should not be able to open" ) { CHECK_FALSE( here.close_door( pos, true, false ) ); - CHECK( here.ter( pos ).obj().id == t_door_locked->id ); + CHECK( here.ter( pos ).obj().id == ter_t_door_locked->id ); } } } @@ -50,19 +56,19 @@ TEST_CASE( "windows_should_be_able_to_open_and_close", "[gates]" ) tripoint pos = get_avatar().pos() + point_east; // create closed window on tile next to player - REQUIRE( here.ter_set( pos, t_window_no_curtains ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains->id ); + REQUIRE( here.ter_set( pos, ter_t_window_no_curtains ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); WHEN( "the window is opened from the inside" ) { THEN( "the window should be able to open" ) { CHECK( here.open_door( get_avatar(), pos, true, false ) ); - CHECK( here.ter( pos ).obj().id == t_window_no_curtains_open->id ); + CHECK( here.ter( pos ).obj().id == ter_t_window_no_curtains_open->id ); } } WHEN( "the window is opened from the outside" ) { THEN( "the window should not be able to open" ) { CHECK_FALSE( here.close_door( pos, false, false ) ); - CHECK( here.ter( pos ).obj().id == t_window_no_curtains->id ); + CHECK( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); } } } @@ -80,56 +86,56 @@ TEST_CASE( "doors_and_windows_should_make_whoosh_sound", "[gates]" ) tripoint pos = get_avatar().pos() + point_east; WHEN( "the door is opened" ) { - REQUIRE( here.ter_set( pos, t_door_c ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_c->id ); + REQUIRE( here.ter_set( pos, ter_t_door_c ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_c->id ); // make sure there is no sounds before action REQUIRE( sounds::get_monster_sounds().first.empty() ); REQUIRE( here.open_door( get_avatar(), pos, true, false ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_o->id ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_o->id ); THEN( "the door should make a swish sound" ) { CHECK_FALSE( sounds::get_monster_sounds().first.empty() ); } } WHEN( "the door is closed" ) { - REQUIRE( here.ter_set( pos, t_door_o ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_o->id ); + REQUIRE( here.ter_set( pos, ter_t_door_o ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_o->id ); // make sure there is no sounds before action REQUIRE( sounds::get_monster_sounds().first.empty() ); REQUIRE( here.close_door( pos, true, false ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_c->id ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_c->id ); THEN( "the door should make a swish sound" ) { CHECK_FALSE( sounds::get_monster_sounds().first.empty() ); } } WHEN( "the window is opened" ) { - REQUIRE( here.ter_set( pos, t_window_no_curtains ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains->id ); + REQUIRE( here.ter_set( pos, ter_t_window_no_curtains ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); // make sure there is no sounds before action REQUIRE( sounds::get_monster_sounds().first.empty() ); REQUIRE( here.open_door( get_avatar(), pos, true, false ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains_open->id ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains_open->id ); THEN( "the window should make a swish sound" ) { CHECK_FALSE( sounds::get_monster_sounds().first.empty() ); } } WHEN( "the window is closed" ) { - REQUIRE( here.ter_set( pos, t_window_no_curtains_open ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains_open->id ); + REQUIRE( here.ter_set( pos, ter_t_window_no_curtains_open ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains_open->id ); // make sure there is no sounds before action REQUIRE( sounds::get_monster_sounds().first.empty() ); REQUIRE( here.close_door( pos, true, false ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains->id ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); THEN( "the window should make a swish sound" ) { CHECK_FALSE( sounds::get_monster_sounds().first.empty() ); @@ -156,8 +162,8 @@ TEST_CASE( "character_should_lose_moves_when_opening_or_closing_doors_or_windows they.set_moves( 0 ); WHEN( "avatar opens door" ) { - REQUIRE( here.ter_set( pos, t_door_c ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_c->id ); + REQUIRE( here.ter_set( pos, ter_t_door_c ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_c->id ); REQUIRE( avatar_action::move( they, here, tripoint_east ) ); @@ -166,8 +172,8 @@ TEST_CASE( "character_should_lose_moves_when_opening_or_closing_doors_or_windows } } WHEN( "avatar fails to open locked door" ) { - REQUIRE( here.ter_set( pos, t_door_locked ) ); - REQUIRE( here.ter( pos ).obj().id == t_door_locked->id ); + REQUIRE( here.ter_set( pos, ter_t_door_locked ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_door_locked->id ); REQUIRE_FALSE( avatar_action::move( they, here, tripoint_east ) ); @@ -179,8 +185,8 @@ TEST_CASE( "character_should_lose_moves_when_opening_or_closing_doors_or_windows REQUIRE( here.is_outside( pos ) ); WHEN( "avatar fails to open window" ) { - REQUIRE( here.ter_set( pos, t_window_no_curtains ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains->id ); + REQUIRE( here.ter_set( pos, ter_t_window_no_curtains ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); REQUIRE_FALSE( avatar_action::move( they, here, tripoint_east ) ); @@ -218,8 +224,8 @@ TEST_CASE( "character_should_lose_moves_when_opening_or_closing_doors_or_windows REQUIRE_FALSE( here.is_outside( pos ) ); WHEN( "avatar opens window" ) { - REQUIRE( here.ter_set( pos, t_window_no_curtains ) ); - REQUIRE( here.ter( pos ).obj().id == t_window_no_curtains->id ); + REQUIRE( here.ter_set( pos, ter_t_window_no_curtains ) ); + REQUIRE( here.ter( pos ).obj().id == ter_t_window_no_curtains->id ); REQUIRE( avatar_action::move( they, here, tripoint_east ) ); diff --git a/tests/ground_destroy_test.cpp b/tests/ground_destroy_test.cpp index d272c99685973..d42134302416e 100644 --- a/tests/ground_destroy_test.cpp +++ b/tests/ground_destroy_test.cpp @@ -18,7 +18,7 @@ TEST_CASE( "pavement_destroy", "[.]" ) { const ter_id flat_roof_id = ter_id( "t_flat_roof" ); - REQUIRE( flat_roof_id != t_null ); + REQUIRE( flat_roof_id != ter_str_id::NULL_ID() ); clear_map_and_put_player_underground(); map &here = get_map(); @@ -41,7 +41,7 @@ TEST_CASE( "pavement_destroy", "[.]" ) TEST_CASE( "explosion_on_ground", "[.]" ) { ter_id flat_roof_id = ter_id( "t_flat_roof" ); - REQUIRE( flat_roof_id != t_null ); + REQUIRE( flat_roof_id != ter_str_id::NULL_ID() ); clear_map_and_put_player_underground(); std::vector test_terrain_id = { @@ -88,10 +88,10 @@ TEST_CASE( "explosion_on_floor_with_rock_floor_basement", "[.]" ) ter_id rock_floor_id = ter_id( "t_rock_floor" ); ter_id open_air_id = ter_id( "t_open_air" ); - REQUIRE( flat_roof_id != t_null ); - REQUIRE( floor_id != t_null ); - REQUIRE( rock_floor_id != t_null ); - REQUIRE( open_air_id != t_null ); + REQUIRE( flat_roof_id != ter_str_id::NULL_ID() ); + REQUIRE( floor_id != ter_str_id::NULL_ID() ); + REQUIRE( rock_floor_id != ter_str_id::NULL_ID() ); + REQUIRE( open_air_id != ter_str_id::NULL_ID() ); clear_map_and_put_player_underground(); @@ -145,10 +145,10 @@ TEST_CASE( "collapse_checks", "[.]" ) const ter_id wall_id = ter_id( "t_wall" ); const ter_id open_air_id = ter_id( "t_open_air" ); - REQUIRE( floor_id != t_null ); - REQUIRE( dirt_id != t_null ); - REQUIRE( wall_id != t_null ); - REQUIRE( open_air_id != t_null ); + REQUIRE( floor_id != ter_str_id::NULL_ID() ); + REQUIRE( dirt_id != ter_str_id::NULL_ID() ); + REQUIRE( wall_id != ter_str_id::NULL_ID() ); + REQUIRE( open_air_id != ter_str_id::NULL_ID() ); clear_map_and_put_player_underground(); @@ -208,7 +208,7 @@ TEST_CASE( "collapse_checks", "[.]" ) } const ter_id t_id = here.ter( pt ); tile_count += 1; - if( t_id == t_open_air ) { + if( t_id == open_air_id ) { open_air_count += 1; if( corners.find( pt ) != corners.end() ) { no_wall_count += 1; diff --git a/tests/map_bash_test.cpp b/tests/map_bash_test.cpp index 74c5e2b19442a..da013eb8dcf48 100644 --- a/tests/map_bash_test.cpp +++ b/tests/map_bash_test.cpp @@ -9,6 +9,7 @@ static const furn_str_id furn_test_f_bash_persist( "test_f_bash_persist" ); static const furn_str_id furn_test_f_eoc( "test_f_eoc" ); +static const ter_str_id ter_t_floor( "t_floor" ); static const ter_str_id ter_test_t_bash_persist( "test_t_bash_persist" ); static const ter_str_id ter_test_t_pit_shallow( "test_t_pit_shallow" ); @@ -46,7 +47,7 @@ static void test_bash_set( const bash_test_set &set ) constexpr int max_tries = 999; for( const furn_id &furn : set.tested_furn ) { INFO( string_format( "%s bashing %s", test.id, furn.id().str() ) ); - here.ter_set( test_pt, t_floor ); + here.ter_set( test_pt, ter_t_floor ); here.furn_set( test_pt, furn ); int tries = 0; while( here.furn( test_pt ) == furn && tries < max_tries ) { diff --git a/tests/map_helpers.cpp b/tests/map_helpers.cpp index 88cb0ff27160c..770409134cd43 100644 --- a/tests/map_helpers.cpp +++ b/tests/map_helpers.cpp @@ -28,6 +28,10 @@ #include "submap.h" #include "type_id.h" +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_open_air( "t_open_air" ); +static const ter_str_id ter_t_rock( "t_rock" ); + // Remove all vehicles from the map void clear_vehicles( map *target ) { @@ -55,7 +59,7 @@ void wipe_map_terrain( map *target ) map &here = target ? *target : get_map(); const int mapsize = here.getmapsize() * SEEX; for( int z = -1; z <= OVERMAP_HEIGHT; ++z ) { - ter_id terrain = z == 0 ? t_grass : z < 0 ? t_rock : t_open_air; + ter_id terrain = z == 0 ? ter_t_grass : z < 0 ? ter_t_rock : ter_t_open_air; for( int x = 0; x < mapsize; ++x ) { for( int y = 0; y < mapsize; ++y ) { here.set( { x, y, z}, terrain, f_null ); @@ -190,9 +194,9 @@ void build_water_test_map( const ter_id &surface, const ter_id &mid, const ter_i } else if( p.z == z_bottom ) { here.ter_set( p, bottom ); } else if( p.z < z_bottom ) { - here.ter_set( p, t_rock ); + here.ter_set( p, ter_t_rock ); } else if( p.z > z_surface ) { - here.ter_set( p, t_open_air ); + here.ter_set( p, ter_t_open_air ); } } diff --git a/tests/monster_vision_test.cpp b/tests/monster_vision_test.cpp index ed073d02bf8d5..297c4fd9cb98f 100644 --- a/tests/monster_vision_test.cpp +++ b/tests/monster_vision_test.cpp @@ -8,12 +8,14 @@ #include "monster.h" #include "options_helpers.h" +static const ter_str_id ter_t_floor( "t_floor" ); + struct tripoint; static monster &spawn_and_clear( const tripoint &pos, bool set_floor ) { if( set_floor ) { - get_map().set( pos, t_floor, f_null ); + get_map().set( pos, ter_t_floor, f_null ); } return spawn_test_monster( "mon_zombie", pos ); } diff --git a/tests/move_cost_test.cpp b/tests/move_cost_test.cpp index 52d9a5d661a6e..194442974ef08 100644 --- a/tests/move_cost_test.cpp +++ b/tests/move_cost_test.cpp @@ -34,6 +34,9 @@ static const move_mode_id move_mode_prone( "prone" ); static const move_mode_id move_mode_run( "run" ); static const move_mode_id move_mode_walk( "walk" ); +static const ter_str_id ter_t_grass( "t_grass" ); +static const ter_str_id ter_t_pavement( "t_pavement" ); + static const trait_id trait_HOOVES( "HOOVES" ); static const trait_id trait_LEG_TENTACLES( "LEG_TENTACLES" ); static const trait_id trait_PADDED_FEET( "PADDED_FEET" ); @@ -99,13 +102,13 @@ TEST_CASE( "footwear_may_affect_movement_cost", "[move_cost][shoes]" ) REQUIRE( ava.get_modifier( character_modifier_limb_run_cost_mod ) == Approx( 1.11696 ) ); WHEN( "on pavement and running" ) { ava.set_movement_mode( move_mode_run ); - here.ter_set( ava.pos(), t_pavement ); + here.ter_set( ava.pos(), ter_t_pavement ); THEN( "much faster than sneakers" ) { CHECK( ava.run_cost( 100 ) == 27 ); } } WHEN( "on grass" ) { - here.ter_set( ava.pos(), t_grass ); + here.ter_set( ava.pos(), ter_t_grass ); THEN( "much slower than sneakers" ) { CHECK( ava.run_cost( 100 ) == 167 ); } @@ -119,13 +122,13 @@ TEST_CASE( "footwear_may_affect_movement_cost", "[move_cost][shoes]" ) REQUIRE( ava.get_modifier( character_modifier_limb_run_cost_mod ) == Approx( 1.11696 ) ); WHEN( "on pavement and running" ) { ava.set_movement_mode( move_mode_run ); - here.ter_set( ava.pos(), t_pavement ); + here.ter_set( ava.pos(), ter_t_pavement ); THEN( "faster than sneakers" ) { CHECK( ava.run_cost( 100 ) == 39 ); } } WHEN( "on grass" ) { - here.ter_set( ava.pos(), t_grass ); + here.ter_set( ava.pos(), ter_t_grass ); THEN( "slower than sneakers" ) { CHECK( ava.run_cost( 100 ) == 145 ); } @@ -139,13 +142,13 @@ TEST_CASE( "footwear_may_affect_movement_cost", "[move_cost][shoes]" ) REQUIRE( ava.get_modifier( character_modifier_limb_run_cost_mod ) == Approx( 1.0 ) ); WHEN( "on pavement and running" ) { ava.set_movement_mode( move_mode_run ); - here.ter_set( ava.pos(), t_pavement ); + here.ter_set( ava.pos(), ter_t_pavement ); THEN( "slightly faster than sneakers" ) { CHECK( ava.run_cost( 100 ) == 42 ); } } WHEN( "on grass" ) { - here.ter_set( ava.pos(), t_grass ); + here.ter_set( ava.pos(), ter_t_grass ); THEN( "slightly slower than sneakers" ) { CHECK( ava.run_cost( 100 ) == 110 ); } diff --git a/tests/player_activities_test.cpp b/tests/player_activities_test.cpp index 70216112806e1..d9ae968028e57 100644 --- a/tests/player_activities_test.cpp +++ b/tests/player_activities_test.cpp @@ -84,6 +84,7 @@ static const recipe_id recipe_water_clean( "water_clean" ); static const skill_id skill_traps( "traps" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); static const ter_str_id ter_t_wall( "t_wall" ); static const ter_str_id ter_test_t_boltcut1( "test_t_boltcut1" ); static const ter_str_id ter_test_t_boltcut2( "test_t_boltcut2" ); @@ -585,8 +586,8 @@ TEST_CASE( "boltcut", "[activity][boltcut]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_null ); - REQUIRE( mp.ter( tripoint_zero ) == t_null ); + mp.ter_set( tripoint_zero, ter_str_id::NULL_ID() ); + REQUIRE( mp.ter( tripoint_zero ) == ter_str_id::NULL_ID() ); item_location boltcutter = setup_dummy(); setup_activity( boltcutter ); @@ -600,8 +601,8 @@ TEST_CASE( "boltcut", "[activity][boltcut]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_dirt ); - REQUIRE( mp.ter( tripoint_zero ) == t_dirt ); + mp.ter_set( tripoint_zero, ter_t_dirt ); + REQUIRE( mp.ter( tripoint_zero ) == ter_t_dirt ); item_location boltcutter = setup_dummy(); setup_activity( boltcutter ); @@ -737,7 +738,7 @@ TEST_CASE( "boltcut", "[activity][boltcut]" ) REQUIRE( dummy.activity.id() == ACT_NULL ); THEN( "terrain gets converted to new terrain type" ) { - CHECK( mp.ter( tripoint_zero ) == t_dirt ); + CHECK( mp.ter( tripoint_zero ) == ter_t_dirt ); } } @@ -849,8 +850,8 @@ TEST_CASE( "hacksaw", "[activity][hacksaw]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_null ); - REQUIRE( mp.ter( tripoint_zero ) == t_null ); + mp.ter_set( tripoint_zero, ter_str_id::NULL_ID() ); + REQUIRE( mp.ter( tripoint_zero ) == ter_str_id::NULL_ID() ); item_location hacksaw = setup_dummy(); setup_activity( hacksaw ); @@ -864,8 +865,8 @@ TEST_CASE( "hacksaw", "[activity][hacksaw]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_dirt ); - REQUIRE( mp.ter( tripoint_zero ) == t_dirt ); + mp.ter_set( tripoint_zero, ter_t_dirt ); + REQUIRE( mp.ter( tripoint_zero ) == ter_t_dirt ); item_location hacksaw = setup_dummy(); setup_activity( hacksaw ); @@ -1002,7 +1003,7 @@ TEST_CASE( "hacksaw", "[activity][hacksaw]" ) REQUIRE( dummy.activity.id() == ACT_NULL ); THEN( "terrain gets converted to new terrain type" ) { - CHECK( mp.ter( tripoint_zero ) == t_dirt ); + CHECK( mp.ter( tripoint_zero ) == ter_t_dirt ); } } @@ -1115,8 +1116,8 @@ TEST_CASE( "oxytorch", "[activity][oxytorch]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_null ); - REQUIRE( mp.ter( tripoint_zero ) == t_null ); + mp.ter_set( tripoint_zero, ter_str_id::NULL_ID() ); + REQUIRE( mp.ter( tripoint_zero ) == ter_str_id::NULL_ID() ); item_location welding_torch = setup_dummy(); setup_activity( welding_torch ); @@ -1130,8 +1131,8 @@ TEST_CASE( "oxytorch", "[activity][oxytorch]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_dirt ); - REQUIRE( mp.ter( tripoint_zero ) == t_dirt ); + mp.ter_set( tripoint_zero, ter_t_dirt ); + REQUIRE( mp.ter( tripoint_zero ) == ter_t_dirt ); item_location welding_torch = setup_dummy(); setup_activity( welding_torch ); @@ -1257,7 +1258,7 @@ TEST_CASE( "oxytorch", "[activity][oxytorch]" ) REQUIRE( dummy.activity.id() == ACT_NULL ); THEN( "terrain gets converted to new terrain type" ) { - CHECK( mp.ter( tripoint_zero ) == t_dirt ); + CHECK( mp.ter( tripoint_zero ) == ter_t_dirt ); } } @@ -1412,8 +1413,8 @@ TEST_CASE( "prying", "[activity][prying]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_null ); - REQUIRE( mp.ter( tripoint_zero ) == t_null ); + mp.ter_set( tripoint_zero, ter_str_id::NULL_ID() ); + REQUIRE( mp.ter( tripoint_zero ) == ter_str_id::NULL_ID() ); item_location prying_tool = setup_dummy( true ); setup_activity( prying_tool ); @@ -1427,8 +1428,8 @@ TEST_CASE( "prying", "[activity][prying]" ) clear_map(); clear_avatar(); - mp.ter_set( tripoint_zero, t_dirt ); - REQUIRE( mp.ter( tripoint_zero ) == t_dirt ); + mp.ter_set( tripoint_zero, ter_t_dirt ); + REQUIRE( mp.ter( tripoint_zero ) == ter_t_dirt ); item_location prying_tool = setup_dummy( true ); setup_activity( prying_tool ); @@ -1523,7 +1524,7 @@ TEST_CASE( "prying", "[activity][prying]" ) REQUIRE( dummy.activity.id() == ACT_NULL ); THEN( "terrain gets converted to new terrain type" ) { - CHECK( mp.ter( tripoint_zero ) == t_dirt ); + CHECK( mp.ter( tripoint_zero ) == ter_t_dirt ); } } @@ -1582,7 +1583,7 @@ TEST_CASE( "prying", "[activity][prying]" ) REQUIRE( dummy.activity.id() == ACT_NULL ); THEN( "terrain gets converted to new type" ) { - CHECK( mp.ter( tripoint_zero ) == t_dirt ); + CHECK( mp.ter( tripoint_zero ) == ter_t_dirt ); } } @@ -1606,7 +1607,7 @@ TEST_CASE( "prying", "[activity][prying]" ) WHEN( "activity fails" ) { CHECK( dummy.activity.id() == ACT_NULL ); - CHECK( mp.ter( terrain_pos ) == t_dirt ); + CHECK( mp.ter( terrain_pos ) == ter_t_dirt ); const map_stack items = get_map().i_at( terrain_pos ); int count_shards = 0; for( const item &it : items ) { diff --git a/tests/stats_tracker_test.cpp b/tests/stats_tracker_test.cpp index f8f020d981159..e0882aa4fb98b 100644 --- a/tests/stats_tracker_test.cpp +++ b/tests/stats_tracker_test.cpp @@ -135,23 +135,22 @@ TEST_CASE( "stats_tracker_minimum_events", "[stats]" ) b.subscribe( &s ); const mtype_id no_monster; - const ter_id t_null( "t_null" ); constexpr event_type am = event_type::avatar_moves; CHECK( s.get_events( am ).minimum( "z" ) == 0 ); - b.send( no_monster, t_null, move_mode_walk, false, 0 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); CHECK( s.get_events( am ).minimum( "z" ) == 0 ); - b.send( no_monster, t_null, move_mode_walk, false, -1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, -1 ); CHECK( s.get_events( am ).minimum( "z" ) == -1 ); - b.send( no_monster, t_null, move_mode_walk, false, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 1 ); CHECK( s.get_events( am ).minimum( "z" ) == -1 ); - b.send( no_monster, t_null, move_mode_walk, false, -3 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, -3 ); CHECK( s.get_events( am ).minimum( "z" ) == -3 ); - b.send( no_monster, t_null, move_mode_walk, true, -1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, -1 ); CHECK( s.get_events( am ).minimum( "z" ) == -3 ); - b.send( no_monster, t_null, move_mode_walk, true, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, 1 ); CHECK( s.get_events( am ).minimum( "z" ) == -3 ); - b.send( no_monster, t_null, move_mode_walk, true, -5 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, -5 ); CHECK( s.get_events( am ).minimum( "z" ) == -5 ); } @@ -162,23 +161,22 @@ TEST_CASE( "stats_tracker_maximum_events", "[stats]" ) b.subscribe( &s ); const mtype_id no_monster; - const ter_id t_null( "t_null" ); constexpr event_type am = event_type::avatar_moves; CHECK( s.get_events( am ).maximum( "z" ) == 0 ); - b.send( no_monster, t_null, move_mode_walk, false, 0 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); CHECK( s.get_events( am ).maximum( "z" ) == 0 ); - b.send( no_monster, t_null, move_mode_walk, false, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 1 ); CHECK( s.get_events( am ).maximum( "z" ) == 1 ); - b.send( no_monster, t_null, move_mode_walk, false, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 1 ); CHECK( s.get_events( am ).maximum( "z" ) == 1 ); - b.send( no_monster, t_null, move_mode_walk, false, 3 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, false, 3 ); CHECK( s.get_events( am ).maximum( "z" ) == 3 ); - b.send( no_monster, t_null, move_mode_walk, true, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, 1 ); CHECK( s.get_events( am ).maximum( "z" ) == 3 ); - b.send( no_monster, t_null, move_mode_walk, true, 1 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, 1 ); CHECK( s.get_events( am ).maximum( "z" ) == 3 ); - b.send( no_monster, t_null, move_mode_walk, true, 5 ); + b.send( no_monster, ter_str_id::NULL_ID(), move_mode_walk, true, 5 ); CHECK( s.get_events( am ).maximum( "z" ) == 5 ); } @@ -219,17 +217,20 @@ TEST_CASE( "stats_tracker_with_event_statistics", "[stats]" ) SECTION( "movement" ) { const mtype_id no_monster; - const ter_id t_null( "t_null" ); const ter_id t_water_dp( "t_water_dp" ); - const cata::event walk = cata::event::make( no_monster, t_null, + const cata::event walk = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); - const cata::event ride = cata::event::make( mon_horse, t_null, + const cata::event ride = cata::event::make( mon_horse, + ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); - const cata::event run = cata::event::make( no_monster, t_null, + const cata::event run = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_run, false, 0 ); - const cata::event crouch = cata::event::make( no_monster, t_null, + const cata::event crouch = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_crouch, false, 0 ); const cata::event swim = cata::event::make( no_monster, t_water_dp, move_mode_walk, false, 0 ); @@ -419,17 +420,20 @@ TEST_CASE( "stats_tracker_watchers", "[stats]" ) SECTION( "movement" ) { const mtype_id no_monster; - const ter_id t_null( "t_null" ); const ter_id t_water_dp( "t_water_dp" ); - const cata::event walk = cata::event::make( no_monster, t_null, + const cata::event walk = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); - const cata::event ride = cata::event::make( mon_horse, t_null, + const cata::event ride = cata::event::make( mon_horse, + ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); - const cata::event run = cata::event::make( no_monster, t_null, + const cata::event run = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_run, false, 0 ); - const cata::event crouch = cata::event::make( no_monster, t_null, + const cata::event crouch = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_crouch, false, 0 ); const cata::event swim = cata::event::make( no_monster, t_water_dp, move_mode_walk, false, 0 ); @@ -790,12 +794,13 @@ TEST_CASE( "achievements_tracker", "[stats]" ) SECTION( "movement" ) { const mtype_id no_monster; - const ter_id t_null( "t_null" ); const ter_id t_water_dp( "t_water_dp" ); const ter_id t_shrub_raspberry( "t_shrub_raspberry" ); - const cata::event walk = cata::event::make( no_monster, t_null, + const cata::event walk = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_walk, false, 0 ); - const cata::event run = cata::event::make( no_monster, t_null, + const cata::event run = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_run, false, 0 ); const cata::event sharp_move = cata::event::make( no_monster, t_shrub_raspberry, move_mode_walk, false, 0 ); @@ -805,9 +810,11 @@ TEST_CASE( "achievements_tracker", "[stats]" ) t_water_dp, move_mode_walk, true, 0 ); const cata::event swim_underwater_deep = cata::event::make( no_monster, t_water_dp, move_mode_walk, true, -5 ); - const cata::event walk_max_z = cata::event::make( no_monster, t_null, + const cata::event walk_max_z = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_walk, false, OVERMAP_HEIGHT ); - const cata::event walk_min_z = cata::event::make( no_monster, t_null, + const cata::event walk_min_z = cata::event::make( no_monster, + ter_str_id::NULL_ID(), move_mode_walk, false, -OVERMAP_DEPTH ); SECTION( "achievement_marathon" ) { diff --git a/tests/submap_load_test.cpp b/tests/submap_load_test.cpp index 0ecb1d6eeda39..6d8dd6b9c0b3e 100644 --- a/tests/submap_load_test.cpp +++ b/tests/submap_load_test.cpp @@ -27,6 +27,13 @@ static const construction_str_id construction_constr_ground_cable( "constr_ground_cable" ); static const construction_str_id construction_constr_rack_coat( "constr_rack_coat" ); +static const ter_str_id ter_t_dirt( "t_dirt" ); +static const ter_str_id ter_t_floor( "t_floor" ); +static const ter_str_id ter_t_floor_blue( "t_floor_blue" ); +static const ter_str_id ter_t_floor_green( "t_floor_green" ); +static const ter_str_id ter_t_floor_red( "t_floor_red" ); +static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); + // NOLINTNEXTLINE(cata-static-declarations) extern const int savegame_version; @@ -837,7 +844,7 @@ static bool is_normal_submap( const submap &sm, submap_checks checks = {} ) // For every point on the submap for( int y = 0; y < SEEY; ++y ) { for( int x = 0; x < SEEX; ++x ) { - if( terrain && sm.get_ter( { x, y } ) != t_dirt ) { + if( terrain && sm.get_ter( { x, y } ) != ter_t_dirt ) { return false; } if( furniture && sm.get_furn( { x, y } ) != f_null ) { @@ -905,28 +912,28 @@ TEST_CASE( "submap_terrain_rle_load", "[submap][load]" ) INFO( string_format( "sw: %s", ter_sw.id().str() ) ); INFO( string_format( "se: %s", ter_se.id().str() ) ); // Require to prevent the lower CHECK from being spammy - REQUIRE( ter_nw == t_floor_green ); - REQUIRE( ter_ne == t_floor_red ); - REQUIRE( ter_sw == t_floor ); - REQUIRE( ter_se == t_floor_blue ); + REQUIRE( ter_nw == ter_t_floor_green ); + REQUIRE( ter_ne == ter_t_floor_red ); + REQUIRE( ter_sw == ter_t_floor ); + REQUIRE( ter_se == ter_t_floor_blue ); // And for the rest of the map, half of it is t_dirt, the other half t_rock_floor for( int x = 1; x < SEEX - 2; ++x ) { - CHECK( sm.get_ter( { x, 0 } ) == t_dirt ); + CHECK( sm.get_ter( { x, 0 } ) == ter_t_dirt ); } for( int y = 1; y < SEEY / 2; ++y ) { for( int x = 0; x < SEEX; ++x ) { - CHECK( sm.get_ter( { x, y } ) == t_dirt ); + CHECK( sm.get_ter( { x, y } ) == ter_t_dirt ); } } for( int y = SEEY / 2; y < SEEY - 1; ++y ) { for( int x = 0; x < SEEX; ++x ) { - CHECK( sm.get_ter( { x, y } ) == t_rock_floor ); + CHECK( sm.get_ter( { x, y } ) == ter_t_rock_floor ); } } for( int x = 1; x < SEEX - 2; ++x ) { - CHECK( sm.get_ter( { x, SEEY - 1 } ) == t_rock_floor ); + CHECK( sm.get_ter( { x, SEEY - 1 } ) == ter_t_rock_floor ); } } @@ -942,12 +949,11 @@ TEST_CASE( "submap_terrain_load_invalid_ter_ids_as_t_dirt", "[submap][load]" ) REQUIRE( error == "invalid ter_str_id 't_this_ter_id_does_not_exist'" ); //capture_debugmsg_during - const ter_id t_dirt( "t_dirt" ); for( int x = 0; x < SEEX; x++ ) { for( int y = 0; y < SEEY; y++ ) { CAPTURE( x, y ); // expect t_rock_floor patch in a corner - const ter_id expected = ( ( x == 11 ) && ( y == 11 ) ) ? t_rock_floor : t_dirt; + const ter_id expected = ( ( x == 11 ) && ( y == 11 ) ) ? ter_t_rock_floor : ter_t_dirt; CHECK( sm.get_ter( {x, y} ) == expected ); } }