From 5a3076811e13e67cadd4dbb4c92eaed5a54f3f3f Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:58:32 +0100 Subject: [PATCH] Squash bc this rebase is already going to be enough of a nightmare Remove remaining fd_null Simplify weird field type loading /tests Remove legacy_enum_id s Rest of /src Remove the list proper Merge weird nested function Make an early return earlier Sanity check some needless if checks --- data/core/sentinels.json | 1 - data/json/field_type.json | 51 ---- .../My_Sweet_Cataclysm/sweet_field_type.json | 1 - data/mods/TEST_DATA/fields.json | 1 - src/activity_actor.cpp | 7 +- src/activity_handlers.cpp | 9 +- src/activity_item_handling.cpp | 9 +- src/ammo_effect.cpp | 20 +- src/ammo_effect.h | 10 +- src/avatar.cpp | 3 +- src/bionics.cpp | 5 +- src/cata_tiles.cpp | 6 +- src/character.cpp | 26 +- src/clzones.cpp | 4 +- src/computer_session.cpp | 13 +- src/creature.h | 1 + src/explosion.cpp | 49 ++-- src/field.cpp | 14 +- src/field.h | 6 +- src/field_type.cpp | 68 +---- src/field_type.h | 56 ---- src/fungal_effects.cpp | 7 +- src/game.cpp | 59 ++-- src/handle_action.cpp | 5 +- src/iexamine.cpp | 7 +- src/item.cpp | 10 +- src/iuse.cpp | 31 +- src/iuse_actor.cpp | 6 +- src/magic_spell_effect.cpp | 8 +- src/map.cpp | 26 +- src/map_extras.cpp | 88 +++--- src/map_field.cpp | 266 +++++++++--------- src/mapgen.cpp | 26 +- src/monattack.cpp | 56 ++-- src/monmove.cpp | 39 ++- src/monster.cpp | 17 +- src/monstergenerator.cpp | 3 +- src/mtype.cpp | 58 ++-- src/mtype.h | 1 - src/mutation.cpp | 8 +- src/npcmove.cpp | 6 +- src/player_hardcoded_effects.cpp | 5 +- src/start_location.cpp | 5 +- src/suffer.cpp | 18 +- src/vehicle.cpp | 9 +- tests/eoc_test.cpp | 7 +- tests/field_test.cpp | 122 ++++---- tests/magic_spell_effect_test.cpp | 18 +- tests/npc_test.cpp | 7 +- tests/string_ids_test.cpp | 17 +- 50 files changed, 610 insertions(+), 685 deletions(-) diff --git a/data/core/sentinels.json b/data/core/sentinels.json index 06a74c091b5f8..c5245352e87c2 100644 --- a/data/core/sentinels.json +++ b/data/core/sentinels.json @@ -41,7 +41,6 @@ { "id": "fd_null", "type": "field_type", - "legacy_enum_id": 0, "intensity_levels": [ { "name": "nothing" } ] }, { diff --git a/data/json/field_type.json b/data/json/field_type.json index 1d7fd291841af..78b6db0033b1d 100644 --- a/data/json/field_type.json +++ b/data/json/field_type.json @@ -2,7 +2,6 @@ { "id": "fd_blood", "type": "field_type", - "legacy_enum_id": 1, "intensity_levels": [ { "name": "blood splatter", "color": "red" }, { "name": "blood stain" }, { "name": "puddle of blood" } ], "description_affix": "covered_in", "underwater_age_speedup": "25 minutes", @@ -16,7 +15,6 @@ { "id": "fd_bile", "type": "field_type", - "legacy_enum_id": 2, "intensity_levels": [ { "name": "bile splatter", "color": "pink" }, { "name": "bile stain" }, { "name": "puddle of bile" } ], "description_affix": "covered_in", "underwater_age_speedup": "25 minutes", @@ -38,7 +36,6 @@ { "id": "fd_gibs_flesh", "type": "field_type", - "legacy_enum_id": 3, "intensity_levels": [ { "name": "scraps of flesh", "sym": "~", "color": "brown" }, { "name": "bloody meat chunks", "color": "light_red" }, @@ -57,7 +54,6 @@ { "id": "fd_gibs_veggy", "type": "field_type", - "legacy_enum_id": 4, "intensity_levels": [ { "name": "shredded leaves and twigs", "sym": "~", "color": "light_green" }, { "name": "shattered branches and leaves" }, @@ -76,7 +72,6 @@ { "id": "fd_web", "type": "field_type", - "legacy_enum_id": 5, "intensity_levels": [ { "name": "cobwebs", @@ -174,7 +169,6 @@ { "id": "fd_slime", "type": "field_type", - "legacy_enum_id": 6, "intensity_levels": [ { "name": "slime trail", "color": "light_green" }, { "name": "slime stain" }, @@ -193,7 +187,6 @@ { "id": "fd_acid", "type": "field_type", - "legacy_enum_id": 7, "intensity_levels": [ { "name": "acid splatter", "sym": "5", "color": "light_green", "dangerous": true }, { "name": "acid streak" }, @@ -212,7 +205,6 @@ { "id": "fd_sap", "type": "field_type", - "legacy_enum_id": 8, "intensity_levels": [ { "name": "sap splatter", @@ -278,7 +270,6 @@ { "id": "fd_sludge", "type": "field_type", - "legacy_enum_id": 9, "mopsafe": true, "intensity_levels": [ { @@ -310,7 +301,6 @@ { "id": "fd_fire", "type": "field_type", - "legacy_enum_id": 10, "intensity_levels": [ { "name": "small fire", @@ -441,7 +431,6 @@ { "id": "fd_rubble", "type": "field_type", - "legacy_enum_id": 11, "intensity_levels": [ { "name": "legacy rubble", "sym": "#", "color": "dark_gray" } ], "description_affix": "covered_in", "half_life": "1 turns", @@ -470,7 +459,6 @@ { "id": "fd_smoke", "type": "field_type", - "legacy_enum_id": 12, "intensity_levels": [ { "name": "thin smoke", @@ -572,7 +560,6 @@ { "id": "fd_toxic_gas", "type": "field_type", - "legacy_enum_id": 13, "intensity_levels": [ { "name": "hazy cloud", @@ -660,7 +647,6 @@ { "id": "fd_pollen_triffid", "type": "field_type", - "legacy_enum_id": 51, "intensity_levels": [ { "name": "hazy cloud", @@ -718,7 +704,6 @@ { "id": "fd_tear_gas", "type": "field_type", - "legacy_enum_id": 14, "intensity_levels": [ { "name": "hazy cloud", "sym": "8", "dangerous": true, "translucency": 1, "concentration": 1 }, { @@ -748,7 +733,6 @@ { "id": "fd_nuke_gas", "type": "field_type", - "legacy_enum_id": 15, "intensity_levels": [ { "name": "hazy cloud", @@ -785,7 +769,6 @@ { "id": "fd_gas_vent", "type": "field_type", - "legacy_enum_id": 16, "intensity_levels": [ { "name": "gas vent", "concentration": 4 }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ], "description_affix": "under", "wandering_field": "fd_toxic_gas", @@ -829,7 +812,6 @@ { "id": "fd_fire_vent", "type": "field_type", - "legacy_enum_id": 17, "intensity_levels": [ { "name": "fire vent", "light_emitted": 20 }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ], "description_affix": "under", "has_fire": true, @@ -848,7 +830,6 @@ { "id": "fd_flame_burst", "type": "field_type", - "legacy_enum_id": 18, "intensity_levels": [ { "name": { "ctxt": "noun", "str": "fire" }, "sym": "5", "color": "red", "dangerous": true, "light_emitted": 20 }, { "//": "repeat last entry" }, @@ -865,7 +846,6 @@ { "id": "fd_electricity", "type": "field_type", - "legacy_enum_id": 19, "intensity_levels": [ { "name": "sparks", "sym": "9", "dangerous": true, "light_emitted": 0.01 }, { "//": "repeat last entry", "light_emitted": 1 }, @@ -889,7 +869,6 @@ { "id": "fd_fatigue", "type": "field_type", - "legacy_enum_id": 20, "intensity_levels": [ { "name": "odd ripple", @@ -919,7 +898,6 @@ { "id": "fd_push_items", "type": "field_type", - "legacy_enum_id": 21, "intensity_levels": [ { "name": "push items", "sym": "&" } ], "priority": -1, "display_items": false, @@ -928,7 +906,6 @@ { "id": "fd_shock_vent", "type": "field_type", - "legacy_enum_id": 22, "intensity_levels": [ { "name": "shock vent", "sym": "&" }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ], "description_affix": "under", "has_elec": true, @@ -941,7 +918,6 @@ { "id": "fd_acid_vent", "type": "field_type", - "legacy_enum_id": 23, "intensity_levels": [ { "name": "acid vent", "sym": "&" }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ], "description_affix": "under", "has_acid": true, @@ -954,7 +930,6 @@ { "id": "fd_plasma", "type": "field_type", - "legacy_enum_id": 24, "intensity_levels": [ { "name": "faint plasma", "color": "magenta", "sym": "9", "light_emitted": 0.01 }, { "name": "glowing plasma", "color": "pink", "light_emitted": 4 }, @@ -971,7 +946,6 @@ { "id": "fd_laser", "type": "field_type", - "legacy_enum_id": 25, "intensity_levels": [ { "name": "faint glimmer", "color": "blue", "sym": "9" }, { "name": "beam of light", "color": "light_blue" }, @@ -989,7 +963,6 @@ { "id": "fd_spotlight", "type": "field_type", - "legacy_enum_id": 26, "intensity_levels": [ { "name": "spotlight", "sym": "&", "light_emitted": 80 } ], "description_affix": "illuminated_by", "priority": 1, @@ -1000,7 +973,6 @@ { "id": "fd_dazzling", "type": "field_type", - "legacy_enum_id": 27, "intensity_levels": [ { "name": "dazzling", @@ -1059,7 +1031,6 @@ { "id": "fd_blood_veggy", "type": "field_type", - "legacy_enum_id": 28, "intensity_levels": [ { "name": "plant sap splatter", "color": "light_green" }, { "name": "plant sap stain" }, @@ -1078,7 +1049,6 @@ { "id": "fd_blood_insect", "type": "field_type", - "legacy_enum_id": 29, "intensity_levels": [ { "name": "bug blood splatter", "color": "green" }, { "name": "bug blood stain" }, { "name": "puddle of bug blood" } ], "description_affix": "covered_in", "underwater_age_speedup": "25 minutes", @@ -1093,7 +1063,6 @@ { "id": "fd_blood_invertebrate", "type": "field_type", - "legacy_enum_id": 30, "intensity_levels": [ { "name": "hemolymph splatter", "color": "light_gray" }, { "name": "hemolymph stain" }, @@ -1112,7 +1081,6 @@ { "id": "fd_gibs_insect", "type": "field_type", - "legacy_enum_id": 31, "intensity_levels": [ { "name": "shards of chitin", "color": "light_green", "sym": "~" }, { "name": "shattered bug leg", "color": "green" }, @@ -1131,7 +1099,6 @@ { "id": "fd_gibs_invertebrate", "type": "field_type", - "legacy_enum_id": 32, "intensity_levels": [ { "name": "gooey scraps", "color": "light_gray", "sym": "~" }, { "name": "icky mess" }, @@ -1150,7 +1117,6 @@ { "id": "fd_cigsmoke", "type": "field_type", - "legacy_enum_id": 33, "intensity_levels": [ { "name": "swirl of tobacco smoke", "translucency": 5 }, { "name": "tobacco smoke", "color": "light_gray" }, @@ -1170,7 +1136,6 @@ { "id": "fd_weedsmoke", "type": "field_type", - "legacy_enum_id": 34, "intensity_levels": [ { "name": "swirl of pot smoke", "translucency": 5 }, { "name": "pot smoke", "color": "light_gray" }, @@ -1191,7 +1156,6 @@ { "id": "fd_cracksmoke", "type": "field_type", - "legacy_enum_id": 35, "intensity_levels": [ { "name": "swirl of crack smoke", "translucency": 5 }, { "name": "crack smoke", "color": "light_gray" }, @@ -1212,7 +1176,6 @@ { "id": "fd_methsmoke", "type": "field_type", - "legacy_enum_id": 36, "intensity_levels": [ { "name": "swirl of meth smoke", "translucency": 5 }, { "name": "meth smoke", "color": "light_gray" }, @@ -1251,7 +1214,6 @@ { "id": "fd_incendiary", "type": "field_type", - "legacy_enum_id": 38, "intensity_levels": [ { "name": "smoke", "sym": "8", "color": "light_red", "dangerous": true, "light_emitted": 20, "translucency": 1 }, { "name": "airborne incendiary", "color": "light_red", "light_emitted": 60, "translucency": 10 }, @@ -1277,7 +1239,6 @@ { "id": "fd_relax_gas", "type": "field_type", - "legacy_enum_id": 39, "intensity_levels": [ { "name": "hazy cloud", @@ -1388,7 +1349,6 @@ { "id": "fd_fungal_haze", "type": "field_type", - "legacy_enum_id": 40, "intensity_levels": [ { "name": "hazy cloud", "sym": ".", "dangerous": true, "concentration": 1 }, { "name": "fungal haze", "color": "cyan", "concentration": 2 }, @@ -1486,7 +1446,6 @@ { "id": "fd_cold_air1", "type": "field_type", - "legacy_enum_id": 41, "intensity_levels": [ { "name": "cold air 1", "sym": "&", "convection_temperature_mod": -2 }, { "color": "blue", "convection_temperature_mod": -4 }, @@ -1502,7 +1461,6 @@ { "id": "fd_cold_air2", "type": "field_type", - "legacy_enum_id": 42, "intensity_levels": [ { "name": "cold air 2", "sym": "&", "convection_temperature_mod": -6 }, { "color": "blue", "convection_temperature_mod": -16 }, @@ -1518,7 +1476,6 @@ { "id": "fd_cold_air3", "type": "field_type", - "legacy_enum_id": 43, "intensity_levels": [ { "name": "cold air 3", "sym": "&", "convection_temperature_mod": -16 }, { "color": "blue", "convection_temperature_mod": -40 }, @@ -1534,7 +1491,6 @@ { "id": "fd_cold_air4", "type": "field_type", - "legacy_enum_id": 44, "intensity_levels": [ { "name": "cold air 4", "sym": "&", "convection_temperature_mod": -70 }, { "color": "blue", "convection_temperature_mod": -100 }, @@ -1550,7 +1506,6 @@ { "id": "fd_hot_air1", "type": "field_type", - "legacy_enum_id": 45, "intensity_levels": [ { "name": "hot air 1", "sym": "&", "convection_temperature_mod": 2 }, { "color": "yellow", "convection_temperature_mod": 6 }, @@ -1566,7 +1521,6 @@ { "id": "fd_hot_air2", "type": "field_type", - "legacy_enum_id": 46, "intensity_levels": [ { "name": "hot air 2", "sym": "&", "convection_temperature_mod": 6 }, { "color": "yellow", "convection_temperature_mod": 16 }, @@ -1582,7 +1536,6 @@ { "id": "fd_hot_air3", "type": "field_type", - "legacy_enum_id": 47, "intensity_levels": [ { "name": "hot air 3", "sym": "&", "convection_temperature_mod": 16 }, { "color": "yellow", "convection_temperature_mod": 40 }, @@ -1598,7 +1551,6 @@ { "id": "fd_hot_air4", "type": "field_type", - "legacy_enum_id": 48, "intensity_levels": [ { "name": "hot air 4", "sym": "&", "convection_temperature_mod": 70 }, { "color": "yellow", "convection_temperature_mod": 100 }, @@ -1689,7 +1641,6 @@ { "id": "fd_fungicidal_gas", "type": "field_type", - "legacy_enum_id": 49, "intensity_levels": [ { "name": "fungicidal mist", "sym": "8", "dangerous": true, "concentration": 1 }, { "name": "fungicidal haze", "color": "light_gray", "concentration": 2 }, @@ -1734,7 +1685,6 @@ { "id": "fd_smoke_vent", "type": "field_type", - "legacy_enum_id": 50, "intensity_levels": [ { "name": "smoke vent", "dangerous": true, "concentration": 4 }, { "//": "repeat last entry" }, @@ -2036,7 +1986,6 @@ { "id": "fd_LIXA_decompression", "type": "field_type", - "legacy_enum_id": 19, "intensity_levels": [ { "name": "decompressed space", diff --git a/data/mods/My_Sweet_Cataclysm/sweet_field_type.json b/data/mods/My_Sweet_Cataclysm/sweet_field_type.json index 73df21fc1a46c..a05dcb4368741 100644 --- a/data/mods/My_Sweet_Cataclysm/sweet_field_type.json +++ b/data/mods/My_Sweet_Cataclysm/sweet_field_type.json @@ -2,7 +2,6 @@ { "id": "fd_gum_web", "type": "field_type", - "legacy_enum_id": 5, "immune_mtypes": [ "mon_spider_gum" ], "decrease_intensity_on_contact": true, "intensity_levels": [ diff --git a/data/mods/TEST_DATA/fields.json b/data/mods/TEST_DATA/fields.json index b0b069f2824d3..3a02a545e52d0 100644 --- a/data/mods/TEST_DATA/fields.json +++ b/data/mods/TEST_DATA/fields.json @@ -2,7 +2,6 @@ { "id": "fd_short_halflife", "type": "field_type", - "legacy_enum_id": 19, "intensity_levels": [ { "name": "sparks", "sym": "9", "dangerous": true, "light_emitted": 0.01 }, { "//": "repeat last entry", "light_emitted": 1 }, diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index af7b7f6c12bcc..6557b6f656967 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -45,7 +45,6 @@ #include "event.h" #include "event_bus.h" #include "faction.h" -#include "field_type.h" #include "fault.h" #include "flag.h" #include "flexbuffer_json-inl.h" @@ -203,6 +202,8 @@ static const efftype_id effect_worked_on( "worked_on" ); static const faction_id faction_your_followers( "your_followers" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const flag_id json_flag_ALWAYS_AIMED( "ALWAYS_AIMED" ); static const flag_id json_flag_NO_RELOAD( "NO_RELOAD" ); @@ -5515,7 +5516,7 @@ void oxytorch_activity_actor::finish( player_activity &act, Character &who ) // 50% chance of starting a fire. if( one_in( 2 ) && here.flammable_items_at( target ) ) { - here.add_field( target, fd_fire, 1, 10_minutes ); + here.add_field( target, field_fd_fire, 1, 10_minutes ); } if( !data->message().empty() ) { @@ -7293,7 +7294,7 @@ void unload_loot_activity_actor::do_turn( player_activity &act, Character &you ) // (to prevent taking out wood off the lit brazier) // and inaccessible furniture, like filled charcoal kiln if( mgr.has( zone_type_LOOT_IGNORE, src, fac_id ) || - here.get_field( src_loc, fd_fire ) != nullptr || + here.get_field( src_loc, field_fd_fire ) != nullptr || !here.can_put_items_ter_furn( src_loc ) ) { continue; } diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 1c7b07a894ef6..ad64d41ffd0b2 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -186,6 +186,8 @@ static const efftype_id effect_social_dissatisfied( "social_dissatisfied" ); static const efftype_id effect_social_satisfied( "social_satisfied" ); static const efftype_id effect_under_operation( "under_operation" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); + static const furn_str_id furn_f_compost_empty( "f_compost_empty" ); static const furn_str_id furn_f_compost_full( "f_compost_full" ); static const furn_str_id furn_f_fvat_empty( "f_fvat_empty" ); @@ -1435,9 +1437,6 @@ void activity_handlers::butcher_finish( player_activity *act, Character *you ) } item &corpse_item = *target; - const mtype *corpse = corpse_item.get_mtype(); - const field_type_id type_blood = corpse->bloodType(); - const field_type_id type_gib = corpse->gibType(); // Dump items from the "container" before destroying it. // Presumably, the character would be doing this while setting up for butchering. @@ -1450,6 +1449,10 @@ void activity_handlers::butcher_finish( player_activity *act, Character *you ) return; } + const mtype *corpse = corpse_item.get_mtype(); + const field_type_id type_blood = corpse->bloodType(); + const field_type_id type_gib = corpse->gibType(); + map &here = get_map(); if( action == butcher_type::DISMEMBER ) { here.add_splatter( type_gib, you->pos_bub(), rng( corpse->size + 2, ( corpse->size + 1 ) * 2 ) ); diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index a4da5ef5aec96..925f0ca33ba20 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -29,7 +29,6 @@ #include "enums.h" #include "faction.h" #include "field.h" -#include "field_type.h" #include "fire.h" #include "flag.h" #include "game.h" @@ -103,6 +102,8 @@ static const addiction_id addiction_alcohol( "alcohol" ); static const efftype_id effect_incorporeal( "incorporeal" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const flag_id json_flag_CUT_HARVEST( "CUT_HARVEST" ); static const flag_id json_flag_MOP( "MOP" ); static const flag_id json_flag_NO_AUTO_CONSUME( "NO_AUTO_CONSUME" ); @@ -2097,7 +2098,7 @@ void activity_on_turn_move_loot( player_activity &act, Character &you ) // and inaccessible furniture, like filled charcoal kiln if( mgr.has( zone_type_LOOT_IGNORE, src, _fac_id( you ) ) || ignore_contents || - here.get_field( src_loc, fd_fire ) != nullptr || + here.get_field( src_loc, field_fd_fire ) != nullptr || !here.can_put_items_ter_furn( src_loc ) ) { continue; } @@ -3402,7 +3403,7 @@ static std::optional find_best_fire( const std::vectorget_field_intensity() > 1 || !here.clear_path( center, pt, PICKUP_RANGE, 1, 100 ) ) { continue; @@ -3685,7 +3686,7 @@ bool try_fuel_fire( player_activity &act, Character &you, const bool starting_fi // Special case: fire containers allow burning logs, so use them as fuel if fire is contained bool contained = here.has_flag_furn( ter_furn_flag::TFLAG_FIRE_CONTAINER, *best_fire ); fire_data fd( 1, contained ); - time_duration fire_age = here.get_field_age( *best_fire, fd_fire ); + time_duration fire_age = here.get_field_age( *best_fire, field_fd_fire ); // Maybe TODO: - refueling in the rain could use more fuel // First, simulate expected burn per turn, to see if we need more fuel diff --git a/src/ammo_effect.cpp b/src/ammo_effect.cpp index ff0a1887d80b8..418fd38a3bf91 100644 --- a/src/ammo_effect.cpp +++ b/src/ammo_effect.cpp @@ -68,7 +68,7 @@ void ammo_effect::load( const JsonObject &jo, const std::string_view ) if( jo.has_member( "aoe" ) ) { JsonObject joa = jo.get_object( "aoe" ); - optional( joa, was_loaded, "field_type", aoe_field_type_name, "fd_null" ); + optional( joa, was_loaded, "field_type", aoe_field_type, field_type_str_id::NULL_ID() ); optional( joa, was_loaded, "intensity_min", aoe_intensity_min, 0 ); optional( joa, was_loaded, "intensity_max", aoe_intensity_max, 0 ); optional( joa, was_loaded, "radius", aoe_radius, 1 ); @@ -81,7 +81,7 @@ void ammo_effect::load( const JsonObject &jo, const std::string_view ) } if( jo.has_member( "trail" ) ) { JsonObject joa = jo.get_object( "trail" ); - optional( joa, was_loaded, "field_type", trail_field_type_name, "fd_null" ); + optional( joa, was_loaded, "field_type", trail_field_type, field_type_str_id::NULL_ID() ); optional( joa, was_loaded, "intensity_min", trail_intensity_min, 0 ); optional( joa, was_loaded, "intensity_max", trail_intensity_max, 0 ); optional( joa, was_loaded, "chance", trail_chance, 100 ); @@ -100,19 +100,10 @@ void ammo_effect::load( const JsonObject &jo, const std::string_view ) } -void ammo_effect::finalize() -{ - for( const ammo_effect &ae : ammo_effects::get_all() ) { - const_cast( ae ).aoe_field_type = field_type_id( ae.aoe_field_type_name ); - const_cast( ae ).trail_field_type = field_type_id( ae.trail_field_type_name ); - } - -} - void ammo_effect::check() const { if( !aoe_field_type.is_valid() ) { - debugmsg( "No such field type %s", aoe_field_type_name ); + debugmsg( "No such field type %s", aoe_field_type.c_str() ); } if( aoe_check_sees_radius < 0 ) { debugmsg( "Value of aoe_check_sees_radius cannot be negative" ); @@ -133,7 +124,7 @@ void ammo_effect::check() const debugmsg( "Maximum intensity must be greater than or equal to minimum intensity" ); } if( !trail_field_type.is_valid() ) { - debugmsg( "No such field type %s", trail_field_type_name ); + debugmsg( "No such field type %s", trail_field_type.c_str() ); } if( trail_chance > 100 || trail_chance <= 0 ) { debugmsg( "Field chance divisor cannot be negative" ); @@ -160,9 +151,6 @@ void ammo_effects::load( const JsonObject &jo, const std::string &src ) void ammo_effects::finalize_all() { get_all_ammo_effects().finalize(); - for( const ammo_effect &ae : get_all_ammo_effects().get_all() ) { - const_cast( ae ).finalize(); - } } void ammo_effects::check_consistency() diff --git a/src/ammo_effect.h b/src/ammo_effect.h index 4bebe763dc087..f8e028bc55902 100644 --- a/src/ammo_effect.h +++ b/src/ammo_effect.h @@ -22,15 +22,11 @@ generic_factory &get_all_ammo_effects(); struct ammo_effect { public: void load( const JsonObject &jo, std::string_view src ); - void finalize(); void check() const; fake_spell spell_data; - field_type_id aoe_field_type = fd_null.id_or( INVALID_FIELD_TYPE_ID ); - /** used during JSON loading only */ + field_type_str_id aoe_field_type = field_type_str_id::NULL_ID(); int trigger_chance = 1; - - std::string aoe_field_type_name = "fd_null"; int aoe_intensity_min = 0; int aoe_intensity_max = 0; int aoe_radius = 1; @@ -48,9 +44,7 @@ struct ammo_effect { std::vector eoc; bool always_cast_spell = false; - field_type_id trail_field_type = fd_null.id_or( INVALID_FIELD_TYPE_ID ); - /** used during JSON loading only */ - std::string trail_field_type_name = "fd_null"; + field_type_str_id trail_field_type = field_type_str_id::NULL_ID(); int trail_intensity_min = 0; int trail_intensity_max = 0; int trail_chance = 100; diff --git a/src/avatar.cpp b/src/avatar.cpp index 1915de0bd29c4..256ddb8f8800c 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -34,7 +34,6 @@ #include "event.h" #include "event_bus.h" #include "faction.h" -#include "field_type.h" #include "flexbuffer_json-inl.h" #include "flexbuffer_json.h" #include "game.h" @@ -107,6 +106,8 @@ static const efftype_id effect_stunned( "stunned" ); static const faction_id faction_your_followers( "your_followers" ); +static const field_type_str_id field_fd_web( "fd_web" ); + static const itype_id itype_guidebook( "guidebook" ); static const itype_id itype_mut_longpull( "mut_longpull" ); diff --git a/src/bionics.cpp b/src/bionics.cpp index cb66c7d45e9b8..3772a00b729ac 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -43,7 +43,6 @@ #include "event.h" #include "event_bus.h" #include "explosion.h" -#include "field_type.h" #include "flag.h" #include "flexbuffer_json-inl.h" #include "flexbuffer_json.h" @@ -136,6 +135,8 @@ static const efftype_id effect_under_operation( "under_operation" ); static const fault_id fault_bionic_salvaged( "fault_bionic_salvaged" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const itype_id itype_anesthetic( "anesthetic" ); static const itype_id itype_radiocontrol( "radiocontrol" ); static const itype_id itype_remotevehcontrol( "remotevehcontrol" ); @@ -930,7 +931,7 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics const std::optional pnt = choose_adjacent( _( "Start a fire where?" ) ); if( pnt && here.is_flammable( *pnt ) && !here.get_field( tripoint_bub_ms( *pnt ), fd_fire ) ) { add_msg_activate(); - here.add_field( *pnt, fd_fire, 1 ); + here.add_field( *pnt, field_fd_fire, 1 ); if( has_trait( trait_PYROMANIA ) ) { add_morale( morale_pyromania_startfire, 5, 10, 3_hours, 2_hours ); rem_morale( morale_pyromania_nofire ); diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp index 72bee0c009d64..5060b02853875 100644 --- a/src/cata_tiles.cpp +++ b/src/cata_tiles.cpp @@ -3710,7 +3710,7 @@ bool cata_tiles::draw_field_or_item( const tripoint &p, const lit_level ll, int auto has_field = [&]( field_type_id fld, const tripoint & q, const bool invis ) -> field_type_id { // go through the fields and see if they are equal - field_type_id found = fd_null; + field_type_id found = field_type_str_id::NULL_ID(); for( std::pair &this_fld : here.field_at( q ) ) { if( this_fld.first == fld ) { @@ -3719,7 +3719,7 @@ bool cata_tiles::draw_field_or_item( const tripoint &p, const lit_level ll, int } const auto it = field_override.find( tripoint_bub_ms( q ) ); return it != field_override.end() ? it->second : - ( !fld_overridden || !invis ) ? found : fd_null; + ( !fld_overridden || !invis ) ? found : field_type_str_id::NULL_ID(); }; // for rotation information const std::array neighborhood = { { @@ -3759,7 +3759,7 @@ bool cata_tiles::draw_field_or_item( const tripoint &p, const lit_level ll, int auto field_at = [&]( const tripoint & q, const bool invis ) -> field_type_id { const auto it = field_override.find( tripoint_bub_ms( q ) ); return it != field_override.end() ? it->second : - ( !fld_overridden || !invis ) ? here.field_at( q ).displayed_field_type() : fd_null; + ( !fld_overridden || !invis ) ? here.field_at( q ).displayed_field_type() : field_type_str_id::NULL_ID(); }; // for rotation information const std::array neighborhood = { diff --git a/src/character.cpp b/src/character.cpp index fed848cef8350..e420ff5a6414e 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -49,7 +49,6 @@ #include "faction.h" #include "fault.h" #include "field.h" -#include "field_type.h" #include "flag.h" #include "fungal_effects.h" #include "game.h" @@ -277,7 +276,16 @@ static const efftype_id effect_winded( "winded" ); static const fault_id fault_bionic_salvaged( "fault_bionic_salvaged" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_bile( "fd_bile" ); +static const field_type_str_id field_fd_blood( "fd_blood" ); +static const field_type_str_id field_fd_blood_insect( "fd_blood_insect" ); +static const field_type_str_id field_fd_blood_invertebrate( "fd_blood_invertebrate" ); +static const field_type_str_id field_fd_blood_veggy( "fd_blood_veggy" ); static const field_type_str_id field_fd_clairvoyant( "fd_clairvoyant" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); +static const field_type_str_id field_fd_gibs_flesh( "fd_gibs_flesh" ); +static const field_type_str_id field_fd_web( "fd_web" ); static const itype_id fuel_type_animal( "animal" ); static const itype_id fuel_type_muscle( "muscle" ); @@ -786,22 +794,22 @@ void Character::starting_inv_damage_worn( int days ) field_type_id Character::bloodType() const { if( has_flag( json_flag_ACIDBLOOD ) ) { - return fd_acid; + return field_fd_acid; } if( has_flag( json_flag_PLANTBLOOD ) ) { - return fd_blood_veggy; + return field_fd_blood_veggy; } if( has_flag( json_flag_INSECTBLOOD ) ) { - return fd_blood_insect; + return field_fd_blood_insect; } if( has_flag( json_flag_INVERTEBRATEBLOOD ) ) { - return fd_blood_invertebrate; + return field_fd_blood_invertebrate; } - return fd_blood; + return field_fd_blood; } field_type_id Character::gibType() const { - return fd_gibs_flesh; + return field_fd_gibs_flesh; } bool Character::in_species( const species_id &spec ) const @@ -7491,7 +7499,7 @@ void Character::vomit() get_event_bus().send( getID() ); if( stomach.contains() != 0_ml ) { - get_map().add_field( adjacent_tile(), fd_bile, 1 ); + get_map().add_field( adjacent_tile(), field_fd_bile, 1 ); add_msg_player_or_npc( m_bad, _( "You throw up heavily!" ), _( " throws up heavily!" ) ); } // needed to ensure digesting vitamin_type::DRUGs are also emptied, even on an empty stomach. @@ -8519,7 +8527,7 @@ void Character::blossoms() sounds::sound( pos(), 10, sounds::sound_t::combat, _( "Pouf!" ), false, "misc", "puff" ); map &here = get_map(); for( const tripoint_bub_ms &tmp : here.points_in_radius( pos_bub(), 2 ) ) { - here.add_field( tmp, fd_fungal_haze, rng( 1, 2 ) ); + here.add_field( tmp, field_fd_fungal_haze, rng( 1, 2 ) ); } } diff --git a/src/clzones.cpp b/src/clzones.cpp index 26540047c64b8..b69a3d8ff47f2 100644 --- a/src/clzones.cpp +++ b/src/clzones.cpp @@ -743,7 +743,7 @@ void zone_data::refresh_display() const zone_type_id type = this->get_type(); - field_type_str_id field = fd_null; + field_type_str_id field = field_type_str_id::NULL_ID(); static const std::vector &all_zone_types = zone_type::get_all(); for( const zone_type &zone : all_zone_types ) { if( zone.id == type ) { @@ -752,7 +752,7 @@ void zone_data::refresh_display() const } } - if( field != fd_null ) { + if( field != field_type_str_id::NULL_ID() ) { tripoint_omt_ms start_ms; tripoint_omt_ms end_ms; diff --git a/src/computer_session.cpp b/src/computer_session.cpp index 441d6dfc5a3db..610259b290a7f 100644 --- a/src/computer_session.cpp +++ b/src/computer_session.cpp @@ -24,7 +24,6 @@ #include "event.h" #include "event_bus.h" #include "explosion.h" -#include "field_type.h" #include "flag.h" #include "game.h" #include "game_constants.h" @@ -68,6 +67,10 @@ static const efftype_id effect_amigara( "amigara" ); +static const field_type_str_id field_fd_nuke_gas( "fd_nuke_gas" ); +static const field_type_str_id field_fd_shock_vent( "fd_shock_vent" ); +static const field_type_str_id field_fd_smoke( "fd_smoke" ); + 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_counter( "f_counter" ); @@ -764,7 +767,7 @@ void computer_session::action_miss_launch() const tripoint_bub_ms nuke_location = { get_player_character().pos_bub() - point( 12, 0 ) }; for( const tripoint_bub_ms &loc : get_map().points_in_radius( nuke_location, 5, 0 ) ) { if( one_in( 4 ) ) { - get_map().add_field( loc, fd_smoke, rng( 1, 9 ) ); + get_map().add_field( loc, field_fd_smoke, rng( 1, 9 ) ); } } @@ -1350,7 +1353,7 @@ void computer_session::action_irradiator() "alarm" ); here.i_rem( dest, it ); here.make_rubble( dest ); - here.propagate_field( dest, fd_nuke_gas, 100, 3 ); + here.propagate_field( dest, field_fd_nuke_gas, 100, 3 ); here.translate_radius( ter_t_water_pool, ter_t_sewage, 8.0, dest, true ); here.adjust_radiation( dest, rng( 50, 500 ) ); for( const tripoint_bub_ms &radorigin : here.points_in_radius( dest, 5 ) ) { @@ -1539,10 +1542,10 @@ void computer_session::action_deactivate_shock_vent() bool has_vent = false; map &here = get_map(); for( const tripoint_bub_ms &dest : here.points_in_radius( player_character.pos_bub(), 10 ) ) { - if( here.get_field( dest, fd_shock_vent ) != nullptr ) { + if( here.get_field( dest, field_fd_shock_vent ) != nullptr ) { has_vent = true; } - here.remove_field( dest, fd_shock_vent ); + here.remove_field( dest, field_fd_shock_vent ); } print_line( _( "Initiating POWER-DIAG ver.2.34…" ) ); if( has_vent ) { diff --git a/src/creature.h b/src/creature.h index 11f32911ddd76..dd24e6c4cb6ae 100644 --- a/src/creature.h +++ b/src/creature.h @@ -752,6 +752,7 @@ class Creature : public viewer static const std::set cmat_fleshnveg; static const std::set cmat_flammable; static const std::set cmat_flameres; + // TODO: Shouldn't these be either determined on creation or be a JSON field? If not change to field_type_str_id virtual field_type_id bloodType() const = 0; virtual field_type_id gibType() const = 0; // TODO: replumb this to use a std::string along with monster flags. diff --git a/src/explosion.cpp b/src/explosion.cpp index 5e29e0a2e9abf..74c9274b26d94 100644 --- a/src/explosion.cpp +++ b/src/explosion.cpp @@ -29,7 +29,6 @@ #include "debug.h" #include "enums.h" #include "fault.h" -#include "field_type.h" #include "flag.h" #include "flexbuffer_json-inl.h" #include "flexbuffer_json.h" @@ -77,6 +76,12 @@ static const efftype_id effect_emp( "emp" ); static const efftype_id effect_stunned( "stunned" ); static const efftype_id effect_teleglow( "teleglow" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_blood( "fd_blood" ); +static const field_type_str_id field_fd_bile( "fd_bile" ); +static const field_type_str_id field_fd_slime( "fd_slime" ); +static const field_type_str_id field_fd_nuke_gas( "fd_nuke_gas" ); + static const furn_str_id furn_f_machinery_electronic( "f_machinery_electronic" ); static const itype_id fuel_type_none( "null" ); @@ -324,7 +329,7 @@ static void do_blast( map *m, const Creature *source, const tripoint_bub_ms &p, if( force > 10.0f || x_in_y( force, 10.0f ) ) { intensity++; } - m->add_field( pt, fd_fire, intensity ); + m->add_field( pt, field_fd_fire, intensity ); } if( const optional_vpart_position vp = m->veh_at( pt ) ) { @@ -868,27 +873,27 @@ void resonance_cascade( const tripoint &p ) case 5: for( int k = i - 1; k <= i + 1; k++ ) { for( int l = j - 1; l <= j + 1; l++ ) { - field_type_id type = fd_null; - switch( rng( 1, 7 ) ) { - case 1: - type = fd_blood; - break; - case 2: - type = fd_bile; - break; - case 3: - case 4: - type = fd_slime; - break; - case 5: - type = fd_fire; - break; - case 6: - case 7: - type = fd_nuke_gas; - break; - } if( !one_in( 3 ) ) { + field_type_str_id type; + switch( rng( 1, 7 ) ) { + case 1: + type = field_fd_blood; + break; + case 2: + type = field_fd_bile; + break; + case 3: + case 4: + type = field_fd_slime; + break; + case 5: + type = field_fd_fire; + break; + case 6: + case 7: + type = field_fd_nuke_gas; + break; + } // TODO: fix point types here.add_field( tripoint_bub_ms{ k, l, p.z }, type, 3 ); } diff --git a/src/field.cpp b/src/field.cpp index 675f34b967965..a466eed5b0f06 100644 --- a/src/field.cpp +++ b/src/field.cpp @@ -9,6 +9,8 @@ #include "make_static.h" #include "rng.h" +static const field_type_str_id field_fd_fire( "fd_fire" ); + std::string field_entry::symbol() const { return get_field_type()->get_symbol( get_field_intensity() - 1 ); @@ -92,7 +94,7 @@ void field_entry::do_decay() age += 1_turns; if( type.obj().half_life > 0_turns && get_field_age() > 0_turns ) { // Legacy handling for fire because it's weird and complicated. - if( type == STATIC( field_type_str_id( "fd_fire" ) ) ) { + if( type == field_fd_fire ) { if( to_turns( type->half_life ) < dice( 2, to_turns( age ) ) ) { set_field_age( 0_turns ); set_field_intensity( get_field_intensity() - 1 ); @@ -109,10 +111,8 @@ void field_entry::do_decay() } } -field::field() - : _displayed_field_type( fd_null.id_or( INVALID_FIELD_TYPE_ID ) ) -{ -} +field::field() : _displayed_field_type( + field_type_str_id::NULL_ID().id_or( field_type_id( -1 ) ) ) {} /* Function: find_field @@ -191,7 +191,7 @@ bool field::remove_field( const field_type_id &field_to_remove ) void field::remove_field( std::map::iterator const it ) { _field_type_list->erase( it ); - _displayed_field_type = fd_null; + _displayed_field_type = field_type_str_id::NULL_ID(); for( auto &fld : *_field_type_list ) { if( !_displayed_field_type || fld.first.obj().priority >= _displayed_field_type.obj().priority ) { _displayed_field_type = fld.first; @@ -202,7 +202,7 @@ void field::remove_field( std::map::iterator const i void field::clear() { _field_type_list->clear(); - _displayed_field_type = fd_null; + _displayed_field_type = field_type_str_id::NULL_ID(); } /* diff --git a/src/field.h b/src/field.h index f5755364384d9..dd462e1b254d7 100644 --- a/src/field.h +++ b/src/field.h @@ -20,10 +20,10 @@ class field_entry { public: - field_entry() : type( fd_null.id_or( INVALID_FIELD_TYPE_ID ) ), intensity( 1 ), age( 0_turns ), - is_alive( false ) { } + field_entry() : type( field_type_str_id::NULL_ID().id_or( field_type_id( -1 ) ) ), + intensity( 1 ), age( 0_turns ), is_alive( false ) {} field_entry( const field_type_id &t, const int i, const time_duration &a ) : type( t ), - intensity( i ), age( a ), is_alive( true ) { } + intensity( i ), age( a ), is_alive( true ) {} nc_color color() const; diff --git a/src/field_type.cpp b/src/field_type.cpp index ed4cb77957342..434df4f4818b4 100644 --- a/src/field_type.cpp +++ b/src/field_type.cpp @@ -8,57 +8,6 @@ #include "generic_factory.h" #include "json.h" -const field_type_str_id fd_null = field_type_str_id::NULL_ID(); -const field_type_str_id fd_acid( "fd_acid" ); -const field_type_str_id fd_acid_vent( "fd_acid_vent" ); -const field_type_str_id fd_bile( "fd_bile" ); -const field_type_str_id fd_blood( "fd_blood" ); -const field_type_str_id fd_blood_insect( "fd_blood_insect" ); -const field_type_str_id fd_blood_invertebrate( "fd_blood_invertebrate" ); -const field_type_str_id fd_blood_veggy( "fd_blood_veggy" ); -const field_type_str_id fd_churned_earth( "fd_churned_earth" ); -const field_type_str_id fd_cold_air2( "fd_cold_air2" ); -const field_type_str_id fd_cold_air3( "fd_cold_air3" ); -const field_type_str_id fd_cold_air4( "fd_cold_air4" ); -const field_type_str_id fd_construction_site( "fd_construction_site" ); -const field_type_str_id fd_dazzling( "fd_dazzling" ); -const field_type_str_id fd_electricity( "fd_electricity" ); -const field_type_str_id fd_electricity_unlit( "fd_electricity_unlit" ); -const field_type_str_id fd_extinguisher( "fd_extinguisher" ); -const field_type_str_id fd_fatigue( "fd_fatigue" ); -const field_type_str_id fd_fire( "fd_fire" ); -const field_type_str_id fd_fire_vent( "fd_fire_vent" ); -const field_type_str_id fd_flame_burst( "fd_flame_burst" ); -const field_type_str_id fd_fungal_haze( "fd_fungal_haze" ); -const field_type_str_id fd_fungicidal_gas( "fd_fungicidal_gas" ); -const field_type_str_id fd_gas_vent( "fd_gas_vent" ); -const field_type_str_id fd_gibs_flesh( "fd_gibs_flesh" ); -const field_type_str_id fd_gibs_insect( "fd_gibs_insect" ); -const field_type_str_id fd_gibs_invertebrate( "fd_gibs_invertebrate" ); -const field_type_str_id fd_gibs_veggy( "fd_gibs_veggy" ); -const field_type_str_id fd_hot_air1( "fd_hot_air1" ); -const field_type_str_id fd_hot_air2( "fd_hot_air2" ); -const field_type_str_id fd_hot_air3( "fd_hot_air3" ); -const field_type_str_id fd_hot_air4( "fd_hot_air4" ); -const field_type_str_id fd_incendiary( "fd_incendiary" ); -const field_type_str_id fd_insecticidal_gas( "fd_insecticidal_gas" ); -const field_type_str_id fd_laser( "fd_laser" ); -const field_type_str_id fd_last_known( "fd_last_known" ); -const field_type_str_id fd_nuke_gas( "fd_nuke_gas" ); -const field_type_str_id fd_plasma( "fd_plasma" ); -const field_type_str_id fd_push_items( "fd_push_items" ); -const field_type_str_id fd_relax_gas( "fd_relax_gas" ); -const field_type_str_id fd_sap( "fd_sap" ); -const field_type_str_id fd_shock_vent( "fd_shock_vent" ); -const field_type_str_id fd_slime( "fd_slime" ); -const field_type_str_id fd_sludge( "fd_sludge" ); -const field_type_str_id fd_smoke( "fd_smoke" ); -const field_type_str_id fd_smoke_vent( "fd_smoke_vent" ); -const field_type_str_id fd_tear_gas( "fd_tear_gas" ); -const field_type_str_id fd_tindalos_rift( "fd_tindalos_rift" ); -const field_type_str_id fd_toxic_gas( "fd_toxic_gas" ); -const field_type_str_id fd_web( "fd_web" ); - namespace io { @@ -158,7 +107,8 @@ int_id string_id::id_or( const int_id &fallb template<> int_id string_id::id() const { - return get_all_field_types().convert( *this, fd_null.id_or( int_id() ) ); + return get_all_field_types().convert( *this, + field_type_str_id::NULL_ID().id_or( int_id() ) ); } /** @relates int_id */ @@ -179,7 +129,6 @@ const field_intensity_level &field_type::get_intensity_level( int level ) const void field_type::load( const JsonObject &jo, const std::string_view ) { - optional( jo, was_loaded, "legacy_enum_id", legacy_enum_id, -1 ); for( const JsonObject jao : jo.get_array( "intensity_levels" ) ) { field_intensity_level intensity_level; field_intensity_level fallback_intensity_level = !intensity_levels.empty() ? intensity_levels.back() @@ -334,7 +283,7 @@ void field_type::finalize() if( !wandering_field.is_valid() ) { debugmsg( "Invalid wandering_field_id %s in field %s.", wandering_field.c_str(), id.c_str() ); - wandering_field = fd_null; + wandering_field = field_type_str_id::NULL_ID(); } for( const mtype_id &m_id : immune_mtypes ) { @@ -412,14 +361,3 @@ const std::vector &field_types::get_all() { return get_all_field_types().get_all(); } - -field_type field_types::get_field_type_by_legacy_enum( int legacy_enum_id ) -{ - for( const field_type &ft : get_all_field_types().get_all() ) { - if( legacy_enum_id == ft.legacy_enum_id ) { - return ft; - } - } - debugmsg( "Cannot find field_type for legacy enum: %d.", legacy_enum_id ); - return field_type(); -} diff --git a/src/field_type.h b/src/field_type.h index 0be98c145fa19..edcb48083b06c 100644 --- a/src/field_type.h +++ b/src/field_type.h @@ -124,59 +124,6 @@ struct field_intensity_level { std::vector field_effects; }; -// NOLINTNEXTLINE(cata-static-int_id-constants) -const field_type_id INVALID_FIELD_TYPE_ID = field_type_id( -1 ); -extern const field_type_str_id fd_null; -extern const field_type_str_id fd_acid; -extern const field_type_str_id fd_acid_vent; -extern const field_type_str_id fd_bile; -extern const field_type_str_id fd_blood; -extern const field_type_str_id fd_blood_insect; -extern const field_type_str_id fd_blood_invertebrate; -extern const field_type_str_id fd_blood_veggy; -extern const field_type_str_id fd_churned_earth; -extern const field_type_str_id fd_construction_site; -extern const field_type_str_id fd_cold_air2; -extern const field_type_str_id fd_cold_air3; -extern const field_type_str_id fd_cold_air4; -extern const field_type_str_id fd_dazzling; -extern const field_type_str_id fd_electricity; -extern const field_type_str_id fd_electricity_unlit; -extern const field_type_str_id fd_extinguisher; -extern const field_type_str_id fd_fatigue; -extern const field_type_str_id fd_fire; -extern const field_type_str_id fd_fire_vent; -extern const field_type_str_id fd_flame_burst; -extern const field_type_str_id fd_fungal_haze; -extern const field_type_str_id fd_fungicidal_gas; -extern const field_type_str_id fd_gas_vent; -extern const field_type_str_id fd_gibs_flesh; -extern const field_type_str_id fd_gibs_insect; -extern const field_type_str_id fd_gibs_invertebrate; -extern const field_type_str_id fd_gibs_veggy; -extern const field_type_str_id fd_hot_air1; -extern const field_type_str_id fd_hot_air2; -extern const field_type_str_id fd_hot_air3; -extern const field_type_str_id fd_hot_air4; -extern const field_type_str_id fd_incendiary; -extern const field_type_str_id fd_insecticidal_gas; -extern const field_type_str_id fd_laser; -extern const field_type_str_id fd_last_known; -extern const field_type_str_id fd_nuke_gas; -extern const field_type_str_id fd_plasma; -extern const field_type_str_id fd_push_items; -extern const field_type_str_id fd_relax_gas; -extern const field_type_str_id fd_sap; -extern const field_type_str_id fd_shock_vent; -extern const field_type_str_id fd_slime; -extern const field_type_str_id fd_sludge; -extern const field_type_str_id fd_smoke; -extern const field_type_str_id fd_smoke_vent; -extern const field_type_str_id fd_tear_gas; -extern const field_type_str_id fd_tindalos_rift; -extern const field_type_str_id fd_toxic_gas; -extern const field_type_str_id fd_web; - struct field_type; struct field_type { @@ -190,8 +137,6 @@ struct field_type { std::vector> src; bool was_loaded = false; - int legacy_enum_id = -1; - std::vector intensity_levels; time_duration underwater_age_speedup = 0_turns; @@ -277,7 +222,6 @@ void reset(); void load_immunity( const JsonObject &jid, field_immunity_data &fd ); const std::vector &get_all(); -field_type get_field_type_by_legacy_enum( int legacy_enum_id ); } // namespace field_types diff --git a/src/fungal_effects.cpp b/src/fungal_effects.cpp index 9ca315662ff92..8a2db4eac8b25 100644 --- a/src/fungal_effects.cpp +++ b/src/fungal_effects.cpp @@ -11,7 +11,6 @@ #include "creature_tracker.h" #include "debug.h" #include "enums.h" -#include "field_type.h" #include "game.h" #include "item.h" #include "item_stack.h" @@ -30,6 +29,8 @@ static const efftype_id effect_spores( "spores" ); static const efftype_id effect_stunned( "stunned" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); + static const furn_str_id furn_f_flower_fungal( "f_flower_fungal" ); static const furn_str_id furn_f_fungal_clump( "f_fungal_clump" ); static const furn_str_id furn_f_fungal_mass( "f_fungal_mass" ); @@ -184,7 +185,7 @@ void fungal_effects::spread_fungus_one_tile( const tripoint_bub_ms &p, const int } } 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( here.get_field_intensity( p, field_fd_fungal_haze ) != 0 ) { if( x_in_y( growth * 10, 800 ) ) { // young trees are vulnerable here.ter_set( p, ter_t_fungus ); if( g->place_critter_at( mon_fungal_blossom, p ) ) { @@ -200,7 +201,7 @@ void fungal_effects::spread_fungus_one_tile( const tripoint_bub_ms &p, const int } } else if( here.has_flag( ter_furn_flag::TFLAG_TREE, p ) ) { if( one_in( 10 ) ) { - if( here.get_field_intensity( p, fd_fungal_haze ) != 0 ) { + if( here.get_field_intensity( p, field_fd_fungal_haze ) != 0 ) { if( x_in_y( growth * 10, 100 ) ) { here.ter_set( p, ter_t_fungus ); if( g->place_critter_at( mon_fungal_blossom, p ) ) { diff --git a/src/game.cpp b/src/game.cpp index a72015fbcf977..e836c917f7707 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -95,7 +95,6 @@ #include "faction.h" #include "fault.h" #include "field.h" -#include "field_type.h" #include "filesystem.h" #include "flag.h" #include "flexbuffer_json-inl.h" @@ -280,6 +279,9 @@ static const efftype_id effect_winded( "winded" ); static const faction_id faction_no_faction( "no_faction" ); static const faction_id faction_your_followers( "your_followers" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const flag_id json_flag_CONVECTS_TEMPERATURE( "CONVECTS_TEMPERATURE" ); static const flag_id json_flag_LEVITATION( "LEVITATION" ); static const flag_id json_flag_NO_RELOAD( "NO_RELOAD" ); @@ -1671,13 +1673,13 @@ units::temperature_delta get_heat_radiation( const tripoint &location ) Character &player_character = get_player_character(); map &here = get_map(); // Convert it to an int id once, instead of 139 times per turn - const field_type_id fd_fire_int = fd_fire.id(); + const field_type_id field_fd_fire_int = field_fd_fire.id(); for( const tripoint_bub_ms &dest : here.points_in_radius( tripoint_bub_ms( location ), 6 ) ) { int heat_intensity = 0; maptile mt = here.maptile_at( dest ); - int ffire = maptile_field_intensity( mt, fd_fire_int ); + int ffire = maptile_field_intensity( mt, field_fd_fire_int ); if( ffire > 0 ) { heat_intensity = ffire; } else { @@ -1707,13 +1709,13 @@ int get_best_fire( const tripoint &location ) Character &player_character = get_player_character(); map &here = get_map(); // Convert it to an int id once, instead of 139 times per turn - const field_type_id fd_fire_int = fd_fire.id(); + const field_type_id field_fd_fire_int = field_fd_fire.id(); for( const tripoint_bub_ms &dest : here.points_in_radius( tripoint_bub_ms( location ), 6 ) ) { int heat_intensity = 0; maptile mt = here.maptile_at( dest ); - int ffire = maptile_field_intensity( mt, fd_fire_int ); + int ffire = maptile_field_intensity( mt, field_fd_fire_int ); if( ffire > 0 ) { heat_intensity = ffire; } else { @@ -1745,7 +1747,7 @@ units::temperature_delta get_convection_temperature( const tripoint &location ) // Directly on lava tiles units::temperature_delta lava_mod = here.tr_at( location ).has_flag( json_flag_CONVECTS_TEMPERATURE ) ? - units::from_fahrenheit_delta( fd_fire->get_intensity_level().convection_temperature_mod ) : + units::from_fahrenheit_delta( field_fd_fire->get_intensity_level().convection_temperature_mod ) : units::from_kelvin_delta( 0 ); // Modifier from fields for( auto &fd : here.field_at( location ) ) { @@ -4387,7 +4389,8 @@ field_entry *game::is_in_dangerous_field() return nullptr; } -std::unordered_set game::get_fishable_locations( int distance, const tripoint &fish_pos ) +std::unordered_set game::get_fishable_locations( int distance, + const tripoint &fish_pos ) { // We're going to get the contiguous fishable terrain starting at // the provided fishing location (e.g. where a line was cast or a fish @@ -5098,7 +5101,8 @@ monster *game::place_critter_at( const shared_ptr_fast &mon, const trip return place_critter_around( mon, p.raw(), 0 ); } -monster *game::place_critter_around( const mtype_id &id, const tripoint ¢er, const int radius ) +monster *game::place_critter_around( const mtype_id &id, const tripoint ¢er, + const int radius ) { // TODO: change this into an assert, it must never happen. if( id.is_null() ) { @@ -5932,7 +5936,7 @@ static std::string get_fire_fuel_string( const tripoint_bub_ms &examp ) { map &here = get_map(); if( here.has_flag( ter_furn_flag::TFLAG_FIRE_CONTAINER, examp ) ) { - field_entry *fire = here.get_field( examp, fd_fire ); + field_entry *fire = here.get_field( examp, field_fd_fire ); if( fire ) { std::string ss; ss += _( "There is a fire here." ); @@ -6602,7 +6606,8 @@ void game::print_fields_info( const tripoint &lp, const catacurses::window &w_lo } } -void game::print_trap_info( const tripoint &lp, const catacurses::window &w_look, const int column, +void game::print_trap_info( const tripoint &lp, const catacurses::window &w_look, + const int column, int &line ) { const trap &tr = m.tr_at( lp ); @@ -6666,7 +6671,8 @@ static void add_visible_items_recursive( std::map &item_order, - std::map &temp_items, const item *it, const tripoint &relative_pos ) + std::map &temp_items, const item *it, + const tripoint &relative_pos ) { const std::string name = it->tname(); @@ -8168,7 +8175,8 @@ bool game::take_screenshot() const #endif //helper method so we can keep list_items shorter -void game::reset_item_list_state( const catacurses::window &window, int height, bool bRadiusSort ) +void game::reset_item_list_state( const catacurses::window &window, int height, + bool bRadiusSort ) { const int width = getmaxx( window ); wattron( window, c_light_gray ); @@ -10854,11 +10862,11 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool if( pulling ) { const tripoint_bub_ms shifted_furn_pos = furn_pos - ms_shift; const tripoint_bub_ms shifted_furn_dest = furn_dest - ms_shift; - const time_duration fire_age = m.get_field_age( shifted_furn_pos, fd_fire ); - const int fire_intensity = m.get_field_intensity( shifted_furn_pos, fd_fire ); - m.remove_field( shifted_furn_pos, fd_fire ); - m.set_field_intensity( shifted_furn_dest, fd_fire, fire_intensity ); - m.set_field_age( shifted_furn_dest, fd_fire, fire_age ); + const time_duration fire_age = m.get_field_age( shifted_furn_pos, field_fd_fire ); + const int fire_intensity = m.get_field_intensity( shifted_furn_pos, field_fd_fire ); + m.remove_field( shifted_furn_pos, field_fd_fire ); + m.set_field_intensity( shifted_furn_dest, field_fd_fire, fire_intensity ); + m.set_field_age( shifted_furn_dest, field_fd_fire, fire_age ); } if( u.is_hauling() ) { @@ -11111,7 +11119,7 @@ point game::place_player( const tripoint &dest_loc, bool quick ) } } else if( pulp_butcher == "pulp" || pulp_butcher == "pulp_adjacent" || pulp_butcher == "pulp_zombie_only" || pulp_butcher == "pulp_adjacent_zombie_only" ) { - const bool acid_immune = u.is_immune_damage( damage_acid ) || u.is_immune_field( fd_acid ); + const bool acid_immune = u.is_immune_damage( damage_acid ) || u.is_immune_field( field_fd_acid ); const auto corpse_available = [&]( const tripoint_bub_ms & pos ) { for( const item &maybe_corpse : m.i_at( pos ) ) { if( maybe_corpse.is_corpse() && maybe_corpse.can_revive() && @@ -11582,8 +11590,8 @@ bool game::grabbed_furn_move( const tripoint &dp ) fo.has_flag( ter_furn_flag::TFLAG_FIRE_CONTAINER ) || fo.has_flag( ter_furn_flag::TFLAG_SEALED ); - const int fire_intensity = m.get_field_intensity( fpos, fd_fire ); - time_duration fire_age = m.get_field_age( fpos, fd_fire ); + const int fire_intensity = m.get_field_intensity( fpos, field_fd_fire ); + time_duration fire_age = m.get_field_age( fpos, field_fd_fire ); int str_req = furntype.move_str_req; // Factor in weight of items contained in the furniture. @@ -11657,9 +11665,9 @@ bool game::grabbed_furn_move( const tripoint &dp ) m.furn_set( fpos, furn_str_id::NULL_ID(), true ); if( fire_intensity == 1 && !pulling_furniture ) { - m.remove_field( fpos, fd_fire ); - m.set_field_intensity( fdest, fd_fire, fire_intensity ); - m.set_field_age( fdest, fd_fire, fire_age ); + m.remove_field( fpos, field_fd_fire ); + m.set_field_intensity( fdest, field_fd_fire, fire_intensity ); + m.set_field_age( fdest, field_fd_fire, fire_age ); } // Is there is only liquids on the ground, remove them after moving furniture. @@ -13718,7 +13726,8 @@ void game::climb_down( const tripoint &examp ) } } -void game::climb_down_using( const tripoint &examp, climbing_aid_id aid_id, bool deploy_affordance ) +void game::climb_down_using( const tripoint &examp, climbing_aid_id aid_id, + bool deploy_affordance ) { const climbing_aid &aid = aid_id.obj(); diff --git a/src/handle_action.cpp b/src/handle_action.cpp index cff4366343f47..2488e5c866f53 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -41,7 +41,6 @@ #include "event_bus.h" #include "faction.h" #include "field.h" -#include "field_type.h" #include "flag.h" #include "game_constants.h" #include "game_inventory.h" @@ -131,6 +130,8 @@ static const efftype_id effect_incorporeal( "incorporeal" ); static const efftype_id effect_laserlocked( "laserlocked" ); static const efftype_id effect_stunned( "stunned" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); + static const flag_id json_flag_MOP( "MOP" ); static const gun_mode_id gun_mode_AUTO( "AUTO" ); @@ -1027,7 +1028,7 @@ avatar::smash_result avatar::smash( tripoint_bub_ms &smashp ) for( const item &maybe_corpse : here.i_at( smashp ) ) { if( is_smashable_corpse( maybe_corpse ) ) { if( maybe_corpse.get_mtype()->bloodType()->has_acid && - !is_immune_field( fd_acid ) ) { + !is_immune_field( field_fd_acid ) ) { if( !query_yn( _( "Are you sure you want to pulp an acid filled corpse?" ) ) ) { return ret; // Player doesn't want an acid bath } diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 025b5e3dbd72d..6c9050e24a475 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -35,7 +35,6 @@ #include "enums.h" #include "event.h" #include "event_bus.h" -#include "field_type.h" #include "flag.h" #include "fungal_effects.h" #include "game.h" @@ -130,6 +129,8 @@ static const efftype_id effect_teleglow( "teleglow" ); static const efftype_id effect_tetanus( "tetanus" ); static const efftype_id effect_weak_antibiotic( "weak_antibiotic" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const furn_str_id furn_f_arcfurnace_empty( "f_arcfurnace_empty" ); static const furn_str_id furn_f_arcfurnace_full( "f_arcfurnace_full" ); static const furn_str_id furn_f_compost_empty( "f_compost_empty" ); @@ -3530,7 +3531,7 @@ void iexamine::fireplace( Character &you, const tripoint_bub_ms &examp ) return; } case 2: { - if( !here.get_field( examp, fd_fire ) && here.add_field( examp, fd_fire, 1 ) ) { + if( !here.get_field( examp, field_fd_fire ) && here.add_field( examp, field_fd_fire, 1 ) ) { you.mod_power_level( -bio_lighter->power_activate ); you.mod_moves( -to_moves( 1_seconds ) ); } else { @@ -3552,7 +3553,7 @@ void iexamine::fireplace( Character &you, const tripoint_bub_ms &examp ) return; } case 4: { - here.remove_field( examp, fd_fire ); + here.remove_field( examp, field_fd_fire ); you.mod_moves( -200 ); you.add_msg_if_player( m_info, _( "With a few determined moves you put out the fire in the %s." ), here.furnname( examp ) ); diff --git a/src/item.cpp b/src/item.cpp index af82241a19c7c..a3ab01ef6cde8 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -50,7 +50,6 @@ #include "explosion.h" #include "faction.h" #include "fault.h" -#include "field_type.h" #include "fire.h" #include "flag.h" #include "game.h" @@ -151,6 +150,9 @@ static const efftype_id effect_weed_high( "weed_high" ); static const fault_id fault_overheat_safety( "fault_overheat_safety" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_weedsmoke( "fd_weedsmoke" ); + static const furn_str_id furn_f_metal_smoking_rack_active( "f_metal_smoking_rack_active" ); static const furn_str_id furn_f_smoking_rack_active( "f_smoking_rack_active" ); static const furn_str_id furn_f_water_mill_active( "f_water_mill_active" ); @@ -13439,7 +13441,7 @@ bool item::process_litcig( map &here, Character *carrier, const tripoint &pos ) } if( typeId() == itype_joint_lit && carrier != nullptr ) { carrier->add_effect( effect_weed_high, 1_minutes ); // one last puff - here.add_field( pos + point( rng( -1, 1 ), rng( -1, 1 ) ), field_type_id( "fd_weedsmoke" ), 2 ); + here.add_field( pos + point( rng( -1, 1 ), rng( -1, 1 ) ), field_fd_weedsmoke, 2 ); weed_msg( *carrier ); } active = false; @@ -13508,11 +13510,11 @@ bool item::process_litcig( map &here, Character *carrier, const tripoint &pos ) if( i.typeId() == typeId() ) { if( here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE, pos ) || here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH, pos ) ) { - here.add_field( pos, fd_fire, 1 ); + here.add_field( pos, field_fd_fire, 1 ); break; } } else if( i.flammable( 0 ) ) { - here.add_field( pos, fd_fire, 1 ); + here.add_field( pos, field_fd_fire, 1 ); break; } } diff --git a/src/iuse.cpp b/src/iuse.cpp index 267696020275a..43d184a912494 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -45,7 +45,6 @@ #include "event_bus.h" #include "explosion.h" #include "field.h" -#include "field_type.h" #include "flag.h" #include "fungal_effects.h" #include "game.h" @@ -238,6 +237,14 @@ static const efftype_id effect_weak_antibiotic_visible( "weak_antibiotic_visible static const efftype_id effect_webbed( "webbed" ); static const efftype_id effect_weed_high( "weed_high" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_extinguisher( "fd_extinguisher" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_incendiary( "fd_incendiary" ); +static const field_type_str_id field_fd_methsmoke( "fd_methsmoke" ); +static const field_type_str_id field_fd_tear_gas( "fd_tear_gas" ); +static const field_type_str_id field_fd_tindalos_rift( "fd_tindalos_rift" ); + static const furn_str_id furn_f_translocator_buoy( "f_translocator_buoy" ); static const harvest_drop_type_id harvest_drop_blood( "blood" ); @@ -1940,7 +1947,7 @@ std::optional iuse::extinguisher( Character *p, item *it, const tripoint & map &here = get_map(); // Reduce the strength of fire (if any) in the target tile. - here.add_field( dest, fd_extinguisher, 3, 10_turns ); + here.add_field( dest, field_fd_extinguisher, 3, 10_turns ); // Also spray monsters in that tile. if( monster *const mon_ptr = get_creature_tracker().creature_at( dest, true ) ) { @@ -1972,7 +1979,7 @@ std::optional iuse::extinguisher( Character *p, item *it, const tripoint & dest.x() += ( dest.x() - p->posx() ); dest.y() += ( dest.y() - p->posy() ); - here.mod_field_intensity( dest, fd_fire, std::min( 0 - rng( 0, 1 ) + rng( 0, 1 ), 0 ) ); + here.mod_field_intensity( dest, field_fd_fire, std::min( 0 - rng( 0, 1 ) + rng( 0, 1 ), 0 ) ); } return 1; @@ -2316,7 +2323,7 @@ std::optional iuse::mace( Character *p, item *it, const tripoint & ) p->mod_moves( -to_moves( 2_seconds ) ); map &here = get_map(); - here.add_field( dest, fd_tear_gas, 2, 3_turns ); + here.add_field( dest, field_fd_tear_gas, 2, 3_turns ); // Also spray monsters in that tile. if( monster *const mon_ptr = get_creature_tracker().creature_at( dest, true ) ) { @@ -3512,7 +3519,7 @@ std::optional iuse::acidbomb_act( Character *p, item *it, const tripoint &p it->charges = -1; map &here = get_map(); for( const tripoint_bub_ms &tmp : here.points_in_radius( tripoint_bub_ms( pos ), 1 ) ) { - here.add_field( tmp, fd_acid, 3 ); + here.add_field( tmp, field_fd_acid, 3 ); } return 1; } @@ -3531,12 +3538,12 @@ std::optional iuse::grenade_inc_act( Character *p, item *, const tripoint & tripoint_bub_ms dest( tripoint_bub_ms( pos ) + point( rng( -5, 5 ), rng( -5, 5 ) ) ); std::vector flames = line_to( tripoint_bub_ms( pos ), dest, 0, 0 ); for( tripoint_bub_ms &flame : flames ) { - here.add_field( flame, fd_fire, rng( 0, 2 ) ); + here.add_field( flame, field_fd_fire, rng( 0, 2 ) ); } } explosion_handler::explosion( p, pos, 8, 0.8, true ); for( const tripoint_bub_ms &dest : here.points_in_radius( tripoint_bub_ms( pos ), 2 ) ) { - here.add_field( dest, fd_incendiary, 3 ); + here.add_field( dest, field_fd_incendiary, 3 ); } avatar &player = get_avatar(); @@ -3556,7 +3563,7 @@ std::optional iuse::molotov_lit( Character *p, item *it, const tripoint &po map &here = get_map(); for( const tripoint_bub_ms &pt : here.points_in_radius( tripoint_bub_ms( pos ), 1, 0 ) ) { const int intensity = 1 + one_in( 3 ) + one_in( 5 ); - here.add_field( pt, fd_fire, intensity ); + here.add_field( pt, field_fd_fire, intensity ); } avatar &player = get_avatar(); if( player.has_trait( trait_PYROMANIA ) && player.sees( pos ) ) { @@ -4481,7 +4488,7 @@ std::optional iuse::call_of_tindalos( Character *p, item *, const tripoint map &here = get_map(); for( const tripoint_bub_ms &dest : here.points_in_radius( p->pos_bub(), 12 ) ) { if( here.is_cornerfloor( dest ) ) { - here.add_field( dest, fd_tindalos_rift, 3 ); + here.add_field( dest, field_fd_tindalos_rift, 3 ); add_msg( m_info, _( "You hear a low-pitched echoing howl." ) ); } } @@ -4920,7 +4927,8 @@ std::optional iuse::spray_can( Character *p, item *it, const tripoint & ) return handle_ground_graffiti( *p, it, _( "Spray what?" ), dest_.value() ); } -std::optional iuse::handle_ground_graffiti( Character &p, item *it, const std::string &prefix, +std::optional iuse::handle_ground_graffiti( Character &p, item *it, + const std::string &prefix, const tripoint &where ) { map &here = get_map(); @@ -5924,7 +5932,8 @@ static std::string colorized_ter_name_flags_at( const tripoint &point, return std::string(); } -static std::string colorized_feature_description_at( const tripoint ¢er_point, bool &item_found, +static std::string colorized_feature_description_at( const tripoint ¢er_point, + bool &item_found, const units::volume &min_visible_volume ) { item_found = false; diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index f6c4fe7767432..1844054c6d668 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -124,6 +124,8 @@ static const efftype_id effect_stunned( "stunned" ); static const fault_id fault_bionic_salvaged( "fault_bionic_salvaged" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const gun_mode_id gun_mode_DEFAULT( "DEFAULT" ); static const itype_id itype_barrel_small( "barrel_small" ); @@ -1336,7 +1338,7 @@ bool firestarter_actor::prep_firestarter_use( const Character &p, tripoint_bub_m return false; } map &here = get_map(); - if( here.get_field( pos, fd_fire ) ) { + if( here.get_field( pos, field_fd_fire ) ) { // check if there's already a fire p.add_msg_if_player( m_info, _( "There is already a fire." ) ); return false; @@ -1392,7 +1394,7 @@ bool firestarter_actor::prep_firestarter_use( const Character &p, tripoint_bub_m void firestarter_actor::resolve_firestarter_use( Character *p, const tripoint_bub_ms &pos ) { - if( get_map().add_field( pos, fd_fire, 1, 10_minutes ) ) { + if( get_map().add_field( pos, field_fd_fire, 1, 10_minutes ) ) { if( !p->has_trait( trait_PYROMANIA ) ) { p->add_msg_if_player( _( "You successfully light a fire." ) ); } else { diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index a642f07c1e1c0..10c989bd6933d 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -32,7 +32,6 @@ #include "enums.h" #include "explosion.h" #include "field.h" -#include "field_type.h" #include "fungal_effects.h" #include "game.h" #include "item.h" @@ -68,6 +67,9 @@ static const efftype_id effect_teleglow( "teleglow" ); +static const field_type_str_id field_fd_fatigue_field( "fd_fatigue_field" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const flag_id json_flag_FIT( "FIT" ); static const json_character_flag json_flag_PRED1( "PRED1" ); @@ -520,7 +522,7 @@ static void damage_targets( const spell &sp, Creature &caster, sp.make_sound( target, caster ); sp.create_field( target, caster ); if( sp.has_flag( spell_flag::IGNITE_FLAMMABLE ) && here.is_flammable( target ) ) { - here.add_field( target, fd_fire, 1, 10_minutes ); + here.add_field( target, field_fd_fire, 1, 10_minutes ); Character &player_character = get_player_character(); if( player_character.has_trait( trait_PYROMANIA ) && @@ -1002,7 +1004,7 @@ void spell_effect::remove_field( const spell &sp, Creature &caster, const tripoi if( fd.first.is_valid() && !fd.first.id().is_null() ) { sp.make_sound( caster.pos_bub(), caster ); - if( fd.first.id() == fd_fatigue ) { + if( fd.first.id() == field_fd_fatigue_field ) { handle_remove_fd_fatigue_field( field_removed, caster ); } else { caster.add_msg_if_player( m_neutral, _( "The %s dissipates." ), diff --git a/src/map.cpp b/src/map.cpp index bfeeb255c4967..5eee6bfd8ff2c 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -43,7 +43,6 @@ #include "enums.h" #include "explosion.h" #include "field.h" -#include "field_type.h" #include "flag.h" #include "fragment_cloud.h" #include "fungal_effects.h" @@ -130,6 +129,10 @@ static const efftype_id effect_incorporeal( "incorporeal" ); static const efftype_id effect_pet( "pet" ); static const field_type_str_id field_fd_clairvoyant( "fd_clairvoyant" ); +static const field_type_str_id field_fd_electricity( "fd_electricity" ); +static const field_type_str_id field_fd_electricity_unlit( "fd_electricity_unlit" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_web( "fd_web" ); static const flag_id json_flag_AVATAR_ONLY( "AVATAR_ONLY" ); static const flag_id json_flag_LEVITATION( "LEVITATION" ); @@ -3669,7 +3672,7 @@ bool map::is_flammable( const tripoint_bub_ms &p ) return true; } - if( get_field_intensity( p, fd_web ) > 0 ) { + if( get_field_intensity( p, field_fd_web ) > 0 ) { return true; } @@ -3782,7 +3785,7 @@ bool map::has_nearby_fire( const tripoint &p, int radius ) const bool map::has_nearby_fire( const tripoint_bub_ms &p, int radius ) const { for( const tripoint_bub_ms &pt : points_in_radius( p, radius ) ) { - if( has_field_at( pt, fd_fire ) ) { + if( has_field_at( pt, field_fd_fire ) ) { return true; } if( has_flag_ter_or_furn( ter_furn_flag::TFLAG_USABLE_FIRE, p ) ) { @@ -4077,7 +4080,8 @@ void map::smash_items( const tripoint_bub_ms &p, const int power, const std::str item_was_damaged = true; } } else { - const field_type_id type_blood = i->is_corpse() ? i->get_mtype()->bloodType() : fd_null; + const field_type_id type_blood = i->is_corpse() ? i->get_mtype()->bloodType() : + field_type_str_id::NULL_ID(); while( ( damage_chance > material_factor || x_in_y( damage_chance, material_factor ) ) && ( i->damage() < i->max_damage() ) ) { i->inc_damage(); @@ -4744,10 +4748,10 @@ void map::shoot( const tripoint_bub_ms &p, projectile &proj, const bool hit_item // only very flammable furn/ter can be set alight with incendiary rounds if( data.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH ) ) { if( incendiary && x_in_y( 1, 10 ) ) { // 10% chance - add_field( p, fd_fire, 1 ); + add_field( p, field_fd_fire, 1 ); } if( ignite ) { - add_field( p, fd_fire, 1 ); + add_field( p, field_fd_fire, 1 ); } } // bash_ter_furn already triggers the alarm @@ -4794,7 +4798,7 @@ void map::shoot( const tripoint_bub_ms &p, projectile &proj, const bool hit_item const std::optional &bash_info = fd.first->bash_info; if( bash_info && bash_info->str_min > 0 ) { if( incendiary ) { - add_field( p, fd_fire, fd.second.get_field_intensity() - 1 ); + add_field( p, field_fd_fire, fd.second.get_field_intensity() - 1 ); } else if( dam > 5 + fd.second.get_field_intensity() * 5 && one_in( 5 - fd.second.get_field_intensity() ) ) { dam -= rng( 1, 2 + fd.second.get_field_intensity() * 2 ); @@ -4881,7 +4885,7 @@ bool map::hit_with_fire( const tripoint_bub_ms &p ) // non passable but flammable terrain, set it on fire if( has_flag( ter_furn_flag::TFLAG_FLAMMABLE, p ) || has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH, p ) ) { - add_field( p, fd_fire, 3 ); + add_field( p, field_fd_fire, 3 ); } return true; } @@ -5575,7 +5579,7 @@ item &map::add_item( const tripoint_bub_ms &p, item new_item, int copies ) return null_item_reference(); } - if( new_item.has_flag( flag_ACT_IN_FIRE ) && get_field( p, fd_fire ) != nullptr ) { + if( new_item.has_flag( flag_ACT_IN_FIRE ) && get_field( p, field_fd_fire ) != nullptr ) { if( new_item.has_flag( flag_BOMB ) && new_item.is_transformable() ) { //Convert a bomb item into its transformable version, e.g. incendiary grenade -> active incendiary grenade new_item.convert( dynamic_cast @@ -6889,8 +6893,8 @@ bool map::add_field( const tripoint_bub_ms &p, const field_type_id &type_id, int } // Hacky way to force electricity fields to become unlit electricity fields - const field_type_id &converted_type_id = ( type_id == fd_electricity || - type_id == fd_electricity_unlit ) ? get_applicable_electricity_field( p ) : type_id; + const field_type_id &converted_type_id = ( type_id == field_fd_electricity || + type_id == field_fd_electricity_unlit ) ? get_applicable_electricity_field( p ) : type_id; const field_type &fd_type = *converted_type_id; intensity = std::min( intensity, fd_type.get_max_intensity() ); diff --git a/src/map_extras.cpp b/src/map_extras.cpp index bcdb49a0eb748..809377554e36e 100644 --- a/src/map_extras.cpp +++ b/src/map_extras.cpp @@ -25,7 +25,6 @@ #include "debug.h" #include "enum_conversions.h" #include "enums.h" -#include "field_type.h" #include "fungal_effects.h" #include "game.h" #include "game_constants.h" @@ -63,6 +62,11 @@ #include "vpart_range.h" #include "weighted_list.h" +static const field_type_str_id field_fd_blood( "fd_blood" ); +static const field_type_str_id field_fd_fatigue( "fd_fatigue" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_gibs_flesh( "fd_gibs_flesh" ); + static const flag_id json_flag_FILTHY( "FILTHY" ); static const furn_str_id furn_f_ash( "f_ash" ); @@ -530,7 +534,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) //50% chance to spawn a dead soldier with a trail of blood if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, { 17, 6, abs_sub.z }, { 19, 3, abs_sub.z } ); + m.add_splatter_trail( field_fd_blood, { 17, 6, abs_sub.z }, { 19, 3, abs_sub.z } ); item body = item::make_corpse(); m.put_items_from_loc( Item_spawn_data_mon_zombie_soldier_death_drops, { 17, 5, abs_sub.z } ); @@ -556,7 +560,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) //10% chance to spawn corpses of bloody people/zombies on every tile of barbed wire fence if( one_in( 10 ) ) { m.add_corpse( i ); - m.add_field( i, fd_blood, rng( 1, 3 ) ); + m.add_field( i, field_fd_blood, rng( 1, 3 ) ); } } @@ -575,14 +579,14 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) for( int i = 0; i < num_mines; i++ ) { const tripoint_omt_ms p2( rng( 3, SEEX * 2 - 4 ), rng( SEEY, SEEY * 2 - 2 ), abs_sub.z ); if( m.tr_at( p2 ).is_null() ) { - m.add_field( p2, fd_blood, rng( 1, 3 ) ); + m.add_field( p2, field_fd_blood, rng( 1, 3 ) ); //10% chance to spawn a corpse of dead people/zombie on a tile with blood if( one_in( 10 ) ) { m.add_corpse( p2 ); for( const tripoint_omt_ms &loc : m.points_in_radius( p2, 1 ) ) { //50% chance to spawn gibs in every tile around corpse in 1-tile radius if( one_in( 2 ) ) { - m.add_field( { loc.xy(), abs_sub.z }, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( { loc.xy(), abs_sub.z }, field_fd_gibs_flesh, rng( 1, 3 ) ); } } } @@ -616,19 +620,19 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) //10% chance to spawn corpses of bloody people/zombies on every tile of barbed wire fence if( one_in( 10 ) ) { m.add_corpse( i ); - m.add_field( i, fd_blood, rng( 1, 3 ) ); + m.add_field( i, field_fd_blood, rng( 1, 3 ) ); } } //50% chance to spawn a blood trail of wounded soldier trying to escape, //but eventually died out of blood loss and wounds and got devoured by zombies if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, { 9, 15, abs_sub.z }, { 11, 18, abs_sub.z } ); - m.add_splatter_trail( fd_blood, { 11, 18, abs_sub.z }, { 11, 21, abs_sub.z } ); + m.add_splatter_trail( field_fd_blood, { 9, 15, abs_sub.z }, { 11, 18, abs_sub.z } ); + m.add_splatter_trail( field_fd_blood, { 11, 18, abs_sub.z }, { 11, 21, abs_sub.z } ); for( const tripoint_omt_ms &loc : m.points_in_radius( tripoint_omt_ms{ 11, 21, abs_sub.z }, 1 ) ) { //50% chance to spawn gibs in every tile around corpse in 1-tile radius if( one_in( 2 ) ) { - m.add_field( { loc.xy(), abs_sub.z }, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( { loc.xy(), abs_sub.z }, field_fd_gibs_flesh, rng( 1, 3 ) ); } } item body = item::make_corpse(); @@ -684,14 +688,14 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) for( int i = 0; i < num_mines; i++ ) { const tripoint_omt_ms p4( rng( 3, SEEX * 2 - 4 ), rng( 1, SEEY ), abs_sub.z ); if( m.tr_at( p4 ).is_null() ) { - m.add_field( p4, fd_blood, rng( 1, 3 ) ); + m.add_field( p4, field_fd_blood, rng( 1, 3 ) ); //10% chance to spawn a corpse of dead people/zombie on a tile with blood if( one_in( 10 ) ) { m.add_corpse( p4 ); for( const tripoint_omt_ms &loc : m.points_in_radius( p4, 1 ) ) { //50% chance to spawn gibs in every tile around corpse in 1-tile radius if( one_in( 2 ) ) { - m.add_field( loc, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( loc, field_fd_gibs_flesh, rng( 1, 3 ) ); } } } @@ -737,9 +741,9 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) std::vector blood_track = line_to( tripoint_omt_ms( 1, 6, abs_sub.z ), tripoint_omt_ms( 8, 6, abs_sub.z ) ); for( tripoint_omt_ms &i : blood_track ) { - m.add_field( i, fd_blood, 1 ); + m.add_field( i, field_fd_blood, 1 ); } - m.add_field( tripoint_omt_ms { 1, 6, abs_sub.z }, fd_gibs_flesh, 1 ); + m.add_field( tripoint_omt_ms { 1, 6, abs_sub.z }, field_fd_gibs_flesh, 1 ); //Add the culprit m.add_vehicle( vehicle_prototype_car_fbi, tripoint_omt_ms( 7, 7, abs_sub.z ), 0_degrees, 70, 1 ); @@ -817,7 +821,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) //10% chance to spawn corpses of bloody people/zombies on every tile of barbed wire fence if( one_in( 10 ) ) { m.add_corpse( i ); - m.add_field( i, fd_blood, rng( 1, 3 ) ); + m.add_field( i, field_fd_blood, rng( 1, 3 ) ); } } @@ -836,14 +840,14 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) for( int i = 0; i < num_mines; i++ ) { const tripoint_omt_ms p6( rng( SEEX + 1, SEEX * 2 - 2 ), rng( 3, SEEY * 2 - 4 ), abs_sub.z ); if( m.tr_at( p6 ).is_null() ) { - m.add_field( p6, fd_blood, rng( 1, 3 ) ); + m.add_field( p6, field_fd_blood, rng( 1, 3 ) ); //10% chance to spawn a corpse of dead people/zombie on a tile with blood if( one_in( 10 ) ) { m.add_corpse( p6 ); for( const tripoint_omt_ms &loc : m.points_in_radius( p6, 1 ) ) { //50% chance to spawn gibs in every tile around corpse in 1-tile radius if( one_in( 2 ) ) { - m.add_field( loc, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( loc, field_fd_gibs_flesh, rng( 1, 3 ) ); } } } @@ -873,7 +877,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) //50% chance to spawn a soldier killed by gunfire, and a trail of blood if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, { 14, 5, abs_sub.z }, { 17, 5, abs_sub.z } ); + m.add_splatter_trail( field_fd_blood, { 14, 5, abs_sub.z }, { 17, 5, abs_sub.z } ); item body = item::make_corpse(); m.put_items_from_loc( Item_spawn_data_mon_zombie_soldier_death_drops, { 15, 5, abs_sub.z } ); @@ -925,7 +929,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) m.put_items_from_loc( Item_spawn_data_mon_zombie_soldier_death_drops, { 23, 12, abs_sub.z } ); m.add_item_or_charges( tripoint_omt_ms{ 23, 12, abs_sub.z }, body ); - m.add_field( tripoint_omt_ms{ 23, 12, abs_sub.z }, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( tripoint_omt_ms{ 23, 12, abs_sub.z }, field_fd_gibs_flesh, rng( 1, 3 ) ); //Spawn broken bench and splintered wood m.furn_set( tripoint_omt_ms{ 23, 13, abs_sub.z }, furn_str_id::NULL_ID() ); @@ -935,7 +939,7 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) for( const tripoint_omt_ms &loc : m.points_in_radius( tripoint_omt_ms{ 23, 12, abs_sub.z }, 1, 0 ) ) { if( one_in( 2 ) ) { - m.add_field( { loc.xy(), abs_sub.z }, fd_blood, rng( 1, 3 ) ); + m.add_field( { loc.xy(), abs_sub.z }, field_fd_blood, rng( 1, 3 ) ); } } //Spawn trash in a crate and its surroundings @@ -979,14 +983,14 @@ static bool mx_minefield( map &, const tripoint &abs_sub ) for( int i = 0; i < num_mines; i++ ) { const tripoint_omt_ms p8( rng( 1, SEEX ), rng( 3, SEEY * 2 - 4 ), abs_sub.z ); if( m.tr_at( p8 ).is_null() ) { - m.add_field( p8, fd_blood, rng( 1, 3 ) ); + m.add_field( p8, field_fd_blood, rng( 1, 3 ) ); //10% chance to spawn a corpse of dead people/zombie on a tile with blood if( one_in( 10 ) ) { m.add_corpse( p8 ); for( const tripoint_omt_ms &loc : m.points_in_radius( p8, 1 ) ) { //50% chance to spawn gibs in every tile around corpse in 1-tile radius if( one_in( 2 ) ) { - m.add_field( loc, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( loc, field_fd_gibs_flesh, rng( 1, 3 ) ); } } } @@ -1050,7 +1054,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) switch( rng( 1, 6 ) ) { //Mycus spreading through the portal case 1: { - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); fungal_effects fe; for( const tripoint_bub_ms &loc : m.points_in_radius( portal_location, 5 ) ) { if( one_in( 3 ) ) { @@ -1064,7 +1068,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) } //Netherworld monsters spawning around the portal case 2: { - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); for( const tripoint_bub_ms &loc : m.points_in_radius( portal_location, 5 ) ) { m.place_spawns( GROUP_NETHER_PORTAL, 15, loc.xy(), loc.xy(), loc.z(), 1, true ); } @@ -1072,7 +1076,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) } //Several cracks in the ground originating from the portal case 3: { - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); for( int i = 0; i < rng( 1, 10 ); i++ ) { tripoint_bub_ms end_location = { rng( 0, SEEX * 2 - 1 ), rng( 0, SEEY * 2 - 1 ), abs_sub.z }; std::vector failure = line_to( portal_location, end_location ); @@ -1084,7 +1088,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) } //Radiation from the portal killed the vegetation case 4: { - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); const int rad = 5; for( int i = p.x() - rad; i <= p.x() + rad; i++ ) { for( int j = p.y() - rad; j <= p.y() + rad; j++ ) { @@ -1125,7 +1129,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) } const tripoint_bub_ms portal_location = { p1 + tripoint_bub_ms( extra.x, extra.y, abs_sub.z ) }; - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); std::set ignited; place_fumarole( m, p1, p2, ignited ); @@ -1137,7 +1141,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) 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_bub_ms( i.x, i.y, abs_sub.z ), fd_fire, 15, 1_minutes ); + m.add_field( tripoint_bub_ms( i.x, i.y, abs_sub.z ), field_fd_fire, 15, 1_minutes ); } } } @@ -1145,7 +1149,7 @@ static bool mx_portal_in( map &m, const tripoint &abs_sub ) } //Anomaly caused by the portal and spawned an artifact case 6: { - m.add_field( portal_location, fd_fatigue, 3 ); + m.add_field( portal_location, field_fd_fatigue, 3 ); artifact_natural_property prop = static_cast( rng( ARTPROP_NULL + 1, ARTPROP_MAX - 1 ) ); m.create_anomaly( portal_location, prop ); @@ -1906,13 +1910,13 @@ static bool mx_casings( map &m, const tripoint &abs_sub ) } //Spawn blood and bloody rag and sometimes trail of blood if( one_in( 2 ) ) { - m.add_field( location, fd_blood, rng( 1, 3 ) ); + m.add_field( location, field_fd_blood, rng( 1, 3 ) ); if( one_in( 2 ) ) { const tripoint_bub_ms bloody_rag_loc = random_entry( m.points_in_radius( location, 3 ) ); m.spawn_item( bloody_rag_loc, itype_sheet_cotton, 1, 0, calendar::start_of_cataclysm, 0, { json_flag_FILTHY } ); } if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, location, + m.add_splatter_trail( field_fd_blood, location, random_entry( m.points_in_radius( location, rng( 1, 4 ) ) ) ); } } @@ -1940,7 +1944,7 @@ static bool mx_casings( map &m, const tripoint &abs_sub ) //Spawn blood and bloody rag in random place if( one_in( 2 ) ) { const tripoint_bub_ms random_place = random_entry( m.points_in_radius( location, rng( 1, 10 ) ) ); - m.add_field( random_place, fd_blood, rng( 1, 3 ) ); + m.add_field( random_place, field_fd_blood, rng( 1, 3 ) ); if( one_in( 2 ) ) { const tripoint_bub_ms bloody_rag_loc = random_entry( m.points_in_radius( random_place, 3 ) ); m.spawn_item( bloody_rag_loc, itype_sheet_cotton, 1, 0, calendar::start_of_cataclysm, 0, { json_flag_FILTHY } ); @@ -1958,7 +1962,7 @@ static bool mx_casings( map &m, const tripoint &abs_sub ) if( one_in( 2 ) ) { m.spawn_items( { i.xy(), abs_sub.z }, items ); if( one_in( 2 ) ) { - m.add_field( { i.xy(), abs_sub.z }, fd_blood, rng( 1, 3 ) ); + m.add_field( { i.xy(), abs_sub.z }, field_fd_blood, rng( 1, 3 ) ); } } } @@ -1972,7 +1976,7 @@ static bool mx_casings( map &m, const tripoint &abs_sub ) } //Spawn blood and bloody rag at the destination if( one_in( 2 ) ) { - m.add_field( from, fd_blood, rng( 1, 3 ) ); + m.add_field( from, field_fd_blood, rng( 1, 3 ) ); if( one_in( 2 ) ) { const tripoint_bub_ms bloody_rag_loc = random_entry( m.points_in_radius( to, 3 ) ); m.spawn_item( bloody_rag_loc, itype_sheet_cotton, 1, 0, calendar::start_of_cataclysm, 0, { json_flag_FILTHY } ); @@ -2009,26 +2013,26 @@ static bool mx_casings( map &m, const tripoint &abs_sub ) } //Spawn blood and bloody rag at the first location, sometimes trail of blood if( one_in( 2 ) ) { - m.add_field( first_loc, fd_blood, rng( 1, 3 ) ); + m.add_field( first_loc, field_fd_blood, rng( 1, 3 ) ); if( one_in( 2 ) ) { const tripoint_bub_ms bloody_rag_loc = random_entry( m.points_in_radius( first_loc, 3 ) ); m.spawn_item( bloody_rag_loc, itype_sheet_cotton, 1, 0, calendar::start_of_cataclysm, 0, { json_flag_FILTHY } ); } if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, first_loc, + m.add_splatter_trail( field_fd_blood, first_loc, random_entry( m.points_in_radius( first_loc, rng( 1, 4 ) ) ) ); } } //Spawn blood and bloody rag at the second location, sometimes trail of blood if( one_in( 2 ) ) { - m.add_field( second_loc, fd_blood, rng( 1, 3 ) ); + m.add_field( second_loc, field_fd_blood, rng( 1, 3 ) ); if( one_in( 2 ) ) { const tripoint_bub_ms bloody_rag_loc = random_entry( m.points_in_radius( second_loc, 3 ) ); m.spawn_item( bloody_rag_loc, itype_sheet_cotton, 1, 0, calendar::start_of_cataclysm, 0, { json_flag_FILTHY } ); } if( one_in( 2 ) ) { - m.add_splatter_trail( fd_blood, second_loc, + m.add_splatter_trail( field_fd_blood, second_loc, random_entry( m.points_in_radius( second_loc, rng( 1, 4 ) ) ) ); } } @@ -2046,7 +2050,7 @@ static bool mx_looters( map &m, const tripoint &abs_sub ) if( one_in( 4 ) && m.passable( center ) ) { m.add_corpse( center ); for( int i = 0; i < rng( 1, 3 ); i++ ) { - m.add_field( random_entry( m.points_in_radius( center, 1 ) ), fd_blood, rng( 1, 3 ) ); + m.add_field( random_entry( m.points_in_radius( center, 1 ) ), field_fd_blood, rng( 1, 3 ) ); } } @@ -2072,12 +2076,12 @@ static bool mx_corpses( map &m, const tripoint &abs_sub ) for( int i = 0; i < num_corpses; i++ ) { const tripoint_bub_ms corpse_location = { rng( 1, SEEX * 2 - 1 ), rng( 1, SEEY * 2 - 1 ), abs_sub.z }; if( m.passable( corpse_location ) ) { - m.add_field( corpse_location, fd_blood, rng( 1, 3 ) ); + m.add_field( corpse_location, field_fd_blood, rng( 1, 3 ) ); m.put_items_from_loc( Item_spawn_data_everyday_corpse, corpse_location ); //50% chance to spawn blood in every tile around every corpse in 1-tile radius for( const tripoint_bub_ms &loc : m.points_in_radius( corpse_location, 1 ) ) { if( one_in( 2 ) ) { - m.add_field( loc, fd_blood, rng( 1, 3 ) ); + m.add_field( loc, field_fd_blood, rng( 1, 3 ) ); } } } @@ -2089,11 +2093,11 @@ static bool mx_corpses( map &m, const tripoint &abs_sub ) item_group::items_from( Item_spawn_data_remains_human_generic, calendar::start_of_cataclysm ); m.spawn_items( corpse_location, gibs ); - m.add_field( corpse_location, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( corpse_location, field_fd_gibs_flesh, rng( 1, 3 ) ); //50% chance to spawn gibs and dogs in every tile around what's left of human corpse in 1-tile radius for( const tripoint_bub_ms &loc : m.points_in_radius( corpse_location, 1 ) ) { if( one_in( 2 ) ) { - m.add_field( { loc.xy(), abs_sub.z }, fd_gibs_flesh, rng( 1, 3 ) ); + m.add_field( { loc.xy(), abs_sub.z }, field_fd_gibs_flesh, rng( 1, 3 ) ); m.place_spawns( GROUP_STRAY_DOGS, 1, loc.xy(), loc.xy(), loc.z(), 1, true ); } } diff --git a/src/map_field.cpp b/src/map_field.cpp index c7125dea292b1..643c7f1ec9061 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -33,7 +33,6 @@ #include "emit.h" #include "enums.h" #include "field.h" -#include "field_type.h" #include "fire.h" #include "fungal_effects.h" #include "game.h" @@ -83,6 +82,36 @@ static const efftype_id effect_quadruped_half( "quadruped_half" ); static const efftype_id effect_stunned( "stunned" ); static const efftype_id effect_teargas( "teargas" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_acid_vent( "fd_acid_vent" ); +static const field_type_str_id field_fd_dazzling( "fd_dazzling" ); +static const field_type_str_id field_fd_electricity( "fd_electricity" ); +static const field_type_str_id field_fd_electricity_unlit( "fd_electricity_unlit" ); +static const field_type_str_id field_fd_extinguisher( "fd_extinguisher" ); +static const field_type_str_id field_fd_fatigue( "fd_fatigue" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_fire_vent( "fd_fire_vent" ); +static const field_type_str_id field_fd_flame_burst( "fd_flame_burst" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); +static const field_type_str_id field_fd_fungicidal_gas( "fd_fungicidal_gas" ); +static const field_type_str_id field_fd_hot_air1( "fd_hot_air1" ); +static const field_type_str_id field_fd_hot_air2( "fd_hot_air2" ); +static const field_type_str_id field_fd_hot_air3( "fd_hot_air3" ); +static const field_type_str_id field_fd_hot_air4( "fd_hot_air4" ); +static const field_type_str_id field_fd_incendiary( "fd_incendiary" ); +static const field_type_str_id field_fd_insecticidal_gas( "fd_insecticidal_gas" ); +static const field_type_str_id field_fd_last_known( "fd_last_known" ); +static const field_type_str_id field_fd_nuke_gas( "fd_nuke_gas" ); +static const field_type_str_id field_fd_push_items( "fd_push_items" ); +static const field_type_str_id field_fd_relax_gas( "fd_relax_gas" ); +static const field_type_str_id field_fd_sap( "fd_sap" ); +static const field_type_str_id field_fd_shock_vent( "fd_shock_vent" ); +static const field_type_str_id field_fd_sludge( "fd_sludge" ); +static const field_type_str_id field_fd_smoke( "fd_smoke" ); +static const field_type_str_id field_fd_tear_gas( "fd_tear_gas" ); +static const field_type_str_id field_fd_toxic_gas( "fd_toxic_gas" ); +static const field_type_str_id field_fd_web( "fd_web" ); + static const flag_id json_flag_NO_UNLOAD( "NO_UNLOAD" ); static const furn_str_id furn_f_ash( "f_ash" ); @@ -424,16 +453,16 @@ void map::create_hot_air( const tripoint_bub_ms &p, int intensity ) field_type_id hot_air; switch( intensity ) { case 1: - hot_air = fd_hot_air1; + hot_air = field_fd_hot_air1; break; case 2: - hot_air = fd_hot_air2; + hot_air = field_fd_hot_air2; break; case 3: - hot_air = fd_hot_air3; + hot_air = field_fd_hot_air3; break; case 4: - hot_air = fd_hot_air4; + hot_air = field_fd_hot_air4; break; default: debugmsg( "Tried to spread hot air with intensity %d", intensity ); @@ -486,8 +515,8 @@ void map::process_fields_in_submap( submap *const current_submap, om_ter, *this, map_tile, - fd_null, - &( *fd_null ) + field_type_str_id::NULL_ID(), + &( *field_type_str_id::NULL_ID() ) }; // Loop through all tiles in this submap indicated by current_submap @@ -579,9 +608,9 @@ static void field_processor_fd_acid( const tripoint &p, field_entry &cur, field_ // Try to fall by a z-level tripoint_bub_ms dst{ p.x, p.y, p.z - 1 }; if( pd.here.valid_move( p, dst.raw(), true, true ) ) { - field_entry *acid_there = pd.here.get_field( dst, fd_acid ); + field_entry *acid_there = pd.here.get_field( dst, field_fd_acid ); if( !acid_there ) { - pd.here.add_field( dst, fd_acid, cur.get_field_intensity(), cur.get_field_age() ); + pd.here.add_field( dst, field_fd_acid, cur.get_field_intensity(), cur.get_field_age() ); } else { // Math can be a bit off, // but "boiling" falling acid can be allowed to be stronger @@ -606,10 +635,10 @@ static void field_processor_fd_extinguisher( const tripoint &p, field_entry &cur field_proc_data &pd ) { // if( cur_fd_type_id == fd_extinguisher ) - if( field_entry *fire_here = pd.map_tile.find_field( fd_fire ) ) { + if( field_entry *fire_here = pd.map_tile.find_field( field_fd_fire ) ) { // extinguisher fights fire in 1:1 ratio const int min_int = std::min( fire_here->get_field_intensity(), cur.get_field_intensity() ); - pd.here.mod_field_intensity( p, fd_fire, -min_int ); + pd.here.mod_field_intensity( p, field_fd_fire, -min_int ); cur.mod_field_intensity( -min_int ); } } @@ -675,7 +704,7 @@ void field_processor_fd_fire_vent( const tripoint &p, field_entry &cur, field_pr } pd.here.create_hot_air( p, cur.get_field_intensity() ); } else { - pd.here.add_field( p, fd_flame_burst, 3, cur.get_field_age() ); + pd.here.add_field( p, field_fd_flame_burst, 3, cur.get_field_age() ); cur.set_field_intensity( 0 ); } } @@ -687,7 +716,7 @@ void field_processor_fd_flame_burst( const tripoint &p, field_entry &cur, field_ cur.set_field_intensity( cur.get_field_intensity() - 1 ); pd.here.create_hot_air( p, cur.get_field_intensity() ); } else { - pd.here.add_field( p, fd_fire_vent, 3, cur.get_field_age() ); + pd.here.add_field( p, field_fd_fire_vent, 3, cur.get_field_age() ); cur.set_field_intensity( 0 ); } } @@ -841,7 +870,7 @@ static void field_processor_fd_push_items( const tripoint &p, field_entry &, fie } else { std::vector valid; for( const tripoint_bub_ms &dst : points_in_radius( tripoint_bub_ms( p ), 1 ) ) { - if( dst.raw() != p && pd.here.get_field( dst, fd_push_items ) ) { + if( dst.raw() != p && pd.here.get_field( dst, field_fd_push_items ) ) { valid.push_back( dst ); } } @@ -896,7 +925,7 @@ static void field_processor_fd_shock_vent( const tripoint &p, field_entry &cur, point bolt = p.xy(); for( int n = 0; n < dist; n++ ) { bolt += dir; - pd.here.add_field( tripoint_bub_ms( bolt.x, bolt.y, p.z ), fd_electricity, rng( 2, 3 ) ); + pd.here.add_field( tripoint_bub_ms( bolt.x, bolt.y, p.z ), field_fd_electricity, rng( 2, 3 ) ); if( one_in( 4 ) ) { if( dir.x == 0 ) { dir.x = rng( 0, 1 ) * 2 - 1; @@ -926,14 +955,14 @@ static void field_processor_fd_acid_vent( const tripoint &p, field_entry &cur, f } else { cur.set_field_intensity( 3 ); for( const tripoint_bub_ms &t : points_in_radius( tripoint_bub_ms( p ), 5 ) ) { - const field_entry *acid = pd.here.get_field( t, fd_acid ); + const field_entry *acid = pd.here.get_field( t, field_fd_acid ); if( acid && acid->get_field_intensity() == 0 ) { int new_intensity = 3 - rl_dist( p, t.raw() ) / 2 + ( one_in( 3 ) ? 1 : 0 ); if( new_intensity > 3 ) { new_intensity = 3; } if( new_intensity > 0 ) { - pd.here.add_field( t, fd_acid, new_intensity ); + pd.here.add_field( t, field_fd_acid, new_intensity ); } } } @@ -948,12 +977,12 @@ void field_processor_fd_incendiary( const tripoint &p, field_entry &cur, field_p if( pd.here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE, dst ) || pd.here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH, dst ) || pd.here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_HARD, dst ) ) { - pd.here.add_field( dst, fd_fire, 1 ); + pd.here.add_field( dst, field_fd_fire, 1 ); } // Check piles for flammable items and set those on fire if( pd.here.flammable_items_at( dst ) ) { - pd.here.add_field( dst, fd_fire, 1 ); + pd.here.add_field( dst, field_fd_fire, 1 ); } pd.here.create_hot_air( p, cur.get_field_intensity() ); @@ -983,7 +1012,6 @@ static void field_processor_fd_fungicidal_gas( const tripoint &p, field_entry &c void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_data &pd ) { - const field_type_id fd_fire = ::fd_fire; map &here = pd.here; maptile &map_tile = pd.map_tile; const oter_id om_ter = pd.om_ter; @@ -1134,9 +1162,9 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da tripoint_bub_ms dst{ p.x, p.y, p.z - 1 }; if( here.valid_move( p, dst.raw(), true, true ) ) { maptile dst_tile = here.maptile_at_internal( dst ); - field_entry *fire_there = dst_tile.find_field( fd_fire ); + field_entry *fire_there = dst_tile.find_field( field_fd_fire ); if( !fire_there ) { - here.add_field( dst, fd_fire, 1, 0_turns, false ); + here.add_field( dst, field_fd_fire, 1, 0_turns, false ); cur.mod_field_intensity( -1 ); } else { // Don't fuel raging fires or they'll burn forever @@ -1211,7 +1239,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da count != neighs.size() && cur.get_field_age() < 0_turns; i = ( i + 1 ) % neighs.size(), count++ ) { maptile &dst = neighs[i].second; - field_entry *dstfld = dst.find_field( fd_fire ); + field_entry *dstfld = dst.find_field( field_fd_fire ); // If the fire exists and is weaker than ours, boost it if( dstfld && ( dstfld->get_field_intensity() <= cur.get_field_intensity() || @@ -1236,7 +1264,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da count != neighbour_vec.size() && cur.get_field_age() < 0_turns; i = ( i + 1 ) % neighbour_vec.size(), count++ ) { maptile &dst = neighs[neighbour_vec[i]].second; - field_entry *dstfld = dst.find_field( fd_fire ); + field_entry *dstfld = dst.find_field( field_fd_fire ); // If the fire exists and is weaker than ours, boost it if( dstfld && ( dstfld->get_field_intensity() <= cur.get_field_intensity() || @@ -1274,7 +1302,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da maximum_intensity = 3; } else { for( auto &neigh : neighs ) { - if( neigh.second.get_field().find_field( fd_fire ) ) { + if( neigh.second.get_field().find_field( field_fd_fire ) ) { adjacent_fires++; } } @@ -1307,11 +1335,11 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da dst_ter.has_flag( ter_furn_flag::TFLAG_FLAMMABLE ) || dst_ter.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH ) || dst_ter.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_HARD ) ) { - field_entry *nearfire = dst.find_field( fd_fire ); + field_entry *nearfire = dst.find_field( field_fd_fire ); if( nearfire != nullptr ) { nearfire->mod_field_age( -2_turns ); } else { - here.add_field( dst_p, fd_fire, 1, 0_turns, false ); + here.add_field( dst_p, field_fd_fire, 1, 0_turns, false ); } // Fueling fires above doesn't cost fuel } @@ -1335,12 +1363,12 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da // This will create small oddities on map edges, but nothing more noticeable than // "cut-off" that happens with bounds checks. - if( dst.find_field( fd_fire ) ) { + if( dst.find_field( field_fd_fire ) ) { // We handled supporting fires in the section above, no need to do it here continue; } - field_entry *nearwebfld = dst.find_field( fd_web ); + field_entry *nearwebfld = dst.find_field( field_fd_web ); int spread_chance = 25 * ( cur.get_field_intensity() - 1 ); if( nearwebfld ) { spread_chance = 50 + spread_chance / 2; @@ -1365,7 +1393,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da ) ) { // Nearby open flammable ground? Set it on fire. // Make the new fire quite weak, so that it doesn't start jumping around instantly - if( here.add_field( dst_p, fd_fire, 1, 2_minutes, false ) ) { + if( here.add_field( dst_p, field_fd_fire, 1, 2_minutes, false ) ) { // Consume a bit of our fuel cur.set_field_age( cur.get_field_age() + 1_minutes ); } @@ -1395,12 +1423,12 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da // This will create small oddities on map edges, but nothing more noticeable than // "cut-off" that happens with bounds checks. - if( dst.find_field( fd_fire ) ) { + if( dst.find_field( field_fd_fire ) ) { // We handled supporting fires in the section above, no need to do it here continue; } - field_entry *nearwebfld = dst.find_field( fd_web ); + field_entry *nearwebfld = dst.find_field( field_fd_web ); int spread_chance = 25 * ( cur.get_field_intensity() - 1 ); if( nearwebfld ) { spread_chance = 50 + spread_chance / 2; @@ -1425,7 +1453,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da ) ) { // Nearby open flammable ground? Set it on fire. // Make the new fire quite weak, so that it doesn't start jumping around instantly - if( here.add_field( dst_p, fd_fire, 1, 2_minutes, false ) ) { + if( here.add_field( dst_p, field_fd_fire, 1, 2_minutes, false ) ) { // Consume a bit of our fuel cur.set_field_age( cur.get_field_age() + 1_minutes ); } @@ -1443,7 +1471,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da if( smoke_up ) { tripoint_bub_ms up{p + tripoint_above}; if( here.has_flag_ter( ter_furn_flag::TFLAG_NO_FLOOR, up ) ) { - here.add_field( up, fd_smoke, rng( 1, cur.get_field_intensity() ), 0_turns, false ); + here.add_field( up, field_fd_smoke, rng( 1, cur.get_field_intensity() ), 0_turns, false ); } else { // Can't create smoke above smoke_up = false; @@ -1452,7 +1480,7 @@ void field_processor_fd_fire( const tripoint &p, field_entry &cur, field_proc_da if( !smoke_up ) { // Create thicker smoke - here.add_field( p, fd_smoke, cur.get_field_intensity(), 0_turns, false ); + here.add_field( p, field_fd_smoke, cur.get_field_intensity(), 0_turns, false ); } } @@ -1506,8 +1534,9 @@ void map::player_in_field( Character &you ) } // Do things based on what field effect we are currently in. + // TODO: Would this be better as a static map of field_type_id/field_type_str_id -> function? const field_type_id ft = cur.get_field_type(); - if( ft == fd_acid ) { + if( ft == field_fd_acid ) { // Assume vehicles block acid damage entirely, // you're certainly not standing in it. if( !you.in_vehicle && !you.has_trait( trait_ACIDPROOF ) ) { @@ -1542,29 +1571,26 @@ void map::player_in_field( Character &you ) you.string_for_ground_contact_bodyparts( bps ) ) ); } else if( on_ground ) { you.add_msg_if_player( m_warning, _( "You're lying in a pool of acid!" ) ); - } else if( !you.is_immune_field( fd_acid ) ) { + } else if( !you.is_immune_field( field_fd_acid ) ) { you.add_msg_if_player( m_warning, _( "You're standing in a pool of acid!" ) ); } you.check_dead_state(); } - } - if( ft == fd_sap ) { + } else if( ft == field_fd_sap ) { // Sap does nothing to cars. if( !you.in_vehicle ) { // Use up sap. mod_field_intensity( you.pos_bub(), ft, -1 ); } - } - if( ft == fd_sludge ) { + } else if( ft == field_fd_sludge ) { // Sludge is on the ground, but you are above the ground when boarded on a vehicle if( !you.has_trait( trait_GASTROPOD_FOOT ) && ( !you.in_vehicle ) ) { you.add_msg_if_player( m_bad, _( "The sludge is thick and sticky. You struggle to pull free." ) ); you.mod_moves( -cur.get_field_intensity() * 300 ); cur.set_field_intensity( 0 ); } - } - if( ft == fd_fire ) { + } else if( ft == field_fd_fire ) { // Heatsink or suit prevents ALL fire damage. if( !you.has_flag( json_flag_HEATSINK ) && !you.is_wearing( itype_rm13_armor_on ) ) { @@ -1651,8 +1677,7 @@ void map::player_in_field( Character &you ) } } - } - if( ft == fd_tear_gas ) { + } else if( ft == field_fd_tear_gas ) { // Tear gas will both give you teargas disease and/or blind you. if( ( cur.get_field_intensity() > 1 || !one_in( 3 ) ) && ( !inside || one_in( 3 ) ) ) { you.add_env_effect( effect_teargas, bodypart_id( "mouth" ), 5, 20_seconds ); @@ -1661,28 +1686,12 @@ void map::player_in_field( Character &you ) you.add_env_effect( effect_blind, bodypart_id( "eyes" ), cur.get_field_intensity() * 2, 10_seconds ); } - } - if( ft == fd_fungal_haze ) { + } else if( ft == field_fd_fungal_haze ) { if( !you.has_trait( trait_M_IMMUNE ) && ( !inside || one_in( 4 ) ) ) { you.add_env_effect( effect_fungus, bodypart_id( "mouth" ), 4, 10_minutes, true ); you.add_env_effect( effect_fungus, bodypart_id( "eyes" ), 4, 10_minutes, true ); } - } - - if( cur.get_intensity_level().extra_radiation_min > 0 ) { - const field_intensity_level &int_level = cur.get_intensity_level(); - // Get irradiated by the nuclear fallout. - const float rads = rng( int_level.extra_radiation_min + 1, - int_level.extra_radiation_max * ( int_level.extra_radiation_max + 1 ) ); - const bool rad_proof = !you.irradiate( rads ); - // TODO: Reduce damage for rad resistant? - if( int_level.extra_radiation_min > 0 && !rad_proof ) { - you.add_msg_if_player( m_bad, int_level.radiation_hurt_message.translated() ); - you.hurtall( rng( int_level.radiation_hurt_damage_min, int_level.radiation_hurt_damage_max ), - nullptr ); - } - } - if( ft == fd_flame_burst ) { + } else if( ft == field_fd_flame_burst ) { // A burst of flame? Only hits the legs and torso. if( !inside ) { // Fireballs can't touch you inside a car. @@ -1700,8 +1709,7 @@ void map::player_in_field( Character &you ) _( "Those flames do not burn ." ) ); } } - } - if( ft == fd_electricity ) { + } else if( ft == field_fd_electricity ) { // Small universal damage based on intensity, only if not electroproofed and not in vehicle. if( cur.get_field_intensity() > 0 && !you.is_elec_immune() && !you.in_vehicle ) { const bodypart_id &main_part = bodypart_id( "torso" ); @@ -1723,8 +1731,7 @@ void map::player_in_field( Character &you ) _( "The electric cloud doesn't seem to affect ." ) ); } } - } - if( ft == fd_fatigue ) { + } else if( ft == field_fd_fatigue ) { // Assume the rift is on the ground for now to prevent issues with the player being unable access vehicle controls on the same tile due to teleportation. if( !you.in_vehicle ) { // Teleports you... somewhere. @@ -1734,13 +1741,11 @@ void map::player_in_field( Character &you ) teleport::teleport( you ); } } - } - // Why do these get removed??? - // Stepping on a shock vent shuts it down. - if( ft == fd_shock_vent || ft == fd_acid_vent ) { + } else if( ft == field_fd_shock_vent || ft == field_fd_acid_vent ) { + // Why do these get removed??? + // Stepping on a shock vent shuts it down. cur.set_field_intensity( 0 ); - } - if( ft == fd_incendiary ) { + } else if( ft == field_fd_incendiary ) { // Mysterious incendiary substance melts you horribly. if( you.has_trait( trait_M_SKIN2 ) || you.has_trait( trait_M_SKIN3 ) || @@ -1754,9 +1759,8 @@ void map::player_in_field( Character &you ) you.add_effect( effect_onfire, 8_turns, bodypart_id( "torso" ) ); you.hurtall( rng( 2, 6 ), nullptr ); } - } - // Both gases are unhealthy and become deadly if you cross a related threshold. - if( ft == fd_fungicidal_gas || ft == fd_insecticidal_gas ) { + } else if( ft == field_fd_fungicidal_gas || ft == field_fd_insecticidal_gas ) { + // Both gases are unhealthy and become deadly if you cross a related threshold. // The gas won't harm you inside a vehicle. if( !inside ) { // Full body suits protect you from the effects of the gas. @@ -1767,7 +1771,7 @@ void map::player_in_field( Character &you ) bool inhaled = you.add_env_effect( effect_poison, bodypart_id( "mouth" ), 5, intensity * 1_minutes ); if( you.has_trait( trait_THRESH_MYCUS ) || you.has_trait( trait_THRESH_MARLOSS ) || - ( ft == fd_insecticidal_gas && + ( ft == field_fd_insecticidal_gas && ( you.has_trait( trait_THRESH_INSECT ) || you.has_trait( trait_THRESH_SPIDER ) ) ) ) { inhaled |= you.add_env_effect( effect_badpoison, bodypart_id( "mouth" ), 5, intensity * 1_minutes ); @@ -1781,6 +1785,20 @@ void map::player_in_field( Character &you ) } } } + + if( cur.get_intensity_level().extra_radiation_min > 0 ) { + const field_intensity_level &int_level = cur.get_intensity_level(); + // Get irradiated by the nuclear fallout. + const float rads = rng( int_level.extra_radiation_min + 1, + int_level.extra_radiation_max * ( int_level.extra_radiation_max + 1 ) ); + const bool rad_proof = !you.irradiate( rads ); + // TODO: Reduce damage for rad resistant? + if( int_level.extra_radiation_min > 0 && !rad_proof ) { + you.add_msg_if_player( m_bad, int_level.radiation_hurt_message.translated() ); + you.hurtall( rng( int_level.radiation_hurt_damage_min, int_level.radiation_hurt_damage_max ), + nullptr ); + } + } // Process npc complaints (moved here from fields processing) if( const int chance = std::get<0>( ft->npc_complain_data ) ) { if( you.is_npc() && chance > 0 && one_in( chance ) ) { @@ -1888,27 +1906,26 @@ void map::monster_in_field( monster &z ) if( !cur.is_field_alive() ) { continue; } + + // TODO: Would this be better as a static map of field_type_id/field_type_str_id -> function? const field_type_id cur_field_type = cur.get_field_type(); - if( cur_field_type == fd_acid ) { + if( cur_field_type == field_fd_acid ) { if( !z.flies() ) { const int d = rng( cur.get_field_intensity(), cur.get_field_intensity() * 3 ); z.deal_damage( nullptr, bodypart_id( "torso" ), damage_instance( damage_acid, d ) ); z.check_dead_state(); } - } - if( cur_field_type == fd_sap ) { + } else if( cur_field_type == field_fd_sap ) { z.mod_moves( -cur.get_field_intensity() * 5 ); mod_field_intensity( z.pos_bub(), cur.get_field_type(), -1 ); - } - if( cur_field_type == fd_sludge ) { + } else if( cur_field_type == field_fd_sludge ) { if( !z.digs() && !z.flies() && !z.has_flag( mon_flag_SLUDGEPROOF ) ) { z.mod_moves( -cur.get_field_intensity() * 300 ); cur.set_field_intensity( 0 ); } - } - if( cur_field_type == fd_fire ) { + } else if( cur_field_type == field_fd_fire ) { // TODO: MATERIALS Use fire resistance if( z.has_flag( mon_flag_FIREPROOF ) || z.has_flag( mon_flag_FIREY ) ) { return; @@ -1950,8 +1967,7 @@ void map::monster_in_field( monster &z ) } } } - } - if( cur_field_type == fd_smoke ) { + } else if( cur_field_type == field_fd_smoke ) { if( !z.has_flag( mon_flag_NO_BREATHE ) ) { if( cur.get_field_intensity() == 3 ) { z.mod_moves( -to_moves( 1_seconds ) * rng_float( 0.1, 0.2 ) ); @@ -1962,8 +1978,7 @@ void map::monster_in_field( monster &z ) } } - } - if( cur_field_type == fd_tear_gas ) { + } else if( cur_field_type == field_fd_tear_gas ) { if( z.made_of_any( Creature::cmat_fleshnveg ) && !z.has_flag( mon_flag_NO_BREATHE ) ) { if( cur.get_field_intensity() == 3 ) { z.add_effect( effect_stunned, rng( 1_minutes, 2_minutes ) ); @@ -1977,28 +1992,24 @@ void map::monster_in_field( monster &z ) } } - } - if( cur_field_type == fd_relax_gas ) { + } else if( cur_field_type == field_fd_relax_gas ) { if( z.made_of_any( Creature::cmat_fleshnveg ) && !z.has_flag( mon_flag_NO_BREATHE ) ) { z.add_effect( effect_stunned, rng( cur.get_field_intensity() * 4_turns, cur.get_field_intensity() * 8_turns ) ); } - } - if( cur_field_type == fd_dazzling ) { + } else if( cur_field_type == field_fd_dazzling ) { if( z.has_flag( mon_flag_SEES ) && !z.has_flag( mon_flag_ELECTRONIC ) ) { z.add_effect( effect_blind, cur.get_field_intensity() * 12_turns ); z.add_effect( effect_stunned, cur.get_field_intensity() * rng( 5_turns, 12_turns ) ); } - } - if( cur_field_type == fd_toxic_gas ) { + } else if( cur_field_type == field_fd_toxic_gas ) { if( !z.has_flag( mon_flag_NO_BREATHE ) ) { dam += cur.get_field_intensity(); z.mod_moves( -cur.get_field_intensity() ); } - } - if( cur_field_type == fd_nuke_gas ) { + } else if( cur_field_type == field_fd_nuke_gas ) { if( !z.has_flag( mon_flag_NO_BREATHE ) ) { if( cur.get_field_intensity() == 3 ) { z.mod_moves( -to_moves( 1_seconds ) * rng_float( 0.6, 1.2 ) ); @@ -2017,8 +2028,7 @@ void map::monster_in_field( monster &z ) } } - } - if( cur_field_type == fd_flame_burst ) { + } else if( cur_field_type == field_fd_flame_burst ) { // TODO: MATERIALS Use fire resistance if( z.has_flag( mon_flag_FIREPROOF ) || z.has_flag( mon_flag_FIREY ) ) { return; @@ -2037,20 +2047,17 @@ void map::monster_in_field( monster &z ) } dam += rng( 0, 8 ); z.mod_moves( -to_moves( 1_seconds ) * 0.2 ); - } - if( cur_field_type == fd_electricity ) { + } else if( cur_field_type == field_fd_electricity ) { // We don't want to increase dam, but deal a separate hit so that it can apply effects const int field_dmg = std::max( 1, rng( cur.get_field_intensity() / 2, cur.get_field_intensity() ) ); z.deal_damage( nullptr, bodypart_id( "torso" ), damage_instance( damage_electric, field_dmg ) ); - } - if( cur_field_type == fd_fatigue ) { + } else if( cur_field_type == field_fd_fatigue ) { if( rng( 0, 2 ) < cur.get_field_intensity() ) { dam += cur.get_field_intensity(); teleport::teleport( z ); } - } - if( cur_field_type == fd_incendiary ) { + } else if( cur_field_type == field_fd_incendiary ) { // TODO: MATERIALS Use fire resistance if( z.has_flag( mon_flag_FIREPROOF ) || z.has_flag( mon_flag_FIREY ) ) { return; @@ -2083,8 +2090,7 @@ void map::monster_in_field( monster &z ) z.add_effect( effect_onfire, rng( 12_turns, 16_turns ) ); } } - } - if( cur_field_type == fd_fungal_haze ) { + } else if( cur_field_type == field_fd_fungal_haze ) { if( !z.type->in_species( species_FUNGUS ) && !z.type->has_flag( mon_flag_NO_BREATHE ) && !z.make_fungus() ) { @@ -2093,15 +2099,13 @@ void map::monster_in_field( monster &z ) z.mod_moves( -rng( 10 * intensity, 30 * intensity ) ); dam += rng( 0, 10 * intensity ); } - } - if( cur_field_type == fd_fungicidal_gas ) { + } else if( cur_field_type == field_fd_fungicidal_gas ) { if( z.type->in_species( species_FUNGUS ) ) { const int intensity = cur.get_field_intensity(); z.mod_moves( -rng( 10 * intensity, 30 * intensity ) ); dam += rng( 4, 7 * intensity ); } - } - if( cur_field_type == fd_insecticidal_gas ) { + } else if( cur_field_type == field_fd_insecticidal_gas ) { if( z.made_of( material_iflesh ) && !z.has_flag( mon_flag_INSECTICIDEPROOF ) ) { const int intensity = cur.get_field_intensity(); z.mod_moves( -rng( 10 * intensity, 30 * intensity ) ); @@ -2291,43 +2295,33 @@ std::vector map_field_processing::processors_for_type( const } // Per-type processors: - if( ft.id == fd_acid ) { + // TODO: Would this be better as a static map? + const field_type_id fti = ft.id; + if( fti == field_fd_acid ) { processors.push_back( &field_processor_fd_acid ); - } - if( ft.id == fd_extinguisher ) { + } else if( fti == field_fd_extinguisher ) { processors.push_back( &field_processor_fd_extinguisher ); - } - if( ft.id == fd_fire ) { + } else if( fti == field_fd_fire ) { processors.push_back( &field_processor_fd_fire ); - } - if( ft.id == fd_fungal_haze ) { + } else if( fti == field_fd_fungal_haze ) { processors.push_back( &field_processor_fd_fungal_haze ); - } - if( ft.id == fd_fire_vent ) { + } else if( fti == field_fd_fire_vent ) { processors.push_back( &field_processor_fd_fire_vent ); - } - if( ft.id == fd_flame_burst ) { + } else if( fti == field_fd_flame_burst ) { processors.push_back( &field_processor_fd_flame_burst ); - } - if( ft.id == fd_electricity || ft.id == fd_electricity_unlit ) { + } else if( fti == field_fd_electricity || fti == field_fd_electricity_unlit ) { processors.push_back( &field_processor_fd_electricity ); - } - if( ft.id == fd_push_items ) { + } else if( fti == field_fd_push_items ) { processors.push_back( &field_processor_fd_push_items ); - } - if( ft.id == fd_shock_vent ) { + } else if( fti == field_fd_shock_vent ) { processors.push_back( &field_processor_fd_shock_vent ); - } - if( ft.id == fd_acid_vent ) { + } else if( fti == field_fd_acid_vent ) { processors.push_back( &field_processor_fd_acid_vent ); - } - if( ft.id == fd_incendiary ) { + } else if( fti == field_fd_incendiary ) { processors.push_back( &field_processor_fd_incendiary ); - } - if( ft.id == fd_fungicidal_gas ) { + } else if( fti == field_fd_fungicidal_gas ) { processors.push_back( &field_processor_fd_fungicidal_gas ); - } - if( ft.id == fd_last_known ) { + } else if( fti == field_fd_last_known ) { processors.push_back( &field_processor_fd_last_known ); } @@ -2336,5 +2330,5 @@ std::vector map_field_processing::processors_for_type( const const field_type_str_id &map::get_applicable_electricity_field( const tripoint_bub_ms &p ) const { - return is_transparent( p ) ? fd_electricity : fd_electricity_unlit; + return is_transparent( p ) ? field_fd_electricity : field_fd_electricity_unlit; } diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 63d1f53114041..3d26a0833b89e 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -31,8 +31,6 @@ #include "drawing_primitives.h" #include "enum_conversions.h" #include "enums.h" -#include "field.h" -#include "field_type.h" #include "game.h" #include "game_constants.h" #include "generic_factory.h" @@ -83,6 +81,14 @@ #include "weighted_list.h" #include "creature_tracker.h" +static const field_type_str_id field_fd_acid_vent( "fd_acid_vent" ); +static const field_type_str_id field_fd_construction_site( "fd_construction_site" ); +static const field_type_str_id field_fd_fire_vent( "fd_fire_vent" ); +static const field_type_str_id field_fd_gas_vent( "fd_gas_vent" ); +static const field_type_str_id field_fd_push_items( "fd_push_items" ); +static const field_type_str_id field_fd_shock_vent( "fd_shock_vent" ); +static const field_type_str_id field_fd_smoke_vent( "fd_smoke_vent" ); + static const furn_str_id furn_f_bed( "f_bed" ); static const furn_str_id furn_f_console( "f_console" ); static const furn_str_id furn_f_counter( "f_counter" ); @@ -6126,9 +6132,9 @@ void map::draw_lab( mapgendata &dat ) 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 ); + add_field( tripoint_bub_ms{i, j, abs_sub.z()}, field_fd_gas_vent, 1 ); } else { - add_field( tripoint_bub_ms{i, j, abs_sub.z()}, fd_smoke_vent, 2 ); + add_field( tripoint_bub_ms{i, j, abs_sub.z()}, field_fd_smoke_vent, 2 ); } } } @@ -7745,7 +7751,7 @@ void map::create_anomaly( const tripoint_bub_ms &cp, artifact_natural_property p for( int i = c.x() - 5; i <= c.x() + 5; i++ ) { for( int j = c.y() - 5; j <= c.y() + 5; j++ ) { if( furn( point_bub_ms( i, j ) ) == furn_f_rubble ) { - add_field( tripoint_bub_ms{ i, j, z }, fd_push_items, 1 ); + add_field( tripoint_bub_ms{ i, j, z }, field_fd_push_items, 1 ); if( one_in( 3 ) ) { spawn_item( point_bub_ms( i, j ), "rock" ); } @@ -7822,18 +7828,18 @@ void map::create_anomaly( const tripoint_bub_ms &cp, artifact_natural_property p case ARTPROP_ELECTRIC: case ARTPROP_CRACKLING: - add_field( { c, abs_sub.z() }, fd_shock_vent, 3 ); + add_field( { c, abs_sub.z() }, field_fd_shock_vent, 3 ); break; case ARTPROP_SLIMY: - add_field( { c, abs_sub.z() }, fd_acid_vent, 3 ); + add_field( { c, abs_sub.z() }, field_fd_acid_vent, 3 ); break; case ARTPROP_WARM: for( int i = c.x() - 5; i <= c.x() + 5; i++ ) { for( int j = c.y() - 5; j <= c.y() + 5; j++ ) { if( furn( point_bub_ms( i, j ) ) == furn_f_rubble ) { - add_field( tripoint_bub_ms{ i, j, abs_sub.z() }, fd_fire_vent, + add_field( tripoint_bub_ms{ i, j, abs_sub.z() }, field_fd_fire_vent, 1 + ( rl_dist( c, point_bub_ms( i, j ) ) % 3 ) ); } } @@ -8175,9 +8181,9 @@ bool apply_construction_marker( const update_mapgen_id &update_mapgen_id, for( const tripoint_omt_ms &pos : tmp_map.points_on_zlevel( omt_pos.z() ) ) { if( tmp_map.ter( pos ) != ter_t_grass || tmp_map.has_furn( pos ) ) { if( apply ) { - update_tmap.add_field( pos, fd_construction_site, 1, time_duration::from_turns( 0 ), false ); + update_tmap.add_field( pos, field_fd_construction_site, 1, time_duration::from_turns( 0 ), false ); } else { - update_tmap.delete_field( pos, fd_construction_site ); + update_tmap.delete_field( pos, field_fd_construction_site ); } } } diff --git a/src/monattack.cpp b/src/monattack.cpp index 1dba3a4bbeb1c..077bac12df967 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -38,7 +38,6 @@ #include "event.h" #include "event_bus.h" #include "explosion.h" -#include "field_type.h" #include "flag.h" #include "fungal_effects.h" #include "game.h" @@ -141,6 +140,19 @@ static const efftype_id effect_slimed( "slimed" ); static const efftype_id effect_social_dissatisfied( "social_dissatisfied" ); static const efftype_id effect_stunned( "stunned" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_bile( "fd_bile" ); +static const field_type_str_id field_fd_dazzling( "fd_dazzling" ); +static const field_type_str_id field_fd_electricity( "fd_electricity" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); +static const field_type_str_id field_fd_gibs_flesh( "fd_gibs_flesh" ); +static const field_type_str_id field_fd_relax_gas( "fd_relax_gas" ); +static const field_type_str_id field_fd_smoke( "fd_smoke" ); +static const field_type_str_id field_fd_spotlight( "fd_spotlight" ); +static const field_type_str_id field_fd_tear_gas( "fd_tear_gas" ); +static const field_type_str_id field_fd_tindalos_rift( "fd_tindalos_rift" ); + static const itype_id itype_anesthetic( "anesthetic" ); static const itype_id itype_badge_deputy( "badge_deputy" ); static const itype_id itype_badge_detective( "badge_detective" ); @@ -749,7 +761,7 @@ bool mattack::acid( monster *z ) if( here.passable( dest ) && here.clear_path( dest, hitp, 6, 1, 100 ) && ( ( one_in( std::abs( j ) ) && one_in( std::abs( i ) ) ) || ( i == 0 && j == 0 ) ) ) { - here.add_field( dest, fd_acid, 2 ); + here.add_field( dest, field_fd_acid, 2 ); } } } @@ -771,7 +783,7 @@ bool mattack::acid_barf( monster *z ) z->mod_moves( -to_moves( 1_seconds ) * 0.8 ); // Make sure it happens before uncanny dodge - get_map().add_field( target->pos_bub(), fd_acid, 1 ); + get_map().add_field( target->pos_bub(), field_fd_acid, 1 ); bodypart_id hit = target->get_random_body_part(); damage_instance dam_inst = damage_instance( damage_acid, rng( 5, 12 ) ); @@ -869,14 +881,14 @@ bool mattack::shockstorm( monster *z ) // Fill the LOS with electricity for( tripoint_bub_ms &i : bolt ) { if( !one_in( 4 ) ) { - here.add_field( i, fd_electricity, rng( 1, 3 ) ); + here.add_field( i, field_fd_electricity, rng( 1, 3 ) ); } } // 3x3 cloud of electricity at the square hit for( const tripoint_bub_ms &dest : here.points_in_radius( tarp, 1 ) ) { if( one_in( 3 ) ) { - here.add_field( dest, fd_electricity, rng( 4, 10 ) ); + here.add_field( dest, field_fd_electricity, rng( 4, 10 ) ); } } @@ -998,10 +1010,10 @@ bool mattack::boomer( monster *z ) add_msg( m_warning, _( "The %s spews bile!" ), z->name() ); } for( tripoint_bub_ms &i : line ) { - here.add_field( i, fd_bile, 1.0f ); + here.add_field( i, field_fd_bile, 1.0f ); // If bile hit a solid tile, return. if( here.impassable( i ) ) { - here.add_field( i, fd_bile, 3 ); + here.add_field( i, field_fd_bile, 3 ); add_msg_if_player_sees( i, _( "Bile splatters on the %s!" ), here.tername( i ) ); return true; } @@ -1039,9 +1051,9 @@ bool mattack::boomer_glow( monster *z ) add_msg( m_warning, _( "The %s spews bile!" ), z->name() ); } for( tripoint_bub_ms &i : line ) { - here.add_field( i, fd_bile, 1 ); + here.add_field( i, field_fd_bile, 1 ); if( here.impassable( i ) ) { - here.add_field( i, fd_bile, 3 ); + here.add_field( i, field_fd_bile, 3 ); add_msg_if_player_sees( i, _( "Bile splatters on the %s!" ), here.tername( i ) ); return true; } @@ -1111,7 +1123,7 @@ bool mattack::resurrect( monster *z ) mt->in_species( species_ZOMBIE ) && !mt->has_flag( mon_flag_NO_NECRO ) ) ) { continue; } - if( here.get_field_intensity( p, fd_fire ) > 1 || !sees_and_is_empty( p.raw() ) ) { + if( here.get_field_intensity( p, field_fd_fire ) > 1 || !sees_and_is_empty( p.raw() ) ) { continue; } @@ -1699,7 +1711,7 @@ bool mattack::fungus_haze( monster *z ) z->mod_moves( -to_moves( 1_seconds ) * 1.5 ); map &here = get_map(); for( const tripoint_bub_ms &dest : here.points_in_radius( z->pos_bub(), 3 ) ) { - here.add_field( dest, fd_fungal_haze, rng( 1, 2 ) ); + here.add_field( dest, field_fd_fungal_haze, rng( 1, 2 ) ); } return true; @@ -1712,13 +1724,13 @@ bool mattack::fungus_big_blossom( monster *z ) map &here = get_map(); // Fungal fire-suppressor! >:D for( const tripoint_bub_ms &dest : here.points_in_radius( z->pos_bub(), 6 ) ) { - if( here.get_field_intensity( dest, fd_fire ) != 0 ) { + if( here.get_field_intensity( dest, field_fd_fire ) != 0 ) { firealarm = true; } if( firealarm ) { - here.remove_field( dest, fd_fire ); - here.remove_field( dest, fd_smoke ); - here.add_field( dest, fd_fungal_haze, 3 ); + here.remove_field( dest, field_fd_fire ); + here.remove_field( dest, field_fd_smoke ); + here.add_field( dest, field_fd_fungal_haze, 3 ); } } // Special effects handled outside the loop @@ -1745,7 +1757,7 @@ bool mattack::fungus_big_blossom( monster *z ) } z->mod_moves( -to_moves( 1_seconds ) * 1.5 ); for( const tripoint_bub_ms &dest : here.points_in_radius( z->pos_bub(), 12 ) ) { - here.add_field( dest, fd_fungal_haze, rng( 1, 2 ) ); + here.add_field( dest, field_fd_fungal_haze, rng( 1, 2 ) ); } } @@ -3603,7 +3615,7 @@ bool mattack::riotbot( monster *z ) for( const tripoint_bub_ms &dest : here.points_in_radius( z->pos_bub(), 4 ) ) { if( here.passable( dest ) && here.clear_path( z->pos_bub(), dest, 3, 1, 100 ) ) { - here.add_field( dest, fd_relax_gas, rng( 1, 3 ) ); + here.add_field( dest, field_fd_relax_gas, rng( 1, 3 ) ); } } } @@ -3746,7 +3758,7 @@ bool mattack::riotbot( monster *z ) for( const tripoint_bub_ms &dest : here.points_in_radius( z->pos_bub(), 2 ) ) { if( here.passable( dest ) && here.clear_path( z->pos_bub(), dest, 3, 1, 100 ) ) { - here.add_field( dest, fd_tear_gas, rng( 1, 3 ) ); + here.add_field( dest, field_fd_tear_gas, rng( 1, 3 ) ); } } @@ -3784,7 +3796,7 @@ bool mattack::riotbot( monster *z ) if( !here.is_transparent( elem ) ) { break; } - here.add_field( elem, fd_dazzling, 1 ); + here.add_field( elem, field_fd_dazzling, 1 ); } return true; @@ -3942,8 +3954,8 @@ bool mattack::tindalos_teleport( monster *z ) z->setpos( dest ); // Not teleporting if it means losing sight of our current target if( z->sees( *target ) ) { - here.add_field( oldpos, fd_tindalos_rift, 2 ); - here.add_field( dest, fd_tindalos_rift, 2 ); + here.add_field( oldpos, field_fd_tindalos_rift, 2 ); + here.add_field( dest, field_fd_tindalos_rift, 2 ); add_msg_if_player_sees( *z, m_bad, _( "The %s dissipates and reforms itself from the angles in the corner." ), z->name() ); return true; @@ -3983,7 +3995,7 @@ bool mattack::flesh_tendril( monster *z ) if( monster *const summoned = g->place_critter_around( spawned, z->pos(), 1 ) ) { z->mod_moves( -to_moves( 1_seconds ) ); summoned->make_ally( *z ); - get_map().propagate_field( z->pos_bub(), fd_gibs_flesh, 75, 1 ); + get_map().propagate_field( z->pos_bub(), field_fd_gibs_flesh, 75, 1 ); add_msg_if_player_sees( *z, m_warning, _( "A %s struggles to pull itself free from the %s!" ), summoned->name(), z->name() ); } diff --git a/src/monmove.cpp b/src/monmove.cpp index 227f04fe8b6db..8148577b6845c 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -22,7 +22,6 @@ #include "creature_tracker.h" #include "debug.h" #include "field.h" -#include "field_type.h" #include "game.h" #include "game_constants.h" #include "line.h" @@ -75,7 +74,17 @@ static const efftype_id effect_pushed( "pushed" ); static const efftype_id effect_stumbled_into_invisible( "stumbled_into_invisible" ); static const efftype_id effect_stunned( "stunned" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_churned_earth( "fd_churned_earth" ); +static const field_type_str_id field_fd_electricity( "fd_electricity" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); +static const field_type_str_id field_fd_fungicidal_gas( "fd_fungicidal_gas" ); +static const field_type_str_id field_fd_insecticidal_gas( "fd_insecticidal_gas" ); static const field_type_str_id field_fd_last_known( "fd_last_known" ); +static const field_type_str_id field_fd_sap( "fd_sap" ); +static const field_type_str_id field_fd_sludge( "fd_sludge" ); +static const field_type_str_id field_fd_web( "fd_web" ); static const flag_id json_flag_GRAB( "GRAB" ); static const flag_id json_flag_GRAB_FILTER( "GRAB_FILTER" ); @@ -94,19 +103,19 @@ 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 ) { + if( fid == field_fd_fungal_haze ) { return has_flag( mon_flag_NO_BREATHE ) || type->in_species( species_FUNGUS ); } - if( fid == fd_fungicidal_gas ) { + if( fid == field_fd_fungicidal_gas ) { return !type->in_species( species_FUNGUS ); } - if( fid == fd_insecticidal_gas ) { + if( fid == field_fd_insecticidal_gas ) { return !made_of( material_iflesh ) || has_flag( mon_flag_INSECTICIDEPROOF ); } - if( fid == fd_web ) { + if( fid == field_fd_web ) { return has_flag( mon_flag_WEBWALK ); } - if( fid == fd_sludge || fid == fd_sap ) { + if( fid == field_fd_sludge || fid == field_fd_sap ) { return flies(); } const field_type &ft = fid.obj(); @@ -243,11 +252,11 @@ bool monster::know_danger_at( const tripoint &p ) const } // Without avoid_complex, only fire and electricity are checked for field avoidance. - if( avoid_fire && target_field.find_field( fd_fire ) && !is_immune_field( fd_fire ) ) { + if( avoid_fire && target_field.find_field( field_fd_fire ) && !is_immune_field( field_fd_fire ) ) { return false; } - if( avoid_simple && target_field.find_field( fd_electricity ) && - !is_immune_field( fd_electricity ) ) { + if( avoid_simple && target_field.find_field( field_fd_electricity ) && + !is_immune_field( field_fd_electricity ) ) { return false; } } @@ -1976,23 +1985,23 @@ bool monster::move_to( const tripoint &p, bool force, bool step_on_critter, factor = 4; break; } - here.add_field( pos_bub(), fd_churned_earth, 2 ); + here.add_field( pos_bub(), field_fd_churned_earth, 2 ); for( const tripoint_bub_ms &dest : here.points_in_radius( pos_bub(), 1, 0 ) ) { if( here.has_flag( ter_furn_flag::TFLAG_DIGGABLE, dest ) && one_in( factor ) ) { - here.add_field( dest, fd_churned_earth, 2 ); + here.add_field( dest, field_fd_churned_earth, 2 ); } } } // Acid trail monsters leave... a trail of acid if( has_flag( mon_flag_ACIDTRAIL ) ) { - here.add_field( pos_bub(), fd_acid, 3 ); + here.add_field( pos_bub(), field_fd_acid, 3 ); } // Not all acid trail monsters leave as much acid. Every time this monster takes a step, there is a 1/5 chance it will drop a puddle. if( has_flag( mon_flag_SHORTACIDTRAIL ) ) { if( one_in( 5 ) ) { - here.add_field( pos_bub(), fd_acid, 3 ); + here.add_field( pos_bub(), field_fd_acid, 3 ); } } @@ -2000,14 +2009,14 @@ bool monster::move_to( const tripoint &p, bool force, bool step_on_critter, for( const tripoint_bub_ms &sludge_p : here.points_in_radius( pos_bub(), 1 ) ) { const int fstr = 3 - ( std::abs( sludge_p.x() - posx() ) + std::abs( sludge_p.y() - posy() ) ); if( fstr >= 2 ) { - here.add_field( sludge_p, fd_sludge, fstr ); + here.add_field( sludge_p, field_fd_sludge, fstr ); } } } if( has_flag( mon_flag_SMALLSLUDGETRAIL ) ) { if( one_in( 2 ) ) { - here.add_field( pos_bub(), fd_sludge, 1 ); + here.add_field( pos_bub(), field_fd_sludge, 1 ); } } diff --git a/src/monster.cpp b/src/monster.cpp index 5afd56f73d69d..484f40971cbda 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -27,7 +27,6 @@ #include "event_bus.h" #include "explosion.h" #include "faction.h" -#include "field_type.h" #include "game.h" #include "game_constants.h" #include "harvest.h" @@ -138,6 +137,8 @@ static const efftype_id effect_worked_on( "worked_on" ); static const emit_id emit_emit_shock_cloud( "emit_shock_cloud" ); static const emit_id emit_emit_shock_cloud_big( "emit_shock_cloud_big" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + static const flag_id json_flag_DISABLE_FLIGHT( "DISABLE_FLIGHT" ); static const flag_id json_flag_GRAB( "GRAB" ); static const flag_id json_flag_GRAB_FILTER( "GRAB_FILTER" ); @@ -1827,12 +1828,12 @@ void monster::process_triggers() process_trigger( mon_trigger::FIRE, [this]() { int ret = 0; map &here = get_map(); - const field_type_id fd_fire = ::fd_fire; // convert to int_id once + const field_type_id field_fd_fire_int = field_fd_fire.id(); // convert to int_id once for( const tripoint_bub_ms &p : here.points_in_radius( pos_bub(), 3 ) ) { // note using `has_field_at` without bound checks, // as points that come from `points_in_radius` are guaranteed to be in bounds const int fire_intensity = - here.has_field_at( p, false ) ? 5 * here.get_field_intensity( p, fd_fire ) : 0; + here.has_field_at( p, false ) ? 5 * here.get_field_intensity( p, field_fd_fire_int ) : 0; ret += fire_intensity; } return ret; @@ -1935,7 +1936,7 @@ bool monster::is_immune_effect( const efftype_id &effect ) const } if( effect == effect_bleed ) { - return ( type->bloodType() == fd_null || type->bleed_rate == 0 ); + return ( type->bloodType() == field_type_str_id::NULL_ID() || type->bleed_rate == 0 ); } if( effect == effect_venom_dmg || @@ -2855,7 +2856,7 @@ void monster::process_turn() const map_stack items = here.i_at( zap ); for( const item &item : items ) { if( item.made_of( phase_id::LIQUID ) && item.flammable() ) { // start a fire! - here.add_field( zap, fd_fire, 2, 1_minutes ); + here.add_field( zap, field_fd_fire, 2, 1_minutes ); sounds::sound( pos(), 30, sounds::sound_t::combat, _( "fwoosh!" ), false, "fire", "ignition" ); break; } @@ -2872,7 +2873,7 @@ void monster::process_turn() } else { add_msg_if_player_sees( zap.raw(), m_warning, _( "Lightning from %1$s engulfs the %2$s!" ), name(), here.tername( zap ) ); - here.add_field( zap, fd_fire, 1, 2_turns ); + here.add_field( zap, field_fd_fire, 1, 2_turns ); } } } @@ -3583,14 +3584,14 @@ bool monster::has_mind() const field_type_id monster::bloodType() const { if( is_hallucination() ) { - return fd_null; + return field_type_str_id::NULL_ID(); } return type->bloodType(); } field_type_id monster::gibType() const { if( is_hallucination() ) { - return fd_null; + return field_type_str_id::NULL_ID(); } return type->gibType(); } diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index 55844d292eedd..021e928e66d3a 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -1369,8 +1369,7 @@ void species_type::load( const JsonObject &jo, const std::string_view ) optional( jo, was_loaded, "anger_triggers", anger, trigger_reader ); optional( jo, was_loaded, "placate_triggers", placate, trigger_reader ); optional( jo, was_loaded, "fear_triggers", fear, trigger_reader ); - - optional( jo, was_loaded, "bleeds", bleeds, string_id_reader<::field_type> {}, fd_null ); + optional( jo, was_loaded, "bleeds", bleeds, field_type_str_id::NULL_ID() ); } void mon_flag::load_mon_flags( const JsonObject &jo, const std::string &src ) diff --git a/src/mtype.cpp b/src/mtype.cpp index db1c7ed1e39d6..50e310e39b707 100644 --- a/src/mtype.cpp +++ b/src/mtype.cpp @@ -7,7 +7,6 @@ #include "behavior_strategy.h" #include "creature.h" -#include "field_type.h" #include "item.h" #include "itype.h" #include "mod_manager.h" @@ -18,6 +17,17 @@ #include "units.h" #include "weakpoint.h" +static const field_type_str_id field_fd_acid( "fd_acid" ); +static const field_type_str_id field_fd_bile( "fd_bile" ); +static const field_type_str_id field_fd_blood( "fd_blood" ); +static const field_type_str_id field_fd_blood_insect( "fd_blood_insect" ); +static const field_type_str_id field_fd_blood_invertebrate( "fd_blood_invertebrate" ); +static const field_type_str_id field_fd_blood_veggy( "fd_blood_veggy" ); +static const field_type_str_id field_fd_gibs_flesh( "fd_gibs_flesh" ); +static const field_type_str_id field_fd_gibs_insect( "fd_gibs_insect" ); +static const field_type_str_id field_fd_gibs_invertebrate( "fd_gibs_invertebrate" ); +static const field_type_str_id field_fd_gibs_veggy( "fd_gibs_veggy" ); + static const harvest_id harvest_list_human( "human" ); static const itype_id itype_bone( "bone" ); @@ -397,18 +407,6 @@ std::vector mtype::species_descriptions() const return ret; } -field_type_id mtype::get_bleed_type() const -{ - if( bleed_rate > 0 ) { - for( const species_id &s : species ) { - if( !s->bleeds.is_empty() ) { - return s->bleeds; - } - } - } - return fd_null; -} - bool mtype::same_species( const mtype &other ) const { return std::any_of( species.begin(), species.end(), [&]( const species_id & s ) { @@ -418,45 +416,51 @@ bool mtype::same_species( const mtype &other ) const field_type_id mtype::bloodType() const { - if( has_flag( mon_flag_ACID_BLOOD ) ) + if( has_flag( mon_flag_ACID_BLOOD ) ) { //A monster that has the death effect "ACID" does not need to have acid blood. - { - return fd_acid; + return field_fd_acid; } if( has_flag( mon_flag_BILE_BLOOD ) ) { - return fd_bile; + return field_fd_bile; } if( has_flag( mon_flag_ARTHROPOD_BLOOD ) ) { - return fd_blood_invertebrate; + return field_fd_blood_invertebrate; } if( made_of( material_veggy ) ) { - return fd_blood_veggy; + return field_fd_blood_veggy; } if( made_of( material_iflesh ) ) { - return fd_blood_insect; + return field_fd_blood_insect; } if( has_flag( mon_flag_WARM ) && made_of( material_flesh ) ) { - return fd_blood; + return field_fd_blood; + } + if( bleed_rate > 0 ) { + for( const species_id &s : species ) { + if( !s->bleeds.is_empty() ) { + return s->bleeds; + } + } } - return get_bleed_type(); + return field_type_str_id::NULL_ID(); } field_type_id mtype::gibType() const { if( in_species( species_MOLLUSK ) ) { - return fd_gibs_invertebrate; + return field_fd_gibs_invertebrate; } if( made_of( material_veggy ) ) { - return fd_gibs_veggy; + return field_fd_gibs_veggy; } if( made_of( material_iflesh ) ) { - return fd_gibs_insect; + return field_fd_gibs_insect; } if( made_of( material_flesh ) ) { - return fd_gibs_flesh; + return field_fd_gibs_flesh; } // There are other materials not listed here like steel, protoplasmic, powder, null, stone, bone - return fd_null; + return field_type_str_id::NULL_ID(); } itype_id mtype::get_meat_itype() const diff --git a/src/mtype.h b/src/mtype.h index 4dfac2cf25ca8..3604a66d35957 100644 --- a/src/mtype.h +++ b/src/mtype.h @@ -537,7 +537,6 @@ struct mtype { bool in_category( const std::string &category ) const; bool in_species( const species_id &spec ) const; std::vector species_descriptions() const; - field_type_id get_bleed_type() const; //Used for corpses. field_type_id bloodType() const; field_type_id gibType() const; diff --git a/src/mutation.cpp b/src/mutation.cpp index a6fef23a36699..1aac0f257dc14 100644 --- a/src/mutation.cpp +++ b/src/mutation.cpp @@ -20,7 +20,6 @@ #include "enums.h" #include "event.h" #include "event_bus.h" -#include "field_type.h" #include "game.h" #include "item.h" #include "itype.h" @@ -49,6 +48,9 @@ static const activity_id ACT_PULL_CREATURE( "ACT_PULL_CREATURE" ); static const activity_id ACT_TREE_COMMUNION( "ACT_TREE_COMMUNION" ); +static const field_type_str_id field_fd_sludge( "fd_sludge" ); +static const field_type_str_id field_fd_web( "fd_web" ); + static const flag_id json_flag_INTEGRATED( "INTEGRATED" ); static const itype_id itype_fake_burrowing( "fake_burrowing" ); @@ -879,7 +881,7 @@ void Character::activate_mutation( const trait_id &mut ) } if( mut == trait_WEB_WEAVER ) { - get_map().add_field( pos_bub(), fd_web, 1 ); + get_map().add_field( pos_bub(), field_fd_web, 1 ); add_msg_if_player( _( "You start spinning web with your spinnerets!" ) ); } else if( mut == trait_LONG_TONGUE2 || mut == trait_GASTROPOD_EXTREMITY2 || @@ -888,7 +890,7 @@ void Character::activate_mutation( const trait_id &mut ) assign_activity( ACT_PULL_CREATURE, to_moves( 1_seconds ), 0, 0, mutation_name( mut ) ); return; } else if( mut == trait_SNAIL_TRAIL ) { - get_map().add_field( pos_bub(), fd_sludge, 1 ); + get_map().add_field( pos_bub(), field_fd_sludge, 1 ); add_msg_if_player( _( "You start leaving a trail of sludge as you go." ) ); } else if( mut == trait_BURROW || mut == trait_BURROWLARGE ) { tdata.powered = false; diff --git a/src/npcmove.cpp b/src/npcmove.cpp index b781234b6f513..0887c80350bc8 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -36,7 +36,6 @@ #include "event_bus.h" #include "explosion.h" #include "field.h" -#include "field_type.h" #include "flag.h" #include "flat_set.h" #include "game.h" @@ -136,6 +135,7 @@ static const efftype_id effect_psi_stunned( "psi_stunned" ); static const efftype_id effect_stumbled_into_invisible( "stumbled_into_invisible" ); static const efftype_id effect_stunned( "stunned" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); static const field_type_str_id field_fd_last_known( "fd_last_known" ); static const itype_id itype_inhaler( "inhaler" ); @@ -770,11 +770,11 @@ void npc::assess_danger() } map &here = get_map(); // cache string_id -> int_id conversion before hot loop - const field_type_id fd_fire = ::fd_fire; + const field_type_id field_fd_fire_int = field_fd_fire.id(); // first, check if we're about to be consumed by fire // `map::get_field` uses `field_cache`, so in general case (no fire) it provides an early exit for( const tripoint_bub_ms &pt : here.points_in_radius( pos_bub(), 6 ) ) { - if( pt == pos_bub() || !here.get_field( pt, fd_fire ) || + if( pt == pos_bub() || !here.get_field( pt, field_fd_fire_int ) || here.has_flag( ter_furn_flag::TFLAG_FIRE_CONTAINER, pt ) ) { continue; } diff --git a/src/player_hardcoded_effects.cpp b/src/player_hardcoded_effects.cpp index 057cfcdbc3f43..4575936390c7b 100644 --- a/src/player_hardcoded_effects.cpp +++ b/src/player_hardcoded_effects.cpp @@ -17,7 +17,6 @@ #include "enums.h" #include "event.h" #include "event_bus.h" -#include "field_type.h" #include "fungal_effects.h" #include "game.h" #include "input.h" @@ -99,6 +98,8 @@ static const efftype_id effect_visuals( "visuals" ); static const efftype_id effect_weak_antibiotic( "weak_antibiotic" ); static const efftype_id effect_winded( "winded" ); +static const field_type_str_id field_fd_tindalos_rift( "fd_tindalos_rift" ); + static const furn_str_id furn_f_rubble_rock( "f_rubble_rock" ); static const json_character_flag json_flag_ALARMCLOCK( "ALARMCLOCK" ); @@ -1347,7 +1348,7 @@ void Character::hardcoded_effects( effect &it ) add_msg_if_player( m_bad, _( "You are beset with a vision of a prowling beast." ) ); for( const tripoint_bub_ms &dest : here.points_in_radius( pos_bub(), 6 ) ) { if( here.is_cornerfloor( dest ) ) { - here.add_field( dest, fd_tindalos_rift, 3 ); + here.add_field( dest, field_fd_tindalos_rift, 3 ); add_msg_if_player( m_info, _( "Your surroundings are permeated with a foul scent." ) ); // Queue the effect for removal, since it's done all it needs to do to the target. it.set_duration( 0_turns ); diff --git a/src/start_location.cpp b/src/start_location.cpp index fe6e6713bdc8f..bd2e48536ec28 100644 --- a/src/start_location.cpp +++ b/src/start_location.cpp @@ -14,7 +14,6 @@ #include "debug.h" #include "effect_source.h" #include "enum_conversions.h" -#include "field_type.h" #include "game_constants.h" #include "generic_factory.h" #include "json.h" @@ -33,6 +32,8 @@ class item; static const efftype_id effect_bleed( "bleed" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); + 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" ); @@ -543,7 +544,7 @@ void start_location::burn( const tripoint_abs_omt &omtstart, const size_t count, } std::shuffle( valid.begin(), valid.end(), rng_get_engine() ); for( size_t i = 0; i < std::min( count, valid.size() ); i++ ) { - m.add_field( valid[i], fd_fire, 3 ); + m.add_field( valid[i], field_fd_fire, 3 ); } m.save(); } diff --git a/src/suffer.cpp b/src/suffer.cpp index 696d873ab9e39..09d154dd00ef1 100644 --- a/src/suffer.cpp +++ b/src/suffer.cpp @@ -29,7 +29,6 @@ #include "enums.h" #include "event.h" #include "event_bus.h" -#include "field_type.h" #include "flag.h" #include "game.h" #include "game_constants.h" @@ -111,6 +110,11 @@ static const efftype_id effect_weary_7( "weary_7" ); static const efftype_id effect_weary_8( "weary_8" ); static const efftype_id effect_winded( "winded" ); +static const field_type_str_id field_fd_fatigue( "fd_fatigue" ); +static const field_type_str_id field_fd_sludge( "fd_sludge" ); +static const field_type_str_id field_fd_tindalos_rift( "fd_tindalos_rift" ); +static const field_type_str_id field_fd_web( "fd_web" ); + static const itype_id itype_e_handcuffs( "e_handcuffs" ); static const itype_id itype_inhaler( "inhaler" ); static const itype_id itype_oxygen_tank( "oxygen_tank" ); @@ -1060,12 +1064,12 @@ void suffer::from_other_mutations( Character &you ) //Web Weavers...weave web if( you.has_active_mutation( trait_WEB_WEAVER ) && !you.in_vehicle ) { // this adds intensity to if its not already there. - here.add_field( position, fd_web, 1 ); + here.add_field( position, field_fd_web, 1 ); } if( you.has_active_mutation( trait_SNAIL_TRAIL ) && !you.in_vehicle ) { - here.add_field( position, fd_sludge, 1 ); + here.add_field( position, field_fd_sludge, 1 ); } @@ -1090,11 +1094,11 @@ void suffer::from_other_mutations( Character &you ) if( you.has_trait( trait_WEB_SPINNER ) && !you.in_vehicle && one_in( 3 ) ) { // this adds intensity to if its not already there. - here.add_field( position, fd_web, 1 ); + here.add_field( position, field_fd_web, 1 ); } if( you.has_trait( trait_MUCUS_SECRETION ) && !you.in_vehicle && one_in( 2033 ) ) { - here.add_field( position, fd_sludge, 1 ); + here.add_field( position, field_fd_sludge, 1 ); } bool should_mutate = you.has_trait( trait_UNSTABLE ) && !you.has_trait( trait_CHAOTIC_BAD ) && @@ -1600,7 +1604,7 @@ void suffer::from_artifact_resonance( Character &you, int amt ) map &here = get_map(); for( const tripoint_bub_ms &dest : here.points_in_radius( you.pos_bub(), 12 ) ) { if( here.is_cornerfloor( dest ) ) { - here.add_field( dest, fd_tindalos_rift, 3 ); + here.add_field( dest, field_fd_tindalos_rift, 3 ); add_msg( m_info, _( "You hear a low-pitched echoing howl." ) ); } } @@ -1608,7 +1612,7 @@ void suffer::from_artifact_resonance( Character &you, int amt ) you.add_msg_player_or_npc( m_bad, _( "Reality gives way under your feet like rotten scaffolding." ), _( "Reality gives way under 's feet like rotten scaffolding." ) ); map &here = get_map(); - here.add_field( you.pos_bub(), fd_fatigue, 1 ); + here.add_field( you.pos_bub(), field_fd_fatigue, 1 ); } else if( rng_outcome == 3 ) { you.add_msg_player_or_npc( m_bad, _( "You suddenly lose all substance and corporeality." ), _( " suddenly loses all substance and corporeality." ) ); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index f3930e1c643c8..edace0de91b33 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -40,7 +40,6 @@ #include "event_bus.h" #include "explosion.h" #include "faction.h" -#include "field_type.h" #include "flag.h" #include "game.h" #include "item.h" @@ -102,6 +101,8 @@ static const efftype_id effect_winded( "winded" ); static const fault_id fault_engine_immobiliser( "fault_engine_immobiliser" ); +static const field_type_str_id field_fd_smoke( "fd_smoke" ); + static const itype_id fuel_type_animal( "animal" ); static const itype_id fuel_type_battery( "battery" ); static const itype_id fuel_type_mana( "mana" ); @@ -4335,7 +4336,7 @@ void vehicle::noise_and_smoke( int load, time_duration time ) } if( ( exhaust_part == -1 ) && engine_on ) { - spew_field( j, p, fd_smoke, bad_filter ? fd_smoke->get_max_intensity() : 1 ); + spew_field( j, p, field_fd_smoke, bad_filter ? field_fd_smoke->get_max_intensity() : 1 ); } else { mufflesmoke += j; } @@ -4350,8 +4351,8 @@ void vehicle::noise_and_smoke( int load, time_duration time ) /// TODO: handle other engine types: muscle / animal / wind / coal / ... if( exhaust_part != -1 && engine_on ) { - spew_field( mufflesmoke, exhaust_part, fd_smoke, - bad_filter ? fd_smoke->get_max_intensity() : 1 ); + spew_field( mufflesmoke, exhaust_part, field_fd_smoke, + bad_filter ? field_fd_smoke->get_max_intensity() : 1 ); } if( is_rotorcraft() ) { noise *= 2; diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index 84db8099bb8eb..7d5d5d6eaa962 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -136,6 +136,9 @@ effect_on_condition_run_eocs_talker_mixes( "run_eocs_talker_mixes" ); static const effect_on_condition_id effect_on_condition_run_eocs_talker_mixes_loc( "run_eocs_talker_mixes_loc" ); +static const field_type_str_id field_fd_blood( "fd_blood" ); +static const field_type_str_id field_fd_blood_insect( "fd_blood_insect" ); + static const flag_id json_flag_FILTHY( "FILTHY" ); static const furn_str_id furn_f_cardboard_box( "f_cardboard_box" ); @@ -511,8 +514,8 @@ TEST_CASE( "EOC_math_field", "[eoc][math_parser]" ) global_variables &globvars = get_globals(); globvars.clear_global_values(); - get_map().add_field( get_avatar().pos_bub(), fd_blood, 3 ); - get_map().add_field( get_avatar().pos_bub() + point_south, fd_blood_insect, 3 ); + get_map().add_field( get_avatar().pos_bub(), field_fd_blood, 3 ); + get_map().add_field( get_avatar().pos_bub() + point_south, field_fd_blood_insect, 3 ); REQUIRE( globvars.get_global_value( "key_field_strength" ).empty() ); REQUIRE( globvars.get_global_value( "key_field_strength_north" ).empty() ); diff --git a/tests/field_test.cpp b/tests/field_test.cpp index 9667d80e49bab..076cd66dacf44 100644 --- a/tests/field_test.cpp +++ b/tests/field_test.cpp @@ -6,7 +6,6 @@ #include "cata_catch.h" #include "effect.h" #include "field.h" -#include "field_type.h" #include "item.h" #include "map.h" #include "map_helpers.h" @@ -21,7 +20,20 @@ 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_blood( "fd_blood" ); +static const field_type_str_id field_fd_blood_insect( "fd_blood_insect" ); +static const field_type_str_id field_fd_blood_invertebrate( "fd_blood_invertebrate" ); +static const field_type_str_id field_fd_blood_veggy( "fd_blood_veggy" ); +static const field_type_str_id field_fd_fire( "fd_fire" ); +static const field_type_str_id field_fd_fire_vent( "fd_fire_vent" ); +static const field_type_str_id field_fd_flame_burst( "fd_flame_burst" ); +static const field_type_str_id field_fd_fungal_haze( "fd_fungal_haze" ); +static const field_type_str_id field_fd_nuke_gas( "fd_nuke_gas" ); +static const field_type_str_id field_fd_sap( "fd_sap" ); +static const field_type_str_id field_fd_smoke( "fd_smoke" ); +static const field_type_str_id field_fd_smoke_vent( "fd_smoke_vent" ); static const field_type_str_id field_fd_test( "fd_test" ); +static const field_type_str_id field_fd_web( "fd_web" ); static const ter_str_id ter_t_open_air( "t_open_air" ); static const ter_str_id ter_t_tree_walnut( "t_tree_walnut" ); @@ -108,9 +120,9 @@ static void fire_duration( const std::string &terrain_type, const time_duration const tripoint_bub_ms fire_loc{ 33, 33, 0 }; map &m = get_map(); m.ter_set( fire_loc, ter_id( terrain_type ) ); - m.add_field( fire_loc, fd_fire, 1, 10_minutes ); - REQUIRE( m.get_field( fire_loc, fd_fire ) ); - CHECK( m.get_field( fire_loc, fd_fire )->is_field_alive() ); + m.add_field( fire_loc, field_fd_fire, 1, 10_minutes ); + REQUIRE( m.get_field( fire_loc, field_fd_fire ) ); + CHECK( m.get_field( fire_loc, field_fd_fire )->is_field_alive() ); const time_point before_time = calendar::turn; bool field_alive = true; while( field_alive && calendar::turn - before_time < minimum ) { @@ -118,7 +130,7 @@ static void fire_duration( const std::string &terrain_type, const time_duration calendar::turn += 1_seconds; const int effective_age = to_turns( calendar::turn - before_time ); INFO( effective_age << " seconds" ); - field_entry *this_field = m.get_field( fire_loc, fd_fire ); + field_entry *this_field = m.get_field( fire_loc, field_fd_fire ); field_alive = this_field && this_field->is_field_alive(); } { @@ -130,7 +142,7 @@ static void fire_duration( const std::string &terrain_type, const time_duration calendar::turn += 1_seconds; const int effective_age = to_turns( calendar::turn - before_time ); INFO( effective_age << " seconds" ); - field_entry *this_field = m.get_field( fire_loc, fd_fire ); + field_entry *this_field = m.get_field( fire_loc, field_fd_fire ); field_alive = this_field && this_field->is_field_alive(); } CHECK( !field_alive ); @@ -172,11 +184,11 @@ TEST_CASE( "fd_acid_falls_down", "[field]" ) const tripoint_bub_ms p{ 33, 33, 0 }; map &m = get_map(); - m.add_field( p, fd_acid, 3 ); + m.add_field( p, field_fd_acid, 3 ); REQUIRE_FALSE( m.valid_move( p, p + tripoint_below ) ); - REQUIRE( m.get_field( p, fd_acid ) ); - REQUIRE_FALSE( m.get_field( p + tripoint_below, fd_acid ) ); + REQUIRE( m.get_field( p, field_fd_acid ) ); + REQUIRE_FALSE( m.get_field( p + tripoint_below, field_fd_acid ) ); calendar::turn += 1_turns; m.process_fields(); @@ -195,9 +207,9 @@ TEST_CASE( "fd_acid_falls_down", "[field]" ) { INFO( "acid field is dropped by exactly one point" ); - field_entry *acid_here = m.get_field( p, fd_acid ); + field_entry *acid_here = m.get_field( p, field_fd_acid ); CHECK( ( !acid_here || !acid_here->is_field_alive() ) ); - CHECK( m.get_field( p + tripoint_below, fd_acid ) ); + CHECK( m.get_field( p + tripoint_below, field_fd_acid ) ); } fields_test_cleanup(); @@ -214,15 +226,15 @@ TEST_CASE( "fire_spreading", "[field][!mayfail]" ) map &m = get_map(); - m.add_field( p, fd_fire, 3 ); + m.add_field( p, field_fd_fire, 3 ); const auto check_spreading = [&m, &p, &far_p]( const time_duration time_limit ) { const int time_limit_turns = to_turns( time_limit ); REQUIRE( fields_test_turns() == 0 ); - while( !m.get_field( far_p, fd_fire ) && fields_test_turns() < time_limit_turns ) { + while( !m.get_field( far_p, field_fd_fire ) && fields_test_turns() < time_limit_turns ) { calendar::turn += 1_turns; m.process_fields(); - REQUIRE( m.get_field( p, fd_fire ) ); + REQUIRE( m.get_field( p, field_fd_fire ) ); } { INFO( string_format( "Fire should've spread to the far point in under %d turns", @@ -233,7 +245,7 @@ TEST_CASE( "fire_spreading", "[field][!mayfail]" ) SECTION( "fire spreads on fd_web" ) { for( tripoint_bub_ms p0 = p; p0 != far_p + tripoint_east; p0 += tripoint_east ) { - m.add_field( p0, fd_web, 1 ); + m.add_field( p0, field_fd_web, 1 ); } // note: time limit here was chosen arbitrarily. It could be too low or too high. check_spreading( 5_minutes ); @@ -265,13 +277,13 @@ TEST_CASE( "fd_fire_and_fd_fire_vent_test", "[field]" ) const tripoint_bub_ms p{ 33, 33, 0 }; map &m = get_map(); - m.add_field( p, fd_fire_vent, 3 ); - CHECK( m.get_field( p, fd_fire_vent ) ); - CHECK_FALSE( m.get_field( p, fd_flame_burst ) ); + m.add_field( p, field_fd_fire_vent, 3 ); + CHECK( m.get_field( p, field_fd_fire_vent ) ); + CHECK_FALSE( m.get_field( p, field_fd_flame_burst ) ); const int time_limit_turns = to_turns( 2_minutes ); - while( !m.get_field( p, fd_flame_burst ) && fields_test_turns() < time_limit_turns ) { + while( !m.get_field( p, field_fd_flame_burst ) && fields_test_turns() < time_limit_turns ) { calendar::turn += 1_turns; m.process_fields(); } @@ -282,8 +294,8 @@ TEST_CASE( "fd_fire_and_fd_fire_vent_test", "[field]" ) } { - field_entry *fire_vent = m.get_field( p, fd_fire_vent ); - field_entry *flame_burst = m.get_field( p, fd_flame_burst ); + field_entry *fire_vent = m.get_field( p, field_fd_fire_vent ); + field_entry *flame_burst = m.get_field( p, field_fd_flame_burst ); INFO( "Flame burst should replace fire vent" ); CAPTURE( fire_vent ? fire_vent->get_field_intensity() : 0 ); CHECK( ( !fire_vent || !fire_vent->is_field_alive() ) ); @@ -294,13 +306,13 @@ TEST_CASE( "fd_fire_and_fd_fire_vent_test", "[field]" ) // With the current implementation `fd_flame_burst` can be processed once in the same turn it is created. // This could be a bug. - const int flame_burst_intensity = m.get_field( p, fd_flame_burst )->get_field_intensity(); + const int flame_burst_intensity = m.get_field( p, field_fd_flame_burst )->get_field_intensity(); for( int i = flame_burst_intensity - 1; i >= 0; i-- ) { calendar::turn += 1_turns; m.process_fields(); - field_entry *flame_burst = m.get_field( p, fd_flame_burst ); + field_entry *flame_burst = m.get_field( p, field_fd_flame_burst ); INFO( "Flame burst intensity should drop" ); CAPTURE( i ); CHECK( ( flame_burst && @@ -309,8 +321,8 @@ TEST_CASE( "fd_fire_and_fd_fire_vent_test", "[field]" ) { INFO( "Flame burst should convert back to fire vent" ); - field_entry *fire_vent = m.get_field( p, fd_fire_vent ); - field_entry *flame_burst = m.get_field( p, fd_flame_burst ); + field_entry *fire_vent = m.get_field( p, field_fd_fire_vent ); + field_entry *flame_burst = m.get_field( p, field_fd_flame_burst ); REQUIRE( fire_vent ); CHECK( fire_vent->get_field_intensity() >= 2 ); CHECK( ( !flame_burst || !flame_burst->is_field_alive() ) ); @@ -327,24 +339,24 @@ TEST_CASE( "wandering_field_test", "[field]" ) const tripoint_bub_ms p{ 33, 33, 0 }; map &m = get_map(); - REQUIRE( fd_smoke_vent->wandering_field == fd_smoke ); + REQUIRE( field_fd_smoke_vent->wandering_field == field_fd_smoke ); // 1 second old, so gets processed right away - m.add_field( p, fd_smoke_vent, 3, 1_seconds ); + m.add_field( p, field_fd_smoke_vent, 3, 1_seconds ); - REQUIRE( m.get_field( p, fd_smoke_vent ) ); - REQUIRE( count_fields( fd_smoke ) == 0 ); + REQUIRE( m.get_field( p, field_fd_smoke_vent ) ); + REQUIRE( count_fields( field_fd_smoke ) == 0 ); calendar::turn += 1_turns; m.process_fields(); { INFO( "fd_smoke should've spawned around the vent in a 5x5 area" ) - CHECK( count_fields( fd_smoke ) == 25 ); + CHECK( count_fields( field_fd_smoke ) == 25 ); } for( const tripoint_bub_ms &pnt : points_in_radius( p, 2 ) ) { - CHECK( m.get_field( pnt, fd_smoke ) ); + CHECK( m.get_field( pnt, field_fd_smoke ) ); } fields_test_cleanup(); @@ -358,10 +370,10 @@ TEST_CASE( "radioactive_field", "[field]" ) const tripoint_bub_ms p{ 33, 33, 0 }; map &m = get_map(); - REQUIRE( fd_nuke_gas->get_intensity_level().extra_radiation_max > 0 ); + REQUIRE( field_fd_nuke_gas->get_intensity_level().extra_radiation_max > 0 ); REQUIRE( m.get_radiation( p ) == 0 ); - m.add_field( p, fd_nuke_gas, 1 ); + m.add_field( p, field_fd_nuke_gas, 1 ); const int time_limit_turns = to_turns( 5_minutes ); @@ -386,7 +398,7 @@ TEST_CASE( "fungal_haze_test", "[field]" ) map &m = get_map(); REQUIRE_FALSE( m.has_flag( "FUNGUS", p ) ); - m.add_field( p, fd_fungal_haze, 3 ); + m.add_field( p, field_fd_fungal_haze, 3 ); // note: time limit was chosen arbitrary. It could be too low. const int time_limit_turns = to_turns( 1_hours ); @@ -396,8 +408,8 @@ TEST_CASE( "fungal_haze_test", "[field]" ) m.process_fields(); // maintain fungal field up to the time limit - if( !m.get_field( p, fd_fungal_haze ) ) { - m.add_field( p, fd_fungal_haze, 3 ); + if( !m.get_field( p, field_fd_fungal_haze ) ) { + m.add_field( p, field_fd_fungal_haze, 3 ); } } { @@ -420,13 +432,13 @@ TEST_CASE( "player_in_field_test", "[field][player]" ) map &m = get_map(); - m.add_field( p, fd_sap, 3 ); + m.add_field( p, field_fd_sap, 3 ); // Also add bunch of unrelated fields - m.add_field( p, fd_blood, 3 ); - m.add_field( p, fd_blood_insect, 3 ); - m.add_field( p, fd_blood_veggy, 3 ); - m.add_field( p, fd_blood_invertebrate, 3 ); + m.add_field( p, field_fd_blood, 3 ); + m.add_field( p, field_fd_blood_insect, 3 ); + m.add_field( p, field_fd_blood_veggy, 3 ); + m.add_field( p, field_fd_blood_invertebrate, 3 ); const int time_limit_turns = to_turns( 5_minutes ); @@ -434,7 +446,7 @@ TEST_CASE( "player_in_field_test", "[field][player]" ) while( is_field_alive && fields_test_turns() < time_limit_turns ) { calendar::turn += 1_turns; m.creature_in_field( dummy ); - const field_entry *sap_field = m.get_field( p, fd_sap ); + const field_entry *sap_field = m.get_field( p, field_fd_sap ); is_field_alive = sap_field && sap_field->is_field_alive(); } { @@ -454,27 +466,27 @@ TEST_CASE( "field_API_test", "[field]" ) map &m = get_map(); field &f = m.field_at( p ); - REQUIRE_FALSE( f.find_field( fd_fire ) ); + REQUIRE_FALSE( f.find_field( field_fd_fire ) ); - CHECK( m.add_field( p, fd_fire, 1 ) ); + CHECK( m.add_field( p, field_fd_fire, 1 ) ); - CHECK( f.find_field( fd_fire ) ); - CHECK( f.find_field( fd_fire, /*alive_only*/ false ) ); - CHECK( m.get_field( p, fd_fire ) ); - CHECK( m.get_field_intensity( p, fd_fire ) == 1 ); + CHECK( f.find_field( field_fd_fire ) ); + CHECK( f.find_field( field_fd_fire, /*alive_only*/ false ) ); + CHECK( m.get_field( p, field_fd_fire ) ); + CHECK( m.get_field_intensity( p, field_fd_fire ) == 1 ); - m.remove_field( p, fd_fire ); + m.remove_field( p, field_fd_fire ); - CHECK_FALSE( f.find_field( fd_fire ) ); + CHECK_FALSE( f.find_field( field_fd_fire ) ); { INFO( "Field is still there, actually removed only by process_fields" ); - CHECK( f.find_field( fd_fire, /*alive_only*/ false ) ); + CHECK( f.find_field( field_fd_fire, /*alive_only*/ false ) ); } - CHECK_FALSE( m.get_field( p, fd_fire ) ); - CHECK( m.get_field_intensity( p, fd_fire ) == 0 ); + CHECK_FALSE( m.get_field( p, field_fd_fire ) ); + CHECK( m.get_field_intensity( p, field_fd_fire ) == 0 ); - CHECK( m.set_field_intensity( p, fd_fire, 1 ) == 1 ); - CHECK( f.find_field( fd_fire ) ); + CHECK( m.set_field_intensity( p, field_fd_fire, 1 ) == 1 ); + CHECK( f.find_field( field_fd_fire ) ); fields_test_cleanup(); } diff --git a/tests/magic_spell_effect_test.cpp b/tests/magic_spell_effect_test.cpp index bdef638395299..bae5130347b29 100644 --- a/tests/magic_spell_effect_test.cpp +++ b/tests/magic_spell_effect_test.cpp @@ -17,6 +17,8 @@ #include "point.h" #include "type_id.h" +static const field_type_str_id field_fd_fatigue( "fd_fatigue" ); + static const spell_id spell_AO_CLOSE_TEAR( "AO_CLOSE_TEAR" ); static const spell_id spell_test_line_spell( "test_line_spell" ); @@ -104,10 +106,10 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) tripoint_abs_ms p2 = player_initial_pos + tripoint_east * 11; tripoint_abs_ms p3 = player_initial_pos + tripoint_east * 12; tripoint_abs_ms p4 = player_initial_pos + tripoint_east * 13; - m.add_field( m.bub_from_abs( p1 ), fd_fatigue, 1, 1_hours ); - m.add_field( m.bub_from_abs( p2 ), fd_fatigue, 2, 1_hours ); - m.add_field( m.bub_from_abs( p3 ), fd_fatigue, 3, 1_hours ); - m.add_field( m.bub_from_abs( p4 ), fd_fatigue, 3, 1_hours ); + m.add_field( m.bub_from_abs( p1 ), field_fd_fatigue, 1, 1_hours ); + m.add_field( m.bub_from_abs( p2 ), field_fd_fatigue, 2, 1_hours ); + m.add_field( m.bub_from_abs( p3 ), field_fd_fatigue, 3, 1_hours ); + m.add_field( m.bub_from_abs( p4 ), field_fd_fatigue, 3, 1_hours ); if( with_light ) { player_add_headlamp(); @@ -120,7 +122,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) dummy.recalc_sight_limits(); CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); - CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p1, p2, p3, p4 } ); + CHECK( count_fields_near( p1, field_fd_fatigue ) == std::set { p1, p2, p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); calendar::turn += 1_turns; @@ -129,7 +131,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) m.process_fields(); CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); - CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p2, p3, p4 } ); + CHECK( count_fields_near( p1, field_fd_fatigue ) == std::set { p2, p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); calendar::turn += 1_turns; @@ -138,7 +140,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) m.process_fields(); CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); - CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p3, p4 } ); + CHECK( count_fields_near( p1, field_fd_fatigue ) == std::set { p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); calendar::turn += 1_turns; @@ -146,7 +148,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) calendar::turn += 1_turns; m.process_fields(); - CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p4 } ); + CHECK( count_fields_near( p1, field_fd_fatigue ) == std::set { p4 } ); }; setup_and_remove_fields( true ); diff --git a/tests/npc_test.cpp b/tests/npc_test.cpp index 40b341606759c..54aa95616becd 100644 --- a/tests/npc_test.cpp +++ b/tests/npc_test.cpp @@ -14,7 +14,6 @@ #include "creature_tracker.h" #include "faction.h" #include "field.h" -#include "field_type.h" #include "game.h" #include "line.h" #include "map.h" @@ -40,6 +39,8 @@ class Creature; static const efftype_id effect_bouldering( "bouldering" ); static const efftype_id effect_sleep( "sleep" ); +static const field_type_str_id field_fd_acid( "fd_acid" ); + static const item_group_id Item_spawn_data_test_NPC_guns( "test_NPC_guns" ); static const item_group_id Item_spawn_data_trash_forest( "trash_forest" ); @@ -461,7 +462,7 @@ TEST_CASE( "npc-movement" ) if( type == 'A' || type == 'R' || type == 'W' || type == 'M' || type == 'B' || type == 'C' ) { - here.add_field( p, fd_acid, 3 ); + here.add_field( p, field_fd_acid, 3 ); } // spawn rubbles if( type == 'R' ) { @@ -487,7 +488,7 @@ TEST_CASE( "npc-movement" ) guy->remove_worn_items_with( [&]( item & armor ) { return armor.covers( bodypart_id( "foot_r" ) ) || armor.covers( bodypart_id( "foot_l" ) ); } ); - REQUIRE( !guy->is_immune_field( fd_acid ) ); + REQUIRE( !guy->is_immune_field( field_fd_acid ) ); guy->spawn_at_precise( get_map().getglobal( p ) ); // Set the shopkeep mission; this means that // the NPC deems themselves to be guarding and stops them diff --git a/tests/string_ids_test.cpp b/tests/string_ids_test.cpp index 0ecb3f11bcf7a..790ce821e5402 100644 --- a/tests/string_ids_test.cpp +++ b/tests/string_ids_test.cpp @@ -7,12 +7,16 @@ #include #include "cata_catch.h" -#include "field_type.h" #include "string_id_utils.h" #include "type_id.h" class json_flag; +static const field_type_str_id field_fd_smoke( "fd_smoke" ); +static const field_type_str_id field_fd_toxic_gas( "fd_toxic_gas" ); +static const field_type_str_id field_fd_tear_gas( "fd_tear_gas" ); +static const field_type_str_id field_fd_nuke_gas( "fd_nuke_gas" ); + TEST_CASE( "sizeof_new_id", "[.][int_id][string_id]" ) { DYNAMIC_SECTION( "sizeof: int_id: " << sizeof( flag_id ) ) {} @@ -22,17 +26,18 @@ TEST_CASE( "sizeof_new_id", "[.][int_id][string_id]" ) TEST_CASE( "static_string_ids_equality_test", "[string_id]" ) { + // Check equivilance of interned string_id s to dynamic string_id s // NOLINTNEXTLINE(cata-static-string_id-constants) - CHECK( fd_smoke == string_id( "fd_smoke" ) ); + CHECK( field_fd_smoke == string_id( "fd_smoke" ) ); // NOLINTNEXTLINE(cata-static-string_id-constants) - CHECK( fd_toxic_gas == string_id( "fd_toxic_gas" ) ); + CHECK( field_fd_toxic_gas == string_id( "fd_toxic_gas" ) ); // NOLINTNEXTLINE(cata-static-string_id-constants) - CHECK( fd_tear_gas == string_id( "fd_tear_gas" ) ); + CHECK( field_fd_tear_gas == string_id( "fd_tear_gas" ) ); // NOLINTNEXTLINE(cata-static-string_id-constants) - CHECK( fd_nuke_gas == string_id( "fd_nuke_gas" ) ); + CHECK( field_fd_nuke_gas == string_id( "fd_nuke_gas" ) ); // NOLINTNEXTLINE(cata-static-string_id-constants) - CHECK( fd_nuke_gas != string_id( "fd_nuke_gas1" ) ); + CHECK( field_fd_nuke_gas != string_id( "fd_nuke_gas1" ) ); } TEST_CASE( "string_ids_intern_test", "[string_id]" )