Split out unrelated changes to CleanupRoundup branch

This commit is contained in:
jadebenn
2024-02-03 02:07:57 -06:00
parent b3dd1d3d4c
commit 74d8a5b167
6 changed files with 104 additions and 91 deletions

View File

@@ -10,6 +10,7 @@
#include "Database.h"
#include "eConnectionType.h"
#include "eChatInternalMessageType.h"
#include "eGameMasterLevel.h"
#include "ChatPackets.h"
#include "dConfig.h"
@@ -20,6 +21,14 @@ void PlayerContainer::Initialize() {
GeneralUtils::TryParse<uint32_t>(Game::config->GetValue("max_number_of_friends")).value_or(m_MaxNumberOfFriends);
}
PlayerContainer::~PlayerContainer() {
m_Players.clear();
}
PlayerData::PlayerData() {
gmLevel = eGameMasterLevel::CIVILIAN;
}
TeamData::TeamData() {
lootFlag = Game::config->GetValue("default_team_loot") == "0" ? 0 : 1;
}

View File

@@ -1,13 +1,14 @@
#pragma once
#include <map>
#include "dCommonVars.h"
#include "eGameMasterLevel.h"
#include "RakString.h"
#include <vector>
#include "Game.h"
#include "dServer.h"
#include <unordered_map>
enum class eGameMasterLevel : uint8_t;
struct IgnoreData {
IgnoreData(const std::string& name, const LWOOBJID& id) : playerName(name), playerId(id) {}
inline bool operator==(const std::string& other) const noexcept {
@@ -23,6 +24,7 @@ struct IgnoreData {
};
struct PlayerData {
PlayerData();
operator bool() const noexcept {
return playerID != LWOOBJID_EMPTY;
}
@@ -43,7 +45,7 @@ struct PlayerData {
std::string playerName;
std::vector<FriendData> friends;
std::vector<IgnoreData> ignoredPlayers;
eGameMasterLevel gmLevel = eGameMasterLevel::CIVILIAN;
eGameMasterLevel gmLevel;
bool isFTP = false;
};
@@ -59,6 +61,8 @@ struct TeamData {
class PlayerContainer {
public:
~PlayerContainer();
void Initialize();
void InsertPlayer(Packet* packet);
void RemovePlayer(Packet* packet);