From 63062f9ddbc2c2a2384bfbbd496fc0572318a9e0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Feb 2019 00:32:06 +0300 Subject: Move local variables in atcommand.c into interface Also move defines from map.h inot mapdefines.h for fix cycle include issue. --- src/map/atcommand.c | 3 ++ src/map/atcommand.h | 4 ++ src/map/map.h | 79 --------------------------------------- src/map/mapdefines.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 79 deletions(-) create mode 100644 src/map/mapdefines.h (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 87be6ab1b..a9f63fe13 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10716,6 +10716,9 @@ void atcommand_defaults(void) { atcommand = &atcommand_s; + atcommand->atcmd_output = &atcmd_output; + atcommand->atcmd_player_name = &atcmd_player_name; + atcommand->db = NULL; atcommand->alias_db = NULL; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 3bbbefa20..1783e5dc6 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -21,9 +21,11 @@ #ifndef MAP_ATCOMMAND_H #define MAP_ATCOMMAND_H +#include "map/mapdefines.h" #include "map/pc_groups.h" #include "common/hercules.h" #include "common/db.h" +#include "common/mmo.h" #include @@ -90,6 +92,8 @@ struct atcmd_binding_data { * Interface **/ struct atcommand_interface { + char (*atcmd_output)[CHAT_SIZE_MAX]; + char (*atcmd_player_name)[NAME_LENGTH]; unsigned char at_symbol; unsigned char char_symbol; /* atcommand binding */ diff --git a/src/map/map.h b/src/map/map.h index ace2a35a1..1f70680e8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -45,42 +45,6 @@ enum E_MAPSERVER_ST { MAPSERVER_ST_LAST }; -#define MAX_NPC_PER_MAP 512 -#define AREA_SIZE (battle->bc->area_size) -#define CHAT_AREA_SIZE (battle->bc->chat_area_size) -#define DEAD_AREA_SIZE (battle->bc->dead_area_size) -#define DAMAGELOG_SIZE 30 -#define LOOTITEM_SIZE 10 -#define MAX_MOBSKILL 50 -#define MAX_MOB_LIST_PER_MAP 100 -#define MAX_EVENTQUEUE 2 -#define MAX_EVENTTIMER 32 -#define NATURAL_HEAL_INTERVAL 500 -#define MIN_FLOORITEM 2 -#define MAX_FLOORITEM START_ACCOUNT_NUM -#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] - -#define BLOCK_SIZE 8 -#define block_free_max 1048576 -#define BL_LIST_MAX 1048576 - -// The following system marks a different job ID system used by the map server, -// which makes a lot more sense than the normal one. [Skotlex] -// These marks the "level" of the job. -#define JOBL_2_1 0x0100 -#define JOBL_2_2 0x0200 -#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 -#define JOBL_UPPER 0x1000 -#define JOBL_BABY 0x2000 -#define JOBL_THIRD 0x4000 - -// For filtering and quick checking. -#define MAPID_BASEMASK 0x00ff -#define MAPID_UPPERMASK 0x0fff -#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) - //First Jobs //Note the oddity of the novice: //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type. @@ -344,36 +308,6 @@ enum { STATIC_ASSERT(((MAPID_1_1_MAX - 1) | MAPID_BASEMASK) == MAPID_BASEMASK, "First class map IDs do not fit into MAPID_BASEMASK"); -// Max size for inputs to Graffiti, Talkie Box and Vending text prompts -#define MESSAGE_SIZE (79 + 1) -// String length you can write in the 'talking box' -#define CHATBOX_SIZE (70 + 1) -// Chatroom-related string sizes -#define CHATROOM_TITLE_SIZE (36 + 1) -#define CHATROOM_PASS_SIZE (8 + 1) -// Max allowed chat text length -#define CHAT_SIZE_MAX (255 + 1) -// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS -#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) -#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) -// Specifies maps where players may hit each other -#define map_flag_vs(m) ( \ - map->list[m].flag.pvp \ - || map->list[m].flag.gvg_dungeon \ - || map->list[m].flag.gvg \ - || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ - || map->list[m].flag.battleground \ - || map->list[m].flag.cvc \ - ) -// Specifies maps that have special GvG/WoE restrictions -#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) -// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) -#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) -// No Kill Steal Protection -#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) -// No ViewID -#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) - //This stackable implementation does not means a BL can be more than one type at a time, but it's // meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] enum bl_type { @@ -392,9 +326,6 @@ enum bl_type { BL_ALL = 0xFFF, }; -// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. -#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) - enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; /** @@ -748,16 +679,6 @@ enum map_zone_merge_type { MZMT_NEVERMERGE, ///< Cannot merge with any zones. }; -#define MAP_ZONE_NAME_LENGTH 60 -#define MAP_ZONE_ALL_NAME "All" -#define MAP_ZONE_NORMAL_NAME "Normal" -#define MAP_ZONE_PVP_NAME "PvP" -#define MAP_ZONE_GVG_NAME "GvG" -#define MAP_ZONE_BG_NAME "Battlegrounds" -#define MAP_ZONE_CVC_NAME "CvC" -#define MAP_ZONE_PK_NAME "PK Mode" -#define MAP_ZONE_MAPFLAG_LENGTH 65 - struct map_zone_data { char name[MAP_ZONE_NAME_LENGTH];/* 20'd */ enum map_zone_merge_type merge_type; diff --git a/src/map/mapdefines.h b/src/map/mapdefines.h new file mode 100644 index 000000000..df9e9bccb --- /dev/null +++ b/src/map/mapdefines.h @@ -0,0 +1,103 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2012-2018 Hercules Dev Team + * Copyright (C) Athena Dev Teams + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef MAP_MAPDEFINES_H +#define MAP_MAPDEFINES_H + +#define MAX_NPC_PER_MAP 512 +#define AREA_SIZE (battle->bc->area_size) +#define CHAT_AREA_SIZE (battle->bc->chat_area_size) +#define DEAD_AREA_SIZE (battle->bc->dead_area_size) +#define DAMAGELOG_SIZE 30 +#define LOOTITEM_SIZE 10 +#define MAX_MOBSKILL 50 +#define MAX_MOB_LIST_PER_MAP 100 +#define MAX_EVENTQUEUE 2 +#define MAX_EVENTTIMER 32 +#define NATURAL_HEAL_INTERVAL 500 +#define MIN_FLOORITEM 2 +#define MAX_FLOORITEM START_ACCOUNT_NUM +#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] + +#define BLOCK_SIZE 8 +#define block_free_max 1048576 +#define BL_LIST_MAX 1048576 + +// The following system marks a different job ID system used by the map server, +// which makes a lot more sense than the normal one. [Skotlex] +// These marks the "level" of the job. +#define JOBL_2_1 0x0100 +#define JOBL_2_2 0x0200 +#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 +#define JOBL_UPPER 0x1000 +#define JOBL_BABY 0x2000 +#define JOBL_THIRD 0x4000 + +// For filtering and quick checking. +#define MAPID_BASEMASK 0x00ff +#define MAPID_UPPERMASK 0x0fff +#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) + +// Max size for inputs to Graffiti, Talkie Box and Vending text prompts +#define MESSAGE_SIZE (79 + 1) +// String length you can write in the 'talking box' +#define CHATBOX_SIZE (70 + 1) +// Chatroom-related string sizes +#define CHATROOM_TITLE_SIZE (36 + 1) +#define CHATROOM_PASS_SIZE (8 + 1) +// Max allowed chat text length +#define CHAT_SIZE_MAX (255 + 1) +// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS +#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) +#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) +// Specifies maps where players may hit each other +#define map_flag_vs(m) ( \ + map->list[m].flag.pvp \ + || map->list[m].flag.gvg_dungeon \ + || map->list[m].flag.gvg \ + || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ + || map->list[m].flag.battleground \ + || map->list[m].flag.cvc \ + ) +// Specifies maps that have special GvG/WoE restrictions +#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) +// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) +#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) +// No Kill Steal Protection +#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) +// No ViewID +#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) + +// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. +#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) + +#define MAP_ZONE_NAME_LENGTH 60 +#define MAP_ZONE_ALL_NAME "All" +#define MAP_ZONE_NORMAL_NAME "Normal" +#define MAP_ZONE_PVP_NAME "PvP" +#define MAP_ZONE_GVG_NAME "GvG" +#define MAP_ZONE_BG_NAME "Battlegrounds" +#define MAP_ZONE_CVC_NAME "CvC" +#define MAP_ZONE_PK_NAME "PK Mode" +#define MAP_ZONE_MAPFLAG_LENGTH 65 + +#endif /* MAP_MAPDEFINES_H */ -- cgit v1.2.3-60-g2f50