diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-08 02:13:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-08 02:19:35 +0300 |
commit | 178f4811e8602ba7dacb1a0513baa546088d517d (patch) | |
tree | c23cf5dd5d752216e88473c51e7730700942d0fc | |
parent | da44888ee2de9ae1e5c006126e84b36fcc95d4e5 (diff) | |
download | manaverse-178f4811e8602ba7dacb1a0513baa546088d517d.tar.gz manaverse-178f4811e8602ba7dacb1a0513baa546088d517d.tar.bz2 manaverse-178f4811e8602ba7dacb1a0513baa546088d517d.tar.xz manaverse-178f4811e8602ba7dacb1a0513baa546088d517d.zip |
Fix compilation errors and more style.
32 files changed, 234 insertions, 260 deletions
diff --git a/src/client.cpp b/src/client.cpp index 54a0b6224..023eb5353 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -988,10 +988,10 @@ int Client::gameExec() if (mState != mOldState) { - Mana::Event evt(EVENT_STATECHANGE); + Event evt(EVENT_STATECHANGE); evt.setInt("oldState", mOldState); evt.setInt("newState", mState); - Mana::Event::trigger(CHANNEL_CLIENT, evt); + Event::trigger(CHANNEL_CLIENT, evt); if (mOldState == STATE_GAME) { @@ -1191,10 +1191,10 @@ int Client::gameExec() if (!BeingInfo::unknown) BeingInfo::unknown = new BeingInfo; - Mana::Event evt2(EVENT_STATECHANGE); + Event evt2(EVENT_STATECHANGE); evt2.setInt("newState", STATE_LOAD_DATA); evt2.setInt("oldState", mOldState); - Mana::Event::trigger(CHANNEL_CLIENT, evt2); + Event::trigger(CHANNEL_CLIENT, evt2); // Load XML databases CharDB::load(); diff --git a/src/configuration.cpp b/src/configuration.cpp index 254a3fea8..c4f1cc360 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -193,21 +193,21 @@ int Configuration::getIntValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - if (itdef->second->getType() == Mana::VariableData::DATA_INT) + if (itdef->second->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast<Mana::IntData*>( + defaultValue = (static_cast<IntData*>( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - defaultValue = atoi((static_cast<Mana::StringData*>( + defaultValue = atoi((static_cast<StringData*>( itdef->second))->getData().c_str()); } else if (itdef->second->getType() - == Mana::VariableData::DATA_BOOL) + == VariableData::DATA_BOOL) { - if ((static_cast<Mana::BoolData*>( + if ((static_cast<BoolData*>( itdef->second))->getData()) { defaultValue = 1; @@ -241,9 +241,9 @@ int Configuration::resetIntValue(const std::string &key) DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_INT) + && itdef->second->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast<Mana::IntData*>( + defaultValue = (static_cast<IntData*>( itdef->second))->getData(); } else @@ -270,15 +270,15 @@ std::string Configuration::getStringValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - defaultValue = (static_cast<Mana::StringData*>( + defaultValue = (static_cast<StringData*>( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_BOOL) + == VariableData::DATA_BOOL) { - if ((static_cast<Mana::BoolData*>( + if ((static_cast<BoolData*>( itdef->second))->getData()) { defaultValue = "1"; @@ -289,9 +289,9 @@ std::string Configuration::getStringValue(const std::string &key) const } } else if (itdef->second->getType() - == Mana::VariableData::DATA_INT) + == VariableData::DATA_INT) { - defaultValue = toString((static_cast<Mana::IntData*>( + defaultValue = toString((static_cast<IntData*>( itdef->second))->getData()); } } @@ -322,10 +322,10 @@ float Configuration::getFloatValue(const std::string &key) const DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_FLOAT) + && itdef->second->getType() == VariableData::DATA_FLOAT) { defaultValue = static_cast<float>( - (static_cast<Mana::FloatData*>(itdef->second))->getData()); + (static_cast<FloatData*>(itdef->second))->getData()); } else { @@ -354,15 +354,15 @@ bool Configuration::getBoolValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - if (itdef->second->getType() == Mana::VariableData::DATA_BOOL) + if (itdef->second->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast<Mana::BoolData*>( + defaultValue = (static_cast<BoolData*>( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_INT) + == VariableData::DATA_INT) { - if ((static_cast<Mana::IntData*>( + if ((static_cast<IntData*>( itdef->second))->getData() != 0) { defaultValue = true; @@ -373,9 +373,9 @@ bool Configuration::getBoolValue(const std::string &key) const } } else if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - if ((static_cast<Mana::StringData*>( + if ((static_cast<StringData*>( itdef->second))->getData() != "0") { defaultValue = true; @@ -410,9 +410,9 @@ bool Configuration::resetBoolValue(const std::string &key) DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_BOOL) + && itdef->second->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast<Mana::BoolData*>( + defaultValue = (static_cast<BoolData*>( itdef->second))->getData(); } else diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp index 9e30d30d9..fb83cab4a 100644 --- a/src/debug/debug_new.cpp +++ b/src/debug/debug_new.cpp @@ -62,49 +62,49 @@ #endif /** - * @def _DEBUG_NEW_ALIGNMENT + * @def M_DEBUG_NEW_ALIGNMENT * * The alignment requirement of allocated memory blocks. It must be a * power of two. */ -#ifndef _DEBUG_NEW_ALIGNMENT -#define _DEBUG_NEW_ALIGNMENT 16 +#ifndef M_DEBUG_NEW_ALIGNMENT +#define M_DEBUG_NEW_ALIGNMENT 16 #endif /** - * @def _DEBUG_NEW_CALLER_ADDRESS + * @def M_DEBUG_NEW_CALLER_ADDRESS * * The expression to return the caller address. #print_position will * later on use this address to print the position information of memory * operation points. */ -#ifndef _DEBUG_NEW_CALLER_ADDRESS +#ifndef M_DEBUG_NEW_CALLER_ADDRESS #ifdef __GNUC__ -#define _DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) +#define M_DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) #else -#define _DEBUG_NEW_CALLER_ADDRESS NULL +#define M_DEBUG_NEW_CALLER_ADDRESS NULL #endif #endif /** - * @def _DEBUG_NEW_ERROR_ACTION + * @def M_DEBUG_NEW_ERROR_ACTION * * The action to take when an error occurs. The default behaviour is to - * call \e abort, unless \c _DEBUG_NEW_ERROR_CRASH is defined, in which + * call \e abort, unless \c M_DEBUG_NEW_ERROR_CRASH is defined, in which * case a segmentation fault will be triggered instead (which can be * useful on platforms like Windows that do not generate a core dump * when \e abort is called). */ -#ifndef _DEBUG_NEW_ERROR_ACTION -#ifndef _DEBUG_NEW_ERROR_CRASH -#define _DEBUG_NEW_ERROR_ACTION abort() +#ifndef M_DEBUG_NEW_ERROR_ACTION +#ifndef M_DEBUG_NEW_ERROR_CRASH +#define M_DEBUG_NEW_ERROR_ACTION abort() #else -#define _DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) +#define M_DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) #endif #endif /** - * @def _DEBUG_NEW_FILENAME_LEN + * @def M_DEBUG_NEW_FILENAME_LEN * * The length of file name stored if greater than zero. If it is zero, * only a const char pointer will be stored. Currently the default @@ -114,70 +114,70 @@ * name in a shared library after a \c SIGINT). The current default * value makes the size of new_ptr_list_t 64 on 32-bit platforms. */ -#ifndef _DEBUG_NEW_FILENAME_LEN -#define _DEBUG_NEW_FILENAME_LEN 100 +#ifndef M_DEBUG_NEW_FILENAME_LEN +#define M_DEBUG_NEW_FILENAME_LEN 100 #endif /** - * @def _DEBUG_NEW_PROGNAME + * @def M_DEBUG_NEW_PROGNAME * * The program (executable) name to be set at compile time. It is * better to assign the full program path to #new_progname in \e main * (at run time) than to use this (compile-time) macro, but this macro * serves well as a quick hack. Note also that double quotation marks * need to be used around the program name, i.e., one should specify a - * command-line option like <code>-D_DEBUG_NEW_PROGNAME=\"a.out\"</code> - * in \e bash, or <code>-D_DEBUG_NEW_PROGNAME=\"a.exe\"</code> in the + * command-line option like <code>-DM_DEBUG_NEW_PROGNAME=\"a.out\"</code> + * in \e bash, or <code>-DM_DEBUG_NEW_PROGNAME=\"a.exe\"</code> in the * Windows command prompt. */ -#ifndef _DEBUG_NEW_PROGNAME -#define _DEBUG_NEW_PROGNAME NULL +#ifndef M_DEBUG_NEW_PROGNAME +#define M_DEBUG_NEW_PROGNAME NULL #endif /** - * @def _DEBUG_NEW_STD_OPER_NEW + * @def M_DEBUG_NEW_STD_OPER_NEW * * Macro to indicate whether the standard-conformant behaviour of * <code>operator new</code> is wanted. It is on by default now, but * the user may set it to \c 0 to revert to the old behaviour. */ -#ifndef _DEBUG_NEW_STD_OPER_NEW -#define _DEBUG_NEW_STD_OPER_NEW 1 +#ifndef M_DEBUG_NEW_STD_OPER_NEW +#define M_DEBUG_NEW_STD_OPER_NEW 1 #endif /** - * @def _DEBUG_NEW_TAILCHECK + * @def M_DEBUG_NEW_TAILCHECK * * Macro to indicate whether a writing-past-end check will be performed. * Define it to a positive integer as the number of padding bytes at the * end of a memory block for checking. */ -#ifndef _DEBUG_NEW_TAILCHECK -#define _DEBUG_NEW_TAILCHECK 0 +#ifndef M_DEBUG_NEW_TAILCHECK +#define M_DEBUG_NEW_TAILCHECK 0 #endif /** - * @def _DEBUG_NEW_TAILCHECK_CHAR + * @def M_DEBUG_NEW_TAILCHECK_CHAR * * Value of the padding bytes at the end of a memory block. */ -#ifndef _DEBUG_NEW_TAILCHECK_CHAR -#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC +#ifndef M_DEBUG_NEW_TAILCHECK_CHAR +#define M_DEBUG_NEW_TAILCHECK_CHAR 0xCC #endif /** - * @def _DEBUG_NEW_USE_ADDR2LINE + * @def M_DEBUG_NEW_USE_ADDR2LINE * * Whether to use \e addr2line to convert a caller address to file/line * information. Defining it to a non-zero value will enable the * conversion (automatically done if GCC is detected). Defining it to * zero will disable the conversion. */ -#ifndef _DEBUG_NEW_USE_ADDR2LINE +#ifndef M_DEBUG_NEW_USE_ADDR2LINE #ifdef __GNUC__ -#define _DEBUG_NEW_USE_ADDR2LINE 1 +#define M_DEBUG_NEW_USE_ADDR2LINE 1 #else -#define _DEBUG_NEW_USE_ADDR2LINE 0 +#define M_DEBUG_NEW_USE_ADDR2LINE 0 #endif #endif @@ -187,20 +187,20 @@ #pragma init_seg(lib) #endif -#undef _DEBUG_NEW_EMULATE_MALLOC -#undef _DEBUG_NEW_REDEFINE_NEW +#undef M_DEBUG_NEW_EMULATE_MALLOC +#undef M_DEBUG_NEW_REDEFINE_NEW /** * Macro to indicate whether redefinition of \c new is wanted. Here it * is defined to \c 0 to disable the redefinition of \c new. */ -#define _DEBUG_NEW_REDEFINE_NEW 0 +#define M_DEBUG_NEW_REDEFINE_NEW 0 #include "debug_new.h" /** * Gets the aligned value of memory block size. */ #define align(s) \ - (((s) + _DEBUG_NEW_ALIGNMENT - 1) & ~(_DEBUG_NEW_ALIGNMENT - 1)) + (((s) + M_DEBUG_NEW_ALIGNMENT - 1) & ~(M_DEBUG_NEW_ALIGNMENT - 1)) /** * Structure to store the position information where \c new occurs. @@ -212,10 +212,10 @@ struct new_ptr_list_t size_t size; union { -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 const char* file; #else - char file[_DEBUG_NEW_FILENAME_LEN]; + char file[M_DEBUG_NEW_FILENAME_LEN]; #endif void* addr; }; @@ -244,7 +244,7 @@ static new_ptr_list_t new_ptr_list = &new_ptr_list, 0, { -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 NULL #else "" @@ -291,15 +291,15 @@ FILE* new_output_fp = stderr; /** * Pointer to the program name. Its initial value is the macro - * #_DEBUG_NEW_PROGNAME. You should try to assign the program path to + * #M_DEBUG_NEW_PROGNAME. You should try to assign the program path to * it early in your application. Assigning <code>argv[0]</code> to it * in \e main is one way. If you use \e bash or \e ksh (or similar), * the following statement is probably what you want: * `<code>new_progname = getenv("_");</code>'. */ -const char* new_progname = _DEBUG_NEW_PROGNAME; +const char* new_progname = M_DEBUG_NEW_PROGNAME; -#if _DEBUG_NEW_USE_ADDR2LINE +#if M_DEBUG_NEW_USE_ADDR2LINE /** * Tries printing the position information from an instruction address. * This is the version that uses \e addr2line. @@ -397,11 +397,11 @@ static bool print_position_from_addr(const void*) { return false; } -#endif // _DEBUG_NEW_USE_ADDR2LINE +#endif // M_DEBUG_NEW_USE_ADDR2LINE /** * Prints the position information of a memory operation point. When \c - * _DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this + * M_DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this * function will try to convert a given caller address to file/line * information with \e addr2line. * @@ -427,7 +427,7 @@ static void print_position(const void* ptr, int line) } } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK /** * Checks whether the padding bytes at the end of a memory block is * tampered with. @@ -440,9 +440,9 @@ static bool check_tail(new_ptr_list_t* ptr) { const unsigned char* const pointer = (unsigned char*)ptr + ALIGNED_LIST_ITEM_SIZE + ptr->size; - for (int i = 0; i < _DEBUG_NEW_TAILCHECK; ++i) + for (int i = 0; i < M_DEBUG_NEW_TAILCHECK; ++i) { - if (pointer[i] != _DEBUG_NEW_TAILCHECK_CHAR) + if (pointer[i] != M_DEBUG_NEW_TAILCHECK_CHAR) return false; } return true; @@ -462,14 +462,14 @@ static bool check_tail(new_ptr_list_t* ptr) static void* alloc_mem(size_t size, const char* file, int line, bool is_array) { assert(line >= 0); - STATIC_ASSERT((_DEBUG_NEW_ALIGNMENT & (_DEBUG_NEW_ALIGNMENT - 1)) == 0, + STATIC_ASSERT((M_DEBUG_NEW_ALIGNMENT & (M_DEBUG_NEW_ALIGNMENT - 1)) == 0, Alignment_must_be_power_of_two); - STATIC_ASSERT(_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); - size_t s = size + ALIGNED_LIST_ITEM_SIZE + _DEBUG_NEW_TAILCHECK; + STATIC_ASSERT(M_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); + size_t s = size + ALIGNED_LIST_ITEM_SIZE + M_DEBUG_NEW_TAILCHECK; new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s); if (ptr == NULL) { -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW return NULL; #else fast_mutex_autolock lock(new_output_lock); @@ -477,17 +477,17 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array) "Out of memory when allocating %u bytes\n", size); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; #endif } void* pointer = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 ptr->file = file; #else if (line) { - strncpy(ptr->file, file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; + strncpy(ptr->file, file, M_DEBUG_NEW_FILENAME_LEN - 1) + [M_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; } else { @@ -506,9 +506,9 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array) new_ptr_list.prev = ptr; } ptr->dumped = 0; -#if _DEBUG_NEW_TAILCHECK - memset((char*)pointer + size, _DEBUG_NEW_TAILCHECK_CHAR, - _DEBUG_NEW_TAILCHECK); +#if M_DEBUG_NEW_TAILCHECK + memset((char*)pointer + size, M_DEBUG_NEW_TAILCHECK_CHAR, + M_DEBUG_NEW_TAILCHECK); #endif if (new_verbose_flag) { @@ -552,7 +552,7 @@ static void free_pointer(void* pointer, void* addr, bool is_array) } check_mem_corruption(); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } if (is_array != ptr->is_array) { @@ -575,14 +575,14 @@ static void free_pointer(void* pointer, void* addr, bool is_array) print_position(ptr->addr, ptr->line); fprintf(new_output_fp, "\n"); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (!check_tail(ptr)) { check_mem_corruption(); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } #endif { @@ -630,7 +630,7 @@ int check_leaks() "warning: heap data corrupt near %p\n", pointer); } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (!check_tail(ptr)) { fprintf(new_output_fp, @@ -687,14 +687,14 @@ int check_mem_corruption() { const char* const pointer = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; if (ptr->magic == MAGIC -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK && check_tail(ptr) #endif ) { continue; } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (ptr->magic != MAGIC) { #endif @@ -702,7 +702,7 @@ int check_mem_corruption() "Heap data corrupt near %p (size %u, ", pointer, (unsigned)ptr->size); -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK } else { @@ -738,19 +738,19 @@ void __debug_new_recorder::_M_process(void* pointer) _M_file, _M_line); return; } -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 ptr->file = _M_file; #else - strncpy(ptr->file, _M_file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; + strncpy(ptr->file, _M_file, M_DEBUG_NEW_FILENAME_LEN - 1) + [M_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; #endif ptr->line = _M_line; } -void* operator new(size_t size, const char* file, int line) +void* operator new (size_t size, const char* file, int line) { void* ptr = alloc_mem(size, file, line, false); -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW if (ptr) return ptr; else @@ -760,10 +760,10 @@ void* operator new(size_t size, const char* file, int line) #endif } -void* operator new[](size_t size, const char* file, int line) +void* operator new [](size_t size, const char* file, int line) { void* ptr = alloc_mem(size, file, line, true); -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW if (ptr) return ptr; else @@ -773,40 +773,40 @@ void* operator new[](size_t size, const char* file, int line) #endif } -void* operator new(size_t size) throw(std::bad_alloc) +void* operator new (size_t size) throw(std::bad_alloc) { - return operator new(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + return operator new (size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } -void* operator new[](size_t size) throw(std::bad_alloc) +void* operator new [](size_t size) throw(std::bad_alloc) { - return operator new[](size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + return operator new [](size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } #if !defined(__BORLANDC__) || __BORLANDC__ > 0x551 -void* operator new(size_t size, const std::nothrow_t&) throw() +void* operator new (size_t size, const std::nothrow_t&) throw() { - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, false); + return alloc_mem(size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0, false); } -void* operator new[](size_t size, const std::nothrow_t&) throw() +void* operator new [](size_t size, const std::nothrow_t&) throw() { - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, true); + return alloc_mem(size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0, true); } #endif -void operator delete(void* pointer) throw() +void operator delete (void* pointer) throw() { - free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, false); + free_pointer(pointer, M_DEBUG_NEW_CALLER_ADDRESS, false); } void operator delete [](void* pointer) throw() { - free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, true); + free_pointer(pointer, M_DEBUG_NEW_CALLER_ADDRESS, true); } #if HAVE_PLACEMENT_DELETE -void operator delete(void* pointer, const char* file, int line) throw() +void operator delete (void* pointer, const char* file, int line) throw() { if (new_verbose_flag) { @@ -817,7 +817,7 @@ void operator delete(void* pointer, const char* file, int line) throw() print_position(file, line); fprintf(new_output_fp, ")\n"); } - operator delete(pointer); + operator delete (pointer); } void operator delete [](void* pointer, const char* file, int line) throw() @@ -834,14 +834,14 @@ void operator delete [](void* pointer, const char* file, int line) throw() operator delete [](pointer); } -void operator delete(void* pointer, const std::nothrow_t&) throw() +void operator delete (void* pointer, const std::nothrow_t&) throw() { - operator delete(pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + operator delete (pointer, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } void operator delete [](void* pointer, const std::nothrow_t&) throw() { - operator delete [](pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + operator delete [](pointer, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } #endif // HAVE_PLACEMENT_DELETE diff --git a/src/debug/debug_new.h b/src/debug/debug_new.h index 0e99b96a7..157f2648a 100644 --- a/src/debug/debug_new.h +++ b/src/debug/debug_new.h @@ -61,7 +61,7 @@ #endif /** - * @def _DEBUG_NEW_REDEFINE_NEW + * @def M_DEBUG_NEW_REDEFINE_NEW * * Macro to indicate whether redefinition of \c new is wanted. If one * wants to define one's own <code>operator new</code>, to call @@ -84,8 +84,8 @@ * # endif * @endcode */ -#ifndef _DEBUG_NEW_REDEFINE_NEW -#define _DEBUG_NEW_REDEFINE_NEW 1 +#ifndef M_DEBUG_NEW_REDEFINE_NEW +#define M_DEBUG_NEW_REDEFINE_NEW 1 #endif /* Prototypes */ @@ -114,16 +114,16 @@ extern const char* new_progname; // default to NULL; should be assigned argv[0] * @def DEBUG_NEW * * Macro to catch file/line information on allocation. If - * #_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; + * #M_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; * otherwise \c new will be defined to it, and one must use \c new * instead. */ #define DEBUG_NEW __debug_new_recorder(__FILE__, __LINE__) ->* new -# if _DEBUG_NEW_REDEFINE_NEW +# if M_DEBUG_NEW_REDEFINE_NEW # define new DEBUG_NEW # endif -# ifdef _DEBUG_NEW_EMULATE_MALLOC +# ifdef M_DEBUG_NEW_EMULATE_MALLOC # include <stdlib.h> # ifdef new # define malloc(s) ((void*)(new char[s])) diff --git a/src/defaults.cpp b/src/defaults.cpp index 1bce806ff..18b00dfb7 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -31,8 +31,6 @@ #include "debug.h" -using namespace Mana; - VariableData* createData(int defData) { return new IntData(defData); diff --git a/src/defaults.h b/src/defaults.h index 850e15d37..fc74f76c8 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -26,16 +26,16 @@ #include <string> #include "variabledata.h" -typedef std::map<std::string, Mana::VariableData*> DefaultsData; +typedef std::map<std::string, VariableData*> DefaultsData; -Mana::VariableData* createData(int defData); -Mana::VariableData* createData(double defData); -Mana::VariableData* createData(float defData); -Mana::VariableData* createData(const std::string &defData); -Mana::VariableData* createData(const char* defData); -Mana::VariableData* createData(bool defData); -Mana::DefaultsData* getConfigDefaults(); -Mana::DefaultsData* getBrandingDefaults(); -Mana::DefaultsData* getPathsDefaults(); +VariableData* createData(int defData); +VariableData* createData(double defData); +VariableData* createData(float defData); +VariableData* createData(const std::string &defData); +VariableData* createData(const char* defData); +VariableData* createData(bool defData); +DefaultsData* getConfigDefaults(); +DefaultsData* getBrandingDefaults(); +DefaultsData* getPathsDefaults(); #endif diff --git a/src/event.cpp b/src/event.cpp index 4f77967bc..a536bcaea 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -26,9 +26,6 @@ #include "debug.h" -namespace Mana -{ - ListenMap Event::mBindings; Event::~Event() @@ -142,5 +139,3 @@ void Event::unbind(Listener *listener, Channels channel) { mBindings[channel].erase(listener); } - -} diff --git a/src/event.h b/src/event.h index 61bf31e14..7dffaad21 100644 --- a/src/event.h +++ b/src/event.h @@ -26,10 +26,6 @@ #include <set> #include <string> - -namespace Mana -{ - enum Channels { CHANNEL_ACTORSPRITE = 0, @@ -115,9 +111,9 @@ typedef std::set<Listener *> ListenerSet; typedef std::map<Channels, ListenerSet > ListenMap; #define SERVER_NOTICE(message) { \ -Mana::Event event(Mana::EVENT_SERVERNOTICE); \ +Event event(EVENT_SERVERNOTICE); \ event.setString("message", message); \ -Mana::Event::trigger(Mana::CHANNEL_NOTICES, event); } +Event::trigger(CHANNEL_NOTICES, event); } class Event { @@ -172,6 +168,4 @@ class Event VariableMap mData; }; -} // namespace Mana - #endif diff --git a/src/game.cpp b/src/game.cpp index cd54f9c98..6adf62f12 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -175,7 +175,7 @@ const unsigned adjustDelay = 10; */ static void initEngines() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_ENGINESINITALIZING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZING)); actorSpriteManager = new ActorSpriteManager; commandHandler = new CommandHandler; @@ -187,7 +187,7 @@ static void initEngines() particleEngine = new Particle(nullptr); particleEngine->setupEngine(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_ENGINESINITALIZED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZED)); } /** @@ -195,7 +195,7 @@ static void initEngines() */ static void createGuiWindows() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADING)); if (setupWindow) setupWindow->clearWindowsForReset(); @@ -292,7 +292,7 @@ static void createGuiWindows() if (player_node) player_node->updateStatus(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADED)); } #define del_0(X) { delete X; X = nullptr; } @@ -302,7 +302,7 @@ static void createGuiWindows() */ static void destroyGuiWindows() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADING)); logger->setChatWindow(nullptr); if (whoIsOnline) @@ -345,7 +345,7 @@ static void destroyGuiWindows() del_0(killStats); del_0(didYouKnowWindow); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADED)); if (auctionManager && AuctionManager::getEnableAuctionBot()) auctionManager->reload(); @@ -416,7 +416,7 @@ Game::Game(): if (guildManager && GuildManager::getEnableGuildBot()) guildManager->requestGuildInfo(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_CONSTRUCTED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_CONSTRUCTED)); } Game::~Game() @@ -450,7 +450,7 @@ Game::~Game() mInstance = nullptr; - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_DESTRUCTED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_DESTRUCTED)); } static bool saveScreenshot() @@ -1843,9 +1843,9 @@ void Game::changeMap(const std::string &mapPath) if (mumbleManager) mumbleManager->setMap(mapPath); - Mana::Event event(EVENT_MAPLOADED); + Event event(EVENT_MAPLOADED); event.setString("mapPath", mapPath); - Mana::Event::trigger(CHANNEL_GAME, event); + Event::trigger(CHANNEL_GAME, event); } void Game::updateHistory(SDL_Event &event) diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 452d2420e..4fa608f35 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -159,7 +159,7 @@ ChatWindow::ChatWindow(): mGMLoaded(false) { listen(CHANNEL_NOTICES); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Chat"); @@ -866,19 +866,19 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) +void ChatWindow::processEvent(Channels channel, const Event &event) { - if (channel == Mana::CHANNEL_NOTICES) + if (channel == CHANNEL_NOTICES) { - if (event.getName() == Mana::EVENT_SERVERNOTICE && localChatTab) + if (event.getName() == EVENT_SERVERNOTICE && localChatTab) localChatTab->chatLog(event.getString("message"), BY_SERVER); } - else if (channel == Mana::CHANNEL_ATTRIBUTES) + else if (channel == CHANNEL_ATTRIBUTES) { if (!config.getBoolValue("showBattleEvents")) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -902,7 +902,7 @@ void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) break; }; } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { if (!config.getBoolValue("showJobExp")) return; diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 82e3d31f2..b3dce33fc 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -80,7 +80,7 @@ struct CHATLOG class ChatWindow : public Window, public gcn::ActionListener, public gcn::KeyListener, - public Mana::Listener + public Listener { public: /** @@ -190,7 +190,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); /** * Scrolls the chat window diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 23f1e6fcf..8c59d10eb 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -113,7 +113,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): setWindowName("Inventory"); } - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); @@ -585,10 +585,10 @@ void InventoryWindow::close() } } -void InventoryWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void InventoryWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 9d4be5afc..08456ba29 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -54,7 +54,7 @@ class InventoryWindow : public Window, public gcn::KeyListener, public gcn::SelectionListener, public InventoryListener, - public Mana::Listener + public Listener { public: /** @@ -126,7 +126,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateButtons(Item *item = nullptr); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 972c660ec..357a016f2 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -60,7 +60,7 @@ KillStats::KillStats(): setStickyButtonLock(true); setDefaultSize(250, 250, 350, 300); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); int xp(PlayerInfo::getAttribute(EXP)); int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED)); @@ -438,10 +438,10 @@ void KillStats::validateJacko() } } -void KillStats::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void KillStats::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == EXP || id == EXP_NEEDED) diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 8562e67a4..9773190de 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -33,7 +33,7 @@ class Label; class Button; -class KillStats : public Window, gcn::ActionListener, public Mana::Listener +class KillStats : public Window, gcn::ActionListener, public Listener { public: /** @@ -78,8 +78,8 @@ class KillStats : public Window, gcn::ActionListener, public Mana::Listener void addLog(std::string str); - void processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event); + void processEvent(Channels channel A_UNUSED, + const Event &event); private: void validateJacko(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index 00df97813..aaccd36c8 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -54,7 +54,7 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus", "ministatus.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); StatusWindow::updateHPBar(mHpBar); @@ -218,10 +218,10 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } } -void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void MiniStatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == HP || id == MAX_HP) @@ -235,7 +235,7 @@ void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, else if (id == MONEY) StatusWindow::updateMoneyBar(mMoneyBar); } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { StatusWindow::updateMPBar(mMpBar); StatusWindow::updateJobBar(mJobBar); diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index ca18e1b92..ba2cf7b2d 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -44,7 +44,7 @@ class TextPopup; */ class MiniStatusWindow : public Popup, public InventoryListener, - public Mana::Listener + public Listener { public: MiniStatusWindow(); @@ -60,7 +60,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 3fbec4f35..25403e544 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -126,7 +126,7 @@ StatusWindow::StatusWindow(): Window(player_node ? player_node->getName() : "?", false, nullptr, "status.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Status"); setupWindow->registerWindowForReset(this); @@ -277,14 +277,14 @@ StatusWindow::StatusWindow(): mLvlLabel->adjustSize(); } -void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void StatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { static bool blocked = false; if (blocked) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -343,7 +343,7 @@ void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, break; } } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { int id = event.getInt("id"); if (id == Net::getPlayerHandler()->getJobLocation()) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 8e110a354..7f6bd2d18 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -44,7 +44,7 @@ class VertContainer; */ class StatusWindow : public Window, public gcn::ActionListener, - public Mana::Listener + public Listener { public: /** @@ -52,7 +52,7 @@ class StatusWindow : public Window, */ StatusWindow(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void setPointsNeeded(int id, int needed); diff --git a/src/listener.cpp b/src/listener.cpp index ea125013f..fd04c9f00 100644 --- a/src/listener.cpp +++ b/src/listener.cpp @@ -25,9 +25,6 @@ #include "debug.h" -namespace Mana -{ - Listener::~Listener() { Event::remove(this); @@ -42,5 +39,3 @@ void Listener::ignore(Channels channel) { Event::unbind(this, channel); } - -} // namespace Mana diff --git a/src/listener.h b/src/listener.h index dc968672a..bb6e3d4b4 100644 --- a/src/listener.h +++ b/src/listener.h @@ -26,9 +26,6 @@ #include <string> -namespace Mana -{ - class Listener { public: @@ -41,6 +38,4 @@ class Listener virtual void processEvent(Channels channel, const Event &event) = 0; }; -} // namespace Mana - #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index bb0c087d5..3225bac8d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -139,7 +139,7 @@ LocalPlayer::LocalPlayer(int id, int subtype): mAttackRange = 0; - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); mLevel = 1; mAdvanced = true; @@ -1664,12 +1664,12 @@ void LocalPlayer::optionChanged(const std::string &value) mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); } -void LocalPlayer::processEvent(Mana::Channels channel, - const Mana::Event &event) +void LocalPlayer::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_ATTRIBUTES) + if (channel == CHANNEL_ATTRIBUTES) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -1692,7 +1692,7 @@ void LocalPlayer::processEvent(Mana::Channels channel, break; }; } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { if (!mShowJobExp) return; diff --git a/src/localplayer.h b/src/localplayer.h index a7ce3dd7f..bf65096b5 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -69,7 +69,7 @@ enum * The local player character. */ class LocalPlayer : public Being, public ActorSpriteListener, - public Mana::Listener + public Listener { public: /** @@ -387,7 +387,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, */ void optionChanged(const std::string &value); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); /** * set a following player. diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index b7566e271..6d021d6a9 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -43,20 +43,20 @@ GameHandler::GameHandler() { mCharID = 0; - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_GAME); } -void GameHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GameHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_GAME) + if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_ENGINESINITALIZED) + if (event.getName() == EVENT_ENGINESINITALIZED) { if (mMap != "") Game::instance()->changeMap(mMap); } - else if (event.getName() == Mana::EVENT_MAPLOADED) + else if (event.getName() == EVENT_MAPLOADED) { mapLoadedEvent(); } diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 248175617..59cb148c4 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -32,13 +32,13 @@ namespace Ea { -class GameHandler : public Net::GameHandler, public Mana::Listener +class GameHandler : public Net::GameHandler, public Listener { public: GameHandler(); - virtual void processEvent(Mana::Channels channel, - const Mana::Event &event); + virtual void processEvent(Channels channel, + const Event &event); virtual void who(); diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index 584faa368..d95c98d23 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -93,8 +93,8 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - listen(Mana::CHANNEL_CLIENT); - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_CLIENT); + listen(CHANNEL_GAME); } void GeneralHandler::load() @@ -176,10 +176,10 @@ void GeneralHandler::clearHandlers() clearNetworkHandlers(); } -void GeneralHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_CLIENT) + if (channel == CHANNEL_CLIENT) { int newState = event.getInt("newState"); @@ -195,9 +195,9 @@ void GeneralHandler::processEvent(Mana::Channels channel, Attributes::informItemDB(); } } - else if (channel == Mana::CHANNEL_GAME) + else if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) + if (event.getName() == EVENT_GUIWINDOWSLOADED) { inventoryWindow->setSplitAllowed(true); skillDialog->loadSkills("mana-skills.xml"); diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index fcb28c846..6ea5c7845 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -33,7 +33,7 @@ namespace ManaServ { -class GeneralHandler : public Net::GeneralHandler, public Mana::Listener +class GeneralHandler : public Net::GeneralHandler, public Listener { public: GeneralHandler(); @@ -50,7 +50,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener void clearHandlers(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index a666fa5f4..77c91e1dd 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -244,12 +244,12 @@ void GeneralHandler::clearHandlers() mNetwork->clearHandlers(); } -void GeneralHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_GAME) + if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) + if (event.getName() == EVENT_GUIWINDOWSLOADED) { if (inventoryWindow) inventoryWindow->setSplitAllowed(false); @@ -288,7 +288,7 @@ void GeneralHandler::processEvent(Mana::Channels channel, statusWindow->addAttribute(ATTACK_SPEED, _("Damage per sec."), false, ""); } - else if (event.getName() == Mana::EVENT_GUIWINDOWSUNLOADING) + else if (event.getName() == EVENT_GUIWINDOWSUNLOADING) { if (socialWindow) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index b250ddfd4..73f7a0e1b 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -34,7 +34,7 @@ namespace TmwAthena { class GeneralHandler : public MessageHandler, public Net::GeneralHandler, - public Mana::Listener + public Listener { public: GeneralHandler(); @@ -53,7 +53,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void reloadPartially(); diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 0b9d16de2..6dd7bdc06 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -59,11 +59,11 @@ int mLevelProgress = 0; void triggerAttr(int id, int old) { - Mana::Event event(Mana::EVENT_UPDATEATTRIBUTE); + Event event(EVENT_UPDATEATTRIBUTE); event.setInt("id", id); event.setInt("oldValue", old); event.setInt("newValue", mData.mAttributes.find(id)->second); - Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); + Event::trigger(CHANNEL_ATTRIBUTES, event); } void triggerStat(int id, const std::string &changed, int old1, int old2) @@ -72,7 +72,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) if (it == mData.mStats.end()) return; - Mana::Event event(Mana::EVENT_UPDATESTAT); + Event event(EVENT_UPDATESTAT); event.setInt("id", id); event.setInt("base", it->second.base); event.setInt("mod", it->second.mod); @@ -81,7 +81,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) event.setString("changed", changed); event.setInt("oldValue1", old1); event.setInt("oldValue2", old2); - Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); + Event::trigger(CHANNEL_ATTRIBUTES, event); } // --- Attributes ------------------------------------------------------------- @@ -280,9 +280,9 @@ void setTrading(bool trading) if (notify) { - Mana::Event event(Mana::EVENT_TRADING); + Event event(EVENT_TRADING); event.setInt("trading", trading); - Mana::Event::trigger(Mana::CHANNEL_STATUS, event); + Event::trigger(CHANNEL_STATUS, event); } } @@ -303,20 +303,20 @@ void updateAttrs() } } -class PlayerInfoListener : Mana::Listener +class PlayerInfoListener : Listener { public: PlayerInfoListener() { - listen(Mana::CHANNEL_CLIENT); - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_CLIENT); + listen(CHANNEL_GAME); } - void processEvent(Mana::Channels channel, const Mana::Event &event) + void processEvent(Channels channel, const Event &event) { - if (channel == Mana::CHANNEL_CLIENT) + if (channel == CHANNEL_CLIENT) { - if (event.getName() == Mana::EVENT_STATECHANGE) + if (event.getName() == EVENT_STATECHANGE) { int newState = event.getInt("newState"); @@ -330,9 +330,9 @@ public: } } } - else if (channel == Mana::CHANNEL_GAME) + else if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_DESTRUCTED) + if (event.getName() == EVENT_DESTRUCTED) { delete mInventory; mInventory = nullptr; diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index aba020261..d6c01af6d 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -93,7 +93,8 @@ void EmoteDB::load() spriteNode->xmlChildrenNode->content); currentSprite->sprite = AnimatedSprite::load(file, XML::getProperty(spriteNode, "variant", 0)); - currentSprite->name = XML::langProperty(spriteNode, "name", ""); + currentSprite->name = XML::langProperty( + spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) @@ -147,7 +148,8 @@ void EmoteDB::load() spriteNode->xmlChildrenNode->content); currentSprite->sprite = AnimatedSprite::load(file, XML::getProperty(spriteNode, "variant", 0)); - currentSprite->name = XML::langProperty(spriteNode, "name", ""); + currentSprite->name = XML::langProperty( + spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) diff --git a/src/variabledata.h b/src/variabledata.h index e5516bd9f..c306d43ed 100644 --- a/src/variabledata.h +++ b/src/variabledata.h @@ -24,9 +24,6 @@ #include <string> -namespace Mana -{ - class VariableData { public: @@ -109,6 +106,4 @@ class BoolData : public VariableData bool mData; }; -} // namespace Mana - #endif |