Skip to content

Commit 63062f9

Browse files
committed
Move local variables in atcommand.c into interface
Also move defines from map.h inot mapdefines.h for fix cycle include issue.
1 parent 4af6f3c commit 63062f9

File tree

4 files changed

+110
-79
lines changed

4 files changed

+110
-79
lines changed

src/map/atcommand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10716,6 +10716,9 @@ void atcommand_defaults(void)
1071610716
{
1071710717
atcommand = &atcommand_s;
1071810718

10719+
atcommand->atcmd_output = &atcmd_output;
10720+
atcommand->atcmd_player_name = &atcmd_player_name;
10721+
1071910722
atcommand->db = NULL;
1072010723
atcommand->alias_db = NULL;
1072110724

src/map/atcommand.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
#ifndef MAP_ATCOMMAND_H
2222
#define MAP_ATCOMMAND_H
2323

24+
#include "map/mapdefines.h"
2425
#include "map/pc_groups.h"
2526
#include "common/hercules.h"
2627
#include "common/db.h"
28+
#include "common/mmo.h"
2729

2830
#include <stdarg.h>
2931

@@ -90,6 +92,8 @@ struct atcmd_binding_data {
9092
* Interface
9193
**/
9294
struct atcommand_interface {
95+
char (*atcmd_output)[CHAT_SIZE_MAX];
96+
char (*atcmd_player_name)[NAME_LENGTH];
9397
unsigned char at_symbol;
9498
unsigned char char_symbol;
9599
/* atcommand binding */

src/map/map.h

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,6 @@ enum E_MAPSERVER_ST {
4545
MAPSERVER_ST_LAST
4646
};
4747

48-
#define MAX_NPC_PER_MAP 512
49-
#define AREA_SIZE (battle->bc->area_size)
50-
#define CHAT_AREA_SIZE (battle->bc->chat_area_size)
51-
#define DEAD_AREA_SIZE (battle->bc->dead_area_size)
52-
#define DAMAGELOG_SIZE 30
53-
#define LOOTITEM_SIZE 10
54-
#define MAX_MOBSKILL 50
55-
#define MAX_MOB_LIST_PER_MAP 100
56-
#define MAX_EVENTQUEUE 2
57-
#define MAX_EVENTTIMER 32
58-
#define NATURAL_HEAL_INTERVAL 500
59-
#define MIN_FLOORITEM 2
60-
#define MAX_FLOORITEM START_ACCOUNT_NUM
61-
#define MAX_IGNORE_LIST 20 // official is 14
62-
#define MAX_VENDING 12
63-
#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
64-
65-
#define BLOCK_SIZE 8
66-
#define block_free_max 1048576
67-
#define BL_LIST_MAX 1048576
68-
69-
// The following system marks a different job ID system used by the map server,
70-
// which makes a lot more sense than the normal one. [Skotlex]
71-
// These marks the "level" of the job.
72-
#define JOBL_2_1 0x0100
73-
#define JOBL_2_2 0x0200
74-
#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2
75-
#define JOBL_UPPER 0x1000
76-
#define JOBL_BABY 0x2000
77-
#define JOBL_THIRD 0x4000
78-
79-
// For filtering and quick checking.
80-
#define MAPID_BASEMASK 0x00ff
81-
#define MAPID_UPPERMASK 0x0fff
82-
#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK)
83-
8448
//First Jobs
8549
//Note the oddity of the novice:
8650
//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type.
@@ -344,36 +308,6 @@ enum {
344308

345309
STATIC_ASSERT(((MAPID_1_1_MAX - 1) | MAPID_BASEMASK) == MAPID_BASEMASK, "First class map IDs do not fit into MAPID_BASEMASK");
346310

347-
// Max size for inputs to Graffiti, Talkie Box and Vending text prompts
348-
#define MESSAGE_SIZE (79 + 1)
349-
// String length you can write in the 'talking box'
350-
#define CHATBOX_SIZE (70 + 1)
351-
// Chatroom-related string sizes
352-
#define CHATROOM_TITLE_SIZE (36 + 1)
353-
#define CHATROOM_PASS_SIZE (8 + 1)
354-
// Max allowed chat text length
355-
#define CHAT_SIZE_MAX (255 + 1)
356-
// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
357-
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
358-
#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000)
359-
// Specifies maps where players may hit each other
360-
#define map_flag_vs(m) ( \
361-
map->list[m].flag.pvp \
362-
|| map->list[m].flag.gvg_dungeon \
363-
|| map->list[m].flag.gvg \
364-
|| ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \
365-
|| map->list[m].flag.battleground \
366-
|| map->list[m].flag.cvc \
367-
)
368-
// Specifies maps that have special GvG/WoE restrictions
369-
#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle))
370-
// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status)
371-
#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle)
372-
// No Kill Steal Protection
373-
#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground)
374-
// No ViewID
375-
#define map_no_view(m, view) (map->list[m].flag.noviewid & (view))
376-
377311
//This stackable implementation does not means a BL can be more than one type at a time, but it's
378312
// meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex]
379313
enum bl_type {
@@ -392,9 +326,6 @@ enum bl_type {
392326
BL_ALL = 0xFFF,
393327
};
394328

395-
// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
396-
#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM)
397-
398329
enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB };
399330

400331
/**
@@ -748,16 +679,6 @@ enum map_zone_merge_type {
748679
MZMT_NEVERMERGE, ///< Cannot merge with any zones.
749680
};
750681

751-
#define MAP_ZONE_NAME_LENGTH 60
752-
#define MAP_ZONE_ALL_NAME "All"
753-
#define MAP_ZONE_NORMAL_NAME "Normal"
754-
#define MAP_ZONE_PVP_NAME "PvP"
755-
#define MAP_ZONE_GVG_NAME "GvG"
756-
#define MAP_ZONE_BG_NAME "Battlegrounds"
757-
#define MAP_ZONE_CVC_NAME "CvC"
758-
#define MAP_ZONE_PK_NAME "PK Mode"
759-
#define MAP_ZONE_MAPFLAG_LENGTH 65
760-
761682
struct map_zone_data {
762683
char name[MAP_ZONE_NAME_LENGTH];/* 20'd */
763684
enum map_zone_merge_type merge_type;

src/map/mapdefines.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* This file is part of Hercules.
3+
* http://herc.ws - http://github.com/HerculesWS/Hercules
4+
*
5+
* Copyright (C) 2012-2018 Hercules Dev Team
6+
* Copyright (C) Athena Dev Teams
7+
*
8+
* Hercules is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*/
21+
#ifndef MAP_MAPDEFINES_H
22+
#define MAP_MAPDEFINES_H
23+
24+
#define MAX_NPC_PER_MAP 512
25+
#define AREA_SIZE (battle->bc->area_size)
26+
#define CHAT_AREA_SIZE (battle->bc->chat_area_size)
27+
#define DEAD_AREA_SIZE (battle->bc->dead_area_size)
28+
#define DAMAGELOG_SIZE 30
29+
#define LOOTITEM_SIZE 10
30+
#define MAX_MOBSKILL 50
31+
#define MAX_MOB_LIST_PER_MAP 100
32+
#define MAX_EVENTQUEUE 2
33+
#define MAX_EVENTTIMER 32
34+
#define NATURAL_HEAL_INTERVAL 500
35+
#define MIN_FLOORITEM 2
36+
#define MAX_FLOORITEM START_ACCOUNT_NUM
37+
#define MAX_IGNORE_LIST 20 // official is 14
38+
#define MAX_VENDING 12
39+
#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
40+
41+
#define BLOCK_SIZE 8
42+
#define block_free_max 1048576
43+
#define BL_LIST_MAX 1048576
44+
45+
// The following system marks a different job ID system used by the map server,
46+
// which makes a lot more sense than the normal one. [Skotlex]
47+
// These marks the "level" of the job.
48+
#define JOBL_2_1 0x0100
49+
#define JOBL_2_2 0x0200
50+
#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2
51+
#define JOBL_UPPER 0x1000
52+
#define JOBL_BABY 0x2000
53+
#define JOBL_THIRD 0x4000
54+
55+
// For filtering and quick checking.
56+
#define MAPID_BASEMASK 0x00ff
57+
#define MAPID_UPPERMASK 0x0fff
58+
#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK)
59+
60+
// Max size for inputs to Graffiti, Talkie Box and Vending text prompts
61+
#define MESSAGE_SIZE (79 + 1)
62+
// String length you can write in the 'talking box'
63+
#define CHATBOX_SIZE (70 + 1)
64+
// Chatroom-related string sizes
65+
#define CHATROOM_TITLE_SIZE (36 + 1)
66+
#define CHATROOM_PASS_SIZE (8 + 1)
67+
// Max allowed chat text length
68+
#define CHAT_SIZE_MAX (255 + 1)
69+
// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
70+
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
71+
#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000)
72+
// Specifies maps where players may hit each other
73+
#define map_flag_vs(m) ( \
74+
map->list[m].flag.pvp \
75+
|| map->list[m].flag.gvg_dungeon \
76+
|| map->list[m].flag.gvg \
77+
|| ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \
78+
|| map->list[m].flag.battleground \
79+
|| map->list[m].flag.cvc \
80+
)
81+
// Specifies maps that have special GvG/WoE restrictions
82+
#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle))
83+
// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status)
84+
#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle)
85+
// No Kill Steal Protection
86+
#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground)
87+
// No ViewID
88+
#define map_no_view(m, view) (map->list[m].flag.noviewid & (view))
89+
90+
// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
91+
#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM)
92+
93+
#define MAP_ZONE_NAME_LENGTH 60
94+
#define MAP_ZONE_ALL_NAME "All"
95+
#define MAP_ZONE_NORMAL_NAME "Normal"
96+
#define MAP_ZONE_PVP_NAME "PvP"
97+
#define MAP_ZONE_GVG_NAME "GvG"
98+
#define MAP_ZONE_BG_NAME "Battlegrounds"
99+
#define MAP_ZONE_CVC_NAME "CvC"
100+
#define MAP_ZONE_PK_NAME "PK Mode"
101+
#define MAP_ZONE_MAPFLAG_LENGTH 65
102+
103+
#endif /* MAP_MAPDEFINES_H */

0 commit comments

Comments
 (0)