Skip to content

Commit

Permalink
Also remove points
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Feb 14, 2021
1 parent e0551fa commit 51fb417
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
6 changes: 2 additions & 4 deletions include/liblobby/LobbyMessages.h
Expand Up @@ -286,8 +286,7 @@ class LobbyMessage_PlayerList : public LobbyMessage
for(unsigned i = 0; i < list.size(); ++i)
{
const LobbyPlayerInfo* player = list.getElement(i);
LOG.writeToFile(" %d: %d %s %s %d %d %d\n") % i % player->getId() % player->getName()
% player->getVersion() % player->getPunkte() % player->getGewonnen() % player->getVerloren();
LOG.writeToFile(" %d: %d %s %s\n") % i % player->getId() % player->getName() % player->getVersion();
}
}

Expand Down Expand Up @@ -329,8 +328,7 @@ class LobbyMessage_PlayerList : public LobbyMessage
for(unsigned i = 0; i < list.size(); ++i)
{
const LobbyPlayerInfo* player = list.getElement(i);
LOG.writeToFile(" %d: %d %s %s %d %d %d\n") % i % player->getId() % player->getName()
% player->getVersion() % player->getPunkte() % player->getGewonnen() % player->getVerloren();
LOG.writeToFile(" %d: %d %s %s\n") % i % player->getId() % player->getName() % player->getVersion();
}

return cb->OnNMSLobbyPlayerList(id, list, ingamePlayers);
Expand Down
9 changes: 0 additions & 9 deletions include/liblobby/LobbyPlayerInfo.h
Expand Up @@ -25,17 +25,11 @@ class LobbyPlayerInfo
std::string getName() const { return name_; }
std::string getEmail() const { return email_; }
std::string getVersion() const { return version_; }
int getPunkte() const { return punkte_; }
unsigned getGewonnen() const { return gewonnen_; }
unsigned getVerloren() const { return verloren_; }

void setId(const unsigned playerId) { this->playerId_ = playerId; }
void setName(const std::string& name) { this->name_ = name; }
void setEmail(const std::string& email) { this->email_ = email; }
void setVersion(const std::string& version) { this->version_ = version; }
void setPunkte(const unsigned punkte) { this->punkte_ = punkte; }
void setGewonnen(const unsigned gewonnen) { this->gewonnen_ = gewonnen; }
void setVerloren(const unsigned verloren) { this->verloren_ = verloren; }

/// Is the player in a game (not synchronized ATM)
bool isIngame;
Expand All @@ -45,7 +39,4 @@ class LobbyPlayerInfo
std::string name_;
std::string email_;
std::string version_;
int punkte_;
unsigned gewonnen_;
unsigned verloren_;
};
17 changes: 7 additions & 10 deletions src/LobbyPlayerInfo.cpp
Expand Up @@ -24,12 +24,9 @@ LobbyPlayerInfo::LobbyPlayerInfo(const unsigned /*playerId*/, Serializer& ser)
*/
void LobbyPlayerInfo::clear()
{
playerId_ = 0;
playerId_ = static_cast<unsigned>(-1);
name_.clear();
version_.clear();
punkte_ = 0;
gewonnen_ = 0;
verloren_ = 0;
isIngame = false;
}

Expand All @@ -43,9 +40,9 @@ void LobbyPlayerInfo::serialize(Serializer& ser) const
ser.PushUnsignedInt(playerId_);
ser.PushLongString(name_);
ser.PushLongString(version_);
ser.PushSignedInt(punkte_);
ser.PushUnsignedInt(gewonnen_);
ser.PushUnsignedInt(verloren_);
ser.PushSignedInt(0); // points
ser.PushUnsignedInt(0); // games won
ser.PushUnsignedInt(0); // games lost
}

/**
Expand All @@ -58,7 +55,7 @@ void LobbyPlayerInfo::deserialize(Serializer& ser)
playerId_ = ser.PopUnsignedInt();
name_ = ser.PopLongString();
version_ = ser.PopLongString();
punkte_ = ser.PopSignedInt();
gewonnen_ = ser.PopUnsignedInt();
verloren_ = ser.PopUnsignedInt();
ser.PopSignedInt(); // points
ser.PopUnsignedInt(); // games won
ser.PopUnsignedInt(); // games lost
}

0 comments on commit 51fb417

Please sign in to comment.