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
+21 -19
View File
@@ -1,18 +1,18 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(qserv_sources
database.cpp
lfguild.cpp
queryserv.cpp
queryservconfig.cpp
worldserver.cpp
database.cpp
lfguild.cpp
queryserv.cpp
queryservconfig.cpp
worldserver.cpp
)
SET(qserv_headers
database.h
lfguild.h
queryservconfig.h
worldserver.h
database.h
lfguild.h
queryservconfig.h
worldserver.h
)
ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers})
@@ -22,22 +22,24 @@ ADD_DEFINITIONS(-DQSERV)
TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC)
SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib")
SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib")
ENDIF(MSVC)
IF(MINGW)
TARGET_LINK_LIBRARIES(queryserv "WS2_32")
TARGET_LINK_LIBRARIES(queryserv "WS2_32")
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(queryserv "dl")
TARGET_LINK_LIBRARIES(queryserv "z")
TARGET_LINK_LIBRARIES(queryserv "m")
TARGET_LINK_LIBRARIES(queryserv "rt")
TARGET_LINK_LIBRARIES(queryserv "pthread")
ADD_DEFINITIONS(-fPIC)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "z")
TARGET_LINK_LIBRARIES(queryserv "m")
TARGET_LINK_LIBRARIES(queryserv "rt")
TARGET_LINK_LIBRARIES(queryserv "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
+4 -5
View File
@@ -1,6 +1,4 @@
/*
EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -321,3 +319,4 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3
}
}
}
+6 -7
View File
@@ -1,6 +1,4 @@
/*
EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -44,7 +42,7 @@ public:
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
~Database();
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type);
void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 Items);
@@ -57,7 +55,8 @@ protected:
void HandleMysqlError(uint32 errnum);
private:
void DBInitVars();
};
#endif
+10 -9
View File
@@ -39,7 +39,7 @@ bool LFGuildManager::LoadDatabase()
MYSQL_RES *result;
MYSQL_ROW row;
if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `type`,`name`,`comment`, `fromlevel`, `tolevel`, `classes`, `aacount`, `timezone`, `timeposted` FROM `lfguild`"),errbuf,&result)){
if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `type`,`name`,`comment`, `fromlevel`, `tolevel`, `classes`, `aacount`, `timezone`, `timeposted` FROM `lfguild`"),errbuf,&result)){
_log(QUERYSERV__ERROR, "Failed to load LFGuild info from database. %s %s", query, errbuf);
safe_delete_array(query);
@@ -103,7 +103,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack)
pack->ReadString(Comments);
uint32 Toggle = pack->ReadUInt32();
uint32 TimeZone = pack->ReadUInt32();
TogglePlayer(FromZoneID, FromInstanceID, From, Class, Level, AAPoints, Comments, Toggle, TimeZone);
break;
@@ -116,7 +116,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack)
case QSG_LFGuild_UpdateGuildInfo:
{
char GuildName[33], Comments[257];
pack->ReadString(GuildName);
pack->ReadString(Comments);
@@ -154,8 +154,8 @@ void LFGuildManager::HandlePacket(ServerPacket *pack)
default:
break;
}
}
void LFGuildManager::SendPlayerMatches(uint32 FromZoneID, uint32 FromInstanceID, char *From, uint32 FromLevel, uint32 ToLevel, uint32 MinAA, uint32 TimeZone, uint32 Classes)
@@ -258,7 +258,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char
}
if(!database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From), errbuf, 0, 0))
_log(QUERYSERV__ERROR, "Error removing player from LFGuild table, query was %s, %s", query, errbuf);
_log(QUERYSERV__ERROR, "Error removing player from LFGuild table, query was %s, %s", query, errbuf);
safe_delete_array(query);
@@ -289,7 +289,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char
worldserver->SendPacket(pack);
safe_delete(pack);
}
void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char *From, char* GuildName, char *Comments, uint32 FromLevel, uint32 ToLevel, uint32 Classes, uint32 AACount, uint32 Toggle, uint32 TimeZone)
@@ -336,7 +336,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char
pack->WriteUInt32(TimeZone);
pack->WriteUInt32(Now);
pack->WriteUInt32(Toggle);
worldserver->SendPacket(pack);
safe_delete(pack);
}
@@ -396,7 +396,7 @@ void LFGuildManager::SendPlayerStatus(uint32 FromZoneID, uint32 FromInstanceID,
pack->WriteUInt32((*it).TimeZone);
pack->WriteUInt32((*it).TimePosted);
pack->WriteUInt32(1);
worldserver->SendPacket(pack);
safe_delete(pack);
break;
@@ -433,3 +433,4 @@ void LFGuildManager::SendGuildStatus(uint32 FromZoneID, uint32 FromInstanceID, c
}
}
}
+14 -16
View File
@@ -1,6 +1,4 @@
/*
EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -38,7 +36,7 @@ volatile bool RunLoops = true;
uint32 MailMessagesSent = 0;
uint32 ChatMessagesSent = 0;
TimeoutManager timeout_manager;
TimeoutManager timeout_manager;
Database database;
LFGuildManager lfguildmanager;
@@ -58,8 +56,8 @@ void CatchSignal(int sig_num) {
}
int main() {
RegisterExecutablePlatform(ExePlatformQueryServ);
set_exception_handler();
RegisterExecutablePlatform(ExePlatformQueryServ);
set_exception_handler();
Timer LFGuildExpireTimer(60000);
@@ -131,13 +129,13 @@ int main() {
void UpdateWindowTitle(char* iNewTitle) {
#ifdef _WINDOWS
char tmp[500];
if (iNewTitle) {
snprintf(tmp, sizeof(tmp), "QueryServ: %s", iNewTitle);
}
else {
snprintf(tmp, sizeof(tmp), "QueryServ");
}
SetConsoleTitle(tmp);
char tmp[500];
if (iNewTitle) {
snprintf(tmp, sizeof(tmp), "QueryServ: %s", iNewTitle);
}
else {
snprintf(tmp, sizeof(tmp), "QueryServ");
}
SetConsoleTitle(tmp);
#endif
}
+4 -5
View File
@@ -1,6 +1,4 @@
/*
EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -27,3 +25,4 @@ queryservconfig *queryservconfig::_chat_config = nullptr;
string queryservconfig::GetByName(const string &var_name) const {
return(EQEmuConfig::GetByName(var_name));
}
+5 -6
View File
@@ -1,6 +1,4 @@
/*
EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -36,7 +34,7 @@ public:
// Produce a const singleton
static const queryservconfig *get() {
if (_chat_config == nullptr)
if (_chat_config == nullptr)
LoadConfig();
return(_chat_config);
}
@@ -54,3 +52,4 @@ public:
};
#endif
+18 -18
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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
*/
#include "../common/debug.h"
#include <iostream>
@@ -58,7 +58,7 @@ void WorldServer::OnConnected()
void WorldServer::Process()
{
WorldConnection::Process();
if (!Connected())
return;
@@ -140,19 +140,19 @@ void WorldServer::Process()
// uint32 SourceZoneID
// uint32 SourceInstanceID
// char OriginatingCharacterName[0] // Null terminated name of the character this packet came from. This could be just
// // an empty string if it has no meaning in the context of a particular packet.
// // an empty string if it has no meaning in the context of a particular packet.
// uint32 Type
//
// The 'Type' field is a 'sub-opcode'. A value of 0 is used for the LFGuild packets. The next feature to be added
// to queryserv would use 1, etc.
//
// Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The
// Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The
// 'Generic' in the name of this ServerOP code relates to the four header fields.
char From[64];
pack->SetReadPosition(8);
pack->ReadString(From);
uint32 Type = pack->ReadUInt32();
switch(Type)
{
case QSG_LFGuild:
@@ -164,7 +164,7 @@ void WorldServer::Process()
default:
_log(QUERYSERV__ERROR, "Received unhandled ServerOP_QueryServGeneric", Type);
break;
}
}
break;
}
+18 -18
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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 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.
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
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
*/
#ifndef WORLDSERVER_H
#define WORLDSERVER_H
@@ -23,13 +23,13 @@
class WorldServer : public WorldConnection
{
public:
WorldServer();
virtual ~WorldServer();
virtual void Process();
private:
virtual void OnConnected();
public:
WorldServer();
virtual ~WorldServer();
virtual void Process();
private:
virtual void OnConnected();
};
#endif