Skip to content

Commit 8f17d25

Browse files
committed
Use language gender instead of creature's gender definition for all grammar forms
1 parent b6e7160 commit 8f17d25

File tree

9 files changed

+10
-14
lines changed

9 files changed

+10
-14
lines changed

creature.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ void Creature::onKilledOrCaptured(Creature* victim) {
12891289
if (victim->getStatus().contains(CreatureStatus::LEADER) && getBody().hasBrain(getGame()->getContentFactory())) {
12901290
auto victimName = victim->getName();
12911291
victimName.setKillTitle(none);
1292-
TString title = setSubjectGender(TSentence("KILL_TITLE", victimName.name), getAttributes().getGender());
1292+
TString title = setSubjectGender(TSentence("KILL_TITLE", victimName.name), getName().name);
12931293
if (!killTitles.contains(title)) {
12941294
attributes->getName().setKillTitle(title);
12951295
killTitles.push_back(title);

creature_attributes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ optional<SoundId> CreatureAttributes::getAttackSound(AttackType type, bool damag
212212
}
213213

214214
TString CreatureAttributes::getDescription(const ContentFactory* factory) const {
215-
return setSubjectGender(body->getDescription(factory), gender);
215+
return setSubjectGender(body->getDescription(factory), name.name);
216216
}
217217

218218
void CreatureAttributes::add(BodyPart p, int count, const ContentFactory* factory) {

data_free/game_config/translations/english.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4050,6 +4050,7 @@ ENEMY_AGGRESSION_EXTREME "extreme"
40504050
EXP_INCREASE_MILD "mild"
40514051
EXP_INCREASE_NORMAL "normal"
40524052
EXP_INCREASE_EXTREME "extreme"
4053+
SUBJECT_GENDER "{1}"
40534054
NEW_LINE "{1}
40544055
{2}"
40554056
TEXT128 "Page not found. Please contact mod author."

data_free/game_config/translations/polish.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9936,6 +9936,7 @@ ENEMY_AGGRESSION_EXTREME "ekstremalna"
99369936
EXP_INCREASE_MILD "łagodna"
99379937
EXP_INCREASE_NORMAL "normalna"
99389938
EXP_INCREASE_EXTREME "ekstremalna"
9939+
SUBJECT_GENDER "{1:2}"
99399940
NEW_LINE "{1}
99409941
{2}"
99419942
TEXT128 "Nie znaleziono strony. Skontaktuj się z autorem moda."

effect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2292,7 +2292,7 @@ static bool apply(const Effects::Audience& a, Position pos, Creature* attacker)
22922292
if (wasTeleported) {
22932293
if (attacker)
22942294
attacker->privateMessage(PlayerMessage(setSubjectGender(TSentence("AUDIENCE_SUMMONED"),
2295-
attacker->getAttributes().getGender()), MessagePriority::HIGH));
2295+
attacker->getName().name), MessagePriority::HIGH));
22962296
else
22972297
pos.globalMessage(PlayerMessage(TStringId("AUDIENCE_SUMMONED2"), MessagePriority::HIGH));
22982298
return true;

message_generator.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void addSecond(const Creature* c, MsgType type, vector<TString> param) {
133133
}
134134
}();
135135
if (msg)
136-
c->message(PlayerMessage(setSubjectGender(*msg, c->getAttributes().getGender()), MessagePriority::HIGH));
136+
c->message(PlayerMessage(setSubjectGender(*msg, c->getName().name), MessagePriority::HIGH));
137137
}
138138

139139
static void addBoulder(const Creature* c, MsgType type, vector<TString> param) {
@@ -219,7 +219,7 @@ void MessageGenerator::addThirdPerson(const Creature* c, PlayerMessage msg) {
219219

220220
void MessageGenerator::addSecondPerson(const Creature* c, PlayerMessage msg) {
221221
if (type == SECOND_PERSON) {
222-
msg.text = setSubjectGender(msg.text, c->getAttributes().getGender());
222+
msg.text = setSubjectGender(msg.text, c->getName().name);
223223
c->message(std::move(msg));
224224
}
225225
}

t_string.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,8 @@ TString makePlural(TString s) {
229229
return TSentence("MAKE_PLURAL", std::move(s));
230230
}
231231

232-
TString setSubjectGender(TString s, Gender gender) {
233-
if (gender == Gender::FEMALE)
234-
s = TSentence("FEMININE_SUBJECT", std::move(s));
235-
return s;
232+
TString setSubjectGender(TString s, TString name) {
233+
return TSentence("SUBJECT_GENDER", std::move(s), std::move(name));
236234
}
237235

238236
TString combineWithAnd(vector<TString> v) {

t_string.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ TString combineSentences(vector<TString>);
8383
TString toText(int num);
8484
TString capitalFirst(TString);
8585
TString makePlural(TString);
86-
TString setSubjectGender(TString, Gender);
86+
TString setSubjectGender(TString sentence, TString subject);
8787
TString toPercentage(double);
8888
TString toStringWithSign(int);

translations.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ string Translations::get(const string& language, const TSentence& s, vector<stri
9595
form.push_back("plural");
9696
return get(language, s.params[0], std::move(form));
9797
}
98-
if (s.id == TStringId("FEMININE_SUBJECT")) {
99-
form.push_back("feminine");
100-
return get(language, s.params[0], std::move(form));
101-
}
10298
if (s.id == TStringId("MAKE_SENTENCE"))
10399
return makeSentence(get(language, s.params[0], std::move(form)));
104100
if (s.id == TStringId("A_ARTICLE")) {

0 commit comments

Comments
 (0)