summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-14 00:23:03 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-14 00:34:05 +0300
commitd6c647ca7f46a517b200f2901eba319e7e4223e8 (patch)
tree1cf66e73804e65753bd66ea49f6eaab114414a04
parent35b27514c8eede4daa8f07f7b44d9579c78d18cf (diff)
downloadplus-d6c647ca7f46a517b200f2901eba319e7e4223e8.tar.gz
plus-d6c647ca7f46a517b200f2901eba319e7e4223e8.tar.bz2
plus-d6c647ca7f46a517b200f2901eba319e7e4223e8.tar.xz
plus-d6c647ca7f46a517b200f2901eba319e7e4223e8.zip
Add features.xml attribute for force char gender for new chars.
New attribute: forceCharGender Default value: -1 (mean not forcing)
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/windows/charcreatedialog.cpp56
2 files changed, 36 insertions, 21 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index a424137c0..38573de9d 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -633,6 +633,7 @@ DefaultsData* getFeaturesDefaults()
AddDEF("allowFollow", true);
AddDEF("fixDeadAnimation", true);
AddDEF("forceAccountGender", -1);
+ AddDEF("forceCharGender", -1);
return configData;
}
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 39618917e..58363cb76 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -215,28 +215,37 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
if (serverFeatures->haveCreateCharGender())
{
- const int size = config.getIntValue("fontSize");
- mGenderStrip = new TabStrip(this,
- "gender_" + getWindowName(),
- size + 16);
- mGenderStrip->setPressFirst(false);
- mGenderStrip->addActionListener(this);
- mGenderStrip->setActionEventId("gender_");
- // TRANSLATORS: one char size female character gender
- mGenderStrip->addButton(_("F"), "f", false);
- // TRANSLATORS: one char size male character gender
- mGenderStrip->addButton(_("M"), "m", false);
- if (features.getIntValue("forceAccountGender") == -1)
+ const int forceGender = features.getIntValue("forceCharGender");
+ if (forceGender == -1)
{
- // TRANSLATORS: one char size unknown character gender
- mGenderStrip->addButton(_("U"), "u", true);
- }
- mGenderStrip->setVisible(Visible_true);
- add(mGenderStrip);
+ const int size = config.getIntValue("fontSize");
+ mGenderStrip = new TabStrip(this,
+ "gender_" + getWindowName(),
+ size + 16);
+ mGenderStrip->setPressFirst(false);
+ mGenderStrip->addActionListener(this);
+ mGenderStrip->setActionEventId("gender_");
+ // TRANSLATORS: one char size female character gender
+ mGenderStrip->addButton(_("F"), "f", false);
+ // TRANSLATORS: one char size male character gender
+ mGenderStrip->addButton(_("M"), "m", false);
+ if (features.getIntValue("forceAccountGender") == -1)
+ {
+ // TRANSLATORS: one char size unknown character gender
+ mGenderStrip->addButton(_("U"), "u", true);
+ }
+ mGenderStrip->setVisible(Visible_true);
+ add(mGenderStrip);
- mGenderStrip->setPosition(385, 130);
- mGenderStrip->setWidth(500);
- mGenderStrip->setHeight(50);
+ mGenderStrip->setPosition(385, 130);
+ mGenderStrip->setWidth(500);
+ mGenderStrip->setHeight(50);
+ }
+ else
+ {
+ mGender = Being::intToGender(forceGender);
+ mPlayer->setGender(mGender);
+ }
}
mPlayerBox->setWidth(74);
@@ -600,7 +609,9 @@ void CharCreateDialog::setAttributes(const StringVect &labels,
h = y + labels.size() * 24 +
mAttributesLeft->getHeight() + getPadding();
}
- if (serverFeatures->haveCreateCharGender() && y < 160)
+ if (serverFeatures->haveCreateCharGender() &&
+ features.getIntValue("forceCharGender") == -1 &&
+ y < 160)
{
if (h < 160)
h = 160;
@@ -615,6 +626,9 @@ void CharCreateDialog::setAttributes(const StringVect &labels,
void CharCreateDialog::setDefaultGender(const GenderT gender)
{
+ if (features.getIntValue("forceCharGender") != -1)
+ return;
+
mDefaultGender = gender;
mPlayer->setGender(gender);
}