From 947b3f76be9fbd6986e8a78c799e8304bf055125 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 19 Nov 2017 11:06:35 +0200 Subject: [PATCH] [Server] Replace Player's isMale() and setIsMale() with gender property For simplicity and clarity. --- apps/openmw-mp/Player.cpp | 23 +++++++++++------------ apps/openmw-mp/Player.hpp | 4 ++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 9752e4984..f48455ce5 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -45,9 +45,8 @@ void Player::Init(LuaState &lua) "name", sol::property(&Player::getName, &Player::setName), "setCharGenStages", &Player::setCharGenStages, - "isMale", &Player::isMale, - "setIsMale", &Player::setIsMale, "level", sol::property(&Player::getLevel, &Player::setLevel), + "gender", sol::property(&Player::getGender, &Player::setGender), "race", sol::property(&Player::getRace, &Player::setRace), "head", sol::property(&Player::getHead, &Player::setHead), "hair", sol::property(&Player::getHair, &Player::setHair), @@ -353,26 +352,26 @@ void Player::message(const std::string &message, bool toAll) packet->Send(true); } -bool Player::isMale() const +void Player::setLevel(int level) { - return npc.isMale(); + creatureStats.mLevel = level; + levelChanged = true; } -void Player::setIsMale(bool male) +int Player::getLevel() const { - npc.setIsMale(male); - baseInfoChanged = true; + return creatureStats.mLevel; } -void Player::setLevel(int level) +void Player::setGender(int gender) { - creatureStats.mLevel = level; - levelChanged = true; + npc.setIsMale(gender); + baseInfoChanged = true; } -int Player::getLevel() const +int Player::getGender() const { - return creatureStats.mLevel; + return npc.isMale(); } void Player::setRace(const std::string &race) diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index 37bf427df..c5a8fb8ea 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -82,8 +82,8 @@ public: std::string getName(); void setCharGenStages(int currentStage, int endStage); void message(const std::string &message, bool toAll = false); - bool isMale() const; - void setIsMale(bool male); + void setGender(int gender); + int getGender() const; void setRace(const std::string &race); std::string getRace() const; void setHead(const std::string &head);