mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Code] LoginServerList Global to Singleton Cleanup (#4941)
This commit is contained in:
parent
2128b45313
commit
1153c9ab96
@ -90,7 +90,6 @@ std::vector<RaceClassAllocation> character_create_allocations;
|
|||||||
std::vector<RaceClassCombos> character_create_race_class_combos;
|
std::vector<RaceClassCombos> character_create_race_class_combos;
|
||||||
|
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern uint32 numclients;
|
extern uint32 numclients;
|
||||||
extern volatile bool RunLoops;
|
extern volatile bool RunLoops;
|
||||||
@ -518,7 +517,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
|||||||
ServerLSPlayerJoinWorld_Struct* join =(ServerLSPlayerJoinWorld_Struct*)pack->pBuffer;
|
ServerLSPlayerJoinWorld_Struct* join =(ServerLSPlayerJoinWorld_Struct*)pack->pBuffer;
|
||||||
strcpy(join->key,GetLSKey());
|
strcpy(join->key,GetLSKey());
|
||||||
join->lsaccount_id = GetLSID();
|
join->lsaccount_id = GetLSID();
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1250,7 +1249,7 @@ bool Client::Process() {
|
|||||||
ServerLSPlayerLeftWorld_Struct* logout =(ServerLSPlayerLeftWorld_Struct*)pack->pBuffer;
|
ServerLSPlayerLeftWorld_Struct* logout =(ServerLSPlayerLeftWorld_Struct*)pack->pBuffer;
|
||||||
strcpy(logout->key,GetLSKey());
|
strcpy(logout->key,GetLSKey());
|
||||||
logout->lsaccount_id = GetLSID();
|
logout->lsaccount_id = GetLSID();
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
LogInfo("Client disconnected (not active in process)");
|
LogInfo("Client disconnected (not active in process)");
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
#include "world_config.h"
|
#include "world_config.h"
|
||||||
|
|
||||||
extern uint32 numplayers;
|
extern uint32 numplayers;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern volatile bool RunLoops;
|
extern volatile bool RunLoops;
|
||||||
extern SharedTaskManager shared_task_manager;
|
extern SharedTaskManager shared_task_manager;
|
||||||
@ -146,7 +145,7 @@ void ClientListEntry::LSUpdate(ZoneServer *iZS)
|
|||||||
zone->count = iZS->NumPlayers();
|
zone->count = iZS->NumPlayers();
|
||||||
zone->zone = iZS->GetZoneID();
|
zone->zone = iZS->GetZoneID();
|
||||||
zone->zone_wid = iZS->GetID();
|
zone->zone_wid = iZS->GetID();
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +161,7 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
|
|||||||
zonechange->lsaccount_id = LSID();
|
zonechange->lsaccount_id = LSID();
|
||||||
zonechange->from = ztz->current_zone_id;
|
zonechange->from = ztz->current_zone_id;
|
||||||
zonechange->to = ztz->requested_zone_id;
|
zonechange->to = ztz->requested_zone_id;
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username
|
* @param username
|
||||||
@ -534,8 +533,8 @@ void ConsoleLock(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
WorldConfig::LockWorld();
|
WorldConfig::LockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
connection->SendLine("World locked.");
|
connection->SendLine("World locked.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -555,8 +554,8 @@ void ConsoleUnlock(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
WorldConfig::UnlockWorld();
|
WorldConfig::UnlockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
connection->SendLine("World unlocked.");
|
connection->SendLine("World unlocked.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -48,7 +48,6 @@
|
|||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern uint32 numzones;
|
extern uint32 numzones;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern LauncherList launcher_list;
|
extern LauncherList launcher_list;
|
||||||
extern volatile bool RunLoops;
|
extern volatile bool RunLoops;
|
||||||
|
|
||||||
@ -86,15 +85,15 @@ const std::string &EQW::GetOutput() const {
|
|||||||
|
|
||||||
void EQW::LockWorld() {
|
void EQW::LockWorld() {
|
||||||
WorldConfig::LockWorld();
|
WorldConfig::LockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQW::UnlockWorld() {
|
void EQW::UnlockWorld() {
|
||||||
WorldConfig::UnlockWorld();
|
WorldConfig::UnlockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +103,7 @@ Const_char *EQW::GetConfig(Const_char *var_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EQW::LSConnected() {
|
bool EQW::LSConnected() {
|
||||||
return(loginserverlist.Connected());
|
return(LoginServerList::Instance()->Connected());
|
||||||
}
|
}
|
||||||
|
|
||||||
int EQW::CountZones() {
|
int EQW::CountZones() {
|
||||||
|
|||||||
@ -37,7 +37,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "world_config.h"
|
#include "world_config.h"
|
||||||
|
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern uint32 numzones;
|
extern uint32 numzones;
|
||||||
extern uint32 numplayers;
|
extern uint32 numplayers;
|
||||||
|
|||||||
@ -21,6 +21,13 @@ public:
|
|||||||
bool SendAccountUpdate(ServerPacket *pack);
|
bool SendAccountUpdate(ServerPacket *pack);
|
||||||
bool Connected();
|
bool Connected();
|
||||||
size_t GetServerCount() const { return m_list.size(); }
|
size_t GetServerCount() const { return m_list.size(); }
|
||||||
|
|
||||||
|
static LoginServerList* Instance()
|
||||||
|
{
|
||||||
|
static LoginServerList instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list<std::unique_ptr<LoginServer>> m_list;
|
std::list<std::unique_ptr<LoginServer>> m_list;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -94,7 +94,6 @@
|
|||||||
ClientList client_list;
|
ClientList client_list;
|
||||||
GroupLFPList LFPGroupList;
|
GroupLFPList LFPGroupList;
|
||||||
ZSList zoneserver_list;
|
ZSList zoneserver_list;
|
||||||
LoginServerList loginserverlist;
|
|
||||||
UCSConnection UCSLink;
|
UCSConnection UCSLink;
|
||||||
QueryServConnection QSLink;
|
QueryServConnection QSLink;
|
||||||
LauncherList launcher_list;
|
LauncherList launcher_list;
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include "zonelist.h"
|
#include "zonelist.h"
|
||||||
#include "launcher_list.h"
|
#include "launcher_list.h"
|
||||||
|
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LauncherList launcher_list;
|
extern LauncherList launcher_list;
|
||||||
@ -33,8 +32,8 @@ void EQW__IsLocked(WebInterface *i, const std::string& method, const std::string
|
|||||||
|
|
||||||
void EQW__Lock(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
void EQW__Lock(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
||||||
WorldConfig::LockWorld();
|
WorldConfig::LockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value ret;
|
Json::Value ret;
|
||||||
@ -44,8 +43,8 @@ void EQW__Lock(WebInterface *i, const std::string& method, const std::string& id
|
|||||||
|
|
||||||
void EQW__Unlock(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
void EQW__Unlock(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
||||||
WorldConfig::UnlockWorld();
|
WorldConfig::UnlockWorld();
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value ret;
|
Json::Value ret;
|
||||||
@ -69,7 +68,7 @@ void EQW__GetLauncherCount(WebInterface *i, const std::string& method, const std
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EQW__GetLoginServerCount(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
void EQW__GetLoginServerCount(WebInterface *i, const std::string& method, const std::string& id, const Json::Value& params) {
|
||||||
Json::Value ret = loginserverlist.GetServerCount();
|
Json::Value ret = LoginServerList::Instance()->GetServerCount();
|
||||||
i->SendResponse(id, ret);
|
i->SendResponse(id, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -183,15 +183,13 @@ int get_file_size(const std::string &filename) // path to file
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
|
|
||||||
void WorldBoot::RegisterLoginservers()
|
void WorldBoot::RegisterLoginservers()
|
||||||
{
|
{
|
||||||
const auto c = EQEmuConfig::get();
|
const auto c = EQEmuConfig::get();
|
||||||
|
|
||||||
if (c->LoginCount == 0) {
|
if (c->LoginCount == 0) {
|
||||||
if (c->LoginHost.length()) {
|
if (c->LoginHost.length()) {
|
||||||
loginserverlist.Add(
|
LoginServerList::Instance()->Add(
|
||||||
c->LoginHost.c_str(),
|
c->LoginHost.c_str(),
|
||||||
c->LoginPort,
|
c->LoginPort,
|
||||||
c->LoginAccount.c_str(),
|
c->LoginAccount.c_str(),
|
||||||
@ -207,7 +205,7 @@ void WorldBoot::RegisterLoginservers()
|
|||||||
iterator.Reset();
|
iterator.Reset();
|
||||||
while (iterator.MoreElements()) {
|
while (iterator.MoreElements()) {
|
||||||
if (iterator.GetData()->LoginHost.length()) {
|
if (iterator.GetData()->LoginHost.length()) {
|
||||||
loginserverlist.Add(
|
LoginServerList::Instance()->Add(
|
||||||
iterator.GetData()->LoginHost.c_str(),
|
iterator.GetData()->LoginHost.c_str(),
|
||||||
iterator.GetData()->LoginPort,
|
iterator.GetData()->LoginPort,
|
||||||
iterator.GetData()->LoginAccount.c_str(),
|
iterator.GetData()->LoginAccount.c_str(),
|
||||||
|
|||||||
@ -55,7 +55,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern GroupLFPList LFPGroupList;
|
extern GroupLFPList LFPGroupList;
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LoginServerList loginserverlist;
|
|
||||||
extern volatile bool RunLoops;
|
extern volatile bool RunLoops;
|
||||||
extern volatile bool UCSServerAvailable_;
|
extern volatile bool UCSServerAvailable_;
|
||||||
extern AdventureManager adventure_manager;
|
extern AdventureManager adventure_manager;
|
||||||
@ -164,7 +163,7 @@ void ZoneServer::LSBootUpdate(uint32 zone_id, uint32 instanceid, bool startup) {
|
|||||||
bootup->zone = zone_id;
|
bootup->zone = zone_id;
|
||||||
bootup->zone_wid = GetID();
|
bootup->zone_wid = GetID();
|
||||||
bootup->instance = instanceid;
|
bootup->instance = instanceid;
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +178,7 @@ void ZoneServer::LSSleepUpdate(uint32 zone_id) {
|
|||||||
auto sleep = (ServerLSZoneSleep_Struct*) pack->pBuffer;
|
auto sleep = (ServerLSZoneSleep_Struct*) pack->pBuffer;
|
||||||
sleep->zone = zone_id;
|
sleep->zone = zone_id;
|
||||||
sleep->zone_wid = GetID();
|
sleep->zone_wid = GetID();
|
||||||
loginserverlist.SendPacket(pack);
|
LoginServerList::Instance()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,8 +1075,8 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
WorldConfig::UnlockWorld();
|
WorldConfig::UnlockWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loginserverlist.Connected()) {
|
if (LoginServerList::Instance()->Connected()) {
|
||||||
loginserverlist.SendStatus();
|
LoginServerList::Instance()->SendStatus();
|
||||||
SendEmoteMessage(
|
SendEmoteMessage(
|
||||||
l->character_name,
|
l->character_name,
|
||||||
0,
|
0,
|
||||||
@ -1339,7 +1338,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
}
|
}
|
||||||
case ServerOP_LSAccountUpdate: {
|
case ServerOP_LSAccountUpdate: {
|
||||||
LogNetcode("Received ServerOP_LSAccountUpdate packet from zone");
|
LogNetcode("Received ServerOP_LSAccountUpdate packet from zone");
|
||||||
loginserverlist.SendAccountUpdate(pack);
|
LoginServerList::Instance()->SendAccountUpdate(pack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_DiscordWebhookMessage:
|
case ServerOP_DiscordWebhookMessage:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user