summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.c44
-rw-r--r--src/char/char.h1
-rw-r--r--src/char/int_auction.c25
-rw-r--r--src/char/int_elemental.c22
-rw-r--r--src/char/int_elemental.h2
-rw-r--r--src/char/int_guild.c24
-rw-r--r--src/char/int_guild.h3
-rw-r--r--src/char/int_homun.c21
-rw-r--r--src/char/int_homun.h2
-rw-r--r--src/char/int_mail.c20
-rw-r--r--src/char/int_mail.h3
-rw-r--r--src/char/int_mercenary.c22
-rw-r--r--src/char/int_mercenary.h4
-rw-r--r--src/char/int_party.c25
-rw-r--r--src/char/int_party.h2
-rw-r--r--src/char/int_pet.c22
-rw-r--r--src/char/int_quest.c22
-rw-r--r--src/char/int_storage.c22
-rw-r--r--src/char/inter.c43
-rw-r--r--src/char/inter.h5
-rw-r--r--src/char/pincode.c11
-rw-r--r--src/common/HPM.c31
-rw-r--r--src/common/HPM.h6
-rw-r--r--src/common/HPMi.h16
-rw-r--r--src/common/cbasetypes.h6
-rw-r--r--src/common/conf.c3
-rw-r--r--src/common/conf.h1
-rw-r--r--src/common/console.c223
-rw-r--r--src/common/console.h21
-rw-r--r--src/common/core.c38
-rw-r--r--src/common/core.h3
-rw-r--r--src/common/db.c10
-rw-r--r--src/common/db.h3
-rw-r--r--src/common/des.c7
-rw-r--r--src/common/ers.c8
-rw-r--r--src/common/grfio.c17
-rw-r--r--src/common/malloc.c11
-rw-r--r--src/common/mapindex.c15
-rw-r--r--src/common/md5calc.c8
-rw-r--r--src/common/mmo.h6
-rw-r--r--src/common/mutex.c5
-rw-r--r--src/common/mutex.h1
-rw-r--r--src/common/nullpo.c6
-rw-r--r--src/common/random.c18
-rw-r--r--src/common/showmsg.c17
-rw-r--r--src/common/showmsg.h23
-rw-r--r--src/common/socket.c64
-rw-r--r--src/common/socket.h12
-rw-r--r--src/common/spinlock.h9
-rw-r--r--src/common/sql.c12
-rw-r--r--src/common/sql.h3
-rw-r--r--src/common/strlib.c13
-rw-r--r--src/common/strlib.h15
-rw-r--r--src/common/sysinfo.c32
-rw-r--r--src/common/sysinfo.h16
-rw-r--r--src/common/thread.c31
-rw-r--r--src/common/thread.h1
-rw-r--r--src/common/timer.c19
-rw-r--r--src/common/utils.c36
-rw-r--r--src/common/utils.h3
-rw-r--r--src/config/const.h7
-rw-r--r--src/config/renewal.h1
-rw-r--r--src/login/account.h1
-rw-r--r--src/login/account_sql.c17
-rw-r--r--src/login/ipban_sql.c14
-rw-r--r--src/login/login.c21
-rw-r--r--src/login/login.h2
-rw-r--r--src/login/loginlog.h2
-rw-r--r--src/login/loginlog_sql.c9
-rw-r--r--src/map/HPMmap.c42
-rw-r--r--src/map/atcommand.c67
-rw-r--r--src/map/atcommand.h2
-rw-r--r--src/map/battle.c61
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/battleground.c33
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/buyingstore.c17
-rw-r--r--src/map/buyingstore.h5
-rw-r--r--src/map/chat.c23
-rw-r--r--src/map/chat.h5
-rw-r--r--src/map/chrif.c35
-rw-r--r--src/map/chrif.h4
-rw-r--r--src/map/clif.c83
-rw-r--r--src/map/clif.h9
-rw-r--r--src/map/date.c6
-rw-r--r--src/map/date.h2
-rw-r--r--src/map/duel.c10
-rw-r--r--src/map/duel.h4
-rw-r--r--src/map/elemental.c54
-rw-r--r--src/map/elemental.h1
-rw-r--r--src/map/guild.c47
-rw-r--r--src/map/guild.h16
-rw-r--r--src/map/homunculus.c56
-rw-r--r--src/map/homunculus.h3
-rw-r--r--src/map/instance.c34
-rw-r--r--src/map/instance.h3
-rw-r--r--src/map/intif.c51
-rw-r--r--src/map/intif.h13
-rw-r--r--src/map/irc-bot.c22
-rw-r--r--src/map/irc-bot.h2
-rw-r--r--src/map/itemdb.c27
-rw-r--r--src/map/itemdb.h5
-rw-r--r--src/map/log.c23
-rw-r--r--src/map/log.h5
-rw-r--r--src/map/mail.c16
-rw-r--r--src/map/mail.h6
-rw-r--r--src/map/map.c96
-rw-r--r--src/map/map.h9
-rw-r--r--src/map/mapreg_sql.c14
-rw-r--r--src/map/mercenary.c54
-rw-r--r--src/map/mercenary.h1
-rw-r--r--src/map/mob.c69
-rw-r--r--src/map/mob.h9
-rw-r--r--src/map/npc.c57
-rw-r--r--src/map/npc.h4
-rw-r--r--src/map/npc_chat.c26
-rw-r--r--src/map/party.c43
-rw-r--r--src/map/party.h7
-rw-r--r--src/map/path.c17
-rw-r--r--src/map/path.h1
-rw-r--r--src/map/pc.c59
-rw-r--r--src/map/pc.h29
-rw-r--r--src/map/pc_groups.c14
-rw-r--r--src/map/pc_groups.h4
-rw-r--r--src/map/pet.c48
-rw-r--r--src/map/pet.h10
-rw-r--r--src/map/quest.c45
-rw-r--r--src/map/quest.h4
-rw-r--r--src/map/script.c79
-rw-r--r--src/map/script.h12
-rw-r--r--src/map/searchstore.c11
-rw-r--r--src/map/searchstore.h6
-rw-r--r--src/map/skill.c64
-rw-r--r--src/map/skill.h14
-rw-r--r--src/map/status.c59
-rw-r--r--src/map/status.h16
-rw-r--r--src/map/storage.c32
-rw-r--r--src/map/storage.h5
-rw-r--r--src/map/trade.c24
-rw-r--r--src/map/unit.c63
-rw-r--r--src/map/unit.h12
-rw-r--r--src/map/vending.c27
-rw-r--r--src/map/vending.h1
-rw-r--r--src/tool/mapcache.c14
144 files changed, 1367 insertions, 1676 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 6c0902644..77e393c0d 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2,30 +2,7 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // CONSOLE_INPUT
-#include "char.h"
-
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-
-#include "int_elemental.h"
-#include "int_guild.h"
-#include "int_homun.h"
-#include "int_mercenary.h"
-#include "int_party.h"
-#include "int_storage.h"
-#include "inter.h"
-#include "pincode.h"
-#include "../common/HPM.h"
#include "../common/cbasetypes.h"
-#include "../common/console.h"
#include "../common/core.h"
#include "../common/db.h"
#include "../common/malloc.h"
@@ -36,6 +13,25 @@
#include "../common/strlib.h"
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/console.h"
+#include "../common/HPM.h"
+#include "int_guild.h"
+#include "int_homun.h"
+#include "int_mercenary.h"
+#include "int_elemental.h"
+#include "int_party.h"
+#include "int_storage.h"
+#include "char.h"
+#include "inter.h"
+#include "pincode.h"
+
+#include <sys/types.h>
+#include <time.h>
+#include <signal.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
// private declarations
#define CHAR_CONF_NAME "conf/char-server.conf"
@@ -5501,7 +5497,7 @@ int do_init(int argc, char **argv) {
Sql_HerculesUpdateCheck(sql_handle);
#ifdef CONSOLE_INPUT
- console->input->setSQL(sql_handle);
+ console->setSQL(sql_handle);
#endif
ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port);
diff --git a/src/char/char.h b/src/char/char.h
index 09a78f6b9..2928929de 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -5,6 +5,7 @@
#ifndef _COMMON_CHAR_H_
#define _COMMON_CHAR_H_
+#include "../config/core.h"
#include "../common/core.h" // CORE_ST_LAST
#include "../common/db.h"
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index 886b5be26..924930867 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -2,25 +2,22 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_auction.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "int_mail.h"
-#include "inter.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/db.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
#include "../common/strlib.h"
+#include "../common/sql.h"
#include "../common/timer.h"
+#include "char.h"
+#include "inter.h"
+#include "int_mail.h"
+#include "int_auction.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
static DBMap* auction_db_ = NULL; // int auction_id -> struct auction_data*
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index 3a36e75a2..ed0c2a9ed 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_elemental.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
-#include "../common/strlib.h"
#include "../common/utils.h"
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
bool mapif_elemental_save(struct s_elemental* ele) {
bool flag = true;
diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h
index c869e6fc2..c90891fc4 100644
--- a/src/char/int_elemental.h
+++ b/src/char/int_elemental.h
@@ -4,7 +4,7 @@
#ifndef _CHAR_INT_ELEMENTAL_H_
#define _CHAR_INT_ELEMENTAL_H_
-#include "../common/cbasetypes.h"
+struct s_elemental;
void inter_elemental_sql_init(void);
void inter_elemental_sql_final(void);
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index ffbe48e10..895cbbb94 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -2,25 +2,21 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // DBPATH
-#include "int_guild.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
-#include "../common/showmsg.h"
+#include "../common/malloc.h"
#include "../common/socket.h"
+#include "../common/db.h"
+#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "char.h"
+#include "inter.h"
+#include "int_guild.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
#define GS_MEMBER_UNMODIFIED 0x00
#define GS_MEMBER_MODIFIED 0x01
diff --git a/src/char/int_guild.h b/src/char/int_guild.h
index 5e657ff06..4eb7d310b 100644
--- a/src/char/int_guild.h
+++ b/src/char/int_guild.h
@@ -20,6 +20,9 @@ enum {
GS_REMOVE = 0x8000,
};
+struct guild;
+struct guild_castle;
+
int inter_guild_parse_frommap(int fd);
int inter_guild_sql_init(void);
void inter_guild_sql_final(void);
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index 795a6b927..143277f05 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -2,23 +2,20 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_homun.h"
+#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/utils.h"
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/sql.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
int inter_homunculus_sql_init(void)
{
diff --git a/src/char/int_homun.h b/src/char/int_homun.h
index 9477f4f03..561dc848f 100644
--- a/src/char/int_homun.h
+++ b/src/char/int_homun.h
@@ -4,8 +4,6 @@
#ifndef _CHAR_INT_HOMUN_H_
#define _CHAR_INT_HOMUN_H_
-#include "../common/cbasetypes.h"
-
struct s_homunculus;
int inter_homunculus_sql_init(void);
diff --git a/src/char/int_mail.c b/src/char/int_mail.c
index 86a36d59f..826771676 100644
--- a/src/char/int_mail.c
+++ b/src/char/int_mail.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_mail.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
#include "../common/strlib.h"
+#include "../common/sql.h"
#include "../common/timer.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
static int mail_fromsql(int char_id, struct mail_data* md)
{
diff --git a/src/char/int_mail.h b/src/char/int_mail.h
index 824ba48a3..7c06cdc1f 100644
--- a/src/char/int_mail.h
+++ b/src/char/int_mail.h
@@ -4,9 +4,6 @@
#ifndef _CHAR_INT_MAIL_H_
#define _CHAR_INT_MAIL_H_
-struct item;
-struct mail_message;
-
int inter_mail_parse_frommap(int fd);
void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item);
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c
index 1dffb656c..aecb3844a 100644
--- a/src/char/int_mercenary.c
+++ b/src/char/int_mercenary.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_mercenary.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
-#include "../common/strlib.h"
#include "../common/utils.h"
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status)
{
diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h
index 195a83b34..b614b8cf7 100644
--- a/src/char/int_mercenary.h
+++ b/src/char/int_mercenary.h
@@ -4,9 +4,7 @@
#ifndef _CHAR_INT_MERCENARY_H_
#define _CHAR_INT_MERCENARY_H_
-#include "../common/cbasetypes.h"
-
-struct mmo_charstatus;
+struct s_mercenary;
int inter_mercenary_sql_init(void);
void inter_mercenary_sql_final(void);
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 3e4a743d6..7c328c452 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -2,25 +2,22 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_party.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
#include "../common/cbasetypes.h"
+#include "../common/mmo.h"
#include "../common/db.h"
#include "../common/malloc.h"
-#include "../common/mapindex.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
+#include "../common/strlib.h"
#include "../common/socket.h"
+#include "../common/showmsg.h"
+#include "../common/mapindex.h"
#include "../common/sql.h"
-#include "../common/strlib.h"
+#include "char.h"
+#include "inter.h"
+#include "int_party.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct party_data {
struct party party;
diff --git a/src/char/int_party.h b/src/char/int_party.h
index 098c1e9a9..84f00635a 100644
--- a/src/char/int_party.h
+++ b/src/char/int_party.h
@@ -14,6 +14,8 @@ enum {
PS_BREAK = 0x20, //Specify that this party must be deleted.
};
+struct party;
+
int inter_party_parse_frommap(int fd);
int inter_party_sql_init(void);
void inter_party_sql_final(void);
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 29c40eff9..25f00e6f0 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_pet.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
-#include "../common/showmsg.h"
+#include "../common/malloc.h"
#include "../common/socket.h"
-#include "../common/sql.h"
#include "../common/strlib.h"
+#include "../common/showmsg.h"
#include "../common/utils.h"
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct s_pet *pet_pt;
diff --git a/src/char/int_quest.c b/src/char/int_quest.c
index 61b43c57d..061dd89d9 100644
--- a/src/char/int_quest.c
+++ b/src/char/int_quest.c
@@ -2,25 +2,23 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "int_quest.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
+#include "../common/mmo.h"
#include "../common/db.h"
#include "../common/malloc.h"
-#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
#include "../common/strlib.h"
+#include "../common/sql.h"
#include "../common/timer.h"
+#include "char.h"
+#include "inter.h"
+#include "int_quest.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
/**
* Loads the entire questlog for a character.
*
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index bf7b76da0..966e61bb3 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // GP_BOUND_ITEMS
-#include "int_storage.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "char.h"
-#include "inter.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
#include "../common/strlib.h" // StringBuf
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
#define STORAGE_MEMINC 16
diff --git a/src/char/inter.c b/src/char/inter.c
index 972407ef3..515ca0ec4 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -2,34 +2,33 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/mmo.h"
+#include "../common/db.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "char.h"
#include "inter.h"
+#include "int_party.h"
+#include "int_guild.h"
+#include "int_storage.h"
+#include "int_pet.h"
+#include "int_homun.h"
+#include "int_mercenary.h"
+#include "int_mail.h"
+#include "int_auction.h"
+#include "int_quest.h"
+#include "int_elemental.h"
-#include <errno.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
#include <sys/stat.h> // for stat/lstat/fstat - [Dekamaster/Ultimate GM Tool]
-#include "char.h"
-#include "int_auction.h"
-#include "int_elemental.h"
-#include "int_guild.h"
-#include "int_homun.h"
-#include "int_mail.h"
-#include "int_mercenary.h"
-#include "int_party.h"
-#include "int_pet.h"
-#include "int_quest.h"
-#include "int_storage.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
#define WISDATA_TTL (60*1000) //Wis data Time To Live (60 seconds)
#define WISDELLIST_MAX 256 // Number of elements in the list Delete data Wis
diff --git a/src/char/inter.h b/src/char/inter.h
index 5e655237e..25b0c2a96 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -5,10 +5,9 @@
#ifndef _CHAR_INTER_H_
#define _CHAR_INTER_H_
-#include "char.h"
-#include "../common/sql.h"
-
struct accreg;
+#include "../common/sql.h"
+#include "char.h"
int inter_init_sql(const char *file);
void inter_final(void);
diff --git a/src/char/pincode.c b/src/char/pincode.c
index 59182f12d..d51953448 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -2,19 +2,16 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "pincode.h"
-
-#include <stdlib.h>
-
-#include "char.h"
#include "../common/cbasetypes.h"
#include "../common/mmo.h"
#include "../common/random.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/strlib.h"
+#include "char.h"
+#include "pincode.h"
+
+#include <stdlib.h>
int enabled = PINCODE_OK;
int changetime = 0;
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 00b92dc60..9ffce87de 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -1,31 +1,26 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
-#define HERCULES_CORE
-
-#include "../config/core.h" // CONSOLE_INPUT
-#include "HPM.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/console.h"
+#include "../common/mmo.h"
#include "../common/core.h"
#include "../common/malloc.h"
-#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
-#include "../common/sql.h"
-#include "../common/strlib.h"
-#include "../common/sysinfo.h"
#include "../common/timer.h"
+#include "../common/conf.h"
#include "../common/utils.h"
+#include "../common/console.h"
+#include "../common/strlib.h"
+#include "../common/sql.h"
+#include "../common/sysinfo.h"
+#include "HPM.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifndef WIN32
-# include <unistd.h>
+#include <unistd.h>
#endif
struct malloc_interface iMalloc_HPM;
@@ -691,7 +686,7 @@ bool hplugins_parse_conf(const char *w1, const char *w2, enum HPluginConfType po
void hplugins_share_defaults(void) {
/* console */
#ifdef CONSOLE_INPUT
- HPM->share(console->input->addCommand,"addCPCommand");
+ HPM->share(console->addCommand,"addCPCommand");
#endif
/* our own */
HPM->share(hplugins_addpacket,"addPacket");
@@ -760,7 +755,7 @@ void hpm_init(void) {
HPM->symbol_defaults();
#ifdef CONSOLE_INPUT
- console->input->addCommand("plugins",CPCMD_A(plugins));
+ console->addCommand("plugins",CPCMD_A(plugins));
#endif
return;
}
diff --git a/src/common/HPM.h b/src/common/HPM.h
index 9c176cfd6..0f0df4cda 100644
--- a/src/common/HPM.h
+++ b/src/common/HPM.h
@@ -4,12 +4,8 @@
#ifndef _COMMON_HPM_H_
#define _COMMON_HPM_H_
-#ifndef HERCULES_CORE
-#error You should never include HPM.h from a plugin.
-#endif
-
-#include "../common/HPMi.h"
#include "../common/cbasetypes.h"
+#include "../common/HPMi.h"
#ifdef WIN32
#ifndef WIN32_LEAN_AND_MEAN
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index b98e87d90..19206aeca 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -5,8 +5,8 @@
#define _COMMON_HPMI_H_
#include "../common/cbasetypes.h"
-#include "../common/console.h"
#include "../common/core.h"
+#include "../common/console.h"
#include "../common/sql.h"
struct script_state;
@@ -20,6 +20,18 @@ struct map_session_data;
#define HPExport
#endif
+#ifndef _COMMON_SHOWMSG_H_
+ HPExport void (*ShowMessage) (const char *, ...);
+ HPExport void (*ShowStatus) (const char *, ...);
+ HPExport void (*ShowSQL) (const char *, ...);
+ HPExport void (*ShowInfo) (const char *, ...);
+ HPExport void (*ShowNotice) (const char *, ...);
+ HPExport void (*ShowWarning) (const char *, ...);
+ HPExport void (*ShowDebug) (const char *, ...);
+ HPExport void (*ShowError) (const char *, ...);
+ HPExport void (*ShowFatalError) (const char *, ...);
+#endif
+
/* after */
#include "../common/showmsg.h"
@@ -180,7 +192,7 @@ HPExport struct HPMi_interface {
/* pc group permission */
void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask);
} HPMi_s;
-#ifndef HERCULES_CORE
+#ifndef _COMMON_HPM_H_
HPExport struct HPMi_interface *HPMi;
#endif
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index da0d6b307..f44e80413 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -442,11 +442,5 @@ void SET_FUNCPOINTER(T1& var, T2 p)
#define SET_FUNCPOINTER(var,p) ((var) = (p))
#endif
-/* pointer size fix which fixes several gcc warnings */
-#ifdef __64BIT__
- #define __64BPTRSIZE(y) ((intptr)(y))
-#else
- #define __64BPTRSIZE(y) (y)
-#endif
#endif /* _COMMON_CBASETYPES_H_ */
diff --git a/src/common/conf.c b/src/common/conf.c
index 46a034497..b816b2f7f 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -2,10 +2,7 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
#include "conf.h"
-
#include "../../3rdparty/libconfig/libconfig.h"
#include "../common/showmsg.h" // ShowError
diff --git a/src/common/conf.h b/src/common/conf.h
index e5b637e47..9aff3df47 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -6,7 +6,6 @@
#define _COMMON_CONF_H_
#include "../common/cbasetypes.h"
-
#include "../../3rdparty/libconfig/libconfig.h"
/**
diff --git a/src/common/console.c b/src/common/console.c
index 6a82db555..d8f352c8a 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -2,46 +2,42 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // CONSOLE_INPUT, MAX_CONSOLE_INPUT
-#include "console.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
#include "../common/cbasetypes.h"
-#include "../common/core.h"
#include "../common/showmsg.h"
+#include "../common/core.h"
#include "../common/sysinfo.h"
+#include "../config/core.h"
+#include "console.h"
#ifndef MINICORE
-# include "../common/atomic.h"
-# include "../common/ers.h"
-# include "../common/malloc.h"
-# include "../common/mutex.h"
-# include "../common/spinlock.h"
-# include "../common/sql.h"
-# include "../common/strlib.h"
-# include "../common/thread.h"
-# include "../common/timer.h"
+ #include "../common/ers.h"
+ #include "../common/malloc.h"
+ #include "../common/atomic.h"
+ #include "../common/spinlock.h"
+ #include "../common/thread.h"
+ #include "../common/mutex.h"
+ #include "../common/timer.h"
+ #include "../common/strlib.h"
+ #include "../common/sql.h"
#endif
+#include <stdio.h>
+#include <stdlib.h>
#if !defined(WIN32)
-# include <sys/time.h>
-# include <unistd.h>
+ #include <unistd.h>
+ #include <sys/time.h>
#else
-# include "../common/winapi.h" // Console close event handling
-# ifdef CONSOLE_INPUT
-# include <conio.h> /* _kbhit() */
-# endif
+ #include "../common/winapi.h" // Console close event handling
#endif
-struct console_interface console_s;
#ifdef CONSOLE_INPUT
-struct console_input_interface console_input_s;
+ #if defined(WIN32)
+ #include <conio.h> /* _kbhit() */
+ #endif
#endif
+struct console_interface console_s;
+
/*======================================
* CORE : Display title
*--------------------------------------*/
@@ -120,12 +116,12 @@ CPCMD_C(mem_report,server) {
**/
CPCMD(help) {
unsigned int i = 0;
- for ( i = 0; i < console->input->cmd_list_count; i++ ) {
- if( console->input->cmd_list[i]->next_count ) {
- ShowInfo("- '"CL_WHITE"%s"CL_RESET"' subs\n",console->input->cmd_list[i]->cmd);
- console->input->parse_list_subs(console->input->cmd_list[i],2);
+ for ( i = 0; i < console->cmd_list_count; i++ ) {
+ if( console->cmd_list[i]->next_count ) {
+ ShowInfo("- '"CL_WHITE"%s"CL_RESET"' subs\n",console->cmd_list[i]->cmd);
+ console->parse_list_subs(console->cmd_list[i],2);
} else {
- ShowInfo("- '"CL_WHITE"%s"CL_RESET"'\n",console->input->cmd_list[i]->cmd);
+ ShowInfo("- '"CL_WHITE"%s"CL_RESET"'\n",console->cmd_list[i]->cmd);
}
}
}
@@ -148,7 +144,7 @@ CPCMD_C(skip,update) {
ShowDebug("usage example: sql update skip 2013-02-14--16-15.sql\n");
return;
}
- Sql_HerculesUpdateSkip(console->input->SQL, line);
+ Sql_HerculesUpdateSkip(console->SQL, line);
}
/**
@@ -210,7 +206,7 @@ void console_load_defaults(void) {
unsigned int i, len = ARRAYLENGTH(default_list);
struct CParseEntry *cmd;
- RECREATE(console->input->cmds,struct CParseEntry *, len);
+ RECREATE(console->cmds,struct CParseEntry *, len);
for(i = 0; i < len; i++) {
CREATE(cmd, struct CParseEntry, 1);
@@ -224,12 +220,12 @@ void console_load_defaults(void) {
cmd->next_count = 0;
- console->input->cmd_count++;
- console->input->cmds[i] = cmd;
+ console->cmd_count++;
+ console->cmds[i] = cmd;
default_list[i].self = cmd;
if( !default_list[i].connect ) {
- RECREATE(console->input->cmd_list,struct CParseEntry *, ++console->input->cmd_list_count);
- console->input->cmd_list[console->input->cmd_list_count - 1] = cmd;
+ RECREATE(console->cmd_list,struct CParseEntry *, ++console->cmd_list_count);
+ console->cmd_list[console->cmd_list_count - 1] = cmd;
}
}
@@ -237,11 +233,11 @@ void console_load_defaults(void) {
unsigned int k;
if( !default_list[i].connect )
continue;
- for(k = 0; k < console->input->cmd_count; k++) {
- if( strcmpi(default_list[i].connect,console->input->cmds[k]->cmd) == 0 ) {
+ for(k = 0; k < console->cmd_count; k++) {
+ if( strcmpi(default_list[i].connect,console->cmds[k]->cmd) == 0 ) {
cmd = default_list[i].self;
- RECREATE(console->input->cmds[k]->u.next, struct CParseEntry *, ++console->input->cmds[k]->next_count);
- console->input->cmds[k]->u.next[console->input->cmds[k]->next_count - 1] = cmd;
+ RECREATE(console->cmds[k]->u.next, struct CParseEntry *, ++console->cmds[k]->next_count);
+ console->cmds[k]->u.next[console->cmds[k]->next_count - 1] = cmd;
break;
}
}
@@ -260,23 +256,23 @@ void console_parse_create(char *name, CParseFunc func) {
safestrncpy(sublist, name, CP_CMD_LENGTH * 5);
tok = strtok(sublist,":");
- for ( i = 0; i < console->input->cmd_list_count; i++ ) {
- if( strcmpi(tok,console->input->cmd_list[i]->cmd) == 0 )
+ for ( i = 0; i < console->cmd_list_count; i++ ) {
+ if( strcmpi(tok,console->cmd_list[i]->cmd) == 0 )
break;
}
- if( i == console->input->cmd_list_count ) {
- RECREATE(console->input->cmds,struct CParseEntry *, ++console->input->cmd_count);
+ if( i == console->cmd_list_count ) {
+ RECREATE(console->cmds,struct CParseEntry *, ++console->cmd_count);
CREATE(cmd, struct CParseEntry, 1);
safestrncpy(cmd->cmd, tok, CP_CMD_LENGTH);
cmd->next_count = 0;
- console->input->cmds[console->input->cmd_count - 1] = cmd;
- RECREATE(console->input->cmd_list,struct CParseEntry *, ++console->input->cmd_list_count);
- console->input->cmd_list[console->input->cmd_list_count - 1] = cmd;
- i = console->input->cmd_list_count - 1;
+ console->cmds[console->cmd_count - 1] = cmd;
+ RECREATE(console->cmd_list,struct CParseEntry *, ++console->cmd_list_count);
+ console->cmd_list[console->cmd_list_count - 1] = cmd;
+ i = console->cmd_list_count - 1;
}
- cmd = console->input->cmd_list[i];
+ cmd = console->cmd_list[i];
while( ( tok = strtok(NULL, ":") ) != NULL ) {
for(i = 0; i < cmd->next_count; i++) {
@@ -285,13 +281,13 @@ void console_parse_create(char *name, CParseFunc func) {
}
if ( i == cmd->next_count ) {
- RECREATE(console->input->cmds,struct CParseEntry *, ++console->input->cmd_count);
- CREATE(console->input->cmds[console->input->cmd_count-1], struct CParseEntry, 1);
- safestrncpy(console->input->cmds[console->input->cmd_count-1]->cmd, tok, CP_CMD_LENGTH);
- console->input->cmds[console->input->cmd_count-1]->next_count = 0;
+ RECREATE(console->cmds,struct CParseEntry *, ++console->cmd_count);
+ CREATE(console->cmds[console->cmd_count-1], struct CParseEntry, 1);
+ safestrncpy(console->cmds[console->cmd_count-1]->cmd, tok, CP_CMD_LENGTH);
+ console->cmds[console->cmd_count-1]->next_count = 0;
RECREATE(cmd->u.next, struct CParseEntry *, ++cmd->next_count);
- cmd->u.next[cmd->next_count - 1] = console->input->cmds[console->input->cmd_count-1];
- cmd = console->input->cmds[console->input->cmd_count-1];
+ cmd->u.next[cmd->next_count - 1] = console->cmds[console->cmd_count-1];
+ cmd = console->cmds[console->cmd_count-1];
continue;
}
@@ -306,7 +302,7 @@ void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) {
memset(msg, '-', depth);
snprintf(msg + depth,CP_CMD_LENGTH * 2, " '"CL_WHITE"%s"CL_RESET"'",cmd->u.next[i]->cmd);
ShowInfo("%s subs\n",msg);
- console->input->parse_list_subs(cmd->u.next[i],depth + 1);
+ console->parse_list_subs(cmd->u.next[i],depth + 1);
} else {
memset(msg, '-', depth);
snprintf(msg + depth,CP_CMD_LENGTH * 2, " %s",cmd->u.next[i]->cmd);
@@ -324,21 +320,21 @@ void console_parse_sub(char *line) {
memcpy(bline, line, 200);
tok = strtok(line, " ");
- for ( i = 0; i < console->input->cmd_list_count; i++ ) {
- if( strcmpi(tok,console->input->cmd_list[i]->cmd) == 0 )
+ for ( i = 0; i < console->cmd_list_count; i++ ) {
+ if( strcmpi(tok,console->cmd_list[i]->cmd) == 0 )
break;
}
- if( i == console->input->cmd_list_count ) {
+ if( i == console->cmd_list_count ) {
ShowError("'"CL_WHITE"%s"CL_RESET"' is not a known command, type '"CL_WHITE"help"CL_RESET"' to list all commands\n",line);
return;
}
- cmd = console->input->cmd_list[i];
+ cmd = console->cmd_list[i];
len += snprintf(sublist,CP_CMD_LENGTH * 5,"%s", cmd->cmd) + 1;
- if( cmd->next_count == 0 && console->input->cmd_list[i]->u.func ) {
+ if( cmd->next_count == 0 && console->cmd_list[i]->u.func ) {
char *r = NULL;
if( (tok = strtok(NULL, " ")) ) {
r = bline;
@@ -355,7 +351,7 @@ void console_parse_sub(char *line) {
if( strcmpi("help",tok) == 0 ) {
if( cmd->next_count ) {
ShowInfo("- '"CL_WHITE"%s"CL_RESET"' subs\n",sublist);
- console->input->parse_list_subs(cmd,2);
+ console->parse_list_subs(cmd,2);
} else {
ShowError("'"CL_WHITE"%s"CL_RESET"' doesn't possess any subcommands\n",sublist);
}
@@ -396,95 +392,95 @@ void console_parse(char* line) {
}
void *cThread_main(void *x) {
- while( console->input->ptstate ) {/* loopx */
- if( console->input->key_pressed() ) {
+ while( console->ptstate ) {/* loopx */
+ if( console->key_pressed() ) {
char input[MAX_CONSOLE_INPUT];
- console->input->parse(input);
+ console->parse(input);
if( input[0] != '\0' ) {/* did we get something? */
- EnterSpinLock(&console->input->ptlock);
+ EnterSpinLock(&console->ptlock);
if( cinput.count == CONSOLE_PARSE_SIZE ) {
- LeaveSpinLock(&console->input->ptlock);
+ LeaveSpinLock(&console->ptlock);
continue;/* drop */
}
safestrncpy(cinput.queue[cinput.count++],input,MAX_CONSOLE_INPUT);
- LeaveSpinLock(&console->input->ptlock);
+ LeaveSpinLock(&console->ptlock);
}
}
- ramutex_lock( console->input->ptmutex );
- racond_wait( console->input->ptcond, console->input->ptmutex, -1 );
- ramutex_unlock( console->input->ptmutex );
+ ramutex_lock( console->ptmutex );
+ racond_wait( console->ptcond, console->ptmutex, -1 );
+ ramutex_unlock( console->ptmutex );
}
return NULL;
}
int console_parse_timer(int tid, int64 tick, int id, intptr_t data) {
int i;
- EnterSpinLock(&console->input->ptlock);
+ EnterSpinLock(&console->ptlock);
for(i = 0; i < cinput.count; i++) {
- console->input->parse_sub(cinput.queue[i]);
+ console->parse_sub(cinput.queue[i]);
}
cinput.count = 0;
- LeaveSpinLock(&console->input->ptlock);
- racond_signal(console->input->ptcond);
+ LeaveSpinLock(&console->ptlock);
+ racond_signal(console->ptcond);
return 0;
}
void console_parse_final(void) {
- if( console->input->ptstate ) {
- InterlockedDecrement(&console->input->ptstate);
- racond_signal(console->input->ptcond);
+ if( console->ptstate ) {
+ InterlockedDecrement(&console->ptstate);
+ racond_signal(console->ptcond);
/* wait for thread to close */
- rathread_wait(console->input->pthread, NULL);
+ rathread_wait(console->pthread, NULL);
- racond_destroy(console->input->ptcond);
- ramutex_destroy(console->input->ptmutex);
+ racond_destroy(console->ptcond);
+ ramutex_destroy(console->ptmutex);
}
}
void console_parse_init(void) {
cinput.count = 0;
- console->input->ptstate = 1;
+ console->ptstate = 1;
- InitializeSpinLock(&console->input->ptlock);
+ InitializeSpinLock(&console->ptlock);
- console->input->ptmutex = ramutex_create();
- console->input->ptcond = racond_create();
+ console->ptmutex = ramutex_create();
+ console->ptcond = racond_create();
- if( (console->input->pthread = rathread_create(console->input->pthread_main, NULL)) == NULL ){
+ if( (console->pthread = rathread_create(console->pthread_main, NULL)) == NULL ){
ShowFatalError("console_parse_init: failed to spawn console_parse thread.\n");
exit(EXIT_FAILURE);
}
- timer->add_func_list(console->input->parse_timer, "console_parse_timer");
- timer->add_interval(timer->gettick() + 1000, console->input->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
+ timer->add_func_list(console->parse_timer, "console_parse_timer");
+ timer->add_interval(timer->gettick() + 1000, console->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
}
void console_setSQL(Sql *SQL_handle) {
- console->input->SQL = SQL_handle;
+ console->SQL = SQL_handle;
}
#endif /* CONSOLE_INPUT */
void console_init (void) {
#ifdef CONSOLE_INPUT
- console->input->cmd_count = console->input->cmd_list_count = 0;
- console->input->load_defaults();
- console->input->parse_init();
+ console->cmd_count = console->cmd_list_count = 0;
+ console->load_defaults();
+ console->parse_init();
#endif
}
void console_final(void) {
#ifdef CONSOLE_INPUT
unsigned int i;
- console->input->parse_final();
- for( i = 0; i < console->input->cmd_count; i++ ) {
- if( console->input->cmds[i]->next_count )
- aFree(console->input->cmds[i]->u.next);
- aFree(console->input->cmds[i]);
+ console->parse_final();
+ for( i = 0; i < console->cmd_count; i++ ) {
+ if( console->cmds[i]->next_count )
+ aFree(console->cmds[i]->u.next);
+ aFree(console->cmds[i]);
}
- aFree(console->input->cmds);
- aFree(console->input->cmd_list);
+ aFree(console->cmds);
+ aFree(console->cmd_list);
#endif
}
void console_defaults(void) {
@@ -493,20 +489,17 @@ void console_defaults(void) {
console->final = console_final;
console->display_title = display_title;
#ifdef CONSOLE_INPUT
- console->input = &console_input_s;
- console->input->parse_init = console_parse_init;
- console->input->parse_final = console_parse_final;
- console->input->parse_timer = console_parse_timer;
- console->input->pthread_main = cThread_main;
- console->input->parse = console_parse;
- console->input->parse_sub = console_parse_sub;
- console->input->key_pressed = console_parse_key_pressed;
- console->input->load_defaults = console_load_defaults;
- console->input->parse_list_subs = console_parse_list_subs;
- console->input->addCommand = console_parse_create;
- console->input->setSQL = console_setSQL;
- console->input->SQL = NULL;
-#else
- console->input = NULL;
+ console->parse_init = console_parse_init;
+ console->parse_final = console_parse_final;
+ console->parse_timer = console_parse_timer;
+ console->pthread_main = cThread_main;
+ console->parse = console_parse;
+ console->parse_sub = console_parse_sub;
+ console->key_pressed = console_parse_key_pressed;
+ console->load_defaults = console_load_defaults;
+ console->parse_list_subs = console_parse_list_subs;
+ console->addCommand = console_parse_create;
+ console->setSQL = console_setSQL;
+ console->SQL = NULL;
#endif
}
diff --git a/src/common/console.h b/src/common/console.h
index d2c58f978..3d19ddc9d 100644
--- a/src/common/console.h
+++ b/src/common/console.h
@@ -4,13 +4,11 @@
#ifndef _COMMON_CONSOLE_H_
#define _COMMON_CONSOLE_H_
-#include "../config/core.h" // MAX_CONSOLE_INPUT
-
-#include "../common/cbasetypes.h"
+#include "../common/thread.h"
#include "../common/mutex.h"
#include "../common/spinlock.h"
#include "../common/sql.h"
-#include "../common/thread.h"
+#include "../config/core.h"
/**
* Queue Max
@@ -49,8 +47,11 @@ struct {
unsigned short count;
} cinput;
+struct console_interface {
+ void (*init) (void);
+ void (*final) (void);
+ void (*display_title) (void);
#ifdef CONSOLE_INPUT
-struct console_input_interface {
/* vars */
SPIN_LOCK ptlock;/* parse thread lock */
rAthread pthread;/* parse thread */
@@ -76,17 +77,7 @@ struct console_input_interface {
void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth);
void (*addCommand) (char *name, CParseFunc func);
void (*setSQL) (Sql *SQL_handle);
-};
-#else
-struct console_input_interface;
#endif
-
-struct console_interface {
- void (*init) (void);
- void (*final) (void);
- void (*display_title) (void);
-
- struct console_input_interface *input;
};
struct console_interface *console;
diff --git a/src/common/core.c b/src/common/core.c
index 85f824866..49b272488 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -2,40 +2,36 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h"
-#include "core.h"
-
-#include "../common/cbasetypes.h"
-#include "../common/console.h"
-#include "../common/malloc.h"
#include "../common/mmo.h"
-#include "../common/random.h"
#include "../common/showmsg.h"
+#include "../common/malloc.h"
#include "../common/strlib.h"
+#include "core.h"
+#include "../common/console.h"
+#include "../common/random.h"
#include "../common/sysinfo.h"
#ifndef MINICORE
-# include "../common/HPM.h"
-# include "../common/conf.h"
-# include "../common/db.h"
-# include "../common/ers.h"
-# include "../common/socket.h"
-# include "../common/sql.h"
-# include "../common/thread.h"
-# include "../common/timer.h"
-# include "../common/utils.h"
+ #include "../common/db.h"
+ #include "../common/socket.h"
+ #include "../common/timer.h"
+ #include "../common/thread.h"
+ #include "../common/sql.h"
+ #include "../config/core.h"
+ #include "../common/HPM.h"
+ #include "../common/utils.h"
+ #include "../common/conf.h"
+ #include "../common/ers.h"
#endif
-#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
#include <string.h>
#ifndef _WIN32
-# include <unistd.h>
+#include <unistd.h>
#else
-# include "../common/winapi.h" // Console close event handling
+#include "../common/winapi.h" // Console close event handling
#endif
/// Called when a terminate signal is received.
diff --git a/src/common/core.h b/src/common/core.h
index ba75e6b01..e9f7c5961 100644
--- a/src/common/core.h
+++ b/src/common/core.h
@@ -7,10 +7,11 @@
#include "../common/db.h"
#include "../common/mmo.h"
+#include "../config/core.h"
/* so that developers with --enable-debug can raise signals from any section of the code they'd like */
#ifdef DEBUG
-# include <signal.h>
+ #include <signal.h>
#endif
extern int arg_c;
diff --git a/src/common/db.c b/src/common/db.c
index 1781aa96f..8d6b08815 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -67,18 +67,14 @@
* @encoding US-ASCII
* @see #db.h
\*****************************************************************************/
-
-#define HERCULES_CORE
-
-#include "db.h"
-
#include <stdio.h>
#include <stdlib.h>
-#include "../common/ers.h"
-#include "../common/malloc.h"
+#include "db.h"
#include "../common/mmo.h"
+#include "../common/malloc.h"
#include "../common/showmsg.h"
+#include "../common/ers.h"
#include "../common/strlib.h"
/*****************************************************************************\
diff --git a/src/common/db.h b/src/common/db.h
index 0d2548806..67abe6f19 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -42,9 +42,8 @@
#ifndef _COMMON_DB_H_
#define _COMMON_DB_H_
-#include <stdarg.h>
-
#include "../common/cbasetypes.h"
+#include <stdarg.h>
/*****************************************************************************\
* (1) Section with public typedefs, enums, unions, structures and defines. *
diff --git a/src/common/des.c b/src/common/des.c
index 7f952be76..ed6d098dc 100644
--- a/src/common/des.c
+++ b/src/common/des.c
@@ -1,11 +1,8 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-
-#define HERCULES_CORE
-
-#include "des.h"
-
#include "../common/cbasetypes.h"
+#include "../common/des.h"
+
/// DES (Data Encryption Standard) algorithm, modified version.
/// @see http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=5099.
diff --git a/src/common/ers.c b/src/common/ers.c
index d9895e4f2..5a3d7314a 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -39,18 +39,14 @@
* @encoding US-ASCII *
* @see common#ers.h *
\*****************************************************************************/
-
-#define HERCULES_CORE
-
-#include "ers.h"
-
#include <stdlib.h>
#include <string.h>
#include "../common/cbasetypes.h"
#include "../common/malloc.h" // CREATE, RECREATE, aMalloc, aFree
-#include "../common/nullpo.h"
#include "../common/showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL
+#include "../common/nullpo.h"
+#include "ers.h"
#ifndef DISABLE_ERS
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 1111fb3f3..bde0ed720 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -2,8 +2,13 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/cbasetypes.h"
+#include "../common/des.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/nullpo.h"
#include "grfio.h"
#include <stdio.h>
@@ -12,14 +17,6 @@
#include <sys/stat.h>
#include <zlib.h>
-#include "../common/cbasetypes.h"
-#include "../common/des.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
-
//----------------------------
// file entry table struct
//----------------------------
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 13cf0b5ce..5b39cbab6 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -2,19 +2,16 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "malloc.h"
+#include "../common/malloc.h"
+#include "../common/core.h"
+#include "../common/showmsg.h"
+#include "../common/sysinfo.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "../common/core.h"
-#include "../common/showmsg.h"
-#include "../common/sysinfo.h"
-
struct malloc_interface iMalloc_s;
////////////// Memory Libraries //////////////////
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 5c69c7063..3128a3cb0 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -2,19 +2,16 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/mmo.h"
+#include "../common/showmsg.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
+#include "../common/db.h"
#include "mapindex.h"
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
/* mapindex.c interface source */
struct mapindex_interface mapindex_s;
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index e7b506e27..05fde42cc 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -6,15 +6,11 @@
*
***********************************************************/
-#define HERCULES_CORE
-
+#include "../common/random.h"
#include "md5calc.h"
-
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-
-#include "../common/random.h"
#ifndef UINT_MAX
#define UINT_MAX 4294967295U
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 1d826463e..d535d2874 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -5,10 +5,9 @@
#ifndef _COMMON_MMO_H_
#define _COMMON_MMO_H_
-#include <time.h>
-
-#include "../common/cbasetypes.h"
+#include "cbasetypes.h"
#include "../common/db.h"
+#include <time.h>
// server->client protocol version
// 0 - pre-?
@@ -97,7 +96,6 @@
//Official Limit: 2.1b ( the var that stores the money doesn't go much higher than this by default )
#define MAX_BANK_ZENY 2100000000
-#define MAX_LEVEL 175
#define MAX_FAME 1000000000
#define MAX_CART 100
#define MAX_SKILL 1478
diff --git a/src/common/mutex.c b/src/common/mutex.c
index 12524c3b7..0668dbc41 100644
--- a/src/common/mutex.c
+++ b/src/common/mutex.c
@@ -1,10 +1,6 @@
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
-#include "mutex.h"
-
#ifdef WIN32
#include "../common/winapi.h"
#else
@@ -17,6 +13,7 @@
#include "../common/malloc.h"
#include "../common/showmsg.h"
#include "../common/timer.h"
+#include "../common/mutex.h"
struct ramutex{
#ifdef WIN32
diff --git a/src/common/mutex.h b/src/common/mutex.h
index 3b83b66d6..eeb24e6ff 100644
--- a/src/common/mutex.h
+++ b/src/common/mutex.h
@@ -4,7 +4,6 @@
#ifndef _COMMON_MUTEX_H_
#define _COMMON_MUTEX_H_
-#include "../common/cbasetypes.h"
typedef struct ramutex *ramutex; // Mutex
typedef struct racond *racond; // Condition Var
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index 1891835f1..1cb471aff 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -2,14 +2,10 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "nullpo.h"
-
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-
+#include "../common/nullpo.h"
#include "../common/showmsg.h"
/**
diff --git a/src/common/random.c b/src/common/random.c
index 7019a31f3..e46c52cad 100644
--- a/src/common/random.c
+++ b/src/common/random.c
@@ -1,23 +1,17 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
-#include "random.h"
-
-#include <time.h> // time
-
-#include <mt19937ar.h> // init_genrand, genrand_int32, genrand_res53
-
#include "../common/showmsg.h"
#include "../common/timer.h" // gettick
-
+#include "random.h"
#if defined(WIN32)
-# include "../common/winapi.h"
+ #include "../common/winapi.h"
#elif defined(HAVE_GETPID) || defined(HAVE_GETTID)
-# include <sys/types.h>
-# include <unistd.h>
+ #include <sys/types.h>
+ #include <unistd.h>
#endif
+#include <time.h> // time
+#include <mt19937ar.h> // init_genrand, genrand_int32, genrand_res53
/// Initializes the random number generator with an appropriate seed.
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index 1dbcba282..14342fe5e 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -2,26 +2,23 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/cbasetypes.h"
+#include "../common/strlib.h" // StringBuf
#include "showmsg.h"
+#include "core.h" //[Ind] - For SERVER_TYPE
-#include <stdarg.h>
#include <stdio.h>
-#include <stdlib.h> // atexit
#include <string.h>
+#include <stdarg.h>
#include <time.h>
+#include <stdlib.h> // atexit
#include "../../3rdparty/libconfig/libconfig.h"
-#include "../common/cbasetypes.h"
-#include "../common/core.h" //[Ind] - For SERVER_TYPE
-#include "../common/strlib.h" // StringBuf
-
#ifdef WIN32
-# include "../common/winapi.h"
+#include "../common/winapi.h"
#else // not WIN32
-# include <unistd.h>
+#include <unistd.h>
#endif // WIN32
#if defined(DEBUGLOGMAP)
diff --git a/src/common/showmsg.h b/src/common/showmsg.h
index 5b32f39ae..49fbc34fb 100644
--- a/src/common/showmsg.h
+++ b/src/common/showmsg.h
@@ -5,14 +5,12 @@
#ifndef _COMMON_SHOWMSG_H_
#define _COMMON_SHOWMSG_H_
-#include <stdarg.h>
-
-#ifdef HERCULES_CORE
-# include "../../3rdparty/libconfig/libconfig.h"
-#else
-# include "../common/HPMi.h"
+#ifndef _COMMON_HPMI_H_
+ #include "../../3rdparty/libconfig/libconfig.h"
#endif
+#include <stdarg.h>
+
// for help with the console colors look here:
// http://www.edoceo.com/liberum/?doc=printf-with-color
// some code explanation (used here):
@@ -92,7 +90,7 @@ enum msg_type {
};
extern void ClearScreen(void);
-#ifdef HERCULES_CORE
+#ifndef _COMMON_HPMI_H_
extern void ShowMessage(const char *, ...);
extern void ShowStatus(const char *, ...);
extern void ShowSQL(const char *, ...);
@@ -103,18 +101,7 @@ extern void ClearScreen(void);
extern void ShowError(const char *, ...);
extern void ShowFatalError(const char *, ...);
extern void ShowConfigWarning(config_setting_t *config, const char *string, ...);
-#else
- HPExport void (*ShowMessage) (const char *, ...);
- HPExport void (*ShowStatus) (const char *, ...);
- HPExport void (*ShowSQL) (const char *, ...);
- HPExport void (*ShowInfo) (const char *, ...);
- HPExport void (*ShowNotice) (const char *, ...);
- HPExport void (*ShowWarning) (const char *, ...);
- HPExport void (*ShowDebug) (const char *, ...);
- HPExport void (*ShowError) (const char *, ...);
- HPExport void (*ShowFatalError) (const char *, ...);
#endif
-
extern int _vShowMessage(enum msg_type flag, const char *string, va_list ap);
#endif /* _COMMON_SHOWMSG_H_ */
diff --git a/src/common/socket.c b/src/common/socket.c
index 3738f2c2a..35d350e95 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -2,50 +2,48 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/mmo.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../config/core.h"
+#include "../common/HPM.h"
-#include "../config/core.h" // SHOW_SERVER_STATS
#define _H_SOCKET_C_
+
#include "socket.h"
-#undef _H_SOCKET_C_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-
#ifdef WIN32
-# include "../common/winapi.h"
+ #include "../common/winapi.h"
#else
-# include <arpa/inet.h>
-# include <errno.h>
-# include <net/if.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <sys/ioctl.h>
-# include <sys/socket.h>
-# include <sys/time.h>
-# include <unistd.h>
-
-# ifndef SIOCGIFCONF
-# include <sys/sockio.h> // SIOCGIFCONF on Solaris, maybe others? [Shinomori]
-# endif
-# ifndef FIONBIO
-# include <sys/filio.h> // FIONBIO on Solaris [FlavioJS]
-# endif
-
-# ifdef HAVE_SETRLIMIT
-# include <sys/resource.h>
-# endif
+ #include <errno.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <net/if.h>
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+ #include <netdb.h>
+ #include <arpa/inet.h>
+
+ #ifndef SIOCGIFCONF
+ #include <sys/sockio.h> // SIOCGIFCONF on Solaris, maybe others? [Shinomori]
+ #endif
+ #ifndef FIONBIO
+ #include <sys/filio.h> // FIONBIO on Solaris [FlavioJS]
+ #endif
+
+ #ifdef HAVE_SETRLIMIT
+ #include <sys/resource.h>
+ #endif
#endif
/**
diff --git a/src/common/socket.h b/src/common/socket.h
index 804b9284f..75adde4cf 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -5,19 +5,19 @@
#ifndef _COMMON_SOCKET_H_
#define _COMMON_SOCKET_H_
-#include <time.h>
-
#include "../common/cbasetypes.h"
#ifdef WIN32
-# include "../common/winapi.h"
+ #include "../common/winapi.h"
typedef long in_addr_t;
#else
-# include <netinet/in.h>
-# include <sys/socket.h>
-# include <sys/types.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
#endif
+#include <time.h>
+
struct HPluginData;
#define FIFOSIZE_SERVERLINK 256*1024
diff --git a/src/common/spinlock.h b/src/common/spinlock.h
index 0058e1d83..29fbb355b 100644
--- a/src/common/spinlock.h
+++ b/src/common/spinlock.h
@@ -1,3 +1,4 @@
+#pragma once
#ifndef _COMMON_SPINLOCK_H_
#define _COMMON_SPINLOCK_H_
@@ -14,14 +15,14 @@
//
//
-#include "../common/atomic.h"
-#include "../common/cbasetypes.h"
-#include "../common/thread.h"
-
#ifdef WIN32
#include "../common/winapi.h"
#endif
+#include "../common/cbasetypes.h"
+#include "../common/atomic.h"
+#include "../common/thread.h"
+
#ifdef WIN32
typedef struct __declspec( align(64) ) SPIN_LOCK{
diff --git a/src/common/sql.c b/src/common/sql.c
index aeb56bff0..79ccc8e92 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -2,23 +2,19 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "sql.h"
-
-#include <stdlib.h> // strtoul
-#include <string.h> // strlen/strnlen/memcpy/memset
-
#include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "sql.h"
#ifdef WIN32
-# include "../common/winapi.h" // Needed before mysql.h
+#include "../common/winapi.h"
#endif
#include <mysql.h>
+#include <string.h>// strlen/strnlen/memcpy/memset
+#include <stdlib.h>// strtoul
void hercules_mysql_error_handler(unsigned int ecode);
diff --git a/src/common/sql.h b/src/common/sql.h
index 807e0843c..1fb436853 100644
--- a/src/common/sql.h
+++ b/src/common/sql.h
@@ -5,9 +5,10 @@
#ifndef _COMMON_SQL_H_
#define _COMMON_SQL_H_
+#include "../common/cbasetypes.h"
#include <stdarg.h>// va_list
-#include "../common/cbasetypes.h"
+
// Return codes
#define SQL_ERROR (-1)
diff --git a/src/common/strlib.c b/src/common/strlib.c
index e2e802915..361595b07 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -2,19 +2,16 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#define _H_STRLIB_C_
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#define STRLIB_C
#include "strlib.h"
-#undef _H_STRLIB_C_
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <errno.h>
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/showmsg.h"
#define J_MAX_MALLOC_SIZE 65535
diff --git a/src/common/strlib.h b/src/common/strlib.h
index decf661a6..10844d257 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -5,16 +5,15 @@
#ifndef _COMMON_STRLIB_H_
#define _COMMON_STRLIB_H_
-#include <stdarg.h>
-
#include "../common/cbasetypes.h"
+#include <stdarg.h>
#ifndef __USE_GNU
-# define __USE_GNU // required to enable strnlen on some platforms
-# include <string.h>
-# undef __USE_GNU
+ #define __USE_GNU // required to enable strnlen on some platforms
+ #include <string.h>
+ #undef __USE_GNU
#else
-# include <string.h>
+ #include <string.h>
#endif
#ifdef WIN32
@@ -166,7 +165,7 @@ struct sv_interface *sv;
void strlib_defaults(void);
/* the purpose of these macros is simply to not make calling them be an annoyance */
-#ifndef _H_STRLIB_C_
+#ifndef STRLIB_C
#define jstrescape(pt) (strlib->jstrescape(pt))
#define jstrescapecpy(pt,spt) (strlib->jstrescapecpy((pt),(spt)))
#define jmemescapecpy(pt,spt,size) (strlib->jmemescapecpy((pt),(spt),(size)))
@@ -190,6 +189,6 @@ void strlib_defaults(void);
#define safesnprintf(buf,sz,fmt,...) (strlib->safesnprintf((buf),(sz),(fmt),##__VA_ARGS__))
#define strline(str,pos) (strlib->strline((str),(pos)))
#define bin2hex(output,input,count) (strlib->bin2hex((output),(input),(count)))
-#endif /* _H_STRLIB_C_ */
+#endif /* STRLIB_C */
#endif /* _COMMON_STRLIB_H_ */
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index 3fdfadb41..a56896458 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -4,39 +4,23 @@
/// See sysinfo.h for a description of this file
-#define HERCULES_CORE
-
+#define _COMMON_SYSINFO_P_
#include "sysinfo.h"
-
-#include <stdio.h> // fopen
-#include <stdlib.h> // atoi
+#undef _COMMON_SYSINFO_P_
#include "../common/cbasetypes.h"
#include "../common/core.h"
-#include "../common/malloc.h"
#include "../common/strlib.h"
+#include "../common/malloc.h"
#ifdef WIN32
-# include <string.h> // strlen
-# include <windows.h>
+#include <windows.h>
+#include <string.h> // strlen
#else
-# include <unistd.h>
+#include <unistd.h>
#endif
-
-/// Private interface fields
-struct sysinfo_private {
- char *platform;
- char *osversion;
- char *cpu;
- int cpucores;
- char *arch;
- char *compiler;
- char *cflags;
- char *vcstype_name;
- int vcstype;
- char *vcsrevision_src;
- char *vcsrevision_scripts;
-};
+#include <stdio.h> // fopen
+#include <stdlib.h> // atoi
/// sysinfo.c interface source
struct sysinfo_interface sysinfo_s;
diff --git a/src/common/sysinfo.h b/src/common/sysinfo.h
index c0c4d276a..17faac26b 100644
--- a/src/common/sysinfo.h
+++ b/src/common/sysinfo.h
@@ -13,7 +13,23 @@
#include "../common/cbasetypes.h"
+#ifdef _COMMON_SYSINFO_P_
+struct sysinfo_private {
+ char *platform;
+ char *osversion;
+ char *cpu;
+ int cpucores;
+ char *arch;
+ char *compiler;
+ char *cflags;
+ char *vcstype_name;
+ int vcstype;
+ char *vcsrevision_src;
+ char *vcsrevision_scripts;
+};
+#else
struct sysinfo_private;
+#endif
/**
* sysinfo.c interface
diff --git a/src/common/thread.c b/src/common/thread.c
index 4f73aa9b3..4d110f2dd 100644
--- a/src/common/thread.c
+++ b/src/common/thread.c
@@ -6,27 +6,24 @@
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
-#include "thread.h"
-
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/showmsg.h"
-
#ifdef WIN32
-# include "../common/winapi.h"
-# define getpagesize() 4096 // @TODO: implement this properly (GetSystemInfo .. dwPageSize..). (Atm as on all supported win platforms its 4k its static.)
-# define __thread __declspec( thread )
+#include "../common/winapi.h"
+#define getpagesize() 4096 // @TODO: implement this properly (GetSystemInfo .. dwPageSize..). (Atm as on all supported win platforms its 4k its static.)
+#define __thread __declspec( thread )
#else
-# include <stdlib.h>
-# include <unistd.h>
-# include <string.h>
-# include <signal.h>
-# include <pthread.h>
-# include <sched.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <pthread.h>
+#include <sched.h>
#endif
+#include "cbasetypes.h"
+#include "malloc.h"
+#include "showmsg.h"
+#include "thread.h"
+
// When Compiling using MSC (on win32..) we know we have support in any case!
#ifdef _MSC_VER
#define HAS_TLS
diff --git a/src/common/thread.h b/src/common/thread.h
index 887c03179..d6b2bbc6e 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -1,6 +1,7 @@
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
+#pragma once
#ifndef _COMMON_THREAD_H_
#define _COMMON_THREAD_H_
diff --git a/src/common/timer.c b/src/common/timer.c
index 10f14b0f2..526854582 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -2,8 +2,11 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/cbasetypes.h"
+#include "../common/db.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/utils.h"
#include "timer.h"
#include <stdio.h>
@@ -11,17 +14,11 @@
#include <string.h>
#include <time.h>
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/showmsg.h"
-#include "../common/utils.h"
-
#ifdef WIN32
-# include "../common/winapi.h" // GetTickCount()
+#include "../common/winapi.h" // GetTickCount()
#else
-# include <sys/time.h> // struct timeval, gettimeofday()
-# include <unistd.h>
+#include <unistd.h>
+#include <sys/time.h> // struct timeval, gettimeofday()
#endif
struct timer_interface timer_s;
diff --git a/src/common/utils.c b/src/common/utils.c
index 84925f707..47747dd32 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -2,35 +2,33 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
+#include "../common/cbasetypes.h"
+#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/core.h"
+#include "socket.h"
#include "utils.h"
-#include <math.h> // floor()
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h> // cache purposes [Ind/Hercules]
-
-#include "../common/cbasetypes.h"
-#include "../common/core.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
+#include <math.h> // floor()
#ifdef WIN32
-# include "../common/winapi.h"
-# ifndef F_OK
-# define F_OK 0x0
-# endif /* F_OK */
+ #include "../common/winapi.h"
+ #ifndef F_OK
+ #define F_OK 0x0
+ #endif /* F_OK */
#else
-# include <dirent.h>
-# include <sys/stat.h>
-# include <unistd.h>
+ #include <unistd.h>
+ #include <dirent.h>
+ #include <sys/stat.h>
#endif
+#include <sys/stat.h> // cache purposes [Ind/Hercules]
+
struct HCache_interface HCache_s;
/// Dumps given buffer into file pointed to by a handle.
diff --git a/src/common/utils.h b/src/common/utils.h
index 823651163..f89546b8a 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -5,11 +5,10 @@
#ifndef _COMMON_UTILS_H_
#define _COMMON_UTILS_H_
+#include "../common/cbasetypes.h"
#include <stdio.h> // FILE*
#include <time.h>
-#include "../common/cbasetypes.h"
-
/* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */
#define HCACHE_KEY 'k'
diff --git a/src/config/const.h b/src/config/const.h
index f9baa4d7d..6557cb987 100644
--- a/src/config/const.h
+++ b/src/config/const.h
@@ -52,6 +52,13 @@
#define DEFTYPE_MAX CHAR_MAX
#endif
+/* pointer size fix which fixes several gcc warnings */
+#ifdef __64BIT__
+ #define __64BPTRSIZE(y) ((intptr)(y))
+#else
+ #define __64BPTRSIZE(y) (y)
+#endif
+
/* ATCMD_FUNC(mobinfo) HIT and FLEE calculations */
#ifdef RENEWAL
#define MOB_FLEE(mobdata) ( (mobdata)->lv + (mobdata)->status.agi + 100 )
diff --git a/src/config/renewal.h b/src/config/renewal.h
index 36bdd3958..36615d63b 100644
--- a/src/config/renewal.h
+++ b/src/config/renewal.h
@@ -74,6 +74,5 @@
#define RENEWAL_ASPD
#endif // DISABLE_RENEWAL
-#undef DISABLE_RENEWAL
#endif // _CONFIG_RENEWAL_H_
diff --git a/src/login/account.h b/src/login/account.h
index 329ae31c8..234e7c0c1 100644
--- a/src/login/account.h
+++ b/src/login/account.h
@@ -7,7 +7,6 @@
#include "../common/cbasetypes.h"
#include "../common/mmo.h" // ACCOUNT_REG2_NUM
-#include "../common/sql.h" // Sql
typedef struct AccountDB AccountDB;
typedef struct AccountDBIterator AccountDBIterator;
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index 2e4ed7ab9..1483196ab 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -2,22 +2,17 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // CONSOLE_INPUT
-#include "account.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../common/console.h"
#include "../common/malloc.h"
#include "../common/mmo.h"
#include "../common/showmsg.h"
-#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "../common/console.h"
+#include "../common/socket.h"
+#include "account.h"
+#include <stdlib.h>
+#include <string.h>
/// global defines
#define ACCOUNT_SQL_DB_VERSION 20110114
@@ -657,7 +652,7 @@ Sql* account_db_sql_up(AccountDB* self) {
AccountDB_SQL* db = (AccountDB_SQL*)self;
Sql_HerculesUpdateCheck(db->accounts);
#ifdef CONSOLE_INPUT
- console->input->setSQL(db->accounts);
+ console->setSQL(db->accounts);
#endif
return db->accounts;
}
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index 081f28d84..74f45e418 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -2,15 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "ipban.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "login.h"
-#include "loginlog.h"
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/malloc.h"
@@ -18,6 +9,11 @@
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "login.h"
+#include "ipban.h"
+#include "loginlog.h"
+#include <stdlib.h>
+#include <string.h>
// global sql settings
static char global_db_hostname[32] = "127.0.0.1";
diff --git a/src/login/login.c b/src/login/login.c
index cb46e0226..af59fcf38 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -2,18 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "login.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "account.h"
-#include "ipban.h"
-#include "loginlog.h"
-#include "../common/HPM.h"
#include "../common/core.h"
#include "../common/db.h"
#include "../common/malloc.h"
@@ -24,6 +12,15 @@
#include "../common/strlib.h"
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/HPM.h"
+#include "account.h"
+#include "ipban.h"
+#include "login.h"
+#include "loginlog.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct Login_Config login_config;
diff --git a/src/login/login.h b/src/login/login.h
index e77b96a0e..14c361a15 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -5,8 +5,8 @@
#ifndef _LOGIN_LOGIN_H_
#define _LOGIN_LOGIN_H_
-#include "../common/core.h" // CORE_ST_LAST
#include "../common/mmo.h" // NAME_LENGTH,SEX_*
+#include "../common/core.h" // CORE_ST_LAST
enum E_LOGINSERVER_ST
{
diff --git a/src/login/loginlog.h b/src/login/loginlog.h
index a86ad431c..730fb6e62 100644
--- a/src/login/loginlog.h
+++ b/src/login/loginlog.h
@@ -4,7 +4,6 @@
#ifndef _LOGIN_LOGINLOG_H_
#define _LOGIN_LOGINLOG_H_
-#include "../common/cbasetypes.h"
unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes);
void login_log(uint32 ip, const char* username, int rcode, const char* message);
@@ -12,4 +11,5 @@ bool loginlog_init(void);
bool loginlog_final(void);
bool loginlog_config_read(const char* w1, const char* w2);
+
#endif /* _LOGIN_LOGINLOG_H_ */
diff --git a/src/login/loginlog_sql.c b/src/login/loginlog_sql.c
index 2cbc02c93..231ac783b 100644
--- a/src/login/loginlog_sql.c
+++ b/src/login/loginlog_sql.c
@@ -2,18 +2,13 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "loginlog.h"
-
-#include <string.h>
-#include <stdlib.h> // exit
-
#include "../common/cbasetypes.h"
#include "../common/mmo.h"
#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"
+#include <string.h>
+#include <stdlib.h> // exit
// global sql settings (in ipban_sql.c)
static char global_db_hostname[32] = "127.0.0.1";
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index cb8c979c6..061479d87 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -1,15 +1,25 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/HPM.h"
+#include "../common/conf.h"
+#include "../common/db.h"
+#include "../common/des.h"
+#include "../common/ers.h"
+#include "../common/mapindex.h"
+#include "../common/mmo.h"
+#include "../common/socket.h"
+#include "../common/strlib.h"
-#include "HPMmap.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include "HPMmap.h"
+#include "pc.h"
+#include "map.h"
+//
#include "atcommand.h"
#include "battle.h"
#include "battleground.h"
@@ -27,14 +37,12 @@
#include "itemdb.h"
#include "log.h"
#include "mail.h"
-#include "map.h"
#include "mapreg.h"
#include "mercenary.h"
#include "mob.h"
#include "npc.h"
#include "party.h"
#include "path.h"
-#include "pc.h"
#include "pc_groups.h"
#include "pet.h"
#include "quest.h"
@@ -46,19 +54,11 @@
#include "trade.h"
#include "unit.h"
#include "vending.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/db.h"
-#include "../common/des.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/mapindex.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/sysinfo.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
#include "../common/HPMDataCheck.h"
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index df3be40a5..5fd0faf86 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2,60 +2,57 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/mmo.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/core.h"
+#include "../common/showmsg.h"
+#include "../common/malloc.h"
+#include "../common/random.h"
+#include "../common/socket.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/conf.h"
+#include "../common/sysinfo.h"
-#include "../config/core.h" // AUTOLOOTITEM_SIZE, AUTOTRADE_PERSISTENCY, MAX_CARTS, MAX_SUGGESTIONS, MOB_FLEE(), MOB_HIT(), RENEWAL, RENEWAL_DROP, RENEWAL_EXP
#include "atcommand.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "battle.h"
#include "chat.h"
-#include "chrif.h"
#include "clif.h"
+#include "chrif.h"
#include "duel.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
#include "intif.h"
#include "itemdb.h"
#include "log.h"
-#include "mail.h"
#include "map.h"
-#include "mapreg.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
#include "pc.h"
#include "pc_groups.h" // groupid2name
+#include "status.h"
+#include "skill.h"
+#include "mob.h"
+#include "npc.h"
#include "pet.h"
-#include "quest.h"
+#include "homunculus.h"
+#include "mail.h"
+#include "mercenary.h"
+#include "elemental.h"
+#include "party.h"
+#include "guild.h"
#include "script.h"
-#include "searchstore.h"
-#include "skill.h"
-#include "status.h"
#include "storage.h"
#include "trade.h"
#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/core.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/sysinfo.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "mapreg.h"
+#include "quest.h"
+#include "searchstore.h"
#include "HPMmap.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
struct atcommand_interface atcommand_s;
static char atcmd_output[CHAT_SIZE_MAX];
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index c8a1863af..bc4ab30a3 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -5,9 +5,9 @@
#ifndef _MAP_ATCOMMAND_H_
#define _MAP_ATCOMMAND_H_
-#include "pc_groups.h"
#include "../common/conf.h"
#include "../common/db.h"
+#include "pc_groups.h"
/**
* Declarations
diff --git a/src/map/battle.c b/src/map/battle.c
index 0865ee4ba..9089b7102 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2,44 +2,41 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // CELL_NOSTACK, CIRCULAR_AREA, CONSOLE_INPUT, HMAP_ZONE_DAMAGE_CAP_TYPE, OFFICIAL_WALKPATH, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, RE_LVL_DMOD(), RE_LVL_MDMOD(), RE_LVL_TMDMOD(), RE_SKILL_REDUCTION(), SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT, STATS_OPT_OUT
-#include "battle.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "battleground.h"
-#include "chrif.h"
-#include "clif.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
-#include "itemdb.h"
-#include "map.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "party.h"
-#include "path.h"
-#include "pc.h"
-#include "pet.h"
-#include "skill.h"
-#include "status.h"
-#include "../common/HPM.h"
#include "../common/cbasetypes.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
+#include "../common/timer.h"
#include "../common/nullpo.h"
-#include "../common/random.h"
+#include "../common/malloc.h"
#include "../common/showmsg.h"
+#include "../common/ers.h"
+#include "../common/random.h"
#include "../common/socket.h"
#include "../common/strlib.h"
-#include "../common/sysinfo.h"
-#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/sysinfo.h"
+#include "../common/HPM.h"
+
+#include "map.h"
+#include "path.h"
+#include "pc.h"
+#include "status.h"
+#include "skill.h"
+#include "homunculus.h"
+#include "mercenary.h"
+#include "elemental.h"
+#include "mob.h"
+#include "itemdb.h"
+#include "clif.h"
+#include "pet.h"
+#include "guild.h"
+#include "party.h"
+#include "battle.h"
+#include "battleground.h"
+#include "chrif.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
struct Battle_Config battle_config;
struct battle_interface battle_s;
diff --git a/src/map/battle.h b/src/map/battle.h
index fbe097c78..88038ddb4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -5,8 +5,8 @@
#ifndef _MAP_BATTLE_H_
#define _MAP_BATTLE_H_
-#include "map.h" //ELE_MAX
#include "../common/cbasetypes.h"
+#include "map.h" //ELE_MAX
/**
* Declarations
diff --git a/src/map/battleground.c b/src/map/battleground.c
index a7169de0e..68539e25d 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -2,32 +2,29 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/strlib.h"
+#include "../common/conf.h"
#include "battleground.h"
-
-#include <string.h>
-#include <stdio.h>
-
#include "battle.h"
#include "clif.h"
-#include "homunculus.h"
#include "map.h"
-#include "mapreg.h"
-#include "mercenary.h"
-#include "mob.h" // struct mob_data
#include "npc.h"
-#include "party.h"
#include "pc.h"
+#include "party.h"
#include "pet.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
+#include "homunculus.h"
+#include "mercenary.h"
+#include "mapreg.h"
+
+#include <string.h>
+#include <stdio.h>
struct battleground_interface bg_s;
diff --git a/src/map/battleground.h b/src/map/battleground.h
index ec0a86f14..05c4eb060 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -5,9 +5,9 @@
#ifndef _MAP_BATTLEGROUND_H_
#define _MAP_BATTLEGROUND_H_
+#include "../common/mmo.h" // struct party
#include "clif.h"
#include "guild.h"
-#include "../common/mmo.h" // struct party
/**
* Defines
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 80264b30d..2a15e66fc 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -2,21 +2,18 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "buyingstore.h" // struct s_buyingstore
-
-#include "atcommand.h" // msg_txt
-#include "battle.h" // battle_config.*
-#include "chrif.h"
-#include "clif.h" // clif->buyingstore_*
-#include "log.h" // log_pick_pc, log_zeny
-#include "pc.h" // struct map_session_data
#include "../common/cbasetypes.h"
#include "../common/db.h" // ARR_FIND
#include "../common/showmsg.h" // ShowWarning
#include "../common/socket.h" // RBUF*
#include "../common/strlib.h" // safestrncpy
+#include "atcommand.h" // msg_txt
+#include "battle.h" // battle_config.*
+#include "buyingstore.h" // struct s_buyingstore
+#include "clif.h" // clif->buyingstore_*
+#include "log.h" // log_pick_pc, log_zeny
+#include "pc.h" // struct map_session_data
+#include "chrif.h"
struct buyingstore_interface buyingstore_s;
diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h
index 914631872..5141a1013 100644
--- a/src/map/buyingstore.h
+++ b/src/map/buyingstore.h
@@ -5,11 +5,6 @@
#ifndef _MAP_BUYINGSTORE_H_
#define _MAP_BUYINGSTORE_H_
-#include "../common/cbasetypes.h"
-#include "../common/mmo.h" // MAX_SLOTS
-
-struct map_session_data;
-
/**
* Declarations
**/
diff --git a/src/map/chat.c b/src/map/chat.c
index c9d3e6d46..08fc4a575 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -2,13 +2,12 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "chat.h"
-
-#include <stdio.h>
-#include <string.h>
-
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/mmo.h"
#include "atcommand.h" // msg_txt()
#include "battle.h" // struct battle_config
#include "clif.h"
@@ -16,12 +15,10 @@
#include "npc.h" // npc_event_do()
#include "pc.h"
#include "skill.h" // ext_skill_unit_onplace()
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
+#include "chat.h"
+
+#include <stdio.h>
+#include <string.h>
struct chat_interface chat_s;
diff --git a/src/map/chat.h b/src/map/chat.h
index cbc2a391e..b0c6cd905 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -6,12 +6,9 @@
#define _MAP_CHAT_H_
#include "map.h" // struct block_list, CHATROOM_TITLE_SIZE
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-struct chat_data;
struct map_session_data;
-struct npc_data;
+struct chat_data;
#define MAX_CHAT_USERS 20
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 81e2d387c..99a1935fd 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -2,16 +2,15 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // AUTOTRADE_PERSISTENCY, STATS_OPT_OUT
-#include "chrif.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/ers.h"
+#include "../common/HPM.h"
#include "map.h"
#include "battle.h"
@@ -26,17 +25,15 @@
#include "instance.h"
#include "mercenary.h"
#include "elemental.h"
+#include "chrif.h"
#include "quest.h"
#include "storage.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
struct chrif_interface chrif_s;
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 84efc66d3..25e955604 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -5,11 +5,9 @@
#ifndef _MAP_CHRIF_H_
#define _MAP_CHRIF_H_
+#include "../common/cbasetypes.h"
#include <time.h>
-
#include "map.h" //TBL_stuff
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
struct status_change_entry;
diff --git a/src/map/clif.c b/src/map/clif.c
index cb2474961..1a6665307 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2,59 +2,56 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // ANTI_MAYAP_CHEAT, NEW_CARTS, RENEWAL, SECURE_NPCTIMEOUT
-#include "clif.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
+#include "../common/cbasetypes.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/grfio.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/ers.h"
+#include "../common/conf.h"
+#include "../common/HPM.h"
+#include "map.h"
+#include "chrif.h"
+#include "pc.h"
+#include "status.h"
+#include "npc.h"
+#include "itemdb.h"
+#include "chat.h"
+#include "trade.h"
+#include "storage.h"
+#include "script.h"
+#include "skill.h"
#include "atcommand.h"
+#include "intif.h"
#include "battle.h"
#include "battleground.h"
-#include "chat.h"
-#include "chrif.h"
-#include "elemental.h"
+#include "mob.h"
+#include "party.h"
+#include "unit.h"
#include "guild.h"
+#include "vending.h"
+#include "pet.h"
#include "homunculus.h"
#include "instance.h"
-#include "intif.h"
-#include "irc-bot.h"
-#include "itemdb.h"
+#include "mercenary.h"
+#include "elemental.h"
#include "log.h"
+#include "clif.h"
#include "mail.h"
-#include "map.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
-#include "pc.h"
-#include "pet.h"
#include "quest.h"
-#include "script.h"
-#include "skill.h"
-#include "status.h"
-#include "storage.h"
-#include "trade.h"
-#include "unit.h"
-#include "vending.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/ers.h"
-#include "../common/grfio.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "irc-bot.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
struct clif_interface clif_s;
diff --git a/src/map/clif.h b/src/map/clif.h
index 7b27e1fe6..0f4a9e756 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -5,13 +5,13 @@
#ifndef _MAP_CLIF_H_
#define _MAP_CLIF_H_
-#include <stdarg.h>
-
-#include "map.h"
-#include "packets_struct.h"
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/mmo.h"
+#include "../common/socket.h"
+#include "../map/map.h"
+#include "../map/packets_struct.h"
+#include <stdarg.h>
/**
* Declarations
@@ -20,6 +20,7 @@ struct item;
struct item_data;
struct storage_data;
struct guild_storage;
+struct block_list;
struct unit_data;
struct map_session_data;
struct homun_data;
diff --git a/src/map/date.c b/src/map/date.c
index 975a00c50..f38ead858 100644
--- a/src/map/date.c
+++ b/src/map/date.c
@@ -1,14 +1,10 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
+#include "../common/cbasetypes.h"
#include "date.h"
-
#include <time.h>
-#include "../common/cbasetypes.h"
-
int date_get_year(void)
{
time_t t;
diff --git a/src/map/date.h b/src/map/date.h
index b3ed59b2f..46f0d86c3 100644
--- a/src/map/date.h
+++ b/src/map/date.h
@@ -4,8 +4,6 @@
#ifndef _MAP_DATE_H_
#define _MAP_DATE_H_
-#include "../common/cbasetypes.h"
-
int date_get_year(void);
int date_get_month(void);
int date_get_day(void);
diff --git a/src/map/duel.c b/src/map/duel.c
index a423ef240..af2741f77 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -2,20 +2,18 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "atcommand.h" // msg_txt
+#include "clif.h"
#include "duel.h"
+#include "pc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "atcommand.h" // msg_txt
-#include "clif.h"
-#include "pc.h"
-#include "../common/cbasetypes.h"
-
/*==========================================
* Duel organizing functions [LuzZza]
*------------------------------------------*/
diff --git a/src/map/duel.h b/src/map/duel.h
index 956aed36d..5405d2eee 100644
--- a/src/map/duel.h
+++ b/src/map/duel.h
@@ -5,10 +5,6 @@
#ifndef _MAP_DUEL_H_
#define _MAP_DUEL_H_
-#include "../common/cbasetypes.h"
-
-struct map_session_data;
-
struct duel {
int members_count;
int invites_count;
diff --git a/src/map/elemental.c b/src/map/elemental.c
index 323df41e1..f335600d6 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -2,44 +2,42 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "elemental.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/mmo.h"
+#include "../common/showmsg.h"
+#include "../common/utils.h"
+#include "../common/random.h"
+#include "../common/strlib.h"
-#include "atcommand.h"
-#include "battle.h"
-#include "chrif.h"
+#include "log.h"
#include "clif.h"
-#include "guild.h"
+#include "chrif.h"
#include "intif.h"
#include "itemdb.h"
-#include "log.h"
#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
#include "pc.h"
+#include "status.h"
+#include "skill.h"
+#include "mob.h"
#include "pet.h"
+#include "battle.h"
+#include "party.h"
+#include "guild.h"
+#include "atcommand.h"
#include "script.h"
-#include "skill.h"
-#include "status.h"
+#include "npc.h"
#include "trade.h"
#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "elemental.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
struct elemental_interface elemental_s;
diff --git a/src/map/elemental.h b/src/map/elemental.h
index aa27aadc9..6d04a41a5 100644
--- a/src/map/elemental.h
+++ b/src/map/elemental.h
@@ -7,7 +7,6 @@
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
-#include "../common/mmo.h" // NAME_LENGTH
/**
* Defines
diff --git a/src/map/guild.c b/src/map/guild.c
index 69f67238d..fa5805c8b 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -2,37 +2,34 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // GP_BOUND_ITEMS
-#include "guild.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "battle.h"
-#include "clif.h"
-#include "instance.h"
-#include "intif.h"
-#include "log.h"
-#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "pc.h"
-#include "skill.h"
-#include "status.h"
-#include "storage.h"
-#include "../common/HPM.h"
#include "../common/cbasetypes.h"
-#include "../common/ers.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
#include "../common/malloc.h"
#include "../common/mapindex.h"
-#include "../common/nullpo.h"
#include "../common/showmsg.h"
+#include "../common/ers.h"
#include "../common/strlib.h"
-#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/HPM.h"
+
+#include "map.h"
+#include "guild.h"
+#include "storage.h"
+#include "battle.h"
+#include "npc.h"
+#include "pc.h"
+#include "status.h"
+#include "mob.h"
+#include "intif.h"
+#include "clif.h"
+#include "skill.h"
+#include "log.h"
+#include "instance.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct guild_interface guild_s;
diff --git a/src/map/guild.h b/src/map/guild.h
index 34e27a56c..b03bd664d 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -5,10 +5,18 @@
#ifndef _MAP_GUILD_H_
#define _MAP_GUILD_H_
-#include "map.h" // EVENT_NAME_LENGTH, TBL_PC
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/mmo.h"
+//#include "../common/mmo.h"
+#include "map.h" // NAME_LENGTH
+
+/**
+ * Declarations
+ **/
+struct guild;
+struct guild_member;
+struct guild_position;
+struct guild_castle;
+struct map_session_data;
+struct mob_data;
/**
* Defines
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index b6a83d1cb..ff9f7a5b1 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -2,45 +2,43 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // DBPATH
-#include "homunculus.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/mmo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
-#include "atcommand.h"
-#include "battle.h"
-#include "chrif.h"
+#include "log.h"
#include "clif.h"
-#include "guild.h"
+#include "chrif.h"
#include "intif.h"
#include "itemdb.h"
-#include "log.h"
#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
#include "pc.h"
+#include "status.h"
+#include "skill.h"
+#include "mob.h"
#include "pet.h"
+#include "battle.h"
+#include "party.h"
+#include "guild.h"
+#include "atcommand.h"
#include "script.h"
-#include "skill.h"
-#include "status.h"
+#include "npc.h"
#include "trade.h"
#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+
+#include "homunculus.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
struct homunculus_interface homunculus_s;
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index 9eef6af5b..e6d59e30e 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -5,10 +5,9 @@
#ifndef _MAP_HOMUNCULUS_H_
#define _MAP_HOMUNCULUS_H_
-#include "pc.h"
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
-#include "../common/mmo.h"
+#include "pc.h"
#define MAX_HOM_SKILL_REQUIRE 5
#define homdb_checkid(id) ((id) >= HM_CLASS_BASE && (id) <= HM_CLASS_MAX)
diff --git a/src/map/instance.c b/src/map/instance.c
index 5789d7dd6..caf622b3d 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -2,32 +2,30 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/db.h"
+#include "../common/HPM.h"
+#include "clif.h"
#include "instance.h"
+#include "map.h"
+#include "npc.h"
+#include "party.h"
+#include "pc.h"
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <time.h>
-#include "clif.h"
-#include "map.h"
-#include "npc.h"
-#include "party.h"
-#include "pc.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
-
struct instance_interface instance_s;
/// Checks whether given instance id is valid or not.
diff --git a/src/map/instance.h b/src/map/instance.h
index ae649eda7..712a0f141 100644
--- a/src/map/instance.h
+++ b/src/map/instance.h
@@ -6,11 +6,8 @@
#define _MAP_INSTANCE_H_
#include "script.h" // struct reg_db
-#include "../common/cbasetypes.h"
#include "../common/mmo.h" // struct point
-
struct block_list;
-struct map_session_data;
#define INSTANCE_NAME_LENGTH (60+1)
diff --git a/src/map/intif.c b/src/map/intif.c
index 383150fbc..6bd24368a 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1,40 +1,37 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
-#include "../config/core.h" // GP_BOUND_ITEMS
-#include "intif.h"
-
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "atcommand.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
+#include "map.h"
#include "battle.h"
#include "chrif.h"
#include "clif.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
+#include "pc.h"
+#include "intif.h"
#include "log.h"
-#include "mail.h"
-#include "map.h"
-#include "mercenary.h"
+#include "storage.h"
#include "party.h"
-#include "pc.h"
+#include "guild.h"
#include "pet.h"
+#include "atcommand.h"
+#include "mercenary.h"
+#include "homunculus.h"
+#include "elemental.h"
+#include "mail.h"
#include "quest.h"
-#include "storage.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <string.h>
+
struct intif_interface intif_s;
diff --git a/src/map/intif.h b/src/map/intif.h
index b6ee727f3..290dcfcdc 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -5,22 +5,19 @@
#ifndef _MAP_INTIF_H_
#define _MAP_INTIF_H_
-#include "../common/cbasetypes.h"
/**
* Declarations
**/
-struct auction_data;
+struct party_member;
struct guild_member;
struct guild_position;
-struct guild_storage;
-struct mail_message;
-struct map_session_data;
-struct party_member;
-struct s_elemental;
+struct s_pet;
struct s_homunculus;
struct s_mercenary;
-struct s_pet;
+struct s_elemental;
+struct mail_message;
+struct auction_data;
/**
* Defines
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 6f016697f..ff28082e7 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -2,25 +2,23 @@
// See the LICENSE file
// Base Author: shennetsind @ http://hercules.ws
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/strlib.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/random.h"
+#include "map.h"
+#include "pc.h"
+#include "clif.h"
#include "irc-bot.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "clif.h"
-#include "map.h"
-#include "pc.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-
//#define IRCBOT_DEBUG
struct irc_bot_interface irc_bot_s;
diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h
index 60f03fca5..c15a5d46a 100644
--- a/src/map/irc-bot.h
+++ b/src/map/irc-bot.h
@@ -6,8 +6,6 @@
#ifndef _MAP_IRC_BOT_H_
#define _MAP_IRC_BOT_H_
-#include "../common/cbasetypes.h"
-
#define IRC_NICK_LENGTH 40
#define IRC_IDENT_LENGTH 40
#define IRC_HOST_LENGTH 63
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 1981f435c..5eeb90be5 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -2,27 +2,22 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // DBPATH, RENEWAL
-#include "itemdb.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "battle.h" // struct battle_config
-#include "map.h"
-#include "mob.h" // MAX_MOB_DB
-#include "pc.h" // W_MUSICAL, W_WHIP
-#include "script.h" // item script processing
-#include "../common/conf.h"
-#include "../common/malloc.h"
#include "../common/nullpo.h"
+#include "../common/malloc.h"
#include "../common/random.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/utils.h"
+#include "../common/conf.h"
+#include "itemdb.h"
+#include "map.h"
+#include "battle.h" // struct battle_config
+#include "script.h" // item script processing
+#include "pc.h" // W_MUSICAL, W_WHIP
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct itemdb_interface itemdb_s;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 12766b288..77fb2e2ec 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -5,12 +5,9 @@
#ifndef _MAP_ITEMDB_H_
#define _MAP_ITEMDB_H_
-#include "map.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
#include "../common/db.h"
#include "../common/mmo.h" // ITEM_NAME_LENGTH
-#include "../common/sql.h"
+#include "map.h"
/**
* Declarations
diff --git a/src/map/log.c b/src/map/log.c
index 523ef1d65..19a98f34b 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -2,24 +2,21 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "log.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "../common/cbasetypes.h"
+#include "../common/sql.h" // SQL_INNODB
+#include "../common/strlib.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
#include "battle.h"
#include "itemdb.h"
+#include "log.h"
#include "map.h"
#include "mob.h"
#include "pc.h"
-#include "../common/cbasetypes.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/sql.h" // SQL_INNODB
-#include "../common/strlib.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct log_interface log_s;
diff --git a/src/map/log.h b/src/map/log.h
index ecfedeac2..b2cb92c20 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -11,10 +11,11 @@
/**
* Declarations
**/
-struct item;
-struct item_data;
+struct block_list;
struct map_session_data;
struct mob_data;
+struct item;
+struct item_data;
/**
* Defines
diff --git a/src/map/mail.c b/src/map/mail.c
index 7ba7d7470..371aa892f 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -2,20 +2,18 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
#include "mail.h"
-
-#include <time.h>
-#include <string.h>
-
#include "atcommand.h"
-#include "clif.h"
#include "itemdb.h"
-#include "log.h"
+#include "clif.h"
#include "pc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
+#include "log.h"
+
+#include <time.h>
+#include <string.h>
struct mail_interface mail_s;
diff --git a/src/map/mail.h b/src/map/mail.h
index 30b032ef4..8df537ff3 100644
--- a/src/map/mail.h
+++ b/src/map/mail.h
@@ -5,11 +5,7 @@
#ifndef _MAP_MAIL_H_
#define _MAP_MAIL_H_
-#include "../common/cbasetypes.h"
-
-struct item;
-struct mail_message;
-struct map_session_data;
+#include "../common/mmo.h"
struct mail_interface {
void (*clear) (struct map_session_data *sd);
diff --git a/src/map/map.c b/src/map/map.c
index 01d3dbb9f..315924e2e 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2,66 +2,62 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/core.h"
+#include "../common/timer.h"
+#include "../common/ers.h"
+#include "../common/grfio.h"
+#include "../common/malloc.h"
+#include "../common/socket.h" // WFIFO*()
+#include "../common/showmsg.h"
+#include "../common/nullpo.h"
+#include "../common/random.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/conf.h"
+#include "../common/console.h"
+#include "../common/HPM.h"
-#include "../config/core.h" // CELL_NOSTACK, CIRCULAR_AREA, CONSOLE_INPUT, DBPATH, RENEWAL
#include "map.h"
-
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "HPMmap.h"
-#include "atcommand.h"
-#include "battle.h"
-#include "battleground.h"
-#include "chat.h"
+#include "path.h"
#include "chrif.h"
#include "clif.h"
#include "duel.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
-#include "instance.h"
#include "intif.h"
-#include "irc-bot.h"
-#include "itemdb.h"
-#include "log.h"
-#include "mail.h"
-#include "mapreg.h"
-#include "mercenary.h"
-#include "mob.h"
#include "npc.h"
-#include "npc.h" // npc_setcells(), npc_unsetcells()
-#include "party.h"
-#include "path.h"
#include "pc.h"
-#include "pet.h"
-#include "quest.h"
-#include "script.h"
-#include "skill.h"
#include "status.h"
+#include "mob.h"
+#include "npc.h" // npc_setcells(), npc_unsetcells()
+#include "chat.h"
+#include "itemdb.h"
#include "storage.h"
+#include "skill.h"
#include "trade.h"
+#include "party.h"
#include "unit.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/console.h"
-#include "../common/core.h"
-#include "../common/ers.h"
-#include "../common/grfio.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h" // WFIFO*()
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "battle.h"
+#include "battleground.h"
+#include "quest.h"
+#include "script.h"
+#include "mapreg.h"
+#include "guild.h"
+#include "pet.h"
+#include "homunculus.h"
+#include "instance.h"
+#include "mercenary.h"
+#include "elemental.h"
+#include "atcommand.h"
+#include "log.h"
+#include "mail.h"
+#include "irc-bot.h"
+#include "HPMmap.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <math.h>
#ifndef _WIN32
#include <unistd.h>
#endif
@@ -5486,8 +5482,8 @@ void map_cp_defaults(void) {
map->cpsd->bl.y = MAP_DEFAULT_Y;
map->cpsd->bl.m = map->mapname2mapid(MAP_DEFAULT);
- console->input->addCommand("gm:info",CPCMD_A(gm_position));
- console->input->addCommand("gm:use",CPCMD_A(gm_use));
+ console->addCommand("gm:info",CPCMD_A(gm_position));
+ console->addCommand("gm:use",CPCMD_A(gm_use));
#endif
}
/* Hercules Plugin Mananger */
@@ -5843,7 +5839,7 @@ int do_init(int argc, char *argv[])
Sql_HerculesUpdateCheck(map->mysql_handle);
#ifdef CONSOLE_INPUT
- console->input->setSQL(map->mysql_handle);
+ console->setSQL(map->mysql_handle);
#endif
ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map->port);
diff --git a/src/map/map.h b/src/map/map.h
index 539b02ed8..c61868b13 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -5,18 +5,18 @@
#ifndef _MAP_MAP_H_
#define _MAP_MAP_H_
-#include <stdarg.h>
-
-#include "atcommand.h"
#include "../common/cbasetypes.h"
#include "../common/core.h" // CORE_ST_LAST
#include "../common/mmo.h"
#include "../common/mapindex.h"
#include "../common/db.h"
+#include "../config/core.h"
#include "../common/sql.h"
+#include "atcommand.h"
+#include <stdarg.h>
-struct mob_data;
struct npc_data;
+struct item_data;
struct hChSysCh;
enum E_MAPSERVER_ST {
@@ -36,6 +36,7 @@ enum E_MAPSERVER_ST {
#define NATURAL_HEAL_INTERVAL 500
#define MIN_FLOORITEM 2
#define MAX_FLOORITEM START_ACCOUNT_NUM
+#define MAX_LEVEL 175
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index f026fde00..61c25f24e 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -2,15 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "mapreg.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "map.h" // map->mysql_handle
-#include "script.h"
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/ers.h"
@@ -19,6 +10,11 @@
#include "../common/sql.h"
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "map.h" // map->mysql_handle
+#include "script.h"
+#include "mapreg.h"
+#include <stdlib.h>
+#include <string.h>
struct mapreg_interface mapreg_s;
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 26bc8c188..495621014 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -2,44 +2,42 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "mercenary.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/mmo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
-#include "atcommand.h"
-#include "battle.h"
-#include "chrif.h"
+#include "log.h"
#include "clif.h"
-#include "guild.h"
+#include "chrif.h"
#include "intif.h"
#include "itemdb.h"
-#include "log.h"
#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
#include "pc.h"
+#include "status.h"
+#include "skill.h"
+#include "mob.h"
#include "pet.h"
+#include "battle.h"
+#include "party.h"
+#include "guild.h"
+#include "atcommand.h"
#include "script.h"
-#include "skill.h"
-#include "status.h"
+#include "npc.h"
#include "trade.h"
#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "mercenary.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
struct mercenary_interface mercenary_s;
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index b998ac006..dd9266b2e 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -6,7 +6,6 @@
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
-#include "../common/cbasetypes.h"
// number of cells that a mercenary can walk to from it's master before being warped
#define MAX_MER_DISTANCE 15
diff --git a/src/map/mob.c b/src/map/mob.c
index 11ac74621..8f12d4b1b 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2,49 +2,46 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // AUTOLOOT_DISTANCE, DBPATH, DEFTYPE_MAX, DEFTYPE_MIN, RENEWAL_DROP, RENEWAL_EXP
-#include "mob.h"
-
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/db.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/ers.h"
+#include "../common/random.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/socket.h"
-#include "atcommand.h"
-#include "battle.h"
+#include "map.h"
+#include "path.h"
#include "clif.h"
-#include "date.h"
+#include "intif.h"
+#include "pc.h"
+#include "pet.h"
+#include "status.h"
+#include "mob.h"
+#include "homunculus.h"
+#include "mercenary.h"
#include "elemental.h"
#include "guild.h"
-#include "homunculus.h"
-#include "intif.h"
#include "itemdb.h"
-#include "log.h"
-#include "map.h"
-#include "mercenary.h"
-#include "npc.h"
+#include "skill.h"
+#include "battle.h"
#include "party.h"
-#include "path.h"
-#include "pc.h"
-#include "pet.h"
-#include "quest.h"
+#include "npc.h"
+#include "log.h"
#include "script.h"
-#include "skill.h"
-#include "status.h"
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "atcommand.h"
+#include "date.h"
+#include "quest.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <math.h>
struct mob_interface mob_s;
diff --git a/src/map/mob.h b/src/map/mob.h
index d07f78c77..80175b1db 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -5,11 +5,12 @@
#ifndef _MAP_MOB_H_
#define _MAP_MOB_H_
-#include "map.h" // struct status_data, struct view_data, struct mob_skill
-#include "status.h" // struct status_data, struct status_change
-#include "unit.h" // struct unit_data
-#include "../common/cbasetypes.h"
#include "../common/mmo.h" // struct item
+#include "guild.h" // struct guardian_data
+#include "map.h" // struct status_data, struct view_data, struct mob_skill
+#include "status.h" // struct status data, struct status_change
+#include "unit.h" // unit_stop_walking(), unit_stop_attack()
+#include "npc.h"
#define MAX_RANDOMMONSTER 5
diff --git a/src/map/npc.c b/src/map/npc.c
index 8e5854dbf..20b500630 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2,44 +2,41 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // NPC_SECURE_TIMEOUT_INPUT, NPC_SECURE_TIMEOUT_MENU, NPC_SECURE_TIMEOUT_NEXT, SECURE_NPCTIMEOUT, SECURE_NPCTIMEOUT_INTERVAL
-#include "npc.h"
-
-#include <errno.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/ers.h"
+#include "../common/db.h"
+#include "../common/socket.h"
+#include "../common/HPM.h"
-#include "battle.h"
-#include "chat.h"
+#include "map.h"
+#include "log.h"
#include "clif.h"
-#include "instance.h"
#include "intif.h"
+#include "pc.h"
+#include "status.h"
#include "itemdb.h"
-#include "log.h"
-#include "map.h"
+#include "script.h"
#include "mob.h"
-#include "pc.h"
#include "pet.h"
-#include "script.h"
+#include "instance.h"
+#include "battle.h"
#include "skill.h"
-#include "status.h"
#include "unit.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "npc.h"
+#include "chat.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+#include <errno.h>
struct npc_interface npc_s;
diff --git a/src/map/npc.h b/src/map/npc.h
index 6e9686d33..c154b14d0 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -8,10 +8,10 @@
#include "map.h" // struct block_list
#include "status.h" // struct status_change
#include "unit.h" // struct unit_data
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
struct HPluginData;
+struct block_list;
+struct npc_data;
struct view_data;
enum npc_parse_options {
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index f245ffea5..9d5639efc 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -2,27 +2,25 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
#ifdef PCRE_SUPPORT
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+
+#include "mob.h" // struct mob_data
#include "npc.h" // struct npc_data
+#include "pc.h" // struct map_session_data
+#include "script.h" // set_var()
+
+#include "../../3rdparty/pcre/include/pcre.h"
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include "../../3rdparty/pcre/include/pcre.h"
-
-#include "mob.h" // struct mob_data
-#include "pc.h" // struct map_session_data
-#include "script.h" // set_var()
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
+#include <stdarg.h>
/**
* interface sources
diff --git a/src/map/party.c b/src/map/party.c
index 7c49e241c..cf5e7bbe3 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -2,37 +2,34 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/socket.h" // last_tick
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/utils.h"
+#include "../common/strlib.h"
+#include "../common/HPM.h"
-#include "../config/core.h" // GP_BOUND_ITEMS, RENEWAL_EXP
#include "party.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "atcommand.h" //msg_txt()
-#include "battle.h"
-#include "clif.h"
+#include "pc.h"
+#include "map.h"
#include "instance.h"
+#include "battle.h"
#include "intif.h"
-#include "itemdb.h"
+#include "clif.h"
#include "log.h"
-#include "map.h"
-#include "mob.h" // struct mob_data
-#include "pc.h"
#include "skill.h"
#include "status.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h" // last_tick
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "itemdb.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
struct party_interface party_s;
diff --git a/src/map/party.h b/src/map/party.h
index 3bad22b13..ed8289af6 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -5,12 +5,11 @@
#ifndef _MAP_PARTY_H_
#define _MAP_PARTY_H_
+#include "../common/mmo.h" // struct party
+#include "../config/core.h"
#include <stdarg.h>
-#include "map.h" // TBL_PC
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/mmo.h" // struct party
+#include "map.h"
#define PARTY_BOOKING_JOBS 6
#define PARTY_BOOKING_RESULTS 10
diff --git a/src/map/path.c b/src/map/path.c
index d02e9ee4a..ae9fc389d 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -2,16 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // CELL_NOSTACK, CIRCULAR_AREA
-#include "path.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "map.h"
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/malloc.h"
@@ -19,6 +9,13 @@
#include "../common/random.h"
#include "../common/showmsg.h"
+#include "path.h"
+#include "map.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#define SET_OPEN 0
#define SET_CLOSED 1
diff --git a/src/map/path.h b/src/map/path.h
index b48ff05fb..0b67a0120 100644
--- a/src/map/path.h
+++ b/src/map/path.h
@@ -6,7 +6,6 @@
#define _MAP_PATH_H_
#include "map.h" // enum cell_chk
-#include "../common/cbasetypes.h"
#define MOVE_COST 10
#define MOVE_DIAGONAL_COST 14
diff --git a/src/map/pc.c b/src/map/pc.c
index 45adfe22a..c8fb14e55 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2,16 +2,21 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/core.h" // get_svn_revision()
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h" // session[]
+#include "../common/strlib.h" // safestrncpy()
+#include "../common/timer.h"
+#include "../common/utils.h"
+#include "../common/conf.h"
+#include "../common/mmo.h" //NAME_LENGTH
+#include "../common/sysinfo.h"
-#include "../config/core.h" // DBPATH, GP_BOUND_ITEMS, MAX_CARTS, MAX_SPIRITBALL, NEW_CARTS, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EXP, SECURE_NPCTIMEOUT
#include "pc.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
#include "atcommand.h" // get_atcommand_level()
#include "battle.h" // battle_config
#include "battleground.h"
@@ -20,40 +25,32 @@
#include "clif.h"
#include "date.h" // is_day_of_*()
#include "duel.h"
-#include "elemental.h"
-#include "guild.h" // guild->search(), guild_request_info()
-#include "homunculus.h"
-#include "instance.h"
#include "intif.h"
#include "itemdb.h"
#include "log.h"
#include "mail.h"
#include "map.h"
+#include "path.h"
+#include "homunculus.h"
+#include "instance.h"
#include "mercenary.h"
-#include "mob.h" // struct mob_data
+#include "elemental.h"
#include "npc.h" // fake_nd
-#include "party.h" // party->search()
-#include "path.h"
-#include "pc_groups.h"
#include "pet.h" // pet_unlocktarget()
-#include "quest.h"
+#include "party.h" // party->search()
+#include "guild.h" // guild->search(), guild_request_info()
#include "script.h" // script_config
#include "skill.h"
#include "status.h" // struct status_data
#include "storage.h"
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/core.h" // get_svn_revision()
-#include "../common/malloc.h"
-#include "../common/mmo.h" //NAME_LENGTH
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h" // session[]
-#include "../common/strlib.h" // safestrncpy()
-#include "../common/sysinfo.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "pc_groups.h"
+#include "quest.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
struct pc_interface pc_s;
@@ -10654,7 +10651,9 @@ void pc_defaults(void) {
memset(pc->exp_table, 0, sizeof(pc->exp_table)
+ sizeof(pc->max_level)
+ sizeof(pc->statp)
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
+ sizeof(pc->level_penalty)
+#endif
+ sizeof(pc->skill_tree)
+ sizeof(pc->smith_fame_list)
+ sizeof(pc->chemist_fame_list)
diff --git a/src/map/pc.h b/src/map/pc.h
index c4026a48d..70df9ca56 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -5,23 +5,23 @@
#ifndef _MAP_PC_H_
#define _MAP_PC_H_
-#include "../config/core.h" // AUTOLOOTITEM_SIZE, RENEWAL, SECURE_NPCTIMEOUT
-
+#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
+#include "../common/ers.h"
+#include "../common/timer.h" // INVALID_TIMER
+#include "atcommand.h" // AtCommandType
#include "battle.h" // battle_config
-#include "battleground.h" // enum bg_queue_types
+#include "battleground.h"
#include "buyingstore.h" // struct s_buyingstore
-#include "itemdb.h" // MAX_ITEMDELAYS
-#include "log.h" // struct e_log_pick_type
-#include "map.h" // RC_MAX, ELE_MAX
-#include "pc_groups.h" // GroupSettings
-#include "script.h" // struct reg_db
+#include "itemdb.h"
+#include "log.h"
+#include "map.h" // RC_MAX
+#include "mob.h"
+#include "pc_groups.h"
+#include "script.h" // struct script_reg, struct script_regstr
#include "searchstore.h" // struct s_search_store_info
-#include "status.h" // enum sc_type, OPTION_*
-#include "unit.h" // struct unit_data, struct view_data
+#include "status.h" // OPTION_*, struct weapon_atk
+#include "unit.h" // unit_stop_attack(), unit_stop_walking()
#include "vending.h" // struct s_vending
-#include "../common/cbasetypes.h"
-#include "../common/ers.h" // struct eri
-#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
/**
* Defines
@@ -742,8 +742,9 @@ struct pc_interface {
unsigned int exp_table[CLASS_COUNT][2][MAX_LEVEL];
unsigned int max_level[CLASS_COUNT][2];
unsigned int statp[MAX_LEVEL+1];
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1];
-
+#endif
unsigned int equip_pos[EQI_MAX];
/* */
struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index a917ef409..906462c7e 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -2,14 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "pc_groups.h"
-
-#include "atcommand.h" // atcommand->exists(), atcommand->load_groups()
-#include "clif.h" // clif->GM_kick()
-#include "map.h" // mapiterator
-#include "pc.h" // pc->set_group()
#include "../common/cbasetypes.h"
#include "../common/conf.h"
#include "../common/db.h"
@@ -18,6 +10,12 @@
#include "../common/showmsg.h"
#include "../common/strlib.h" // strcmp
+#include "pc_groups.h"
+#include "atcommand.h" // atcommand->exists(), atcommand->load_groups()
+#include "clif.h" // clif->GM_kick()
+#include "map.h" // mapiterator
+#include "pc.h" // pc->set_group()
+
static GroupSettings dummy_group; ///< dummy group used in dummy map sessions @see pc_get_dummy_sd()
struct pc_groups_interface pcg_s;
diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h
index 7c8cdd82a..5c03f999f 100644
--- a/src/map/pc_groups.h
+++ b/src/map/pc_groups.h
@@ -5,10 +5,6 @@
#ifndef _MAP_PC_GROUPS_H_
#define _MAP_PC_GROUPS_H_
-#include "../common/cbasetypes.h"
-#include "../common/conf.h"
-#include "../common/db.h"
-
/// PC permissions
enum e_pc_permission {
PC_PERM_NONE = 0, // #0
diff --git a/src/map/pet.c b/src/map/pet.c
index aa2be4473..993497434 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -2,39 +2,37 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "pet.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/db.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/ers.h"
-#include "atcommand.h" // msg_txt()
-#include "battle.h"
-#include "chrif.h"
-#include "clif.h"
+#include "pc.h"
+#include "status.h"
+#include "map.h"
+#include "path.h"
#include "intif.h"
+#include "clif.h"
+#include "chrif.h"
+#include "pet.h"
#include "itemdb.h"
-#include "log.h"
-#include "map.h"
+#include "battle.h"
#include "mob.h"
#include "npc.h"
-#include "path.h"
-#include "pc.h"
#include "script.h"
#include "skill.h"
-#include "status.h"
#include "unit.h"
-#include "../common/db.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+#include "atcommand.h" // msg_txt()
+#include "log.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct pet_interface pet_s;
diff --git a/src/map/pet.h b/src/map/pet.h
index 8dde0fac2..4ec30b3fb 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -5,14 +5,8 @@
#ifndef _MAP_PET_H_
#define _MAP_PET_H_
-#include "map.h" // struct block_list
-#include "status.h" // enum sc_type
-#include "unit.h" // struct unit_data
-#include "../common/cbasetypes.h"
-#include "../common/mmo.h" // NAME_LENGTH, struct s_pet
-
-#define MAX_PET_DB 300
-#define MAX_PETLOOT_SIZE 30
+#define MAX_PET_DB 300
+#define MAX_PETLOOT_SIZE 30
struct s_pet_db {
short class_;
diff --git a/src/map/quest.c b/src/map/quest.c
index b76d6bc82..bde276f9d 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -2,37 +2,36 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "map.h"
+#include "pc.h"
+#include "npc.h"
+#include "itemdb.h"
+#include "script.h"
+#include "intif.h"
+#include "battle.h"
+#include "mob.h"
+#include "party.h"
+#include "unit.h"
+#include "log.h"
+#include "clif.h"
#include "quest.h"
+#include "chrif.h"
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <time.h>
-#include "battle.h"
-#include "chrif.h"
-#include "clif.h"
-#include "intif.h"
-#include "itemdb.h"
-#include "log.h"
-#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
-#include "pc.h"
-#include "script.h"
-#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
struct quest_interface quest_s;
diff --git a/src/map/quest.h b/src/map/quest.h
index 87894d639..e01e35619 100644
--- a/src/map/quest.h
+++ b/src/map/quest.h
@@ -5,10 +5,6 @@
#ifndef _MAP_QUEST_H_
#define _MAP_QUEST_H_
-#include "map.h" // TBL_PC
-#include "../common/cbasetypes.h"
-#include "../common/mmo.h" // MAX_QUEST_OBJECTIVES
-
#define MAX_QUEST_DB (60355+1) // Highest quest ID + 1
struct quest_db {
diff --git a/src/map/script.c b/src/map/script.c
index 068be8524..4d77c506b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2,46 +2,6 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // NEW_CARTS, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT, SECURE_NPCTIMEOUT_INTERVAL
-#include "script.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "atcommand.h"
-#include "battle.h"
-#include "battleground.h"
-#include "chat.h"
-#include "chrif.h"
-#include "clif.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
-#include "instance.h"
-#include "intif.h"
-#include "itemdb.h"
-#include "log.h"
-#include "mail.h"
-#include "map.h"
-#include "mapreg.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
-#include "path.h"
-#include "pc.h"
-#include "pet.h"
-#include "pet.h"
-#include "quest.h"
-#include "skill.h"
-#include "status.h"
-#include "status.h"
-#include "storage.h"
-#include "unit.h"
#include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/md5calc.h"
@@ -50,10 +10,47 @@
#include "../common/showmsg.h"
#include "../common/socket.h" // usage: getcharip
#include "../common/strlib.h"
-#include "../common/sysinfo.h"
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/sysinfo.h"
+
+#include "map.h"
+#include "path.h"
+#include "clif.h"
+#include "chrif.h"
+#include "itemdb.h"
+#include "pc.h"
+#include "status.h"
+#include "storage.h"
+#include "mob.h"
+#include "npc.h"
+#include "pet.h"
+#include "mapreg.h"
+#include "homunculus.h"
+#include "instance.h"
+#include "mercenary.h"
+#include "intif.h"
+#include "skill.h"
+#include "status.h"
+#include "chat.h"
+#include "battle.h"
+#include "battleground.h"
+#include "party.h"
+#include "guild.h"
+#include "atcommand.h"
+#include "log.h"
+#include "unit.h"
+#include "pet.h"
+#include "mail.h"
+#include "script.h"
+#include "quest.h"
+#include "elemental.h"
+#include "../config/core.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
#ifndef WIN32
#include <sys/time.h>
#endif
diff --git a/src/map/script.h b/src/map/script.h
index 899c745da..90b18d87f 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -5,19 +5,17 @@
#ifndef _MAP_SCRIPT_H_
#define _MAP_SCRIPT_H_
+#include "../common/strlib.h" //StringBuf
+#include "../common/cbasetypes.h"
+#include "map.h" //EVENT_NAME_LENGTH
+
#include <setjmp.h>
#include <errno.h>
-#include "map.h" //EVENT_NAME_LENGTH
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/mmo.h" // struct item
-#include "../common/sql.h" // Sql
-#include "../common/strlib.h" //StringBuf
-
/**
* Declarations
**/
+struct map_session_data;
struct eri;
/**
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index 72b28aacd..0144aea93 100644
--- a/src/map/searchstore.c
+++ b/src/map/searchstore.c
@@ -2,17 +2,14 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "searchstore.h" // struct s_search_store_info
-
-#include "battle.h" // battle_config.*
-#include "clif.h" // clif->open_search_store_info, clif->search_store_info_*
-#include "pc.h" // struct map_session_data
#include "../common/cbasetypes.h"
#include "../common/malloc.h" // aMalloc, aRealloc, aFree
#include "../common/showmsg.h" // ShowError, ShowWarning
#include "../common/strlib.h" // safestrncpy
+#include "battle.h" // battle_config.*
+#include "clif.h" // clif->open_search_store_info, clif->search_store_info_*
+#include "pc.h" // struct map_session_data
+#include "searchstore.h" // struct s_search_store_info
struct searchstore_interface searchstore_s;
diff --git a/src/map/searchstore.h b/src/map/searchstore.h
index c9b93ba54..827e39053 100644
--- a/src/map/searchstore.h
+++ b/src/map/searchstore.h
@@ -5,12 +5,6 @@
#ifndef _MAP_SEARCHSTORE_H_
#define _MAP_SEARCHSTORE_H_
-#include <time.h>
-
-#include "map.h" // MESSAGE_SIZE
-#include "../common/cbasetypes.h"
-#include "../common/mmo.h" // MAX_SLOTS
-
/**
* Defines
**/
diff --git a/src/map/skill.c b/src/map/skill.c
index b2e94ec79..c8388770a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2,48 +2,46 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // DBPATH, MAGIC_REFLECTION_TYPE, OFFICIAL_WALKPATH, RENEWAL, RENEWAL_CAST, VARCAST_REDUCTION()
-#include "skill.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/ers.h"
-#include "battle.h"
-#include "battleground.h"
-#include "chrif.h"
+#include "map.h"
+#include "path.h"
#include "clif.h"
-#include "date.h"
-#include "elemental.h"
-#include "guild.h"
+#include "pc.h"
+#include "status.h"
+#include "skill.h"
+#include "pet.h"
#include "homunculus.h"
-#include "intif.h"
-#include "itemdb.h"
-#include "log.h"
-#include "map.h"
#include "mercenary.h"
+#include "elemental.h"
#include "mob.h"
#include "npc.h"
+#include "battle.h"
+#include "battleground.h"
#include "party.h"
-#include "path.h"
-#include "pc.h"
-#include "pet.h"
+#include "itemdb.h"
#include "script.h"
-#include "status.h"
+#include "intif.h"
+#include "log.h"
+#include "chrif.h"
+#include "guild.h"
+#include "date.h"
#include "unit.h"
-#include "../common/cbasetypes.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+
#define SKILLUNITTIMER_INTERVAL 100
diff --git a/src/map/skill.h b/src/map/skill.h
index b6dbb1fcb..dda310bd4 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -5,23 +5,19 @@
#ifndef _MAP_SKILL_H_
#define _MAP_SKILL_H_
-#include "../config/core.h" // RENEWAL_CAST
-
-#include "map.h" // struct block_list
-#include "status.h" // enum sc_type
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
#include "../common/mmo.h" // MAX_SKILL, struct square
+#include "../common/db.h"
+#include "map.h" // struct block_list
/**
* Declarations
**/
-struct homun_data;
struct map_session_data;
-struct mercenary_data;
+struct homun_data;
struct skill_unit;
-struct square;
+struct skill_unit_group;
struct status_change_entry;
+struct square;
/**
* Defines
diff --git a/src/map/status.c b/src/map/status.c
index eb06138da..4c2bc6d22 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2,46 +2,43 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // ANTI_MAYAP_CHEAT, DBPATH, DEFTYPE_MAX, DEFTYPE_MIN, DEVOTION_REFLECT_DAMAGE, RENEWAL, RENEWAL_ASPD, RENEWAL_EDP
-#include "status.h"
-
-#include <math.h>
-#include <memory.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/malloc.h"
+#include "../common/utils.h"
+#include "../common/ers.h"
+#include "../common/strlib.h"
-#include "battle.h"
-#include "chrif.h"
-#include "clif.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
-#include "itemdb.h"
#include "map.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "npc.h"
#include "path.h"
#include "pc.h"
#include "pet.h"
-#include "script.h"
+#include "npc.h"
+#include "mob.h"
+#include "clif.h"
+#include "guild.h"
#include "skill.h"
+#include "itemdb.h"
+#include "battle.h"
+#include "chrif.h"
#include "skill.h"
+#include "status.h"
+#include "script.h"
#include "unit.h"
+#include "homunculus.h"
+#include "mercenary.h"
+#include "elemental.h"
#include "vending.h"
-#include "../common/cbasetypes.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <string.h>
+#include <math.h>
struct status_interface status_s;
diff --git a/src/map/status.h b/src/map/status.h
index baa586297..e47c2b365 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -5,18 +5,14 @@
#ifndef _MAP_STATUS_H_
#define _MAP_STATUS_H_
-#include "../config/core.h" // defType, NEW_CARTS, RENEWAL, RENEWAL_ASPD
-
-#include "../common/cbasetypes.h"
#include "../common/mmo.h"
struct block_list;
-struct elemental_data;
-struct homun_data;
-struct mercenary_data;
struct mob_data;
-struct npc_data;
struct pet_data;
+struct homun_data;
+struct mercenary_data;
+struct status_change;
//Change the equation when the values are high enough to discard the
//imprecision in exchange of overflow protection [Skotlex]
@@ -1882,7 +1878,11 @@ struct status_interface {
int hp_coefficient2[CLASS_COUNT];
int hp_sigma_val[CLASS_COUNT][MAX_LEVEL+1];
int sp_coefficient[CLASS_COUNT];
- int aspd_base[CLASS_COUNT][MAX_WEAPON_TYPE+1]; // +1 for RENEWAL_ASPD
+#ifdef RENEWAL_ASPD
+ int aspd_base[CLASS_COUNT][MAX_WEAPON_TYPE+1];
+#else
+ int aspd_base[CLASS_COUNT][MAX_WEAPON_TYPE]; //[blackhole89]
+#endif
sc_type Skill2SCTable[MAX_SKILL]; // skill -> status
int IconChangeTable[SC_MAX]; // status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated)
unsigned int ChangeFlagTable[SC_MAX]; // status -> flags
diff --git a/src/map/storage.c b/src/map/storage.c
index 2db5fff3d..e65ed7b80 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -2,29 +2,27 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/cbasetypes.h"
+#include "../common/db.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "map.h" // struct map_session_data
#include "storage.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "atcommand.h"
-#include "battle.h"
#include "chrif.h"
+#include "itemdb.h"
#include "clif.h"
-#include "guild.h"
#include "intif.h"
-#include "itemdb.h"
-#include "log.h"
-#include "map.h" // struct map_session_data
#include "pc.h"
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
+#include "guild.h"
+#include "battle.h"
+#include "atcommand.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
struct storage_interface storage_s;
struct guild_storage_interface gstorage_s;
diff --git a/src/map/storage.h b/src/map/storage.h
index 5edb68cfc..8f9f904f6 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -5,12 +5,11 @@
#ifndef _MAP_STORAGE_H_
#define _MAP_STORAGE_H_
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-
+struct storage_data;
struct guild_storage;
struct item;
struct map_session_data;
+struct DBMap;
struct storage_interface {
/* */
diff --git a/src/map/trade.c b/src/map/trade.c
index 83426c407..44b669ebd 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -2,27 +2,25 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
+#include "../common/nullpo.h"
+#include "../common/socket.h"
#include "trade.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "atcommand.h"
-#include "battle.h"
-#include "chrif.h"
#include "clif.h"
-#include "intif.h"
#include "itemdb.h"
-#include "log.h"
#include "map.h"
-#include "npc.h"
#include "path.h"
#include "pc.h"
+#include "npc.h"
+#include "battle.h"
+#include "chrif.h"
#include "storage.h"
-#include "../common/nullpo.h"
-#include "../common/socket.h"
+#include "intif.h"
+#include "atcommand.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <string.h>
struct trade_interface trade_s;
diff --git a/src/map/unit.c b/src/map/unit.c
index 0ad770e80..151d4bad5 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2,48 +2,45 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "../config/core.h" // RENEWAL_CAST
-#include "unit.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../common/showmsg.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/db.h"
+#include "../common/malloc.h"
+#include "../common/random.h"
+#include "../common/HPM.h"
-#include "battle.h"
-#include "battleground.h"
-#include "chat.h"
-#include "chrif.h"
-#include "clif.h"
-#include "duel.h"
-#include "elemental.h"
-#include "guild.h"
-#include "homunculus.h"
-#include "instance.h"
-#include "intif.h"
#include "map.h"
-#include "mercenary.h"
-#include "mob.h"
-#include "npc.h"
-#include "party.h"
#include "path.h"
#include "pc.h"
+#include "mob.h"
#include "pet.h"
-#include "script.h"
+#include "homunculus.h"
+#include "instance.h"
+#include "mercenary.h"
+#include "elemental.h"
#include "skill.h"
+#include "clif.h"
+#include "duel.h"
+#include "npc.h"
+#include "guild.h"
#include "status.h"
-#include "storage.h"
+#include "unit.h"
+#include "battle.h"
+#include "battleground.h"
+#include "chat.h"
#include "trade.h"
#include "vending.h"
-#include "../common/HPM.h"
-#include "../common/db.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/random.h"
-#include "../common/showmsg.h"
-#include "../common/socket.h"
-#include "../common/timer.h"
+#include "party.h"
+#include "intif.h"
+#include "chrif.h"
+#include "script.h"
+#include "storage.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
const short dirx[8]={0,-1,-1,-1,0,1,1,1};
const short diry[8]={1,1,0,-1,-1,-1,0,1};
diff --git a/src/map/unit.h b/src/map/unit.h
index 9e05647b1..33fa4e052 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -5,13 +5,15 @@
#ifndef _MAP_UNIT_H_
#define _MAP_UNIT_H_
+//#include "map.h"
+struct block_list;
+struct unit_data;
+struct map_session_data;
+
#include "clif.h" // clr_type
+#include "map.h" // struct block_list
#include "path.h" // struct walkpath_data
-#include "skill.h" // 'MAX_SKILLTIMERSKILL, struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset
-#include "../common/cbasetypes.h"
-
-struct map_session_data;
-struct block_list;
+#include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset
struct unit_data {
struct block_list *bl;
diff --git a/src/map/vending.c b/src/map/vending.c
index c8ac814db..9462975b3 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -2,27 +2,24 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#define HERCULES_CORE
-
-#include "vending.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "atcommand.h"
-#include "battle.h"
-#include "chrif.h"
+#include "../common/nullpo.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
#include "clif.h"
#include "itemdb.h"
-#include "log.h"
+#include "atcommand.h"
#include "map.h"
-#include "npc.h"
#include "path.h"
+#include "chrif.h"
+#include "vending.h"
#include "pc.h"
+#include "npc.h"
#include "skill.h"
-#include "../common/nullpo.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
+#include "battle.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <string.h>
struct vending_interface vending_s;
diff --git a/src/map/vending.h b/src/map/vending.h
index a70726374..a212f8385 100644
--- a/src/map/vending.h
+++ b/src/map/vending.h
@@ -7,7 +7,6 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
-
struct map_session_data;
struct s_search_store_search;
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index 96d51aec6..85d5fb548 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -1,14 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#define HERCULES_CORE
-
-#include "../config/core.h" // RENEWAL
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
#include "../common/grfio.h"
#include "../common/malloc.h"
@@ -16,6 +8,12 @@
#include "../common/showmsg.h"
#include "../common/utils.h"
+#include "../config/renewal.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#ifndef _WIN32
#include <unistd.h>
#endif