diff --git a/lang/string_extractor/parser.py b/lang/string_extractor/parser.py index 4275e4c2a3eff..d4f762aee2daf 100644 --- a/lang/string_extractor/parser.py +++ b/lang/string_extractor/parser.py @@ -4,6 +4,7 @@ from .parsers.ammunition_type import parse_ammunition_type from .parsers.bionic import parse_bionic from .parsers.body_part import parse_body_part +from .parsers.camp_migration import parse_camp_migration from .parsers.character_mod import parse_character_mod from .parsers.city import parse_city from .parsers.climbing_aid import parse_climbing_aid @@ -61,6 +62,7 @@ from .parsers.movement_mode import parse_movement_mode from .parsers.mutation_category import parse_mutation_category from .parsers.overmap_land_use_code import parse_overmap_land_use_code +from .parsers.overmap_special import parse_overmap_special from .parsers.practice import parse_practice from .parsers.scenario import parse_scenario from .parsers.shop_blacklist import parse_shopkeeper_blacklist @@ -114,6 +116,7 @@ def dummy_parser(json, origin): "body_part": parse_body_part, "book": parse_generic, "butchery_requirement": dummy_parser, + "camp_migration": parse_camp_migration, "character_mod": parse_character_mod, "charge_removal_blacklist": dummy_parser, "city": parse_city, @@ -193,7 +196,7 @@ def dummy_parser(json, origin): "overmap_connection": dummy_parser, "overmap_land_use_code": parse_overmap_land_use_code, "overmap_location": dummy_parser, - "overmap_special": dummy_parser, + "overmap_special": parse_overmap_special, "overmap_special_migration": dummy_parser, "overmap_terrain": parse_overmap_terrain, "palette": parse_palette, diff --git a/lang/string_extractor/parsers/overmap_special.py b/lang/string_extractor/parsers/overmap_special.py new file mode 100644 index 0000000000000..57e3cc6eb5c53 --- /dev/null +++ b/lang/string_extractor/parsers/overmap_special.py @@ -0,0 +1,8 @@ +from ..write_text import write_text + + +def parse_overmap_special(json, origin): + for overmap in json["overmaps"]: + if "camp_name" in overmap: + write_text(overmap["camp_name"], origin, + comment="Name of NPC faction camp") diff --git a/src/omdata.h b/src/omdata.h index 1203fc13f1edf..04f9460765312 100644 --- a/src/omdata.h +++ b/src/omdata.h @@ -501,7 +501,7 @@ struct overmap_special_terrain : overmap_special_locations { oter_str_id terrain; std::set flags; std::optional camp_owner; - std::string camp_name; + translation camp_name; void deserialize( const JsonObject &om ); }; diff --git a/src/overmap.cpp b/src/overmap.cpp index 60153bd99e71f..a45183e93059f 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -1443,7 +1443,7 @@ struct fixed_overmap_special_data : overmap_special_data { } else { basecamp *temp_camp = *bcp; temp_camp->set_owner( elem.camp_owner.value() ); - temp_camp->set_name( elem.camp_name ); + temp_camp->set_name( elem.camp_name.translated() ); // FIXME? Camp types are raw strings! Not ideal. temp_camp->define_camp( camp_loc, "faction_base_bare_bones_NPC_camp_0", false ); } @@ -3972,7 +3972,7 @@ void overmap::clear_connections_out() } static std::map oter_id_migrations; -static std::map> camp_map; +static std::map> camp_migration_map; void overmap::load_oter_id_migration( const JsonObject &jo ) { @@ -3990,12 +3990,12 @@ void overmap::load_oter_id_camp_migration( const JsonObject &jo ) jsobj.read( "name", name ); jsobj.read( "overmap_terrain", oter ); jsobj.read( "faction", owner ); - camp_map.emplace( oter, std::pair( name, owner ) ); + camp_migration_map.emplace( oter, std::pair( name, owner ) ); } void overmap::reset_oter_id_camp_migrations() { - camp_map.clear(); + camp_migration_map.clear(); } void overmap::reset_oter_id_migrations() @@ -4005,7 +4005,7 @@ void overmap::reset_oter_id_migrations() bool overmap::oter_id_should_have_camp( const oter_type_str_id &oter ) { - return camp_map.count( oter ) > 0; + return camp_migration_map.count( oter ) > 0; } bool overmap::is_oter_id_obsolete( const std::string &oterid ) @@ -4046,8 +4046,8 @@ void overmap::migrate_camps( const std::vector &points ) const basecamp *temp_camp = *bcp; const oter_type_str_id &keyvalue = ter( project_remain ( point ).remainder_tripoint )->get_type_id(); - temp_camp->set_owner( camp_map[keyvalue].second ); - temp_camp->set_name( camp_map[keyvalue].first ); + temp_camp->set_owner( camp_migration_map[keyvalue].second ); + temp_camp->set_name( camp_migration_map[keyvalue].first.translated() ); temp_camp->define_camp( point, "faction_base_bare_bones_NPC_camp_0", false ); } }