Skip to content

Commit

Permalink
Improved checks and removed redundant code.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Apr 23, 2024
1 parent ea1b739 commit 2509fa9
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6612,15 +6612,23 @@ void ProtocolGame::sendOutfitWindow() {
NetworkMessage msg;
msg.addByte(0xC8);

if (oldProtocol) {
Outfit_t currentOutfit = player->getDefaultOutfit();
Outfit_t currentOutfit = player->getDefaultOutfit();
auto isSupportOutfit = player->isSupportOutfit();
bool mounted = false;

if (!isSupportOutfit) {
const auto currentMount = g_game().mounts.getMountByID(player->getLastMount());
if (currentMount) {
mounted = (currentOutfit.lookMount == currentMount->clientId);
currentOutfit.lookMount = currentMount->clientId;
}
} else {
currentOutfit.lookMount = 0;
}

AddOutfit(msg, currentOutfit);
AddOutfit(msg, currentOutfit);

if (oldProtocol) {
std::vector<ProtocolOutfit> protocolOutfits;
const auto outfits = Outfits::getInstance().getOutfits(player->getSex());
protocolOutfits.reserve(outfits.size());
Expand Down Expand Up @@ -6661,22 +6669,6 @@ void ProtocolGame::sendOutfitWindow() {
return;
}

bool mounted = false;
Outfit_t currentOutfit = player->getDefaultOutfit();

auto isSupportOutfit = player->isSupportOutfit();
const auto currentMount = g_game().mounts.getMountByID(player->getLastMount());
if (!isSupportOutfit) {
if (currentMount) {
mounted = (currentOutfit.lookMount == currentMount->clientId);
currentOutfit.lookMount = currentMount->clientId;
}
} else {
currentOutfit.lookMount = 0;
}

AddOutfit(msg, currentOutfit, !isSupportOutfit);

msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountHead);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountBody);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountLegs);
Expand Down

0 comments on commit 2509fa9

Please sign in to comment.