From 5db7c13c4a37bc688a464d369beab0bc31984bd5 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 14 Dec 2015 23:59:48 +0100 Subject: Added merc_id, replaced numeric mercenary IDs with enum members Signed-off-by: Haru --- src/common/mmo.h | 1 - src/map/mercenary.c | 30 +++++++++++++++--------------- src/map/mercenary.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/common/mmo.h b/src/common/mmo.h index 53ef322c2..ff41c00d8 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -191,7 +191,6 @@ // Mercenary System #define MC_SKILLBASE 8201 #define MAX_MERCSKILL 40 -#define MAX_MERCENARY_CLASS 61 // Elemental System #define MAX_ELEMENTALSKILL 42 diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 4e3c8508d..fb801a8da 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -127,11 +127,11 @@ int mercenary_get_guild(struct mercenary_data *md) class_ = md->db->class_; - if( class_ >= 6017 && class_ <= 6026 ) + if (class_ >= MERID_MER_ARCHER01 && class_ <= MERID_MER_ARCHER10) return ARCH_MERC_GUILD; - if( class_ >= 6027 && class_ <= 6036 ) + if (class_ >= MERID_MER_LANCER01 && class_ <= MERID_MER_LANCER10) return SPEAR_MERC_GUILD; - if( class_ >= 6037 && class_ <= 6046 ) + if (class_ >= MERID_MER_SWORDMAN01 && class_ <= MERID_MER_SWORDMAN10) return SWORD_MERC_GUILD; return -1; @@ -147,11 +147,11 @@ int mercenary_get_faith(struct mercenary_data *md) class_ = md->db->class_; - if( class_ >= 6017 && class_ <= 6026 ) + if (class_ >= MERID_MER_ARCHER01 && class_ <= MERID_MER_ARCHER10) return sd->status.arch_faith; - if( class_ >= 6027 && class_ <= 6036 ) + if (class_ >= MERID_MER_LANCER01 && class_ <= MERID_MER_LANCER10) return sd->status.spear_faith; - if( class_ >= 6037 && class_ <= 6046 ) + if (class_ >= MERID_MER_SWORDMAN01 && class_ <= MERID_MER_SWORDMAN10) return sd->status.sword_faith; return 0; @@ -167,11 +167,11 @@ int mercenary_set_faith(struct mercenary_data *md, int value) class_ = md->db->class_; - if( class_ >= 6017 && class_ <= 6026 ) + if (class_ >= MERID_MER_ARCHER01 && class_ <= MERID_MER_ARCHER10) faith = &sd->status.arch_faith; - else if( class_ >= 6027 && class_ <= 6036 ) + else if (class_ >= MERID_MER_LANCER01 && class_ <= MERID_MER_LANCER10) faith = &sd->status.spear_faith; - else if( class_ >= 6037 && class_ <= 6046 ) + else if (class_ >= MERID_MER_SWORDMAN01 && class_ <= MERID_MER_SWORDMAN10) faith = &sd->status.sword_faith; else return 0; @@ -193,11 +193,11 @@ int mercenary_get_calls(struct mercenary_data *md) class_ = md->db->class_; - if( class_ >= 6017 && class_ <= 6026 ) + if (class_ >= MERID_MER_ARCHER01 && class_ <= MERID_MER_ARCHER10) return sd->status.arch_calls; - if( class_ >= 6027 && class_ <= 6036 ) + if (class_ >= MERID_MER_LANCER01 && class_ <= MERID_MER_LANCER10) return sd->status.spear_calls; - if( class_ >= 6037 && class_ <= 6046 ) + if (class_ >= MERID_MER_SWORDMAN01 && class_ <= MERID_MER_SWORDMAN10) return sd->status.sword_calls; return 0; @@ -213,11 +213,11 @@ int mercenary_set_calls(struct mercenary_data *md, int value) class_ = md->db->class_; - if( class_ >= 6017 && class_ <= 6026 ) + if (class_ >= MERID_MER_ARCHER01 && class_ <= MERID_MER_ARCHER10) calls = &sd->status.arch_calls; - else if( class_ >= 6027 && class_ <= 6036 ) + else if (class_ >= MERID_MER_LANCER01 && class_ <= MERID_MER_LANCER10) calls = &sd->status.spear_calls; - else if( class_ >= 6037 && class_ <= 6046 ) + else if (class_ >= MERID_MER_SWORDMAN01 && class_ <= MERID_MER_SWORDMAN10) calls = &sd->status.sword_calls; else return 0; diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 05adc1fce..1b3453a84 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -27,6 +27,7 @@ struct map_session_data; +#define MAX_MERCENARY_CLASS 61 // number of cells that a mercenary can walk to from it's master before being warped #define MAX_MER_DISTANCE 15 @@ -36,6 +37,40 @@ enum { SWORD_MERC_GUILD, }; +/// Mercenary IDs +enum merc_id { + MERID_MER_ARCHER01 = 6017, ///< MER_ARCHER01 / Mina + MERID_MER_ARCHER02 = 6018, ///< MER_ARCHER02 / Dororu + MERID_MER_ARCHER03 = 6019, ///< MER_ARCHER03 / Nami + MERID_MER_ARCHER04 = 6020, ///< MER_ARCHER04 / Elfin + MERID_MER_ARCHER05 = 6021, ///< MER_ARCHER05 / Clara + MERID_MER_ARCHER06 = 6022, ///< MER_ARCHER06 / Dali + MERID_MER_ARCHER07 = 6023, ///< MER_ARCHER07 / Karaya + MERID_MER_ARCHER08 = 6024, ///< MER_ARCHER08 / Hiyori + MERID_MER_ARCHER09 = 6025, ///< MER_ARCHER09 / Kero + MERID_MER_ARCHER10 = 6026, ///< MER_ARCHER10 / Sukye + MERID_MER_LANCER01 = 6027, ///< MER_LANCER01 / Rodin + MERID_MER_LANCER02 = 6028, ///< MER_LANCER02 / Lancer + MERID_MER_LANCER03 = 6029, ///< MER_LANCER03 / Nathan + MERID_MER_LANCER04 = 6030, ///< MER_LANCER04 / Roan + MERID_MER_LANCER05 = 6031, ///< MER_LANCER05 / Orizaro + MERID_MER_LANCER06 = 6032, ///< MER_LANCER06 / Thyla + MERID_MER_LANCER07 = 6033, ///< MER_LANCER07 / Ben + MERID_MER_LANCER08 = 6034, ///< MER_LANCER08 / Pinaka + MERID_MER_LANCER09 = 6035, ///< MER_LANCER09 / Kuhlmann + MERID_MER_LANCER10 = 6036, ///< MER_LANCER10 / Roux + MERID_MER_SWORDMAN01 = 6037, ///< MER_SWORDMAN01 / David + MERID_MER_SWORDMAN02 = 6038, ///< MER_SWORDMAN02 / Ellen + MERID_MER_SWORDMAN03 = 6039, ///< MER_SWORDMAN03 / Luise + MERID_MER_SWORDMAN04 = 6040, ///< MER_SWORDMAN04 / Frank + MERID_MER_SWORDMAN05 = 6041, ///< MER_SWORDMAN05 / Ryan + MERID_MER_SWORDMAN06 = 6042, ///< MER_SWORDMAN06 / Paolo + MERID_MER_SWORDMAN07 = 6043, ///< MER_SWORDMAN07 / Jens + MERID_MER_SWORDMAN08 = 6044, ///< MER_SWORDMAN08 / Thierry + MERID_MER_SWORDMAN09 = 6045, ///< MER_SWORDMAN09 / Steven + MERID_MER_SWORDMAN10 = 6046, ///< MER_SWORDMAN10 / Wayne +}; + struct s_mercenary_db { int class_; char sprite[NAME_LENGTH], name[NAME_LENGTH]; -- cgit v1.2.3-70-g09d2