Skip to content

Commit

Permalink
Allow gendered descriptions for professions outside of translations (C…
Browse files Browse the repository at this point in the history
  • Loading branch information
haveric authored Feb 17, 2022
1 parent ab1863b commit 7b044a9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
10 changes: 8 additions & 2 deletions data/json/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3304,7 +3304,10 @@
"type": "profession",
"id": "reenactor",
"name": { "male": "Historical Reenactor", "female": "Ahistorical Reenactor" },
"description": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world permanently derailed your plans.",
"description": {
"male": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world permanently derailed your plans.",
"female": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world made traditional gender roles obsolete."
},
"points": 3,
"proficiencies": [ "prof_gunsmithing_basic", "prof_metalworking", "prof_gunsmithing_antique" ],
"skills": [
Expand Down Expand Up @@ -3348,7 +3351,10 @@
"type": "profession",
"id": "reenactor2",
"name": { "male": "Ahistorical Reenactor", "female": "Historical Reenactor" },
"description": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world made traditional gender roles obsolete.",
"description": {
"male": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world made traditional gender roles obsolete.",
"female": "You were on your way to the Annual All New England Revolutionary War Living History exhibition when the end of the world permanently derailed your plans."
},
"points": 3,
"proficiencies": [ "prof_spinning", "prof_closures", "prof_knitting" ],
"skills": [
Expand Down
26 changes: 23 additions & 3 deletions src/profession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,31 @@ void profession::load( const JsonObject &jo, const std::string & )

if( !was_loaded || jo.has_member( "description" ) ) {
std::string desc;
mandatory( jo, false, "description", desc, text_style_check_reader() );
std::string desc_male;
std::string desc_female;

bool use_default_description = true;
if( jo.has_object( "description" ) ) {
JsonObject desc_obj = jo.get_object( "description" );
desc_obj.allow_omitted_members();

if( desc_obj.has_member( "male" ) && desc_obj.has_member( "female" ) ) {
use_default_description = false;
mandatory( desc_obj, false, "male", desc_male, text_style_check_reader() );
mandatory( desc_obj, false, "female", desc_female, text_style_check_reader() );
}
}

if( use_default_description ) {
mandatory( jo, false, "description", desc, text_style_check_reader() );
desc_male = desc;
desc_female = desc;
}
// These also may differ depending on the language settings!
_description_male = to_translation( "prof_desc_male", desc );
_description_female = to_translation( "prof_desc_female", desc );
_description_male = to_translation( "prof_desc_male", desc_male );
_description_female = to_translation( "prof_desc_female", desc_female );
}

if( jo.has_string( "vehicle" ) ) {
_starting_vehicle = vproto_id( jo.get_string( "vehicle" ) );
}
Expand Down

0 comments on commit 7b044a9

Please sign in to comment.