diff options
author | Haru <haru@dotalux.com> | 2016-01-03 03:45:30 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-03 21:46:15 +0100 |
commit | 818acc5866707b9e294a87d2dd902aebb670707f (patch) | |
tree | 1d507deb7d066ab066bdab2cf7bd4f549c471278 /src/map/pc.h | |
parent | 87476b17df574f4c1cb1ef46c3c8e47419ea5a08 (diff) | |
download | hercules-818acc5866707b9e294a87d2dd902aebb670707f.tar.gz hercules-818acc5866707b9e294a87d2dd902aebb670707f.tar.bz2 hercules-818acc5866707b9e294a87d2dd902aebb670707f.tar.xz hercules-818acc5866707b9e294a87d2dd902aebb670707f.zip |
Rewritten skill_tree parser in a more robust way
- Fixes an issue that prevented skills with more than 4 pre-requisites
or more than 3 pre-requisites and a minimum level from being parsed
correctly (and without any warning or error messages).
- Removes the limit on 5 pre-requisites (replaced a fixed size array
with a VECTOR)
- Reduces memory usage of skill_tree from 794kB to 440kB (32 bit) or
523kB (64 bit).
- Fixes an issue that prevented multiple inheritance from working
correctly in rare cases (incorrect definition order), without any
warning or error messages. Now a warning is displayed if a job is
inherited before being defined.
- Fixes an issue that prevented skills inherited from being correctly
merged with the skills defined for the current job.
- Prevents a job from inheriting itself by accident.
- Correctly detects skills defined twice for the same job.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.h')
-rw-r--r-- | src/map/pc.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/pc.h b/src/map/pc.h index 97f339bf6..23b46a631 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -41,7 +41,6 @@ * Defines **/ #define MAX_PC_BONUS 10 -#define MAX_PC_SKILL_REQUIRE 5 #define MAX_PC_FEELHATE 3 #define MAX_PC_DEVOTION 5 ///< Max amount of devotion targets #define PVP_CALCRANK_INTERVAL 1000 ///< PVP calculation interval @@ -714,17 +713,19 @@ END_ZEROED_BLOCK; #define pc_can_give_items(sd) ( pc_has_permission((sd),PC_PERM_TRADE) ) #define pc_can_give_bound_items(sd) ( pc_has_permission((sd),PC_PERM_TRADE_BOUND) ) +struct skill_tree_requirement { + short id; + unsigned short idx; + unsigned char lv; +}; + struct skill_tree_entry { short id; unsigned short idx; unsigned char max; unsigned char joblv; short inherited; - struct { - short id; - unsigned short idx; - unsigned char lv; - } need[MAX_PC_SKILL_REQUIRE]; + VECTOR_DECL(struct skill_tree_requirement) need; }; // Celest struct sg_data { @@ -1052,6 +1053,7 @@ END_ZEROED_BLOCK; /* End */ int (*autosave) (int tid, int64 tick, int id, intptr_t data); int (*follow_timer) (int tid, int64 tick, int id, intptr_t data); void (*read_skill_tree) (void); + void (*clear_skill_tree) (void); int (*isUseitem) (struct map_session_data *sd,int n); int (*show_steal) (struct block_list *bl,va_list ap); int (*checkcombo) (struct map_session_data *sd, struct item_data *data ); |