summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-02-26 14:52:21 -0300
committershennetsind <ind@henn.et>2014-02-26 14:52:21 -0300
commita5728fd9ada82b21629fd4cd3bbc9e52555b6881 (patch)
tree9b10f67a6d157b80a4f2174fb43b8470fafc6de6 /src
parent142a8f463120274fd9915a8a3a604d27ce42c43d (diff)
downloadhercules-a5728fd9ada82b21629fd4cd3bbc9e52555b6881.tar.gz
hercules-a5728fd9ada82b21629fd4cd3bbc9e52555b6881.tar.bz2
hercules-a5728fd9ada82b21629fd4cd3bbc9e52555b6881.tar.xz
hercules-a5728fd9ada82b21629fd4cd3bbc9e52555b6881.zip
Removed Option_ constants from const.txt, now input directly from the source
a benefit, for example, would be that the compounds are always up to date regardless if new members are added, also added a new compound OPTION_COSTUME Special Thanks to Haruna, and AnnieRuru for pointing out constdb's outdatedness. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/script.c39
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/status.h1
4 files changed, 47 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 425759d29..45b8505e5 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -818,7 +818,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) {
/// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand)
void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand)
{
- if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST)) {
+ if(sd->sc.option&OPTION_COSTUME) {
*rhand = *lhand = 0;
return;
}
@@ -3209,7 +3209,7 @@ void clif_changelook(struct block_list *bl,int type,int val)
case LOOK_BASE:
if( !sd ) break;
- if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) )
+ if( sd->sc.option&OPTION_COSTUME )
vd->weapon = vd->shield = 0;
if( !vd->cloth_color )
@@ -10086,7 +10086,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE )
return;
- if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) )
+ if( sd->sc.option&OPTION_COSTUME )
return;
if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] ||
@@ -11331,7 +11331,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
}
}
- if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) )
+ if( sd->sc.option&OPTION_COSTUME )
return;
if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) )
@@ -11423,7 +11423,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
}
}
- if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) )
+ if( sd->sc.option&OPTION_COSTUME )
return;
if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) )
diff --git a/src/map/script.c b/src/map/script.c
index 0887b7f4e..6b31ee7b4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4321,6 +4321,7 @@ void do_init_script(bool minimal) {
script->parse_builtin();
script->read_constdb();
+ script->hardcoded_constants();
if (minimal)
return;
@@ -19057,6 +19058,42 @@ void script_label_add(int key, int pos) {
script->label_count++;
}
+/**
+ * Sets source-end constants for scripts to play with
+ **/
+void script_hardcoded_constants(void) {
+
+ /* status options */
+ script->set_constant("Option_Nothing",OPTION_NOTHING,false);
+ script->set_constant("Option_Sight",OPTION_SIGHT,false);
+ script->set_constant("Option_Hide",OPTION_HIDE,false);
+ script->set_constant("Option_Cloak",OPTION_CLOAK,false);
+ script->set_constant("Option_Falcon",OPTION_FALCON,false);
+ script->set_constant("Option_Riding",OPTION_RIDING,false);
+ script->set_constant("Option_Invisible",OPTION_INVISIBLE,false);
+ script->set_constant("Option_Orcish",OPTION_ORCISH,false);
+ script->set_constant("Option_Wedding",OPTION_WEDDING,false);
+ script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false);
+ script->set_constant("Option_Flying",OPTION_FLYING,false);
+ script->set_constant("Option_Xmas",OPTION_XMAS,false);
+ script->set_constant("Option_Transform",OPTION_TRANSFORM,false);
+ script->set_constant("Option_Summer",OPTION_SUMMER,false);
+ script->set_constant("Option_Dragon1",OPTION_DRAGON1,false);
+ script->set_constant("Option_Wug",OPTION_WUG,false);
+ script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false);
+ script->set_constant("Option_Madogear",OPTION_MADOGEAR,false);
+ script->set_constant("Option_Dragon2",OPTION_DRAGON2,false);
+ script->set_constant("Option_Dragon3",OPTION_DRAGON3,false);
+ script->set_constant("Option_Dragon4",OPTION_DRAGON4,false);
+ script->set_constant("Option_Dragon5",OPTION_DRAGON5,false);
+ script->set_constant("Option_Hanbok",OPTION_HANBOK,false);
+ script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false);
+
+ /* status option compounds */
+ script->set_constant("Option_Dragon",OPTION_DRAGON,false);
+ script->set_constant("Option_Costume",OPTION_COSTUME,false);
+}
+
void script_defaults(void) {
// aegis->athena slot position conversion table
unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT,EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L};
@@ -19308,5 +19345,7 @@ void script_defaults(void) {
/* */
script->generic_ui_array_expand = script_generic_ui_array_expand;
script->array_cpy_list = script_array_cpy_list;
+ /* */
+ script->hardcoded_constants = script_hardcoded_constants;
}
diff --git a/src/map/script.h b/src/map/script.h
index 3835a130b..5ce77799a 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -694,6 +694,8 @@ struct script_interface {
/* */
void (*generic_ui_array_expand) (unsigned int plus);
unsigned int *(*array_cpy_list) (struct script_array *sa);
+ /* */
+ void (*hardcoded_constants) (void);
};
struct script_interface *script;
diff --git a/src/map/status.h b/src/map/status.h
index 06bea3908..c0c6c63b7 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1592,6 +1592,7 @@ enum {
// compound constants
OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5,
+ OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST,
};
//Defines for the manner system [Skotlex]