summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-19 12:55:29 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-19 12:55:29 +0000
commit3c89751e48a424ce26bc1c6f78f4bf7fb6242fac (patch)
tree3c8b08a06bfe053c32d6312092576db372fc757e /src
parent2a2455a8ac012ef30c85c07d0ad5dd39307acae4 (diff)
downloadhercules-3c89751e48a424ce26bc1c6f78f4bf7fb6242fac.tar.gz
hercules-3c89751e48a424ce26bc1c6f78f4bf7fb6242fac.tar.bz2
hercules-3c89751e48a424ce26bc1c6f78f4bf7fb6242fac.tar.xz
hercules-3c89751e48a424ce26bc1c6f78f4bf7fb6242fac.zip
* Cleaned/clarified some #include relationships between headers
* Changed clif_sitting() to use 'bl' instead of 'sd' (for non-player objects) * Removed way messed-up script function 'unitdeadsit' * Tagged 'FIXME' lines written by myself git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11040 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c10
-rw-r--r--src/map/atcommand.h3
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/charcommand.c10
-rw-r--r--src/map/chat.c1
-rw-r--r--src/map/chrif.c8
-rw-r--r--src/map/clif.c69
-rw-r--r--src/map/clif.h17
-rw-r--r--src/map/guild.c9
-rw-r--r--src/map/guild.h6
-rw-r--r--src/map/intif.c15
-rw-r--r--src/map/irc.h3
-rw-r--r--src/map/itemdb.c9
-rw-r--r--src/map/log.c9
-rw-r--r--src/map/log.h4
-rw-r--r--src/map/mail.c9
-rw-r--r--src/map/map.c22
-rw-r--r--src/map/mercenary.c11
-rw-r--r--src/map/mob.c13
-rw-r--r--src/map/mob.h14
-rw-r--r--src/map/npc.c5
-rw-r--r--src/map/npc.h9
-rw-r--r--src/map/npc_chat.c1
-rw-r--r--src/map/party.c11
-rw-r--r--src/map/party.h13
-rw-r--r--src/map/path.c9
-rw-r--r--src/map/pc.c53
-rw-r--r--src/map/pc.h11
-rw-r--r--src/map/pet.c11
-rw-r--r--src/map/script.c41
-rw-r--r--src/map/skill.c13
-rw-r--r--src/map/skill.h4
-rw-r--r--src/map/status.c15
-rw-r--r--src/map/status.h2
-rw-r--r--src/map/storage.c12
-rw-r--r--src/map/storage.h13
-rw-r--r--src/map/trade.c7
-rw-r--r--src/map/trade.h4
-rw-r--r--src/map/unit.c9
-rw-r--r--src/map/unit.h4
-rw-r--r--src/map/vending.c7
-rw-r--r--src/map/vending.h3
42 files changed, 258 insertions, 242 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c179451d8..b57f2bd75 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1,11 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
#include "../common/cbasetypes.h"
#include "../common/mmo.h"
#include "../common/timer.h"
@@ -42,6 +37,11 @@
#include "mail.h"
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
char atcommand_symbol = '@'; // first char of the commands (by [Yor])
char *msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index a4fd609d2..e5b00046c 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -10,7 +10,8 @@
//Note: The range is unlimited unless this define is set.
//#define AUTOLOOT_DISTANCE AREA_SIZE
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
enum AtCommandType {
AtCommand_None = -1,
diff --git a/src/map/battle.c b/src/map/battle.c
index fe7f238c3..a0ca94e75 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <math.h>
+
int attr_fix_table[4][ELE_MAX][ELE_MAX];
struct Battle_Config battle_config;
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 008c01a5d..9154048ac 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1,11 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
#include "../common/cbasetypes.h"
#include "../common/socket.h"
#include "../common/timer.h"
@@ -34,6 +29,11 @@
#include "trade.h"
#include "unit.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
char charcommand_symbol = '#';
extern char *msg_table[1000]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
diff --git a/src/map/chat.c b/src/map/chat.c
index 3e8ebeb2c..1f8166871 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <string.h>
+
int chat_triggerevent(struct chat_data *cd); // forward declaration
/// Initializes a chatroom object (common functionality for both pc and npc chatrooms).
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 74733b548..9513c7ea7 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -320,7 +320,7 @@ int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int c
if (sd == NULL || sd->status.char_id != char_id)
return -1;
- if (login_id1 == 1) { //FIXME: charserver says '0'!
+ if (login_id1 == 1) { //FIXME: charserver says '0'! [ultramage]
if (battle_config.error_log)
ShowError("map server change failed.\n");
clif_authfail_fd(sd->fd, 0);
@@ -507,6 +507,7 @@ int auth_db_cleanup(int tid, unsigned int tick, int id, int data)
return 0;
}
+
/*==========================================
*
*------------------------------------------*/
@@ -929,7 +930,8 @@ int chrif_reloadGMdb(void)
*------------------------------------------*/
int chrif_recvgmaccounts(int fd)
{
- ShowInfo("From login-server: receiving information of '"CL_WHITE"%d"CL_RESET"' GM accounts.\n", pc_read_gm_account(fd));
+ int nAccounts = pc_read_gm_account(fd);
+ ShowInfo("From login-server: receiving information of '"CL_WHITE"%d"CL_RESET"' GM accounts.\n", nAccounts);
return 0;
}
@@ -1288,6 +1290,8 @@ int chrif_parse(int fd)
if ((int)RFIFOREST(fd) < packet_len)
return 0;
+ //ShowDebug("Received packet 0x%4x (%d bytes) from char-server (connection %d)\n", RFIFOW(fd,0), packet_len, fd);
+
switch(cmd)
{
case 0x2af9: chrif_connectack(fd); break;
diff --git a/src/map/clif.c b/src/map/clif.c
index b4975ff22..cede06761 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -711,7 +711,7 @@ int clif_clearunit_delayed(struct block_list* bl, unsigned int tick)
return 0;
}
-void clif_get_weapon_view(TBL_PC* sd, unsigned short *rhand, unsigned short *lhand)
+void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand)
{
#if PACKETVER > 3
struct item_data *id;
@@ -895,9 +895,9 @@ static int clif_set0078(struct block_list* bl, unsigned char* buf)
WBUFW(buf,42)=sc->opt3;
}
WBUFW(buf,14)=vd->class_;
- WBUFW(buf,16)=vd->hair_style; //Required for pets (removes attack cursor)
+ WBUFW(buf,16)=vd->hair_style; //Required for pets (removes attack cursor)
//18W: Weapon
- WBUFW(buf,20)=vd->head_bottom; //Pet armor (ignored by client)
+ WBUFW(buf,20)=vd->head_bottom; //Pet armor (ignored by client)
if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS)
{ //The hell, why flags work like this?
WBUFL(buf,22)=emblem_id;
@@ -1068,7 +1068,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFW(buf,16)=vd->class_;
WBUFW(buf,18)=vd->hair_style; //Required for pets (removes attack cursor)
//20L: Weapon/Shield
- WBUFW(buf,24)=vd->head_bottom; //Pet armor
+ WBUFW(buf,24)=vd->head_bottom; //Pet armor
WBUFL(buf,26)=gettick();
//30W: Head top
//32W: Head mid
@@ -1098,7 +1098,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFW(buf,46)=sc->opt3;
}
WBUFW(buf,14)=vd->class_;
- WBUFW(buf,16)=vd->hair_style; //For pets (disables mob attack cursor)
+ WBUFW(buf,16)=vd->hair_style; //Required for pets (removes attack cursor)
//18W: Weapon
WBUFW(buf,20)=vd->head_bottom; //Pet armor
WBUFL(buf,22)=gettick();
@@ -1315,10 +1315,9 @@ int clif_spawn(struct block_list *bl)
WBUFW(buf,10)=sc->opt2;
WBUFW(buf,12)=sc->option;
}
- WBUFW(buf,14)=vd->hair_style; //For pets (disables mob attack cursor)
- //14W: Hair Style
+ WBUFW(buf,14)=vd->hair_style; //Required for pets (removes attack cursor)
//16W: Weapon
- WBUFW(buf,18)=vd->head_bottom; //Pet armor (ignored by client)
+ WBUFW(buf,18)=vd->head_bottom; //Pet armor (ignored by client)
WBUFW(buf,20)=vd->class_;
//22W: Shield
//24W: Head top
@@ -1364,7 +1363,7 @@ int clif_spawn(struct block_list *bl)
}
break;
case BL_PET:
- if (vd->head_bottom) //Pet armor display fix.
+ if (vd->head_bottom)
clif_pet_equip_area((TBL_PET*)bl); // needed to display pet equip properly
break;
}
@@ -3713,7 +3712,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
clif_refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF);
switch (bl->type)
- { // FIXME: 'AREA' causes unneccessary spam since this should be 1:1 communication
+ { // FIXME: 'AREA' causes unneccessary spam since this should be 1:1 communication [ultramage]
case BL_PC:
{
TBL_PC* tsd = (TBL_PC*)bl;
@@ -3740,8 +3739,8 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
}
break;
case BL_PET:
- if (vd->head_bottom) //Pet armor display fix.
- clif_pet_equip(sd, (TBL_PET*)bl);
+ if (vd->head_bottom)
+ clif_pet_equip(sd, (TBL_PET*)bl); // needed to display pet equip properly
break;
}
}
@@ -3858,42 +3857,40 @@ void clif_takeitem(struct block_list* src, struct block_list* dst)
}
/*==========================================
- * inform clients in area that `sd` is sitting
+ * inform clients in area that `bl` is sitting
*------------------------------------------*/
-void clif_sitting(struct map_session_data* sd)
+void clif_sitting(struct block_list* bl)
{
unsigned char buf[32];
-
- nullpo_retv(sd);
+ nullpo_retv(bl);
WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = sd->bl.id;
+ WBUFL(buf, 2) = bl->id;
WBUFB(buf,26) = 2;
- clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
+ clif_send(buf, packet_len(0x8a), bl, AREA);
- if(disguised(&sd->bl)) {
- WBUFL(buf, 2) = -sd->bl.id;
- clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
+ if(disguised(bl)) {
+ WBUFL(buf, 2) = - bl->id;
+ clif_send(buf, packet_len(0x8a), bl, SELF);
}
}
/*==========================================
- * inform clients in area that `sd` is standing
+ * inform clients in area that `bl` is standing
*------------------------------------------*/
-void clif_standing(struct map_session_data* sd)
+void clif_standing(struct block_list* bl)
{
unsigned char buf[32];
-
- nullpo_retv(sd);
+ nullpo_retv(bl);
WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = sd->bl.id;
+ WBUFL(buf, 2) = bl->id;
WBUFB(buf,26) = 3;
- clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
+ clif_send(buf, packet_len(0x8a), bl, AREA);
- if(disguised(&sd->bl)) {
- WBUFL(buf, 2) = -sd->bl.id;
- clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
+ if(disguised(bl)) {
+ WBUFL(buf, 2) = - bl->id;
+ clif_send(buf, packet_len(0x8a), bl, SELF);
}
}
@@ -6115,7 +6112,7 @@ int clif_sendegg(struct map_session_data *sd)
* type = 5 -> param = hairstyle number
* If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player.
*------------------------------------------*/
-int clif_send_petdata(struct map_session_data *sd, struct pet_data* pd, int type, int param)
+int clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param)
{
uint8 buf[16];
nullpo_retr(0, pd);
@@ -8675,7 +8672,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if(pc_issit(sd)) {
//Bugged client? Just refresh them.
- clif_sitting(sd);
+ clif_sitting(&sd->bl);
return;
}
@@ -8690,17 +8687,17 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
pc_setsit(sd);
skill_sit(sd,1);
- clif_sitting(sd);
+ clif_sitting(&sd->bl);
break;
case 0x03: // standup
if (!pc_issit(sd)) {
//Bugged client? Just refresh them.
- clif_standing(sd);
+ clif_standing(&sd->bl);
return;
}
pc_setstand(sd);
skill_sit(sd,0);
- clif_standing(sd);
+ clif_standing(&sd->bl);
break;
}
}
@@ -10834,7 +10831,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd)
WFIFOSET(fd, packet_len(0x0d1));
//Sort the ignore list.
- //FIXME: why not just use a simple shift-and-insert scheme instead?
+ //FIXME: why not just use a simple shift-and-insert scheme instead? [ultramage]
qsort (sd->ignore[0].name, MAX_IGNORE_LIST, sizeof(sd->ignore[0].name), pstrcmp);
}
else
diff --git a/src/map/clif.h b/src/map/clif.h
index 0037b832c..6dbb7f59c 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -4,7 +4,16 @@
#ifndef _CLIF_H_
#define _CLIF_H_
-#include "map.h"
+#include "../common/cbasetypes.h"
+//#include "../common/mmo.h"
+struct storage;
+struct guild_storage;
+//#include "map.h"
+struct block_list;
+struct map_session_data;
+struct homun_data;
+struct unit_data;
+struct flooritem_data;
// server->client protocol version
// v7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
@@ -102,8 +111,8 @@ int clif_updatestatus(struct map_session_data*,int); //self
int clif_changestatus(struct block_list*,int,int); //area
int clif_damage(struct block_list* src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2); // area
void clif_takeitem(struct block_list* src,struct block_list* dst);
-void clif_sitting(struct map_session_data* sd);
-void clif_standing(struct map_session_data* sd);
+void clif_sitting(struct block_list* bl);
+void clif_standing(struct block_list* bl);
int clif_changelook(struct block_list *,int,int); // area
void clif_changetraplook(struct block_list *bl,int val); // area
void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area); //area specified in 'area'
@@ -346,7 +355,7 @@ int clif_timedout(struct map_session_data *sd);
int clif_disp_overhead(struct map_session_data *sd, const char* mes);
-void clif_get_weapon_view(TBL_PC* sd, unsigned short *rhand, unsigned short *lhand);
+void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand);
int clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
void clif_gospel_info(struct map_session_data *sd, int type);
diff --git a/src/map/guild.c b/src/map/guild.c
index b1a8ea8a2..462f2cd76 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -27,6 +23,11 @@
#include "skill.h"
#include "log.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
static DB guild_db;
static DB castle_db;
static DB guild_expcache_db;
diff --git a/src/map/guild.h b/src/map/guild.h
index 07a4b2520..f1bb836ea 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -4,12 +4,14 @@
#ifndef _GUILD_H_
#define _GUILD_H_
-struct map_session_data;
-struct mob_data;
+//#include "../common/mmo.h"
struct guild;
struct guild_member;
struct guild_position;
struct guild_castle;
+//#include "map.h"
+struct map_session_data;
+struct mob_data;
int guild_skill_get_max(int id);
diff --git a/src/map/intif.c b/src/map/intif.c
index 8e66c0e1e..9e7effef3 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1,13 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/timer.h"
@@ -26,6 +19,14 @@
#include "atcommand.h"
#include "mercenary.h" //albator
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <string.h>
+
+
static const int packet_len_table[]={
-1,-1,27,-1, -1, 0,37, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
-1, 7, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810
diff --git a/src/map/irc.h b/src/map/irc.h
index 1cf02692c..c1970fb0e 100644
--- a/src/map/irc.h
+++ b/src/map/irc.h
@@ -4,7 +4,8 @@
#ifndef _IRC_H_
#define _IRC_H_
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
// IRC .conf file [Zido]
#define IRC_CONF "irc_athena.conf"
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 4e93dc309..1ba86cbc4 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/nullpo.h"
#include "../common/malloc.h"
#include "../common/showmsg.h"
@@ -15,6 +11,11 @@
#include "script.h" // item script processing
#include "pc.h" // W_MUSICAL, W_WHIP
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
static struct dbt* item_db;
static struct item_group itemgroup_db[MAX_ITEMGROUP];
diff --git a/src/map/log.c b/src/map/log.c
index 97726bb6e..e1e35f63d 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
#include "../common/strlib.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -13,6 +9,11 @@
#include "log.h"
#include "battle.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
struct Log_Config log_config;
char timestring[255];
diff --git a/src/map/log.h b/src/map/log.h
index 0e03bf0d8..53fa9dd7c 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -4,7 +4,9 @@
#ifndef _LOG_H_
#define _LOG_H_
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
+struct mob_data;
#ifndef TXT_ONLY
diff --git a/src/map/mail.c b/src/map/mail.c
index 65d6ed3f3..8433fbada 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -6,10 +6,6 @@
// Created by Valaris
// moved all strings to msg_athena.conf [Lupus]
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/strlib.h"
#include "../common/socket.h"
#include "../common/timer.h"
@@ -24,6 +20,11 @@
#include "pc.h"
#include "mail.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
int MAIL_CHECK_TIME = 120000;
int mail_timer;
//extern char *msg_table[1000]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
diff --git a/src/map/map.c b/src/map/map.c
index 971ffc9f0..b2e0fc376 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1,22 +1,12 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <math.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
#include "../common/cbasetypes.h"
#include "../common/core.h"
#include "../common/timer.h"
#include "../common/grfio.h"
#include "../common/malloc.h"
-#include "../common/socket.h"
+#include "../common/socket.h" // WFIFO*()
#include "../common/showmsg.h"
#include "../common/version.h"
#include "../common/nullpo.h"
@@ -49,6 +39,16 @@
#include "irc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <math.h>
+
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
#ifndef TXT_ONLY
#include "mail.h"
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index ba2898be1..ace039824 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -1,11 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
#include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/socket.h"
@@ -36,6 +31,12 @@
#include "mercenary.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+
//Better equiprobability than rand()% [orn]
#define rand(a, b) (a+(int) ((float)(b-a+1)*rand()/(RAND_MAX+1.0)))
diff --git a/src/map/mob.c b/src/map/mob.c
index 89642430e..c9b77475e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1,12 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <math.h>
-
#include "../common/cbasetypes.h"
#include "../common/timer.h"
#include "../common/db.h"
@@ -35,6 +29,13 @@
#include "date.h"
#include "irc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <math.h>
+
+
#define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME)
#define MOB_LAZYSKILLPERC 10 // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute)
diff --git a/src/map/mob.h b/src/map/mob.h
index 71abe8d8d..944ab84ac 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -4,18 +4,18 @@
#ifndef _MOB_H_
#define _MOB_H_
-#include "unit.h"
-#include "map.h"
+#include "../common/mmo.h" // struct item
+#include "unit.h" // unit_stop_walking(), unit_stop_attack()
+#include "map.h" // struct status_data, struct view_data, struct mob_skill
#define MAX_RANDOMMONSTER 4
#define MAX_MOB_RACE_DB 6
- /* Change this to increase the table size in your mob_db to accomodate
- a larger mob database. Be sure to note that IDs 4001 to 4048 are reserved for advanced/baby/expanded classes.
- */
+
+// Change this to increase the table size in your mob_db to accomodate a larger mob database.
+// Be sure to note that IDs 4001 to 4048 are reserved for advanced/baby/expanded classes.
#define MAX_MOB_DB 10000
-//The number of drops all mobs have and the max drop-slot that the steal skill
-//will attempt to steal from.
+//The number of drops all mobs have and the max drop-slot that the steal skill will attempt to steal from.
#define MAX_MOB_DROP 10
#define MAX_STEAL_DROP 7
diff --git a/src/map/npc.c b/src/map/npc.c
index 352161189..40df4b678 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -31,7 +31,6 @@
#include <time.h>
-
// linked list of npc source files
struct npc_src_list {
struct npc_src_list* next;
@@ -1102,7 +1101,7 @@ int npc_checknear2(struct map_session_data* sd, struct block_list* bl)
return 0;
}
-TBL_NPC* npc_checknear(struct map_session_data* sd, struct block_list* bl)
+struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl)
{
struct npc_data *nd;
@@ -2808,7 +2807,7 @@ void npc_parsesrcfile(const char* name)
return;
}
-int npc_script_event(TBL_PC* sd, int type)
+int npc_script_event(struct map_session_data* sd, int type)
{
int i;
if (type < 0 || type >= NPCE_MAX)
diff --git a/src/map/npc.h b/src/map/npc.h
index 2ce21d473..9b3c5782b 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -4,7 +4,10 @@
#ifndef _NPC_H_
#define _NPC_H_
-#include "map.h" // TBL_NPC
+//#include "map.h"
+struct block_list;
+struct npc_data;
+struct view_data;
#define START_NPC_NUM 110000000
@@ -47,7 +50,7 @@ int npc_touch_areanpc2(struct block_list* bl); // [Skotlex]
int npc_check_areanpc(int flag, int m, int x, int y, int range);
int npc_click(struct map_session_data* sd, struct npc_data* nd);
int npc_scriptcont(struct map_session_data* sd, int id);
-TBL_NPC* npc_checknear(struct map_session_data* sd, struct block_list* bl);
+struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl);
int npc_checknear2(struct map_session_data* sd, struct block_list* bl);
int npc_buysellsel(struct map_session_data* sd, int id, int type);
int npc_buylist(struct map_session_data* sd,int n, unsigned short* item_list);
@@ -87,7 +90,7 @@ void npc_unload_duplicates (struct npc_data* nd);
int npc_unload(struct npc_data* nd);
int npc_reload(void);
void npc_read_event_script(void);
-int npc_script_event(TBL_PC* sd, int type);
+int npc_script_event(struct map_session_data* sd, int type);
struct npc_data *fake_nd;
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index a1fdae0bc..5094a1d90 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -19,6 +19,7 @@
#include <string.h>
#include <stdarg.h>
+
/**
* Written by MouseJstr in a vision... (2/21/2005)
*
diff --git a/src/map/party.c b/src/map/party.c
index 43835f94f..eeb3d5b9a 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -1,13 +1,9 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
#include "../common/timer.h"
-#include "../common/socket.h"
+#include "../common/socket.h" // last_tick
#include "../common/nullpo.h"
#include "../common/malloc.h"
#include "../common/showmsg.h"
@@ -23,6 +19,11 @@
#include "status.h"
#include "itemdb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
static DB party_db;
int party_share_level = 10;
int party_send_xy_timer(int tid,unsigned int tick,int id,int data);
diff --git a/src/map/party.h b/src/map/party.h
index ac08e8cf2..cb38c9d10 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -4,13 +4,16 @@
#ifndef _PARTY_H_
#define _PARTY_H_
+//#include "map.h"
+struct block_list;
+struct map_session_data;
+struct party;
+struct party_data;
+struct item;
+
#include <stdarg.h>
-#include "map.h"
extern int party_share_level;
-struct party;
-struct map_session_data;
-struct block_list;
void do_init_party(void);
void do_final_party(void);
@@ -41,7 +44,7 @@ int party_check_conflict(struct map_session_data *sd);
int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv);
int party_send_xy_clear(struct party_data *p);
int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
-int party_share_loot(struct party_data* p, TBL_PC* sd, struct item* item_data, int first);
+int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first);
int party_send_dot_remove(struct map_session_data *sd);
int party_sub_count(struct block_list *bl, va_list ap);
int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int type,...);
diff --git a/src/map/path.c b/src/map/path.c
index 471e51e71..da96433ad 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -16,6 +12,11 @@
#include "memwatch.h"
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
//#define PATH_STANDALONETEST
#define MAX_HEAP 150
diff --git a/src/map/pc.c b/src/map/pc.c
index 2ab6fbb0c..e73f0a06e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1,47 +1,44 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
#include "../common/cbasetypes.h"
-#include "../common/socket.h" // [Valaris]
-#include "../common/timer.h"
+#include "../common/core.h" // get_svn_revision()
+#include "../common/malloc.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
-#include "../common/malloc.h"
-#include "../common/core.h"
+#include "../common/socket.h" // RFIFO*()
+#include "../common/timer.h"
-#include "map.h"
+#include "atcommand.h" // get_atcommand_level()
+#include "battle.h" // battle_config
#include "chrif.h"
#include "clif.h"
+#include "date.h" // is_day_of_*()
#include "intif.h"
-#include "pc.h"
-#include "status.h"
-#include "npc.h"
-#include "mob.h"
-#include "pet.h"
-#include "mercenary.h" //orn
#include "itemdb.h"
-#include "script.h"
-#include "battle.h"
-#include "skill.h"
-#include "party.h"
-#include "guild.h"
-#include "chat.h"
-#include "trade.h"
-#include "storage.h"
-#include "vending.h"
-#include "atcommand.h"
#include "log.h"
-#include "date.h"
+#include "map.h"
+#include "mercenary.h" // merc_is_hom_active()
+#include "mob.h" // MAX_MOB_RACE_DB
+#include "npc.h" // fake_nd
+#include "pet.h" // pet_unlocktarget()
+#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 "vending.h" // vending_closevending()
+#include "pc.h"
#ifndef TXT_ONLY // mail system [Valaris]
#include "mail.h"
#endif
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
#define PVP_CALCRANK_INTERVAL 1000 // PVP順位計算の間隔
static unsigned int exp_table[MAX_PC_CLASS][2][MAX_LEVEL];
static unsigned int max_level[MAX_PC_CLASS][2];
@@ -6894,6 +6891,7 @@ int pc_autosave(int tid,unsigned int tick,int id,int data)
int pc_read_gm_account(int fd)
{
+ //FIXME: this implementation is a total failure (direct reading from RFIFO) [ultramage]
int i = 0;
if (gm_account != NULL)
aFree(gm_account);
@@ -6902,7 +6900,6 @@ int pc_read_gm_account(int fd)
for (i = 4; i < RFIFOW(fd,2); i += 5) {
gm_account[GM_num].account_id = RFIFOL(fd,i);
gm_account[GM_num].level = (int)RFIFOB(fd,i+4);
- //printf("GM account: %d -> level %d\n", gm_account[GM_num].account_id, gm_account[GM_num].level);
GM_num++;
}
return GM_num;
diff --git a/src/map/pc.h b/src/map/pc.h
index 7e0a8f7bb..ae7aeeda5 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -4,9 +4,12 @@
#ifndef _PC_H_
#define _PC_H_
-#include "map.h"
-#include "unit.h"
-#include "status.h"
+#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
+#include "../common/timer.h" // INVALID_TIMER
+#include "battle.h" // battle_config
+#include "map.h" // MAX_PC_CLASS, struct map_session_data
+#include "status.h" // OPTION_*
+#include "unit.h" // unit_stop_attack(), unit_stop_walking()
//Update this max as necessary. 53 is the value needed for Super Baby currently
#define MAX_SKILL_TREE 53
@@ -89,7 +92,7 @@ enum {
#define pc_setsit(sd) ((sd)->state.dead_sit = (sd)->vd.dead_sit = 2)
#define pc_isdead(sd) ((sd)->state.dead_sit == 1)
#define pc_issit(sd) ((sd)->vd.dead_sit == 2)
-#define pc_isidle(sd) ((sd)->chatID || (sd)->vender_id || DIFF_TICK(last_tick, sd->idletime) >= battle_config.idle_no_share)
+#define pc_isidle(sd) ((sd)->chatID || (sd)->vender_id || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share)
#define pc_setdir(sd,b,h) ((sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
#define pc_setchatid(sd,n) ((sd)->chatID = n)
#define pc_ishiding(sd) ((sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK))
diff --git a/src/map/pet.c b/src/map/pet.c
index d9743332a..ebfbc6a0e 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/db.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -28,6 +24,11 @@
#include "unit.h"
#include "atcommand.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
#define MIN_PETTHINKTIME 100
struct pet_db pet_db[MAX_PET_DB];
@@ -555,7 +556,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
return 1;
}
- //FIXME: delete taming item here, if this was an item-invoked capture and the item was flagged as delay-consume
+ //FIXME: delete taming item here, if this was an item-invoked capture and the item was flagged as delay-consume [ultramage]
i = search_petDB_index(md->class_,PET_CLASS);
//catch_target_class == 0 is used for universal lures (except bosses for now). [Skotlex]
diff --git a/src/map/script.c b/src/map/script.c
index 472b4e545..86019c40e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8,7 +8,6 @@
//#define DEBUG_HASH
#include "../common/cbasetypes.h"
-#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/malloc.h"
#include "../common/lock.h"
@@ -53,6 +52,7 @@
#include <setjmp.h>
#include <errno.h>
+
///////////////////////////////////////////////////////////////////////////////
//## TODO possible enhancements: [FlavioJS]
// - 'callfunc' supporting labels in the current npc "::LabelName"
@@ -4031,7 +4031,6 @@ BUILDIN_FUNC(unitattack);
BUILDIN_FUNC(unitstop);
BUILDIN_FUNC(unittalk);
BUILDIN_FUNC(unitemote);
-BUILDIN_FUNC(unitdeadsit);
BUILDIN_FUNC(unitskilluseid); // originally by Qamera [celest]
BUILDIN_FUNC(unitskillusepos); // originally by Qamera [celest]
// <--- [zBuffer] List of mob control commands
@@ -4373,7 +4372,6 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(unitstop,"i"),
BUILDIN_DEF(unittalk,"is"),
BUILDIN_DEF(unitemote,"ii"),
- BUILDIN_DEF(unitdeadsit,"ii"),
BUILDIN_DEF(unitskilluseid,"iii?"), // originally by Qamera [Celest]
BUILDIN_DEF(unitskillusepos,"iiiii"), // [Celest]
// <--- [zBuffer] List of mob control commands
@@ -10667,7 +10665,7 @@ BUILDIN_FUNC(soundeffectall)
name = script_getstr(st,2);
type = script_getnum(st,3);
- //FIXME: enumerating map squares (map_foreach) is slower than enumerating the list of online players (map_foreachpc?)
+ //FIXME: enumerating map squares (map_foreach) is slower than enumerating the list of online players (map_foreachpc?) [ultramage]
if(!script_hasdata(st,4))
{ // area around
@@ -13075,41 +13073,6 @@ BUILDIN_FUNC(unitemote)
return 0;
}
-/// Makes the unit do an action
-/// TODO actions
-///
-/// unitdeadsit <unit_id>,<action>;
-BUILDIN_FUNC(unitdeadsit)
-{
- int unit_id;
- int action;
- struct block_list* bl;
-
- unit_id = script_getnum(st,2);
- action = script_getnum(st,3);
-
- bl = map_id2bl(unit_id);
- if( bl != NULL )
- {
- if( action > -1 && action < 4 )
- {
- unsigned char buf[61] = "";
- struct view_data *vd = status_get_viewdata(bl);
- if (vd) vd->dead_sit = action;
- WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = bl->id;
- WBUFB(buf,26) = (unsigned char)action;
- clif_send(buf, 61, bl, AREA);
- } else
- {
- ShowWarning("script:unitdeadsit: %d is not a valid action\n", action);
- return 1;
- }
- }
-
- return 0;
-}
-
/// Makes the unit cast the skill on the target or self if no target is specified
///
/// unitskilluseid <unit_id>,<skill_id>,<skill_lv>{,<target_id>};
diff --git a/src/map/skill.c b/src/map/skill.c
index 668020026..b8abc15c8 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1,11 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
#include "../common/cbasetypes.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -33,6 +28,12 @@
#include "date.h"
#include "unit.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
#define SKILLUNITTIMER_INVERVAL 100
//Guild Skills are shifted to these to make them stick into the skill array.
#define GD_SKILLRANGEMIN 900
@@ -8006,7 +8007,7 @@ static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list
* Determines if a given skill should be made to consume ammo
* when used by the player. [Skotlex]
*------------------------------------------*/
-int skill_isammotype (TBL_PC *sd, int skill)
+int skill_isammotype (struct map_session_data *sd, int skill)
{
return (
battle_config.arrow_decrement==2 &&
diff --git a/src/map/skill.h b/src/map/skill.h
index a612a2798..68b5872f6 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -4,7 +4,7 @@
#ifndef _SKILL_H_
#define _SKILL_H_
-#include "map.h"
+#include "map.h" // MAX_SKILL_LEVEL, ...
#define MAX_SKILL_DB 1100
#define MAX_SKILL_PRODUCE_DB 150
@@ -187,7 +187,7 @@ int skill_tree_get_max( int id, int b_class ); // Celest
const char* skill_get_name( int id ); // [Skotlex]
const char* skill_get_desc( int id ); // [Skotlex]
-int skill_isammotype(TBL_PC *sd, int skill);
+int skill_isammotype(struct map_session_data *sd, int skill);
int skill_castend_id( int tid, unsigned int tick, int id,int data );
int skill_castend_pos( int tid, unsigned int tick, int id,int data );
int skill_castend_map( struct map_session_data *sd,int skill_num, const char *map);
diff --git a/src/map/status.c b/src/map/status.c
index 21ab964a5..a08595952 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1,12 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <string.h>
-
#include "../common/cbasetypes.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -29,6 +23,13 @@
#include "unit.h"
#include "mercenary.h"
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <string.h>
+
+
//For specifying where in the SkillStatusChangeTableArray the "out of bounds" skills get stored. [Skotlex]
#define SC_HM_BASE 800
#define SC_GD_BASE 900
@@ -5323,7 +5324,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
case SC_TENSIONRELAX:
if (sd) {
pc_setsit(sd);
- clif_sitting(sd);
+ clif_sitting(&sd->bl);
}
val2 = 12; //SP cost
val4 = 10000; //Decrease at 10secs intervals.
diff --git a/src/map/status.h b/src/map/status.h
index 793989c53..551991d1c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -4,7 +4,7 @@
#ifndef _STATUS_H_
#define _STATUS_H_
-// forward declarations from map.h
+//#include "map.h"
struct block_list;
struct mob_data;
struct pet_data;
diff --git a/src/map/storage.c b/src/map/storage.c
index 574028872..5d9b67778 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -1,14 +1,13 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#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 "chrif.h"
#include "itemdb.h"
@@ -20,6 +19,11 @@
#include "atcommand.h"
#include "log.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
static struct dbt *storage_db;
static struct dbt *guild_storage_db;
diff --git a/src/map/storage.h b/src/map/storage.h
index bd8c5fdc6..6764d4956 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -4,7 +4,12 @@
#ifndef _STORAGE_H_
#define _STORAGE_H_
-#include "../common/mmo.h"
+//#include "../common/mmo.h"
+struct storage;
+struct guild_storage;
+struct item;
+//#include "map.h"
+struct map_session_data;
int storage_storageopen(struct map_session_data *sd);
int storage_storageadd(struct map_session_data *sd,int index,int amount);
@@ -15,15 +20,15 @@ int storage_storageclose(struct map_session_data *sd);
int do_init_storage(void);
void do_final_storage(void);
void do_reconnect_storage(void);
-struct storage *account2storage(int account_id);
-struct storage *account2storage2(int account_id);
+struct storage* account2storage(int account_id);
+struct storage* account2storage2(int account_id);
int storage_delete(int account_id);
int storage_storage_quit(struct map_session_data *sd, int flag);
int storage_storage_save(int account_id, int final);
int storage_storage_saved(int account_id); //Ack from char server that guild store was saved.
void storage_storage_dirty(struct map_session_data *sd);
-struct guild_storage *guild2storage(int guild_id);
+struct guild_storage* guild2storage(int guild_id);
int guild_storage_delete(int guild_id);
int storage_guild_storageopen(struct map_session_data *sd);
int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount);
diff --git a/src/map/trade.c b/src/map/trade.c
index 73d5a6d42..a58df1eeb 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -1,9 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <string.h>
-
#include "../common/nullpo.h"
#include "clif.h"
#include "itemdb.h"
@@ -18,6 +15,10 @@
#include "atcommand.h"
#include "log.h"
+#include <stdio.h>
+#include <string.h>
+
+
//Max distance from traders to enable a trade to take place.
#define TRADE_DISTANCE 2
diff --git a/src/map/trade.h b/src/map/trade.h
index cbcf34f2a..cdcae7492 100644
--- a/src/map/trade.h
+++ b/src/map/trade.h
@@ -4,7 +4,9 @@
#ifndef _TRADE_H_
#define _TRADE_H_
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
+
void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd);
void trade_tradeack(struct map_session_data *sd,int type);
void trade_tradeadditem(struct map_session_data *sd,int index,int amount);
diff --git a/src/map/unit.c b/src/map/unit.c
index 80267bd49..ba3f9926a 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1,10 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "../common/showmsg.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -30,6 +26,11 @@
#include "chrif.h"
#include "script.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
const int dirx[8]={0,-1,-1,-1,0,1,1,1};
const int diry[8]={1,1,0,-1,-1,-1,0,1};
diff --git a/src/map/unit.h b/src/map/unit.h
index 32fc3cce7..83858fb5d 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -4,7 +4,9 @@
#ifndef _UNIT_H_
#define _UNIT_H_
-#include "map.h"
+//#include "map.h"
+struct block_list;
+struct unit_data;
// PC, MOB, PET に共通する処理を1つにまとめる計画
diff --git a/src/map/vending.c b/src/map/vending.c
index a84189407..c44cb333f 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -1,9 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <string.h>
-
#include "../common/nullpo.h"
#include "clif.h"
#include "itemdb.h"
@@ -18,6 +15,10 @@
#include "irc.h"
+#include <stdio.h>
+#include <string.h>
+
+
/*==========================================
* 露店閉鎖
*------------------------------------------*/
diff --git a/src/map/vending.h b/src/map/vending.h
index d9db08b6d..3b247e549 100644
--- a/src/map/vending.h
+++ b/src/map/vending.h
@@ -4,7 +4,8 @@
#ifndef _VENDING_H_
#define _VENDING_H_
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
void vending_closevending(struct map_session_data *sd);
void vending_openvending(struct map_session_data *sd,int len,char *message,int flag,unsigned char *p);