summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/db.c2
-rw-r--r--src/common/db.h4
-rw-r--r--src/common/ers.h14
-rw-r--r--src/common/memmgr.c22
-rw-r--r--src/common/memmgr.h2
-rw-r--r--src/common/mmo.h17
-rw-r--r--src/common/mutex.h4
-rw-r--r--src/common/showmsg.c2
-rw-r--r--src/common/socket.c14
-rw-r--r--src/common/sql.h4
-rw-r--r--src/common/sysinfo.c2
11 files changed, 47 insertions, 40 deletions
diff --git a/src/common/db.c b/src/common/db.c
index 361e212cb..ca9a70f7c 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -353,7 +353,7 @@ static struct db_stats {
};
#define DB_COUNTSTAT(token) do { if ((stats.token) != UINT32_MAX) ++(stats.token); } while(0)
#else /* !defined(DB_ENABLE_STATS) */
-#define DB_COUNTSTAT(token)
+#define DB_COUNTSTAT(token) (void)0
#endif /* !defined(DB_ENABLE_STATS) */
/* [Ind/Hercules] */
diff --git a/src/common/db.h b/src/common/db.h
index 205288f13..b73970947 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -1717,7 +1717,7 @@ HPShared struct db_interface *DB;
* @return negative if v1 is top, positive if v2 is top, 0 if equal.
*/
#define BHEAP_MINTOPCMP(v1, v2) \
- ( v1 == v2 ? 0 : v1 < v2 ? -1 : 1 )
+ ( (v1) == (v2) ? 0 : (v1) < (v2) ? -1 : 1 )
/**
* Generic comparator for a max-heap (maximum value at top).
@@ -1732,6 +1732,6 @@ HPShared struct db_interface *DB;
* @return negative if v1 is top, positive if v2 is top, 0 if equal.
*/
#define BHEAP_MAXTOPCMP(v1, v2) \
- ( v1 == v2 ? 0 : v1 > v2 ? -1 : 1 )
+ ( (v1) == (v2) ? 0 : (v1) > (v2) ? -1 : 1 )
#endif /* COMMON_DB_H */
diff --git a/src/common/ers.h b/src/common/ers.h
index 938882edd..1689345dc 100644
--- a/src/common/ers.h
+++ b/src/common/ers.h
@@ -148,15 +148,15 @@ typedef struct eri {
#ifdef DISABLE_ERS
// Use memory manager to allocate/free and disable other interface functions
-# define ers_alloc(obj,type) (type *)aMalloc(sizeof(type))
-# define ers_free(obj,entry) aFree(entry)
-# define ers_entry_size(obj) (size_t)0
-# define ers_destroy(obj)
-# define ers_chunk_size(obj,size)
+# define ers_alloc(obj,type) ((void)(obj), (type *)aMalloc(sizeof(type)))
+# define ers_free(obj,entry) ((void)(obj), aFree(entry))
+# define ers_entry_size(obj) ((void)(obj), (size_t)0)
+# define ers_destroy(obj) ((void)(obj), (void)0)
+# define ers_chunk_size(obj,size) ((void)(obj), (void)(size), (size_t)0)
// Disable the public functions
# define ers_new(size,name,options) NULL
-# define ers_report()
-# define ers_final()
+# define ers_report() (void)0
+# define ers_final() (void)0
#else /* not DISABLE_ERS */
// These defines should be used to allow the code to keep working whenever
// the system is disabled
diff --git a/src/common/memmgr.c b/src/common/memmgr.c
index 97991ceaa..93c23ff18 100644
--- a/src/common/memmgr.c
+++ b/src/common/memmgr.c
@@ -45,7 +45,7 @@ struct malloc_interface *iMalloc;
# define REALLOC(p,n,file,line,func) mwRealloc((p),(n),(file),(line))
# define STRDUP(p,file,line,func) mwStrdup((p),(file),(line))
# define FREE(p,file,line,func) mwFree((p),(file),(line))
-# define MEMORY_USAGE() (size_t)0
+# define MEMORY_USAGE() ((size_t)0)
# define MEMORY_VERIFY(ptr) mwIsSafeAddr((ptr), 1)
# define MEMORY_CHECK() CHECK()
@@ -67,21 +67,21 @@ struct malloc_interface *iMalloc;
# include <gc.h>
# ifdef GC_ADD_CALLER
-# define RETURN_ADDR 0,
+# define MALLOC(n,file,line,func) GC_debug_malloc((n), 0, (file), (line))
+# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), 0, (file), (line))
+# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), 0, (file), (line))
+# define STRDUP(p,file,line,func) GC_debug_strdup((p), 0, (file), (line))
# else
-# define RETURN_ADDR
+# define MALLOC(n,file,line,func) GC_debug_malloc((n), (file), (line))
+# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), (file), (line))
+# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), (file), (line))
+# define STRDUP(p,file,line,func) GC_debug_strdup((p), (file), (line))
# endif
-# define MALLOC(n,file,line,func) GC_debug_malloc((n), RETURN_ADDR (file),(line))
-# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), RETURN_ADDR (file),(line))
-# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), RETURN_ADDR (file),(line))
-# define STRDUP(p,file,line,func) GC_debug_strdup((p), RETURN_ADDR (file),(line))
# define FREE(p,file,line,func) GC_debug_free(p)
# define MEMORY_USAGE() GC_get_heap_size()
# define MEMORY_VERIFY(ptr) (GC_base(ptr) != NULL)
# define MEMORY_CHECK() GC_gcollect()
-# undef RETURN_ADDR
-
#else
# define MALLOC(n,file,line,func) malloc(n)
@@ -89,9 +89,9 @@ struct malloc_interface *iMalloc;
# define REALLOC(p,n,file,line,func) realloc((p),(n))
# define STRDUP(p,file,line,func) strdup(p)
# define FREE(p,file,line,func) free(p)
-# define MEMORY_USAGE() (size_t)0
+# define MEMORY_USAGE() ((size_t)0)
# define MEMORY_VERIFY(ptr) true
-# define MEMORY_CHECK()
+# define MEMORY_CHECK() (void)0
#endif
diff --git a/src/common/memmgr.h b/src/common/memmgr.h
index 4b06ae56e..5975f55c4 100644
--- a/src/common/memmgr.h
+++ b/src/common/memmgr.h
@@ -60,7 +60,7 @@
#ifdef __GNUC__ // GCC has variable length arrays
#define CREATE_BUFFER(name, type, size) type name[size]
-#define DELETE_BUFFER(name)
+#define DELETE_BUFFER(name) (void)0
#else // others don't, so we emulate them
diff --git a/src/common/mmo.h b/src/common/mmo.h
index eb1d7cc8e..37fc63e29 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -98,13 +98,19 @@
#endif // 20090603
#endif // 20070227
-/* Feb 1st 2012 */
-#if PACKETVER >= 20120201
-# define NEW_CARTS
-# define MAX_CARTS 9
+#if PACKETVER >= 20150805 /* Cart Decoration */
+ #define CART_DECORATION
+ #define MAX_CARTDECORATION_CARTS 3 // Currently there are 3 Carts available in kRO. [Frost]
#else
-# define MAX_CARTS 5
+ #define MAX_CARTDECORATION_CARTS 0
#endif
+#if PACKETVER >= 20120201 /* New Geneticist Carts */
+ #define NEW_CARTS
+ #define MAX_BASE_CARTS 9
+#else
+ #define MAX_BASE_CARTS 5
+#endif
+#define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS)
#define MAX_INVENTORY 100
//Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
@@ -262,6 +268,7 @@ struct item {
//Equip position constants
enum equip_pos {
+ EQP_NONE = 0x000000,
EQP_HEAD_LOW = 0x000001,
EQP_HEAD_MID = 0x000200, //512
EQP_HEAD_TOP = 0x000100, //256
diff --git a/src/common/mutex.h b/src/common/mutex.h
index 5127d9f4b..e49791493 100644
--- a/src/common/mutex.h
+++ b/src/common/mutex.h
@@ -32,7 +32,7 @@ typedef struct racond racond; // Condition Var
*
* @return not NULL
*/
-ramutex *ramutex_create();
+ramutex *ramutex_create(void);
/**
* Destroys a Mutex
@@ -70,7 +70,7 @@ void ramutex_unlock(ramutex *m);
*
* @return not NULL
*/
-racond *racond_create();
+racond *racond_create(void);
/**
* Destroy a Condition variable
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index e60b9f536..956222a7d 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -478,7 +478,7 @@ int FPRINTF(HANDLE handle, const char *fmt, ...) {
return ret;
}
-#define FFLUSH(handle)
+#define FFLUSH(handle) (void)(handle)
#define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
#define STDERR GetStdHandle(STD_ERROR_HANDLE)
diff --git a/src/common/socket.c b/src/common/socket.c
index f67c3d074..740c07bdc 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -76,11 +76,11 @@ struct socket_interface *sockt;
struct socket_data **session;
#ifdef SEND_SHORTLIST
- // Add a fd to the shortlist so that it'll be recognized as a fd that needs
- // sending done on it.
- void send_shortlist_add_fd(int fd);
- // Do pending network sends (and eof handling) from the shortlist.
- void send_shortlist_do_sends();
+// Add a fd to the shortlist so that it'll be recognized as a fd that needs
+// sending done on it.
+void send_shortlist_add_fd(int fd);
+// Do pending network sends (and eof handling) from the shortlist.
+void send_shortlist_do_sends(void);
#endif
/////////////////////////////////////////////////////////////////////
@@ -1103,7 +1103,7 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) {
clear++;
}
list++;
- }
+ }
dbi_destroy(iter);
if( access_debug ){
@@ -1570,7 +1570,7 @@ void send_shortlist_add_fd(int fd)
}
// Do pending network sends and eof handling from the shortlist.
-void send_shortlist_do_sends()
+void send_shortlist_do_sends(void)
{
int i;
diff --git a/src/common/sql.h b/src/common/sql.h
index 33643407d..e949a8280 100644
--- a/src/common/sql.h
+++ b/src/common/sql.h
@@ -272,13 +272,13 @@ void Sql_HerculesUpdateSkip(Sql* self,const char *filename);
HPShared struct sql_interface *SQL;
#if defined(SQL_REMOVE_SHOWDEBUG)
-#define Sql_ShowDebug(self) (void)0
+#define Sql_ShowDebug(self) (void)(self)
#else
#define Sql_ShowDebug(self) (SQL->ShowDebug_((self), __FILE__, __LINE__))
#endif
#if defined(SQL_REMOVE_SHOWDEBUG)
-#define SqlStmt_ShowDebug(self) (void)0
+#define SqlStmt_ShowDebug(self) (void)(self)
#else
/// Shows debug information (with statement).
#define SqlStmt_ShowDebug(self) (SQL->StmtShowDebug_((self), __FILE__, __LINE__))
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index dbedfa2db..7cc4cd16a 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -65,7 +65,7 @@ struct sysinfo_interface *sysinfo;
#define VCSTYPE_UNKNOWN 0
#define VCSTYPE_GIT 1
#define VCSTYPE_SVN 2
-#define VCSTYPE_NONE -1
+#define VCSTYPE_NONE (-1)
#ifdef WIN32
/**