This commit is contained in:
KimLS 2013-05-23 00:31:02 -07:00
commit e6fba5ba82
88 changed files with 590 additions and 440 deletions

View File

@ -55,6 +55,7 @@ SET(common_sources
serverinfo.cpp
shareddb.cpp
spdat.cpp
StringUtil.cpp
StructStrategy.cpp
TCPConnection.cpp
TCPServer.cpp
@ -170,6 +171,7 @@ SET(common_headers
shareddb.h
skills.h
spdat.h
StringUtil.h
StructStrategy.h
TCPBasicServer.h
TCPConnection.h

View File

@ -36,9 +36,6 @@
#include <windows.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@ -57,10 +54,6 @@
#include <errno.h>
#endif
#ifndef va_copy
#define va_copy(d,s) ((d) = (s))
#endif
static bool WELLRNG_init = false;
static int state_i = 0;
static unsigned int STATE[R];
@ -90,201 +83,6 @@ void CoutTimestamp(bool ms) {
std::cout << " GMT";
}
// normal strncpy doesnt put a null term on copied strings, this one does
// ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecrt/htm/_wcecrt_strncpy_wcsncpy.asp
char* strn0cpy(char* dest, const char* source, uint32 size) {
if (!dest)
return 0;
if (size == 0 || source == 0) {
dest[0] = 0;
return dest;
}
strncpy(dest, source, size);
dest[size - 1] = 0;
return dest;
}
// String N w/null Copy Truncated?
// return value =true if entire string(source) fit, false if it was truncated
bool strn0cpyt(char* dest, const char* source, uint32 size) {
if (!dest)
return 0;
if (size == 0 || source == 0) {
dest[0] = 0;
return false;
}
strncpy(dest, source, size);
dest[size - 1] = 0;
return (bool) (source[strlen(dest)] == 0);
}
const char *MakeUpperString(const char *source) {
static char str[128];
if (!source)
return nullptr;
MakeUpperString(source, str);
return str;
}
void MakeUpperString(const char *source, char *target) {
if (!source || !target) {
*target=0;
return;
}
while (*source)
{
*target = toupper(*source);
target++;source++;
}
*target = 0;
}
const char *MakeLowerString(const char *source) {
static char str[128];
if (!source)
return nullptr;
MakeLowerString(source, str);
return str;
}
void MakeLowerString(const char *source, char *target) {
if (!source || !target) {
*target=0;
return;
}
while (*source)
{
*target = tolower(*source);
target++;source++;
}
*target = 0;
}
int MakeAnyLenString(char** ret, const char* format, ...) {
int buf_len = 128;
int chars = -1;
va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= buf_len) {
safe_delete_array(*ret);
if (chars == -1)
buf_len *= 2;
else
buf_len = chars + 1;
*ret = new char[buf_len];
va_copy(tmpargptr, argptr);
chars = vsnprintf(*ret, buf_len, format, tmpargptr);
}
va_end(argptr);
return chars;
}
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...) {
if (*bufsize == 0)
*bufsize = 256;
if (*ret == 0)
*strlen = 0;
int chars = -1;
char* oldret = 0;
va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= (int32)(*bufsize-*strlen)) {
if (chars == -1)
*bufsize += 256;
else
*bufsize += chars + 25;
oldret = *ret;
*ret = new char[*bufsize];
if (oldret) {
if (*strlen)
memcpy(*ret, oldret, *strlen);
safe_delete_array(oldret);
}
va_copy(tmpargptr, argptr);
chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, tmpargptr);
}
va_end(argptr);
*strlen += chars;
return *strlen;
}
uint32 hextoi(char* num) {
int len = strlen(num);
if (len < 3)
return 0;
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
return 0;
uint32 ret = 0;
int mul = 1;
for (int i=len-1; i>=2; i--) {
if (num[i] >= 'A' && num[i] <= 'F')
ret += ((num[i] - 'A') + 10) * mul;
else if (num[i] >= 'a' && num[i] <= 'f')
ret += ((num[i] - 'a') + 10) * mul;
else if (num[i] >= '0' && num[i] <= '9')
ret += (num[i] - '0') * mul;
else
return 0;
mul *= 16;
}
return ret;
}
uint64 hextoi64(char* num) {
int len = strlen(num);
if (len < 3)
return 0;
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
return 0;
uint64 ret = 0;
int mul = 1;
for (int i=len-1; i>=2; i--) {
if (num[i] >= 'A' && num[i] <= 'F')
ret += ((num[i] - 'A') + 10) * mul;
else if (num[i] >= 'a' && num[i] <= 'f')
ret += ((num[i] - 'a') + 10) * mul;
else if (num[i] >= '0' && num[i] <= '9')
ret += (num[i] - '0') * mul;
else
return 0;
mul *= 16;
}
return ret;
}
bool atobool(char* iBool) {
if (!strcasecmp(iBool, "true"))
return true;
if (!strcasecmp(iBool, "false"))
return false;
if (!strcasecmp(iBool, "yes"))
return true;
if (!strcasecmp(iBool, "no"))
return false;
if (!strcasecmp(iBool, "on"))
return true;
if (!strcasecmp(iBool, "off"))
return false;
if (!strcasecmp(iBool, "enable"))
return true;
if (!strcasecmp(iBool, "disable"))
return false;
if (!strcasecmp(iBool, "enabled"))
return true;
if (!strcasecmp(iBool, "disabled"))
return false;
if (!strcasecmp(iBool, "y"))
return true;
if (!strcasecmp(iBool, "n"))
return false;
if (atoi(iBool))
return true;
return false;
}
int32 filesize(FILE* fp) {
#ifdef _WINDOWS
@ -547,40 +345,6 @@ static unsigned int case_6 (void){
// end WELL RNG code
// solar: removes the crap and turns the underscores into spaces.
char *CleanMobName(const char *in, char *out)
{
unsigned i, j;
for(i = j = 0; i < strlen(in); i++)
{
// convert _ to space.. any other conversions like this? I *think* this
// is the only non alpha char that's not stripped but converted.
if(in[i] == '_')
{
out[j++] = ' ';
}
else
{
if(isalpha(in[i]) || (in[i] == '`')) // numbers, #, or any other crap just gets skipped
out[j++] = in[i];
}
}
out[j] = 0; // terimnate the string before returning it
return out;
}
const char *ConvertArray(int input, char *returnchar)
{
sprintf(returnchar, "%i" ,input);
return returnchar;
}
const char *ConvertArrayF(float input, char *returnchar)
{
sprintf(returnchar, "%0.2f", input);
return returnchar;
}
float EQ13toFloat(int d)
{
@ -625,24 +389,3 @@ float EQHtoFloat(int d)
{
return(360.0f - float((d * 360) >> 11));
}
void RemoveApostrophes(std::string &s)
{
for(unsigned int i = 0; i < s.length(); ++i)
if(s[i] == '\'')
s[i] = '_';
}
char *RemoveApostrophes(const char *s)
{
char *NewString = new char[strlen(s) + 1];
strcpy(NewString, s);
for(unsigned int i = 0 ; i < strlen(NewString); ++i)
if(NewString[i] == '\'')
NewString[i] = '_';
return NewString;
}

View File

@ -86,39 +86,14 @@
#define BITMASK 0x41180000
//////////////////////////////////////////////////////////////////////
//
// MakeUpperString
// i: source - allocated null-terminated string
// return: pointer to static buffer with the target string
const char *MakeUpperString(const char *source);
const char *MakeLowerString(const char *source);
//////////////////////////////////////////////////////////////////////
//
// MakeUpperString
// i : source - allocated null-terminated string
// io: target - allocated buffer, at least of size strlen(source)+1
void MakeUpperString(const char *source, char *target);
void MakeLowerString(const char *source, char *target);
int MakeAnyLenString(char** ret, const char* format, ...);
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...);
uint32 hextoi(char* num);
uint64 hextoi64(char* num);
bool atobool(char* iBool);
int32 filesize(FILE* fp);
uint32 ResolveIP(const char* hostname, char* errbuf = 0);
bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf = 0);
void CoutTimestamp(bool ms = true);
char* strn0cpy(char* dest, const char* source, uint32 size);
// return value =true if entire string(source) fit, false if it was truncated
bool strn0cpyt(char* dest, const char* source, uint32 size);
int MakeRandomInt(int low, int high);
double MakeRandomFloat(double low, double high);
char *CleanMobName(const char *in, char *out);
const char *ConvertArray(int input, char *returnchar);
const char *ConvertArrayF(float input, char *returnchar);
float EQ13toFloat(int d);
float NewEQ13toFloat(int d);
float EQ19toFloat(int d);
@ -127,8 +102,6 @@ int FloatToEQ13(float d);
int NewFloatToEQ13(float d);
int FloatToEQ19(float d);
int FloatToEQH(float d);
void RemoveApostrophes(std::string &s);
char *RemoveApostrophes(const char *s);

View File

@ -65,21 +65,22 @@ bool IsTryLockSupported() {
#endif
Mutex::Mutex() {
#if DEBUG_MUTEX_CLASS >= 7
std::cout << "Constructing Mutex" << std::endl;
#endif
#ifdef _WINDOWS
InitializeCriticalSection(&CSMutex);
InitializeCriticalSection(&CSMutex);
#else
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
#if defined(__CYGWIN__) || defined(__APPLE__) || defined(FREEBSD)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#endif
pthread_mutex_init(&CSMutex, &attr);
pthread_mutexattr_destroy(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#endif
pthread_mutex_init(&CSMutex, &attr);
pthread_mutexattr_destroy(&attr);
#endif
}

351
common/StringUtil.cpp Normal file
View File

@ -0,0 +1,351 @@
/*
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "StringUtil.h"
#include <string>
#include <cstdarg>
#include <cstring> // for strncpy
#include <stdexcept>
#ifdef _WINDOWS
#include <windows.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
#include <stdlib.h>
#include <stdio.h>
#endif
#ifndef va_copy
#define va_copy(d,s) ((d) = (s))
#endif
// original source:
// https://github.com/facebook/folly/blob/master/folly/String.cpp
//
void vStringFormat(std::string& output, const char* format, va_list args)
{
va_list tmpargs;
va_copy(tmpargs,args);
int characters_used = vsnprintf(nullptr, 0, format, tmpargs);
va_end(tmpargs);
if (characters_used < 0) {
// Looks like we have an invalid format string.
// error out.
std::string errorMessage("Invalid format string; snprintf returned negative with format string: ");
errorMessage.append(format);
throw std::runtime_error(errorMessage);
}
else if ((unsigned int)characters_used > output.capacity()) {
output.resize(characters_used+1);
va_copy(tmpargs,args);
characters_used = vsnprintf(&output[0], output.capacity(), format, tmpargs);
va_end(tmpargs);
if (characters_used < 0) {
// We shouldn't have a format error by this point, but I can't imagine what error we
// could have by this point. Still, error out and report it.
std::string errorMessage("Invalid format string or unknown vsnprintf error; vsnprintf returned negative with format string: ");
errorMessage.append(format);
throw std::runtime_error(errorMessage);
}
}
else {
output.resize(characters_used + 1);
va_copy(tmpargs,args);
characters_used = vsnprintf(&output[0], output.capacity(), format, tmpargs);
va_end(tmpargs);
if (characters_used < 0) {
// We shouldn't have a format error by this point, but I can't imagine what error we
// could have by this point. still error out and report it.
std::string errorMessage("Invalid format string or unknown vsnprintf error; vsnprintf returned negative with format string: ");
errorMessage.append(format);
throw std::runtime_error(errorMessage);
}
}
}
void StringFormat(std::string& output, const char* format, ...)
{
va_list args;
va_start(args, format);
vStringFormat(output,format,args);
va_end(args);
}
// normal strncpy doesnt put a null term on copied strings, this one does
// ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecrt/htm/_wcecrt_strncpy_wcsncpy.asp
char* strn0cpy(char* dest, const char* source, uint32 size) {
if (!dest)
return 0;
if (size == 0 || source == 0) {
dest[0] = 0;
return dest;
}
strncpy(dest, source, size);
dest[size - 1] = 0;
return dest;
}
// String N w/null Copy Truncated?
// return value =true if entire string(source) fit, false if it was truncated
bool strn0cpyt(char* dest, const char* source, uint32 size) {
if (!dest)
return 0;
if (size == 0 || source == 0) {
dest[0] = 0;
return false;
}
strncpy(dest, source, size);
dest[size - 1] = 0;
return (bool) (source[strlen(dest)] == 0);
}
const char *MakeUpperString(const char *source) {
static char str[128];
if (!source)
return nullptr;
MakeUpperString(source, str);
return str;
}
void MakeUpperString(const char *source, char *target) {
if (!source || !target) {
*target=0;
return;
}
while (*source)
{
*target = toupper(*source);
target++;source++;
}
*target = 0;
}
const char *MakeLowerString(const char *source) {
static char str[128];
if (!source)
return nullptr;
MakeLowerString(source, str);
return str;
}
void MakeLowerString(const char *source, char *target) {
if (!source || !target) {
*target=0;
return;
}
while (*source)
{
*target = tolower(*source);
target++;source++;
}
*target = 0;
}
int MakeAnyLenString(char** ret, const char* format, ...) {
int buf_len = 128;
int chars = -1;
va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= buf_len) {
safe_delete_array(*ret);
if (chars == -1)
buf_len *= 2;
else
buf_len = chars + 1;
*ret = new char[buf_len];
va_copy(tmpargptr, argptr);
chars = vsnprintf(*ret, buf_len, format, tmpargptr);
}
va_end(argptr);
return chars;
}
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...) {
if (*bufsize == 0)
*bufsize = 256;
if (*ret == 0)
*strlen = 0;
int chars = -1;
char* oldret = 0;
va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= (int32)(*bufsize-*strlen)) {
if (chars == -1)
*bufsize += 256;
else
*bufsize += chars + 25;
oldret = *ret;
*ret = new char[*bufsize];
if (oldret) {
if (*strlen)
memcpy(*ret, oldret, *strlen);
safe_delete_array(oldret);
}
va_copy(tmpargptr, argptr);
chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, tmpargptr);
}
va_end(argptr);
*strlen += chars;
return *strlen;
}
uint32 hextoi(char* num) {
int len = strlen(num);
if (len < 3)
return 0;
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
return 0;
uint32 ret = 0;
int mul = 1;
for (int i=len-1; i>=2; i--) {
if (num[i] >= 'A' && num[i] <= 'F')
ret += ((num[i] - 'A') + 10) * mul;
else if (num[i] >= 'a' && num[i] <= 'f')
ret += ((num[i] - 'a') + 10) * mul;
else if (num[i] >= '0' && num[i] <= '9')
ret += (num[i] - '0') * mul;
else
return 0;
mul *= 16;
}
return ret;
}
uint64 hextoi64(char* num) {
int len = strlen(num);
if (len < 3)
return 0;
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
return 0;
uint64 ret = 0;
int mul = 1;
for (int i=len-1; i>=2; i--) {
if (num[i] >= 'A' && num[i] <= 'F')
ret += ((num[i] - 'A') + 10) * mul;
else if (num[i] >= 'a' && num[i] <= 'f')
ret += ((num[i] - 'a') + 10) * mul;
else if (num[i] >= '0' && num[i] <= '9')
ret += (num[i] - '0') * mul;
else
return 0;
mul *= 16;
}
return ret;
}
bool atobool(char* iBool) {
if (!strcasecmp(iBool, "true"))
return true;
if (!strcasecmp(iBool, "false"))
return false;
if (!strcasecmp(iBool, "yes"))
return true;
if (!strcasecmp(iBool, "no"))
return false;
if (!strcasecmp(iBool, "on"))
return true;
if (!strcasecmp(iBool, "off"))
return false;
if (!strcasecmp(iBool, "enable"))
return true;
if (!strcasecmp(iBool, "disable"))
return false;
if (!strcasecmp(iBool, "enabled"))
return true;
if (!strcasecmp(iBool, "disabled"))
return false;
if (!strcasecmp(iBool, "y"))
return true;
if (!strcasecmp(iBool, "n"))
return false;
if (atoi(iBool))
return true;
return false;
}
// solar: removes the crap and turns the underscores into spaces.
char *CleanMobName(const char *in, char *out)
{
unsigned i, j;
for(i = j = 0; i < strlen(in); i++)
{
// convert _ to space.. any other conversions like this? I *think* this
// is the only non alpha char that's not stripped but converted.
if(in[i] == '_')
{
out[j++] = ' ';
}
else
{
if(isalpha(in[i]) || (in[i] == '`')) // numbers, #, or any other crap just gets skipped
out[j++] = in[i];
}
}
out[j] = 0; // terimnate the string before returning it
return out;
}
void RemoveApostrophes(std::string &s)
{
for(unsigned int i = 0; i < s.length(); ++i)
if(s[i] == '\'')
s[i] = '_';
}
char *RemoveApostrophes(const char *s)
{
char *NewString = new char[strlen(s) + 1];
strcpy(NewString, s);
for(unsigned int i = 0 ; i < strlen(NewString); ++i)
if(NewString[i] == '\'')
NewString[i] = '_';
return NewString;
}
const char *ConvertArray(int input, char *returnchar)
{
sprintf(returnchar, "%i" ,input);
return returnchar;
}
const char *ConvertArrayF(float input, char *returnchar)
{
sprintf(returnchar, "%0.2f", input);
return returnchar;
}

61
common/StringUtil.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _STRINGUTIL_H_
#define _STRINGUTIL_H_
#include <string>
#include <cstdarg>
#include "types.h"
void vStringFormat(std::string& output, const char* format, va_list args);
void StringFormat(std::string& output, const char* format, ...);
//////////////////////////////////////////////////////////////////////
//
// MakeUpperString
// i : source - allocated null-terminated string
// return: pointer to static buffer with the target string
const char *MakeUpperString(const char *source);
const char *MakeLowerString(const char *source);
//////////////////////////////////////////////////////////////////////
//
// MakeUpperString
// i : source - allocated null-terminated string
// io: target - allocated buffer, at least of size strlen(source)+1
void MakeUpperString(const char *source, char *target);
void MakeLowerString(const char *source, char *target);
int MakeAnyLenString(char** ret, const char* format, ...);
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...);
uint32 hextoi(char* num);
uint64 hextoi64(char* num);
bool atobool(char* iBool);
char* strn0cpy(char* dest, const char* source, uint32 size);
// return value =true if entire string(source) fit, false if it was truncated
bool strn0cpyt(char* dest, const char* source, uint32 size);
char *CleanMobName(const char *in, char *out);
const char *ConvertArray(int input, char *returnchar);
const char *ConvertArrayF(float input, char *returnchar);
void RemoveApostrophes(std::string &s);
char *RemoveApostrophes(const char *s);
#endif

View File

@ -24,9 +24,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp

View File

@ -43,7 +43,8 @@
#include "database.h"
#include "eq_packet_structs.h"
#include "guilds.h"
#include "MiscFunctions.h"
//#include "MiscFunctions.h"
#include "StringUtil.h"
#include "extprofile.h"
extern Client client;

View File

@ -13,7 +13,8 @@
#include "dbcore.h"
#include "common_profile.h"
#include <string.h>
#include "../common/MiscFunctions.h"
//#include "../common/MiscFunctions.h"
#include "StringUtil.h"
#define ASYNC_LOOP_GRANULARITY 4 //# of ms between checking our work
bool DBAsyncCB_LoadVariables(DBAsyncWork* iWork) {

View File

@ -1,22 +1,25 @@
#include "debug.h"
#include <iostream>
#include <string>
#include <cstdarg>
#include <time.h>
#include <string.h>
#ifdef _WINDOWS
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
#include <sys/types.h>
#include <unistd.h>
#include <stdarg.h>
#endif
#include "../common/StringUtil.h"
#include "../common/MiscFunctions.h"
#include "../common/platform.h"
@ -72,6 +75,7 @@ EQEMuLog::~EQEMuLog() {
}
bool EQEMuLog::open(LogIDs id) {
if (!logFileValid) {
return false;
}
@ -87,36 +91,40 @@ bool EQEMuLog::open(LogIDs id) {
return true;
}
char exename[200] = "";
std::string filename = FileNames[id];
const EQEmuExePlatform &platform = GetExecutablePlatform();
if(platform == ExePlatformWorld) {
snprintf(exename, sizeof(exename), "_world");
filename.append("_world");
} else if(platform == ExePlatformZone) {
snprintf(exename, sizeof(exename), "_zone");
filename.append("_zone");
} else if(platform == ExePlatformLaunch) {
snprintf(exename, sizeof(exename), "_launch");
filename.append("_launch");
} else if(platform == ExePlatformUCS) {
snprintf(exename, sizeof(exename), "_ucs");
filename.append("_ucs");
} else if(platform == ExePlatformQueryServ) {
snprintf(exename, sizeof(exename), "_queryserv");
filename.append("_queryserv");
} else if(platform == ExePlatformSharedMemory) {
snprintf(exename, sizeof(exename), "_shared_memory");
filename.append("_shared_memory");
}
char filename[200];
#ifndef NO_PIDLOG
snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
#else
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
// Visual Studio 2010 doesn't have std::to_string(int) but it does have one for
// long long. Oh well, it works fine and formats perfectly acceptably.
filename.append(std::to_string((long long)getpid()));
#endif
fp[id] = fopen(filename, "a");
filename.append(".log");
fp[id] = fopen(filename.c_str(), "a");
if (!fp[id]) {
std::cerr << "Failed to open log file: " << filename << std::endl;
pLogStatus[id] |= 4; // set file state to error
return false;
}
fputs("---------------------------------------------\n",fp[id]);
write(id, "Starting Log: %s", filename);
write(id, "Starting Log: %s", filename.c_str());
return true;
}
@ -143,44 +151,54 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */
if (dofile)
if (dofile) {
#ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif
}
va_list argptr, tmpargptr;
va_start(argptr, fmt);
va_list argptr,tmpargptr;
if (dofile) {
va_copy(tmpargptr, argptr);
va_start(argptr, fmt);
va_copy(tmpargptr,argptr);
vfprintf( fp[id], fmt, tmpargptr );
va_end(tmpargptr);
}
if(logCallbackFmt[id]) {
msgCallbackFmt p = logCallbackFmt[id];
va_copy(tmpargptr, argptr);
va_start(argptr, fmt);
va_copy(tmpargptr,argptr);
p(id, fmt, tmpargptr );
va_end(tmpargptr);
}
std::string outputMessage;
va_start(argptr, fmt);
va_copy(tmpargptr,argptr);
vStringFormat(outputMessage, fmt, tmpargptr);
va_end(tmpargptr);
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] ", LogNames[id]);
vfprintf( stderr, fmt, argptr );
std::cerr << "[" << LogNames[id] << "] ";
std::cerr << outputMessage;
}
else {
fprintf(stdout, "[%s] ", LogNames[id]);
vfprintf( stdout, fmt, argptr );
std::cout << "[" << LogNames[id] << "] ";
std::cout << outputMessage;
}
}
va_end(argptr);
if (dofile)
fprintf(fp[id], "\n");
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "\n");
fflush(stderr);
std::cerr << std::endl;
} else {
fprintf(stdout, "\n");
fflush(stdout);
std::cout << std::endl;
}
}
if(dofile)
@ -349,36 +367,45 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski
write(id, "Dumping Packet: %i", size);
// Output as HEX
int j = 0; char* ascii = new char[cols+1]; memset(ascii, 0, cols+1);
uint32 i;
for(i=skip; i<size; i++) {
if ((i-skip)%cols==0) {
if (i != skip)
writeNTS(id, dofile, " | %s\n", ascii);
writeNTS(id, dofile, "%4i: ", i-skip);
memset(ascii, 0, cols+1);
j = 0;
int beginningOfLineOffset = 0;
uint32 indexInData;
std::string asciiOutput;
for(indexInData=skip; indexInData<size; indexInData++) {
if ((indexInData-skip)%cols==0) {
if (indexInData != skip)
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
writeNTS(id, dofile, "%4i: ", indexInData-skip);
asciiOutput.clear();
beginningOfLineOffset = 0;
}
else if ((i-skip)%(cols/2) == 0) {
else if ((indexInData-skip)%(cols/2) == 0) {
writeNTS(id, dofile, "- ");
}
writeNTS(id, dofile, "%02X ", (unsigned char)data[i]);
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
if (data[i] >= 32 && data[i] < 127)
ascii[j++] = data[i];
if (data[indexInData] >= 32 && data[indexInData] < 127)
{
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
// version.
asciiOutput.append(std::to_string((long long)data[indexInData]));
}
else
ascii[j++] = '.';
{
asciiOutput.append(".");
}
}
uint32 k = ((i-skip)-1)%cols;
uint32 k = ((indexInData-skip)-1)%cols;
if (k < 8)
writeNTS(id, dofile, " ");
for (uint32 h = k+1; h < cols; h++) {
writeNTS(id, dofile, " ");
}
writeNTS(id, dofile, " | %s\n", ascii);
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
if (dofile)
fflush(fp[id]);
safe_delete_array(ascii);
return true;
}
@ -435,4 +462,3 @@ void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
SetCallback((LogIDs)r, proc);
}
}

