summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-16 16:23:47 +0200
committerHaru <haru@dotalux.com>2014-05-16 16:23:47 +0200
commitd350bfeb9cc310ec329d968fc57bf4183b7cb527 (patch)
tree9fc7cec46f1e4f19cfd8f36483bd106198e23f99 /src/map
parentfddd0a68178da57e0416722ee7c003eab7167ac4 (diff)
downloadhercules-d350bfeb9cc310ec329d968fc57bf4183b7cb527.tar.gz
hercules-d350bfeb9cc310ec329d968fc57bf4183b7cb527.tar.bz2
hercules-d350bfeb9cc310ec329d968fc57bf4183b7cb527.tar.xz
hercules-d350bfeb9cc310ec329d968fc57bf4183b7cb527.zip
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 <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.h16
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.h8
3 files changed, 14 insertions, 12 deletions
diff --git a/src/map/battle.h b/src/map/battle.h
index 8d7e4183a..0ae18ec30 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 73ef4bb41..099370b7a 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 90f227cee..19e0348d0 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
**/