Skip to content

Commit

Permalink
Fixed order of includes in all source files
Browse files Browse the repository at this point in the history
- Changed order according to the (upcoming) code style guidelines.
- Fixes several issues caused by missing headers when their include
  order is changed or in plugins.

Signed-off-by: Haru <haru@dotalux.com>
  • Loading branch information
MishimaHaruna committed May 9, 2014
1 parent 1c4e382 commit b6b3f58
Show file tree
Hide file tree
Showing 144 changed files with 1,676 additions and 1,367 deletions.
44 changes: 24 additions & 20 deletions src/char/char.c
Expand Up @@ -2,7 +2,30 @@
// 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"
Expand All @@ -13,25 +36,6 @@
#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"
Expand Down Expand Up @@ -5497,7 +5501,7 @@ int do_init(int argc, char **argv) {

Sql_HerculesUpdateCheck(sql_handle);
#ifdef CONSOLE_INPUT
console->setSQL(sql_handle);
console->input->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);

Expand Down
1 change: 0 additions & 1 deletion src/char/char.h
Expand Up @@ -5,7 +5,6 @@
#ifndef _COMMON_CHAR_H_
#define _COMMON_CHAR_H_

#include "../config/core.h"
#include "../common/core.h" // CORE_ST_LAST
#include "../common/db.h"

Expand Down
25 changes: 14 additions & 11 deletions src/char/int_auction.c
Expand Up @@ -2,22 +2,25 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#include "../common/mmo.h"
#include "../common/malloc.h"
#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/showmsg.h"
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/sql.h"
#include "../common/strlib.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*

Expand Down
22 changes: 13 additions & 9 deletions src/char/int_elemental.c
Expand Up @@ -2,20 +2,24 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#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"
#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/showmsg.h"
#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"
#include "../common/utils.h"

bool mapif_elemental_save(struct s_elemental* ele) {
bool flag = true;

Expand Down
2 changes: 1 addition & 1 deletion src/char/int_elemental.h
Expand Up @@ -4,7 +4,7 @@
#ifndef _CHAR_INT_ELEMENTAL_H_
#define _CHAR_INT_ELEMENTAL_H_

struct s_elemental;
#include "../common/cbasetypes.h"

void inter_elemental_sql_init(void);
void inter_elemental_sql_final(void);
Expand Down
24 changes: 14 additions & 10 deletions src/char/int_guild.c
Expand Up @@ -2,21 +2,25 @@
// 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/mmo.h"
#include "../common/malloc.h"
#include "../common/socket.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"
#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
Expand Down
3 changes: 0 additions & 3 deletions src/char/int_guild.h
Expand Up @@ -20,9 +20,6 @@ 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);
Expand Down
21 changes: 12 additions & 9 deletions src/char/int_homun.c
Expand Up @@ -2,20 +2,23 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#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"
#define HERCULES_CORE

#include "int_homun.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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/char/int_homun.h
Expand Up @@ -4,6 +4,8 @@
#ifndef _CHAR_INT_HOMUN_H_
#define _CHAR_INT_HOMUN_H_

#include "../common/cbasetypes.h"

struct s_homunculus;

int inter_homunculus_sql_init(void);
Expand Down
20 changes: 12 additions & 8 deletions src/char/int_mail.c
Expand Up @@ -2,19 +2,23 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#include "../common/mmo.h"
#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/showmsg.h"
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/sql.h"
#include "../common/strlib.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)
{
Expand Down
3 changes: 3 additions & 0 deletions src/char/int_mail.h
Expand Up @@ -4,6 +4,9 @@
#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);

Expand Down
22 changes: 13 additions & 9 deletions src/char/int_mercenary.c
Expand Up @@ -2,20 +2,24 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#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"
#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/showmsg.h"
#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"
#include "../common/utils.h"

bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status)
{
char* data;
Expand Down
4 changes: 3 additions & 1 deletion src/char/int_mercenary.h
Expand Up @@ -4,7 +4,9 @@
#ifndef _CHAR_INT_MERCENARY_H_
#define _CHAR_INT_MERCENARY_H_

struct s_mercenary;
#include "../common/cbasetypes.h"

struct mmo_charstatus;

int inter_mercenary_sql_init(void);
void inter_mercenary_sql_final(void);
Expand Down
25 changes: 14 additions & 11 deletions src/char/int_party.c
Expand Up @@ -2,23 +2,26 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#include "../common/cbasetypes.h"
#include "../common/mmo.h"
#include "../common/db.h"
#include "../common/malloc.h"
#include "../common/strlib.h"
#include "../common/socket.h"
#include "../common/showmsg.h"
#include "../common/mapindex.h"
#include "../common/sql.h"
#include "char.h"
#include "inter.h"
#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/db.h"
#include "../common/malloc.h"
#include "../common/mapindex.h"
#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"

struct party_data {
struct party party;
unsigned int min_lv, max_lv;
Expand Down
2 changes: 0 additions & 2 deletions src/char/int_party.h
Expand Up @@ -14,8 +14,6 @@ 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);
Expand Down

4 comments on commit b6b3f58

@panikon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MishimaHaruna This commit was messing with [AT]cart, and as I'm not sure if it interfered with other systems as well I chose to revert it see this issue: http://hercules.ws/board/tracker/issue-8184-cart-related/?gopid=22784 also the commit which this is reverted 9465728
Sorry for any inconvenience.

@MishimaHaruna
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panikon thank you - I'll re-commit it after fixing the real issue. This is happening because we're doing this in config/const.h:

/* Feb 1st 2012 */
#if PACKETVER >= 20120201
    #define NEW_CARTS
    #define MAX_CARTS 9
#else
    #define MAX_CARTS 5
#endif

while we should do it elsewhere, possibly common/mmo.h, since PACKETVER is defined there, or moved the PACKETVER definition into config/*.
I'll check the other files in config for the same issue.

@panikon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MishimaHaruna Oh I see, sorry for not trying to really fix it, it was 5 in the morning here and I just had to get some sleep

@MishimaHaruna
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay, a temporary revert never hurts, and lets people still use Hercules while we work on a fix :)

Please sign in to comment.