From d350bfeb9cc310ec329d968fc57bf4183b7cb527 Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 16 May 2014 16:23:47 +0200 Subject: [PATCH] Changed battle_config definition to extern to avoid mistakes in plugins - This avoids plugins incorrectly using battle_config (with unreliable results) instead of using the proper interface, battle->bc. - Edited various #defines to use battle->bc instead of battle_config so that they can work perperly in plugins as well. Signed-off-by: Haru --- src/map/battle.h | 16 +++++++++------- src/map/map.h | 2 +- src/map/pc.h | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/map/battle.h b/src/map/battle.h index 8d7e4183a3d..0ae18ec30ee 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -21,12 +21,12 @@ struct status_data; /** * Defines **/ -#define MIN_HAIR_STYLE (battle_config.min_hair_style) -#define MAX_HAIR_STYLE (battle_config.max_hair_style) -#define MIN_HAIR_COLOR (battle_config.min_hair_color) -#define MAX_HAIR_COLOR (battle_config.max_hair_color) -#define MIN_CLOTH_COLOR (battle_config.min_cloth_color) -#define MAX_CLOTH_COLOR (battle_config.max_cloth_color) +#define MIN_HAIR_STYLE (battle->bc->min_hair_style) +#define MAX_HAIR_STYLE (battle->bc->max_hair_style) +#define MIN_HAIR_COLOR (battle->bc->min_hair_color) +#define MAX_HAIR_COLOR (battle->bc->max_hair_color) +#define MIN_CLOTH_COLOR (battle->bc->min_cloth_color) +#define MAX_CLOTH_COLOR (battle->bc->max_cloth_color) #define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru] @@ -469,7 +469,9 @@ struct Battle_Config { int mon_trans_disable_in_gvg; int case_sensitive_aegisnames; -} battle_config; +}; + +extern struct Battle_Config battle_config; /* criteria for battle_config.idletime_critera */ enum e_battle_config_idletime { diff --git a/src/map/map.h b/src/map/map.h index 73ef4bb4125..099370b7a32 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -26,7 +26,7 @@ enum E_MAPSERVER_ST { }; #define MAX_NPC_PER_MAP 512 -#define AREA_SIZE (battle_config.area_size) +#define AREA_SIZE (battle->bc->area_size) #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 #define MAX_MOBSKILL 50 diff --git a/src/map/pc.h b/src/map/pc.h index 90f227cee5e..19e0348d00a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -7,7 +7,7 @@ #include "../config/core.h" // AUTOLOOTITEM_SIZE, RENEWAL, SECURE_NPCTIMEOUT -#include "battle.h" // battle_config +#include "battle.h" // battle #include "battleground.h" // enum bg_queue_types #include "buyingstore.h" // struct s_buyingstore #include "itemdb.h" // MAX_ITEMDELAYS @@ -565,7 +565,7 @@ struct map_session_data { #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)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle_config.idle_no_share ) +#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share ) #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) @@ -587,9 +587,9 @@ struct map_session_data { #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON ) #define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING ) #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE ) -#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate ) +#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate ) #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) -#define pc_maxparameter(sd) ( (((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E) ? battle_config.max_extended_parameter : (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter) ) +#define pc_maxparameter(sd) ( (((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E) ? battle->bc->max_extended_parameter : (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle->bc->max_baby_parameter : battle->bc->max_parameter) ) /** * Ranger **/