diff options
Diffstat (limited to 'src/net/tmwa/charserverhandler.cpp')
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 0ecbb135..f248388b 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -36,6 +36,7 @@ #include "net/tmwa/messageout.h" #include "net/tmwa/network.h" #include "net/tmwa/protocol.h" +#include "net/tmwa/token.h" #include "resources/attributes.h" #include "resources/chardb.h" @@ -89,8 +90,8 @@ void CharServerHandler::handleMessage(MessageIn &msg) auto *character = new Net::Character; readPlayerData(msg, character); mCharacters.push_back(character); - logger->log("CharServer: Player: %s (%d)", - character->dummy->getName().c_str(), character->slot); + Log::info("CharServer: Player: %s (%d)", + character->dummy->getName().c_str(), character->slot); } Client::setState(STATE_CHAR_SELECT); @@ -241,7 +242,7 @@ void CharServerHandler::readPlayerData(MessageIn &msg, Net::Character *character const uint16_t weapon = msg.readInt16(); auto *tempPlayer = new LocalPlayer(id, race); - tempPlayer->setGender(token.sex); + tempPlayer->setGender(sexToGender(token.sex)); tempPlayer->setSprite(SPRITE_SHOE, shoe); tempPlayer->setSprite(SPRITE_GLOVES, gloves); @@ -267,8 +268,7 @@ void CharServerHandler::readPlayerData(MessageIn &msg, Net::Character *character character->data.mStats[i + STRENGTH].base = msg.readInt8(); character->slot = msg.readInt8(); // character slot - const uint8_t sex = msg.readInt8(); - tempPlayer->setGender(sex ? Gender::Male : Gender::Female); + tempPlayer->setGender(sexToGender(static_cast<SEX>(msg.readInt8()))); } void CharServerHandler::setCharSelectDialog(CharSelectDialog *window) @@ -306,7 +306,9 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window) sumStat = Attributes::getCreationPoints(); mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat); - mCharCreateDialog->setDefaultGender(token.sex); + + if (token.sex != SEX::UNSPECIFIED) + mCharCreateDialog->setDefaultGender(sexToGender(token.sex)); } void CharServerHandler::requestCharacters() @@ -324,7 +326,7 @@ void CharServerHandler::chooseCharacter(Net::Character *character) } void CharServerHandler::newCharacter(const std::string &name, int slot, - bool gender, int hairstyle, int hairColor, + Gender /*gender*/, int hairstyle, int hairColor, const std::vector<int> &stats) { MessageOut outMsg(CMSG_CHAR_CREATE); @@ -400,7 +402,7 @@ void CharServerHandler::connect() // [Fate] The next word is unused by the old char server, so we squeeze in // mana client version information outMsg.writeInt16(CLIENT_PROTOCOL_VERSION); - outMsg.writeInt8(token.sex == Gender::Male ? 1 : 0); + outMsg.writeInt8(static_cast<uint8_t>(token.sex)); // We get 4 useless bytes before the real answer comes in (what are these?) mNetwork->skip(4); |