本文整理汇总了C++中LauncherList::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ LauncherList::Get方法的具体用法?C++ LauncherList::Get怎么用?C++ LauncherList::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LauncherList
的用法示例。
在下文中一共展示了LauncherList::Get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDynamicCount
bool EQLConfig::SetDynamicCount(int count) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"UPDATE launcher SET dynamics=%d WHERE name='%s'",
count, namebuf), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", errbuf);
safe_delete_array(query);
return false;
}
safe_delete_array(query);
//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);
}
示例2: DeleteStaticZone
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.
Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", 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;
}
示例3: BootStaticZone
bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(database.GetZoneID(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;
}
示例4:
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);
}
示例5: ChangeStaticZone
bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(database.GetZoneID(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.
LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name);
return(false);
}
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
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';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"UPDATE launcher_zones SET port=%d WHERE launcher='%s' AND zone='%s'",
port, namebuf, zonebuf), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in ChangeStaticZone query: %s", errbuf);
safe_delete_array(query);
return false;
}
safe_delete_array(query);
//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);
}
示例6: DeleteStaticZone
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.
LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name);
return(false);
}
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
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';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"DELETE FROM launcher_zones WHERE launcher='%s' AND zone='%s'",
namebuf, zonebuf), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in DeleteStaticZone query: %s", errbuf);
safe_delete_array(query);
return false;
}
safe_delete_array(query);
//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;
}
示例7: BootStaticZone
bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(database.GetZoneID(short_name) == 0)
return(false);
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
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';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO launcher_zones (launcher,zone,port) VALUES('%s', '%s', %d)",
namebuf, zonebuf, port), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in BootStaticZone query: %s", errbuf);
safe_delete_array(query);
return false;
}
safe_delete_array(query);
//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);
}
示例8: ChangeStaticZone
bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(database.GetZoneID(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.
Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", 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;
}
示例9: SetDynamicCount
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;
}
示例10: StartZone
void EQLConfig::StartZone(Const_char *zone_ref) {
LauncherLink *ll = launcher_list.Get(m_name.c_str());
if(ll == nullptr)
return;
ll->StartZone(zone_ref);
}
示例11: IsConnected
bool EQLConfig::IsConnected() const {
LauncherLink *ll = launcher_list.Get(m_name.c_str());
return(ll != nullptr);
}
示例12: RestartZone
void EQLConfig::RestartZone(Const_char *zone_ref) {
LauncherLink *ll = launcher_list.Get(m_name.c_str());
if(ll == NULL)
return;
ll->RestartZone(zone_ref);
}