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
+35 -35
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 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
*/
#include "debug.h"
@@ -128,9 +128,9 @@ PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_star
bool PersistentTimer::Load(Database *db) {
char errbuf[MYSQL_ERRMSG_SIZE];
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
uint32 qlen = 0;
uint32 qcount = 0;
@@ -169,7 +169,7 @@ bool PersistentTimer::Store(Database *db) {
return(true);
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 qlen = 0;
qlen = MakeAnyLenString(&query, "REPLACE INTO timers "
@@ -196,7 +196,7 @@ bool PersistentTimer::Store(Database *db) {
bool PersistentTimer::Clear(Database *db) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 qlen = 0;
qlen = MakeAnyLenString(&query, "DELETE FROM timers "
@@ -222,30 +222,30 @@ bool PersistentTimer::Clear(Database *db) {
/* This function checks if the timer triggered */
bool PersistentTimer::Expired(Database *db, bool iReset) {
if (this == nullptr) {
if (this == nullptr) {
LogFile->write(EQEMuLog::Error, "Null timer during ->Check()!?\n");
return(true);
}
uint32 current_time = get_current_time();
if (current_time-start_time >= timer_time) {
if (current_time-start_time >= timer_time) {
if (enabled && iReset) {
start_time = current_time; // Reset timer
} else if(enabled) {
Clear(db); //remove it from DB too
}
return(true);
}
}
return(false);
return(false);
}
/* This function set the timer and restart it */
void PersistentTimer::Start(uint32 set_timer_time) {
start_time = get_current_time();
start_time = get_current_time();
enabled = true;
if (set_timer_time != 0) {
if (set_timer_time != 0) {
timer_time = set_timer_time;
}
}
#ifdef DEBUG_PTIMERS
printf("Starting timer: char %lu of type %u at %lu for %lu seconds.\n", (unsigned long)_char_id, _type, (unsigned long)start_time, (unsigned long)timer_time);
#endif
@@ -253,25 +253,25 @@ void PersistentTimer::Start(uint32 set_timer_time) {
// This timer updates the timer without restarting it
void PersistentTimer::SetTimer(uint32 set_timer_time) {
// If we were disabled before => restart the timer
timer_time = set_timer_time;
if (!enabled) {
// If we were disabled before => restart the timer
timer_time = set_timer_time;
if (!enabled) {
start_time = get_current_time();
enabled = true;
}
}
#ifdef DEBUG_PTIMERS
printf("Setting timer: char %lu of type %u at %lu for %lu seconds.\n", (unsigned long)_char_id, _type, (unsigned long)start_time, (unsigned long)timer_time);
#endif
}
uint32 PersistentTimer::GetRemainingTime() {
if (enabled) {
if (enabled) {
uint32 current_time = get_current_time();
if (current_time-start_time > timer_time)
if (current_time-start_time > timer_time)
return 0;
else
return (start_time + timer_time) - current_time;
}
}
else {
return 0xFFFFFFFF;
}
@@ -310,9 +310,9 @@ bool PTimerList::Load(Database *db) {
_list.clear();
char errbuf[MYSQL_ERRMSG_SIZE];
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
uint32 qlen = 0;
uint32 qcount = 0;
@@ -382,7 +382,7 @@ bool PTimerList::Clear(Database *db) {
_list.clear();
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 qlen = 0;
qlen = MakeAnyLenString(&query, "DELETE FROM timers "
@@ -480,7 +480,7 @@ void PTimerList::ToVector(vector< pair<pTimerType, PersistentTimer *> > &out) {
bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 qlen = 0;
qlen = MakeAnyLenString(&query, "DELETE FROM timers WHERE char_id=%lu AND type=%u ",(unsigned long)char_id, type);