Merge branch 'master' into StringFormatting.

Cleaned up the problems. Tested on Linux. Still need to test on windows.

Conflicts:
	common/CMakeLists.txt
	common/MiscFunctions.cpp
	common/MiscFunctions.h
	common/debug.cpp
	world/Adventure.cpp
This commit is contained in:
Arthur Ice
2013-05-19 18:56:21 -07:00
618 changed files with 38225 additions and 38967 deletions
+82 -100
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef EMBPERL
@@ -55,26 +55,23 @@ extern LoginServerList loginserverlist;
extern LauncherList launcher_list;
extern volatile bool RunLoops;
EQW EQW::s_EQW;
//IO Capture routine
XS(XS_EQWIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQWIO_PRINT)
XS(XS_EQWIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQWIO_PRINT)
{
dXSARGS;
if (items < 2)
return;
dXSARGS;
if (items < 2)
return;
int r;
for(r = 1; r < items; r++) {
char *str = SvPV_nolen(ST(r));
EQW::Singleton()->AppendOutput(str);
}
XSRETURN_EMPTY;
}
XSRETURN_EMPTY;
}
EQW::EQW() {
@@ -120,29 +117,29 @@ int EQW::CountZones() {
//returns an array of zone_refs (opaque)
vector<string> EQW::ListBootedZones() {
vector<string> res;
vector<uint32> zones;
zoneserver_list.GetZoneIDList(zones);
vector<uint32>::iterator cur, end;
cur = zones.begin();
end = zones.end();
for(; cur != end; cur++) {
res.push_back(itoa(*cur));
}
return(res);
}
map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
map<string,string> res;
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
if(zs == nullptr) {
res["error"] = "Invalid zone.";
return(res);
}
res["type"] = zs->IsStaticZone()?"static":"dynamic";
res["zone_id"] = itoa(zs->GetZoneID());
res["launch_name"] = zs->GetLaunchName();
@@ -151,7 +148,7 @@ map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
res["long_name"] = zs->GetZoneLongName();
res["port"] = itoa(zs->GetCPort());
res["player_count"] = itoa(zs->NumPlayers());
//this isnt gunna work for dynamic zones...
res["launcher"] = "";
if(zs->GetZoneID() != 0) {
@@ -159,7 +156,7 @@ map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
if(ll != nullptr)
res["launcher"] = ll->GetName();
}
return(res);
}
@@ -170,10 +167,10 @@ int EQW::CountPlayers() {
//returns an array of character names in the zone (empty=all zones)
vector<string> EQW::ListPlayers(Const_char *zone_name) {
vector<string> res;
vector<ClientListEntry *> list;
client_list.GetClients(zone_name, list);
vector<ClientListEntry *>::iterator cur, end;
cur = list.begin();
end = list.end();
@@ -185,13 +182,13 @@ vector<string> EQW::ListPlayers(Const_char *zone_name) {
map<string,string> EQW::GetPlayerDetails(Const_char *char_name) {
map<string,string> res;
ClientListEntry *cle = client_list.FindCharacter(char_name);
if(cle == nullptr) {
res["error"] = "1";
return(res);
}
res["character"] = cle->name();
res["account"] = cle->AccountName();
res["account_id"] = itoa(cle->AccountID());
@@ -208,14 +205,14 @@ map<string,string> EQW::GetPlayerDetails(Const_char *char_name) {
res["guild"] = guild_mgr.GetGuildName(cle->GuildID());
res["status"] = itoa(cle->Admin());
// res["patch"] = cle->DescribePatch();
return(res);
}
int EQW::CountLaunchers(bool active_only) {
if(active_only)
return(launcher_list.GetLauncherCount());
vector<string> it(EQW::ListLaunchers());
return(it.size());
}
@@ -232,13 +229,13 @@ vector<string> EQW::ListLaunchers() {
vector<string> launchers;
launcher_list.GetLauncherNameList(launchers);
return(launchers);
/* if(list.empty()) {
return(launchers);
} else if(launchers.empty()) {
return(list);
}
//union the two lists.
vector<string>::iterator curo, endo, curi, endi;
curo = list.begin();
@@ -286,7 +283,7 @@ void EQW::LSReconnect() {
/*
map<string,string> EQW::GetLaunchersDetails(Const_char *launcher_name) {
map<string,string> res;
LauncherLink *ll = launcher_list.Get(launcher_name);
if(ll == nullptr) {
res["name"] = launcher_name;
@@ -302,7 +299,7 @@ map<string,string> EQW::GetLaunchersDetails(Const_char *launcher_name) {
res["zone_count"] = itoa(ll->CountZones());
res["connected"] = "yes";
}
return(res);
}
@@ -341,7 +338,7 @@ bool EQW::SetDynamicCount(Const_char *launcher_name, int count) {
return(false);
}
int EQW::GetDynamicCount(Const_char *launcher_name) {
int EQW::GetDynamicCount(Const_char *launcher_name) {
return(0);
}
*/
@@ -391,72 +388,72 @@ bool EQW::SetPublicNote(uint32 charid, const char *note) {
}
int EQW::CountBugs() {
char errbuf[MYSQL_ERRMSG_SIZE];
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) {
safe_delete_array(query);
if((row = mysql_fetch_row(result))) {
int count = atoi(row[0]);
mysql_free_result(result);
return count;
}
mysql_free_result(result);
}
safe_delete_array(query);
return 0;
if((row = mysql_fetch_row(result))) {
int count = atoi(row[0]);
mysql_free_result(result);
return count;
}
mysql_free_result(result);
}
safe_delete_array(query);
return 0;
}
vector<string> EQW::ListBugs(uint32 offset) {
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) {
safe_delete_array(query);
while((row = mysql_fetch_row(result))) {
res.push_back(row[0]);
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
while((row = mysql_fetch_row(result))) {
res.push_back(row[0]);
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
}
map<string,string> EQW::GetBugDetails(Const_char *id) {
map<string,string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
map<string,string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) {
safe_delete_array(query);
while((row = mysql_fetch_row(result))) {
res["name"] = row[0];
res["zone"] = row[1];
res["x"] = row[2];
res["y"] = row[3];
res["z"] = row[4];
res["target"] = row[5];
res["bug"] = row[6];
res["id"] = id;
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
while((row = mysql_fetch_row(result))) {
res["name"] = row[0];
res["zone"] = row[1];
res["x"] = row[2];
res["y"] = row[3];
res["z"] = row[4];
res["target"] = row[5];
res["bug"] = row[6];
res["id"] = id;
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
}
void EQW::ResolveBug(const char *id) {
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) {
safe_delete_array(query);
}
safe_delete_array(query);
}
safe_delete_array(query);
}
void EQW::SendMessage(uint32 type, const char *msg) {
@@ -469,18 +466,3 @@ void EQW::WorldShutDown(uint32 time, uint32 interval) {
#endif //EMBPERL