View File

@ -20,7 +20,8 @@
#include "guild_base.h"
#include "database.h"
#include "logsys.h"
#include "MiscFunctions.h"
//#include "MiscFunctions.h"
#include "StringUtil.h"
#include <cstdlib>
#include <cstring>

View File

@ -9,7 +9,7 @@
*/
#include <string.h> /* for memcpy() */
#include "../common/md5.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/seperator.h"
MD5::MD5() {

View File

@ -29,9 +29,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else

View File

@ -8,6 +8,7 @@
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "../clientversions.h"
#include "Client62_structs.h"

View File

@ -8,6 +8,7 @@
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "RoF_structs.h"
#include "../rulesys.h"

View File

@ -8,6 +8,7 @@
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "SoD_structs.h"
#include "../rulesys.h"

View File

@ -7,7 +7,7 @@
#include "../crc32.h"
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "SoF_structs.h"
#include "../rulesys.h"

View File

@ -8,7 +8,7 @@
#include "../races.h"
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "Titanium_structs.h"
#include <sstream>

View File

@ -8,6 +8,7 @@
#include "../eq_packet_structs.h"
#include "../MiscFunctions.h"
#include "../StringUtil.h"
#include "../Item.h"
#include "Underfoot_structs.h"
#include "../rulesys.h"

View File

@ -20,7 +20,7 @@
#include "timer.h"
#include "ptimer.h"
#include "database.h"
#include "MiscFunctions.h"
#include "StringUtil.h"
#include <stdio.h>
#include <cstdlib>
#include <cstring>

View File

@ -19,7 +19,7 @@
#include "rulesys.h"
#include "logsys.h"
#include "database.h"
#include "MiscFunctions.h"
#include "StringUtil.h"
#include <cstdlib>
#include <cstring>

View File

@ -6,7 +6,7 @@
#include "classes.h"
#include "rulesys.h"
#include "seperator.h"
#include "MiscFunctions.h"
#include "StringUtil.h"
#include "eq_packet_structs.h"
#include "guilds.h"
#include "extprofile.h"

View File

@ -68,9 +68,6 @@ typedef const char Const_char; //for perl XS
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
typedef void ThreadReturnType;
@ -80,8 +77,8 @@ typedef const char Const_char; //for perl XS
#define THREAD_RETURN(x) return(x);
#endif
#define safe_delete(d) if(d) { delete d; d=0; }
#define safe_delete_array(d) if(d) { delete[] d; d=0; }
#define safe_delete(d) if(d) { delete d; d=nullptr; }
#define safe_delete_array(d) if(d) { delete[] d; d=nullptr; }
#define L32(i) ((uint32) i)
#define H32(i) ((uint32) (i >> 32))
#define L16(i) ((uint16) i)

View File

@ -20,6 +20,7 @@
#include "../common/servertalk.h"
#include "ZoneLaunch.h"
#include "../common/EQEmuConfig.h"
#include "../common/StringUtil.h"
WorldServer::WorldServer(std::map<std::string, ZoneLaunch *> &zones, const char *name, const EQEmuConfig *config)

View File

@ -43,7 +43,7 @@
#include "database.h"
#include "../common/eq_packet_structs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/servertalk.h"
Database::Database ()

View File

@ -2,7 +2,7 @@
#include "lfguild.h"
#include "database.h"
#include "worldserver.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/packet_dump.h"
#include "../common/rulesys.h"

View File

@ -20,7 +20,7 @@
#include "chatchannel.h"
#include "clientlist.h"
#include "database.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include <cstdlib>
extern Database database;

View File

@ -18,7 +18,7 @@
*/
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "clientlist.h"
#include "database.h"

View File

@ -44,6 +44,7 @@
#include "database.h"
#include "../common/eq_packet_structs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "chatchannel.h"
extern Clientlist *CL;

View File

@ -3,6 +3,7 @@
#include "../common/extprofile.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "Adventure.h"
#include "AdventureManager.h"
#include "worlddb.h"

View File

@ -1,5 +1,6 @@
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/servertalk.h"
#include "../common/rulesys.h"
#include "Adventure.h"

View File

@ -20,7 +20,7 @@
#include "worlddb.h"
#include "LauncherLink.h"
#include "LauncherList.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include <cstdlib>
#include <cstring>

View File

@ -25,7 +25,7 @@
#include "../common/races.h"
#include "../common/classes.h"
#include "../common/misc.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "zoneserver.h"
#include "zonelist.h"
#include "clientlist.h"

View File

@ -25,6 +25,7 @@
#include "../common/packet_dump.h"
#include "../common/servertalk.h"
#include "../common/EmuTCPConnection.h"
#include "../common/StringUtil.h"
#include "worlddb.h"
#include "EQLConfig.h"

View File

@ -29,9 +29,6 @@
#include <winsock.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else // Pyro: fix for linux
@ -59,7 +56,7 @@
#include "LoginServerList.h"
#include "../common/eq_packet_structs.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "zoneserver.h"
#include "worlddb.h"
#include "zonelist.h"

View File

@ -18,9 +18,6 @@
#include <windows.h>
#include <winsock.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@ -46,7 +43,7 @@
#include "../common/languages.h"
#include "../common/skills.h"
#include "../common/extprofile.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "WorldConfig.h"
#include "LoginServer.h"
#include "LoginServerList.h"

View File

@ -24,6 +24,7 @@
#include "zoneserver.h"
#include "WorldConfig.h"
#include "../common/guilds.h"
#include "../common/StringUtil.h"
extern uint32 numplayers;
extern LoginServerList loginserverlist;

View File

@ -22,6 +22,7 @@
#include "client.h"
#include "console.h"
#include "worlddb.h"
#include "../common/StringUtil.h"
#include "../common/guilds.h"
#include "../common/races.h"
#include "../common/classes.h"

View File

@ -38,6 +38,7 @@
#include "../common/opcodemgr.h"
#include "../common/rulesys.h"
#include "../common/ruletypes.h"
#include "../common/StringUtil.h"
#include "WorldConfig.h"
#include "zoneserver.h"
#include "zonelist.h"
@ -48,9 +49,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif

View File

@ -46,9 +46,6 @@
#ifdef _WINDOWS
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#include <conio.h>

View File

@ -18,7 +18,7 @@
#include "worlddb.h"
//#include "../common/Item.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/eq_packet_structs.h"
#include "../common/Item.h"
#include "../common/dbasync.h"

View File

@ -23,7 +23,7 @@
#include "console.h"
#include "WorldConfig.h"
#include "../common/servertalk.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
extern uint32 numzones;
extern bool holdzones;

View File

@ -29,7 +29,7 @@
#include "../common/guilds.h"
#include "../common/packet_dump.h"
#include "../common/misc.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "cliententry.h"
#include "wguild_mgr.h"
#include "lfplist.h"

View File

@ -34,7 +34,7 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include "../common/classes.h"
#include "../common/eq_packet_structs.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/logsys.h"
#include "zonedb.h"
#include "StringIDs.h"

View File

@ -28,7 +28,7 @@
#include "../common/moremath.h"
#include "parser.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"

View File

@ -24,7 +24,7 @@
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/features.h"
#include "StringIDs.h"

View File

@ -37,6 +37,7 @@ Child of the Mob class.
#include "masterentity.h"
#include "../common/packet_functions.h"
#include "../common/StringUtil.h"
#include "../common/crc32.h"
#include "StringIDs.h"
#include "worldserver.h"

View File

@ -1,5 +1,5 @@
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "QGlobals.h"
#include "zonedb.h"

View File

@ -37,7 +37,7 @@
#include "../common/spdat.h"
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"

View File

@ -4,6 +4,7 @@
#include "object.h"
#include "doors.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
extern volatile bool ZoneLoaded;

View File

@ -1,6 +1,7 @@
#ifdef BOTS
#include "bot.h"
#include "../common/StringUtil.h"
bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
_ZP(Bot_AICastSpell);

View File

@ -32,7 +32,7 @@
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#else
#include <stdarg.h>
#include <sys/socket.h>
@ -59,7 +59,7 @@ extern volatile bool RunLoops;
#include "../common/guilds.h"
#include "../common/breakdowns.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "forage.h"
#include "command.h"
#include "StringIDs.h"

View File

@ -29,9 +29,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@ -48,7 +45,7 @@
#include "worldserver.h"
#include "../common/rdtsc.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"

View File

@ -32,9 +32,6 @@
#include <windows.h>
#include <winsock.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@ -50,7 +47,7 @@
#include "../common/packet_dump.h"
#include "worldserver.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/spdat.h"
#include "petitions.h"
#include "NpcAI.h"

View File

@ -50,7 +50,7 @@
#include "../common/EQPacket.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
//#include "../common/servertalk.h" // for oocmute and revoke
#include "worldserver.h"
#include "masterentity.h"

View File

@ -25,7 +25,7 @@
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#define OPEN_DOOR 0x02

View File

@ -30,7 +30,7 @@
#include "questmgr.h"
#include "command.h"
#include "../common/seperator.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "QGlobals.h"
#include "zone.h"

View File

@ -48,12 +48,9 @@
#include "QuestParserCollection.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
extern Zone* zone;

View File

@ -19,7 +19,7 @@
#include "../common/features.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"

View File

@ -31,7 +31,7 @@
#include "watermap.h"
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "zonedb.h"

View File

@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;

View File

@ -28,7 +28,7 @@
#include "../common/ZoneNumbers.h"
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#include "StringIDs.h"
#include "NpcAI.h"

View File

@ -20,6 +20,7 @@
#include "zonedb.h"
#include "worldserver.h"
#include "../common/servertalk.h"
#include "../common/StringUtil.h"
#include "client.h"
#include "entity.h"

View File

@ -20,7 +20,7 @@
#include "masterentity.h"
#include "../common/Item.h"
#include "../common/linked_list.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#include "worldserver.h"

View File

@ -29,6 +29,7 @@
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/logsys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "NpcAI.h"
extern WorldServer worldserver;

View File

@ -8,7 +8,7 @@
#include "../common/spdat.h"
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"

View File

@ -21,6 +21,7 @@
#include "StringIDs.h"
#include "worldserver.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
#include <sstream>
#include <math.h>

View File

@ -40,7 +40,7 @@
#include "../common/spdat.h"
#include "../common/bodytypes.h"
#include "spawngroup.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "StringIDs.h"

View File

@ -21,6 +21,7 @@
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_functions.h"
#include "../common/StringUtil.h"
#include "spawn2.h"
#include "zone.h"
#include "event_codes.h"

View File

@ -28,13 +28,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#endif
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#include "../common/StringUtil.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/packet_dump_file.h"

View File

@ -26,7 +26,7 @@
#include "../common/skills.h"
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "pets.h"
#include <math.h>
#include <assert.h>

View File

@ -67,7 +67,7 @@ And then at then end of embparser.cpp, add:
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_functions.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "spawn2.h"
#include "zone.h"
#include "parser.h"

View File

@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;

View File

@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/StringUtil.h"
#include <stdlib.h>
#include "spawn2.h"
#include "entity.h"

View File

@ -24,6 +24,7 @@
#include "../common/types.h"
#include "zonedb.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
extern EntityList entity_list;

View File

@ -83,13 +83,15 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#ifndef WIN32
// #include <pthread.h>
#include <stdlib.h>
#include "../common/unix.h"
#include <stdlib.h>
#include "../common/unix.h"
#endif
#ifdef _GOTFRAGS
#include "../common/packet_dump_file.h"
#endif

View File

@ -27,7 +27,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#define strcasecmp _stricmp
#endif
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "masterentity.h"
#include "../common/features.h"

View File

@ -19,7 +19,7 @@
#include "../common/eq_packet_structs.h"
#include "masterentity.h"
#include "titles.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern WorldServer worldserver;

View File

@ -30,7 +30,7 @@
#include "../common/packet_dump.h"
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"

View File

@ -18,7 +18,7 @@
#include "../common/debug.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "worldserver.h"

View File

@ -20,7 +20,7 @@
#include "entity.h"
#include "masterentity.h"
#include "../common/spdat.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
/*

View File

@ -23,7 +23,8 @@
#include <float.h>
#include "watermap.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#endif

View File

@ -30,7 +30,7 @@
#include "../common/moremath.h"
#include "parser.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"

View File

@ -28,9 +28,6 @@
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif

View File

@ -45,7 +45,7 @@
#include "../common/packet_dump_file.h"
#include "../common/EQStreamFactory.h"
#include "../common/EQStream.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "ZoneConfig.h"
#include "../common/breakdowns.h"
#include "map.h"

View File

@ -1,7 +1,7 @@
#include "zonedb.h"
#include "../common/Item.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/extprofile.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"

View File

@ -2,7 +2,7 @@
#include <iostream>
#include "entity.h"
#include "masterentity.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include <stdlib.h>

View File

@ -22,6 +22,7 @@
#include "masterentity.h"
#include "../common/packet_dump.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "QuestParserCollection.h"