mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 22:31:15 +00:00
added option to preferences file, 'unit_genders',
which determines whether units with different genders should be used
This commit is contained in:
parent
cefce3bb8e
commit
d96eec74c3
@ -47,6 +47,8 @@ bool message_private_on = true;
|
||||
|
||||
bool haloes = true;
|
||||
|
||||
bool unit_genders = true;
|
||||
|
||||
std::set<std::string> encountered_units_set;
|
||||
std::set<std::string> encountered_terrains_set;
|
||||
|
||||
@ -62,6 +64,7 @@ manager::manager()
|
||||
|
||||
set_colour_cursors(prefs["colour_cursors"] == "yes");
|
||||
set_show_haloes(prefs["show_haloes"] != "no");
|
||||
set_show_unit_genders(prefs["unit_genders"] != "no");
|
||||
|
||||
std::vector<std::string> v;
|
||||
v = config::split(prefs["encountered_units"]);
|
||||
@ -560,6 +563,17 @@ void set_show_haloes(bool value)
|
||||
prefs["show_haloes"] = value ? "yes" : "no";
|
||||
}
|
||||
|
||||
bool show_unit_genders()
|
||||
{
|
||||
return unit_genders;
|
||||
}
|
||||
|
||||
void set_show_unit_genders(bool value)
|
||||
{
|
||||
prefs["unit_genders"] = value ? "yes" : "no";
|
||||
unit_genders = value;
|
||||
}
|
||||
|
||||
std::set<std::string> &encountered_units() {
|
||||
return encountered_units_set;
|
||||
}
|
||||
|
@ -113,6 +113,9 @@ namespace preferences {
|
||||
bool show_haloes();
|
||||
void set_show_haloes(bool value);
|
||||
|
||||
bool show_unit_genders();
|
||||
void set_show_unit_genders(bool value);
|
||||
|
||||
std::set<std::string> &encountered_units();
|
||||
std::set<std::string> &encountered_terrains();
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "language.hpp"
|
||||
#include "log.hpp"
|
||||
#include "pathfind.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "unit.hpp"
|
||||
#include "util.hpp"
|
||||
@ -60,6 +61,10 @@ unit::unit(const game_data& data, const config& cfg) : state_(STATE_NORMAL),
|
||||
|
||||
unit_race::GENDER unit::generate_gender(const unit_type& type, bool gen)
|
||||
{
|
||||
if(preferences::show_unit_genders() == false) {
|
||||
gen = false;
|
||||
}
|
||||
|
||||
const std::vector<unit_race::GENDER>& genders = type.genders();
|
||||
if(genders.empty() == false) {
|
||||
return gen ? genders[get_random()%genders.size()] : genders.front();
|
||||
@ -596,7 +601,7 @@ void unit::read(const game_data& data, const config& cfg)
|
||||
|
||||
assert(type_ != NULL);
|
||||
|
||||
const std::string& gender = cfg["gender"];
|
||||
const std::string& gender = preferences::show_unit_genders() ? cfg["gender"] : "";
|
||||
if(gender == "male") {
|
||||
gender_ = unit_race::MALE;
|
||||
} else if(gender == "female") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user