mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Cleanup] Remove unused methods in eql_config.cpp, eql_config.h, launcher_list.cpp, and launcher_list.h (#3103)
# Notes - These are unused.
This commit is contained in:
parent
4b405fe9fe
commit
61bd485449
@ -66,21 +66,6 @@ void EQLConfig::LoadSettings() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) {
|
|
||||||
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, name, strlen(name)&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new EQLConfig(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQLConfig::GetZones(std::vector<LauncherZone> &result) {
|
void EQLConfig::GetZones(std::vector<LauncherZone> &result) {
|
||||||
std::map<std::string, LauncherZone>::iterator cur, end;
|
std::map<std::string, LauncherZone>::iterator cur, end;
|
||||||
cur = m_zones.begin();
|
cur = m_zones.begin();
|
||||||
@ -90,64 +75,6 @@ void EQLConfig::GetZones(std::vector<LauncherZone> &result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> EQLConfig::ListZones() {
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
std::vector<std::string> res;
|
|
||||||
if(ll == nullptr) {
|
|
||||||
//if the launcher isnt connected, use the list from the database.
|
|
||||||
std::map<std::string, LauncherZone>::iterator cur, end;
|
|
||||||
cur = m_zones.begin();
|
|
||||||
end = m_zones.end();
|
|
||||||
for(; cur != end; ++cur) {
|
|
||||||
res.push_back(cur->first);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//otherwise, use the zone list from the launcher link.
|
|
||||||
ll->GetZoneList(res);
|
|
||||||
}
|
|
||||||
return(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQLConfig::DeleteLauncher() {
|
|
||||||
|
|
||||||
launcher_list.Remove(m_name.c_str());
|
|
||||||
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
|
||||||
results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQLConfig::IsConnected() const {
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
return(ll != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQLConfig::RestartZone(Const_char *zone_ref) {
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll == nullptr)
|
|
||||||
return;
|
|
||||||
ll->RestartZone(zone_ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQLConfig::StopZone(Const_char *zone_ref) {
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll == nullptr)
|
|
||||||
return;
|
|
||||||
ll->StopZone(zone_ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQLConfig::StartZone(Const_char *zone_ref) {
|
void EQLConfig::StartZone(Const_char *zone_ref) {
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
||||||
if(ll == nullptr)
|
if(ll == nullptr)
|
||||||
@ -155,158 +82,6 @@ void EQLConfig::StartZone(Const_char *zone_ref) {
|
|||||||
ll->StartZone(zone_ref);
|
ll->StartZone(zone_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
|
|
||||||
//make sure the short name is valid.
|
|
||||||
if(ZoneID(short_name) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//database update
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
char zonebuf[32];
|
|
||||||
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
|
|
||||||
zonebuf[31] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("INSERT INTO launcher_zones (launcher, zone, port) "
|
|
||||||
"VALUES('%s', '%s', %d)", namebuf, zonebuf, port);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//update our internal state.
|
|
||||||
LauncherZone lz;
|
|
||||||
lz.name = short_name;
|
|
||||||
lz.port = port;
|
|
||||||
m_zones[lz.name] = lz;
|
|
||||||
|
|
||||||
//if the launcher is connected, update it.
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll != nullptr) {
|
|
||||||
ll->BootZone(short_name, port);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
|
|
||||||
//make sure the short name is valid.
|
|
||||||
if(ZoneID(short_name) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//check internal state
|
|
||||||
std::map<std::string, LauncherZone>::iterator res;
|
|
||||||
res = m_zones.find(short_name);
|
|
||||||
if(res == m_zones.end()) {
|
|
||||||
//not found.
|
|
||||||
LogError("Update for unknown zone {}", short_name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
char zonebuf[32];
|
|
||||||
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
|
|
||||||
zonebuf[31] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE launcher_zones SET port=%d WHERE "
|
|
||||||
"launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//update internal state
|
|
||||||
res->second.port = port;
|
|
||||||
|
|
||||||
//if the launcher is connected, update it.
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll != nullptr) {
|
|
||||||
ll->RestartZone(short_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
|
|
||||||
//check internal state
|
|
||||||
std::map<std::string, LauncherZone>::iterator res;
|
|
||||||
res = m_zones.find(short_name);
|
|
||||||
if(res == m_zones.end()) {
|
|
||||||
//not found.
|
|
||||||
LogError("Update for unknown zone {}", short_name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
char zonebuf[32];
|
|
||||||
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
|
|
||||||
zonebuf[31] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("DELETE FROM launcher_zones WHERE "
|
|
||||||
"launcher = '%s' AND zone = '%s'", namebuf, zonebuf);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//internal update.
|
|
||||||
m_zones.erase(res);
|
|
||||||
|
|
||||||
//if the launcher is connected, update it.
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll != nullptr) {
|
|
||||||
ll->StopZone(short_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQLConfig::SetDynamicCount(int count) {
|
|
||||||
|
|
||||||
char namebuf[128];
|
|
||||||
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
|
|
||||||
namebuf[127] = '\0';
|
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf);
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//update in-memory version.
|
|
||||||
m_dynamics = count;
|
|
||||||
|
|
||||||
//if the launcher is connected, update it.
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll != nullptr) {
|
|
||||||
ll->BootDynamics(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EQLConfig::GetDynamicCount() const {
|
int EQLConfig::GetDynamicCount() const {
|
||||||
return(m_dynamics);
|
return(m_dynamics);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string,std::string> EQLConfig::GetZoneDetails(Const_char *zone_ref) {
|
|
||||||
std::map<std::string,std::string> res;
|
|
||||||
|
|
||||||
LauncherLink *ll = launcher_list.Get(m_name.c_str());
|
|
||||||
if(ll == nullptr) {
|
|
||||||
res["name"] = zone_ref;
|
|
||||||
res["up"] = "0";
|
|
||||||
res["starts"] = "0";
|
|
||||||
res["port"] = "0";
|
|
||||||
} else {
|
|
||||||
ll->GetZoneDetails(zone_ref, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -42,24 +42,8 @@ public:
|
|||||||
|
|
||||||
//BEGIN PERL EXPORT
|
//BEGIN PERL EXPORT
|
||||||
Const_char * GetName() const { return(m_name.c_str()); }
|
Const_char * GetName() const { return(m_name.c_str()); }
|
||||||
int GetStaticCount() const { return(m_zones.size()); }
|
|
||||||
bool IsConnected() const; //is this launcher connected to world
|
|
||||||
|
|
||||||
void DeleteLauncher(); //kill this launcher and all its zones.
|
|
||||||
|
|
||||||
void RestartZone(Const_char *zone_ref);
|
|
||||||
void StopZone(Const_char *zone_ref);
|
|
||||||
void StartZone(Const_char *zone_ref);
|
void StartZone(Const_char *zone_ref);
|
||||||
|
|
||||||
bool BootStaticZone(Const_char *short_name, uint16 port);
|
|
||||||
bool ChangeStaticZone(Const_char *short_name, uint16 port);
|
|
||||||
bool DeleteStaticZone(Const_char *short_name);
|
|
||||||
|
|
||||||
bool SetDynamicCount(int count);
|
|
||||||
int GetDynamicCount() const;
|
int GetDynamicCount() const;
|
||||||
|
|
||||||
std::vector<std::string> ListZones(); //returns an array of zone refs
|
|
||||||
std::map<std::string,std::string> GetZoneDetails(Const_char *zone_ref);
|
|
||||||
//END PERL EXPORT
|
//END PERL EXPORT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -86,17 +86,6 @@ LauncherLink *LauncherList::Get(const char *name) {
|
|||||||
return(res->second);
|
return(res->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherLink *LauncherList::FindByZone(const char *short_name) {
|
|
||||||
std::map<std::string, LauncherLink *>::iterator cur, end;
|
|
||||||
cur = m_launchers.begin();
|
|
||||||
end = m_launchers.end();
|
|
||||||
for (; cur != end; ++cur) {
|
|
||||||
if (cur->second->ContainsZone(short_name))
|
|
||||||
return(cur->second);
|
|
||||||
}
|
|
||||||
return(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LauncherList::Add(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn) {
|
void LauncherList::Add(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn) {
|
||||||
auto it = new LauncherLink(nextID++, conn);
|
auto it = new LauncherLink(nextID++, conn);
|
||||||
LogInfo("Adding pending launcher [{}]", it->GetID());
|
LogInfo("Adding pending launcher [{}]", it->GetID());
|
||||||
@ -129,15 +118,6 @@ int LauncherList::GetLauncherCount() {
|
|||||||
return(m_launchers.size());
|
return(m_launchers.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherList::GetLauncherNameList(std::vector<std::string> &res) {
|
|
||||||
std::map<std::string, EQLConfig *>::iterator cur, end;
|
|
||||||
cur = m_configs.begin();
|
|
||||||
end = m_configs.end();
|
|
||||||
for (; cur != end; ++cur) {
|
|
||||||
res.push_back(cur->first);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LauncherList::LoadList() {
|
void LauncherList::LoadList() {
|
||||||
std::vector<std::string> launchers;
|
std::vector<std::string> launchers;
|
||||||
|
|
||||||
@ -160,10 +140,6 @@ EQLConfig *LauncherList::GetConfig(const char *name) {
|
|||||||
return(res->second);
|
return(res->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherList::CreateLauncher(const char *name, uint8 dynamic_count) {
|
|
||||||
m_configs[name] = EQLConfig::CreateLauncher(name, dynamic_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LauncherList::Remove(const char *name) {
|
void LauncherList::Remove(const char *name) {
|
||||||
std::map<std::string, EQLConfig *>::iterator resc;
|
std::map<std::string, EQLConfig *>::iterator resc;
|
||||||
resc = m_configs.find(name);
|
resc = m_configs.find(name);
|
||||||
|
|||||||
@ -37,17 +37,13 @@ public:
|
|||||||
|
|
||||||
void LoadList();
|
void LoadList();
|
||||||
EQLConfig *GetConfig(const char *name);
|
EQLConfig *GetConfig(const char *name);
|
||||||
void CreateLauncher(const char *name, uint8 dynamic_count);
|
|
||||||
void Remove(const char *name);
|
void Remove(const char *name);
|
||||||
|
|
||||||
void Add(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn);
|
void Add(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn);
|
||||||
void Remove(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn);
|
void Remove(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn);
|
||||||
LauncherLink *Get(const char *name);
|
LauncherLink *Get(const char *name);
|
||||||
LauncherLink *FindByZone(const char *short_name);
|
|
||||||
|
|
||||||
int GetLauncherCount();
|
int GetLauncherCount();
|
||||||
void GetLauncherNameList(std::vector<std::string> &list);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map<std::string, EQLConfig *> m_configs; //we own these objects
|
std::map<std::string, EQLConfig *> m_configs; //we own these objects
|
||||||
std::map<std::string, LauncherLink *> m_launchers; //we own these objects
|
std::map<std::string, LauncherLink *> m_launchers; //we own these objects
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user