Skip to content

Commit

Permalink
Rename bodypart name variables to better explain their functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Qrox committed Feb 7, 2020
1 parent 9aa7645 commit ff590a0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 39 deletions.
68 changes: 34 additions & 34 deletions data/json/body_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "torso",
"type": "body_part",
"name": "torso",
"heading_singular": "Torso",
"heading_plural": "Torso",
"heading": "Torso",
"heading_multiple": "Torso",
"hp_bar_ui_text": "TORSO",
"encumbrance_text": "Dodging and melee is hampered.",
"main_part": "torso",
Expand All @@ -20,8 +20,8 @@
"id": "head",
"type": "body_part",
"name": "head",
"heading_singular": "Head",
"heading_plural": "Head",
"heading": "Head",
"heading_multiple": "Head",
"hp_bar_ui_text": "HEAD",
"encumbrance_text": "",
"main_part": "head",
Expand All @@ -37,8 +37,8 @@
"id": "eyes",
"type": "body_part",
"name": "eyes",
"heading_singular": "Eyes",
"heading_plural": "Eyes",
"heading": "Eyes",
"heading_multiple": "Eyes",
"encumbrance_text": "Ranged combat is hampered.",
"main_part": "head",
"opposite_part": "eyes",
Expand All @@ -53,8 +53,8 @@
"id": "mouth",
"type": "body_part",
"name": "mouth",
"heading_singular": "Mouth",
"heading_plural": "Mouth",
"heading": "Mouth",
"heading_multiple": "Mouth",
"encumbrance_text": "Running is slowed.",
"main_part": "head",
"opposite_part": "mouth",
Expand All @@ -69,9 +69,9 @@
"id": "arm_l",
"type": "body_part",
"name": "left arm",
"name_plural": "arms",
"heading_singular": "L. Arm",
"heading_plural": "Arms",
"name_multiple": "arms",
"heading": "L. Arm",
"heading_multiple": "Arms",
"encumbrance_text": "Melee and ranged combat is hampered.",
"hp_bar_ui_text": "L ARM",
"main_part": "arm_l",
Expand All @@ -87,9 +87,9 @@
"id": "arm_r",
"type": "body_part",
"name": "right arm",
"name_plural": "arms",
"heading_singular": "R. Arm",
"heading_plural": "Arms",
"name_multiple": "arms",
"heading": "R. Arm",
"heading_multiple": "Arms",
"hp_bar_ui_text": "R ARM",
"encumbrance_text": "Melee and ranged combat is hampered.",
"main_part": "arm_r",
Expand All @@ -105,9 +105,9 @@
"id": "hand_l",
"type": "body_part",
"name": "left hand",
"name_plural": "hands",
"heading_singular": "L. Hand",
"heading_plural": "Hands",
"name_multiple": "hands",
"heading": "L. Hand",
"heading_multiple": "Hands",
"encumbrance_text": "Manual tasks are slowed.",
"main_part": "arm_l",
"opposite_part": "hand_r",
Expand All @@ -122,9 +122,9 @@
"id": "hand_r",
"type": "body_part",
"name": "right hand",
"name_plural": "hands",
"heading_singular": "R. Hand",
"heading_plural": "Hands",
"name_multiple": "hands",
"heading": "R. Hand",
"heading_multiple": "Hands",
"encumbrance_text": "Manual tasks are slowed.",
"main_part": "arm_r",
"opposite_part": "hand_l",
Expand All @@ -139,9 +139,9 @@
"id": "leg_l",
"type": "body_part",
"name": "left leg",
"name_plural": "legs",
"heading_singular": "L. Leg",
"heading_plural": "Legs",
"name_multiple": "legs",
"heading": "L. Leg",
"heading_multiple": "Legs",
"hp_bar_ui_text": "L LEG",
"encumbrance_text": "Running and swimming are slowed.",
"main_part": "leg_l",
Expand All @@ -157,9 +157,9 @@
"id": "leg_r",
"type": "body_part",
"name": "right leg",
"name_plural": "legs",
"heading_singular": "R. Leg",
"heading_plural": "Legs",
"name_multiple": "legs",
"heading": "R. Leg",
"heading_multiple": "Legs",
"hp_bar_ui_text": "R LEG",
"encumbrance_text": "Running and swimming are slowed.",
"main_part": "leg_r",
Expand All @@ -175,9 +175,9 @@
"id": "foot_l",
"type": "body_part",
"name": "left foot",
"name_plural": "feet",
"heading_singular": "L. Foot",
"heading_plural": "Feet",
"name_multiple": "feet",
"heading": "L. Foot",
"heading_multiple": "Feet",
"encumbrance_text": "Running is slowed.",
"main_part": "leg_l",
"opposite_part": "foot_r",
Expand All @@ -192,9 +192,9 @@
"id": "foot_r",
"type": "body_part",
"name": "right foot",
"name_plural": "feet",
"heading_singular": "R. Foot",
"heading_plural": "Feet",
"name_multiple": "feet",
"heading": "R. Foot",
"heading_multiple": "Feet",
"encumbrance_text": "Running is slowed.",
"main_part": "leg_r",
"opposite_part": "foot_l",
Expand All @@ -209,8 +209,8 @@
"id": "num_bp",
"type": "body_part",
"name": "appendix",
"heading_singular": "appendix",
"heading_plural": "Appendices",
"heading": "appendix",
"heading_multiple": "Appendices",
"encumbrance_text": "It's inflamed.",
"main_part": "num_bp",
"opposite_part": "num_bp",
Expand Down
14 changes: 10 additions & 4 deletions src/bodypart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,15 @@ void body_part_struct::load( const JsonObject &jo, const std::string & )
mandatory( jo, was_loaded, "id", id );

mandatory( jo, was_loaded, "name", name );
optional( jo, was_loaded, "name_plural", name_multiple );
mandatory( jo, was_loaded, "heading_singular", name_as_heading_singular );
mandatory( jo, was_loaded, "heading_plural", name_as_heading_multiple );
// This is NOT the plural of `name`; it's a name refering to the pair of
// bodyparts which this bodypart belongs to, and thus should not be implemented
// using "ngettext" or "translation::make_plural". Otherwise, in languages
// without plural forms, translation of this string would indicate it
// to be a left or right part, while it is not.
optional( jo, was_loaded, "name_multiple", name_multiple );
mandatory( jo, was_loaded, "heading", name_as_heading );
// Same as the above comment
mandatory( jo, was_loaded, "heading_multiple", name_as_heading_multiple );
optional( jo, was_loaded, "hp_bar_ui_text", hp_bar_ui_text );
mandatory( jo, was_loaded, "encumbrance_text", encumb_text );
mandatory( jo, was_loaded, "hit_size", hit_size );
Expand Down Expand Up @@ -276,7 +282,7 @@ std::string body_part_name_accusative( body_part bp, int number )
std::string body_part_name_as_heading( body_part bp, int number )
{
const auto &bdy = get_bp( bp );
return number > 1 ? _( bdy.name_as_heading_multiple ) : _( bdy.name_as_heading_singular );
return number > 1 ? _( bdy.name_as_heading_multiple ) : _( bdy.name_as_heading );
}

std::string body_part_hp_bar_ui_text( body_part bp )
Expand Down
2 changes: 1 addition & 1 deletion src/bodypart.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct body_part_struct {
// Those are stored untranslated
std::string name;
std::string name_multiple;
std::string name_as_heading_singular;
std::string name_as_heading;
std::string name_as_heading_multiple;
std::string hp_bar_ui_text;
std::string encumb_text;
Expand Down

0 comments on commit ff590a0

Please sign in to comment.