summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-01-19 20:05:10 +0100
committerHaruna <haru@dotalux.com>2015-01-19 20:05:10 +0100
commit03709c136ad300be631adfd38dc36c2433bda718 (patch)
treeb690163936b99640f78141f36320fb2921556747
parente3426296a6add20845bd08013355fd3d5f975556 (diff)
parentdef25b0d1ef77cfbd4ce09656c1cef9ec0a33269 (diff)
downloadhercules-03709c136ad300be631adfd38dc36c2433bda718.tar.gz
hercules-03709c136ad300be631adfd38dc36c2433bda718.tar.bz2
hercules-03709c136ad300be631adfd38dc36c2433bda718.tar.xz
hercules-03709c136ad300be631adfd38dc36c2433bda718.zip
Merge pull request #443 from 4144/pcext
Extract exp table validation into separate function.
-rw-r--r--src/map/pc.c27
-rw-r--r--src/map/pc.h2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc26
5 files changed, 50 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 09194fbab..b64bdea80 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -10357,16 +10357,7 @@ int pc_readdb(void) {
}
}
fclose(fp);
- for (i = 0; i < JOB_MAX; i++) {
- if (!pc->db_checkid(i)) continue;
- if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER)
- continue; //Classes that do not need exp tables.
- j = pc->class2idx(i);
- if (!pc->max_level[j][0])
- ShowWarning("Class %s (%d) does not has a base exp table.\n", pc->job_name(i), i);
- if (!pc->max_level[j][1])
- ShowWarning("Class %s (%d) does not has a job exp table.\n", pc->job_name(i), i);
- }
+ pc->validate_levels();
ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"exp.txt");
count = 0;
// Reset and read skilltree
@@ -10481,6 +10472,21 @@ int pc_readdb(void) {
return 0;
}
+void pc_validate_levels(void) {
+ int i;
+ int j;
+ for (i = 0; i < JOB_MAX; i++) {
+ if (!pc->db_checkid(i)) continue;
+ if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER)
+ continue; //Classes that do not need exp tables.
+ j = pc->class2idx(i);
+ if (!pc->max_level[j][0])
+ ShowWarning("Class %s (%d) does not has a base exp table.\n", pc->job_name(i), i);
+ if (!pc->max_level[j][1])
+ ShowWarning("Class %s (%d) does not has a job exp table.\n", pc->job_name(i), i);
+ }
+}
+
void pc_itemcd_do(struct map_session_data *sd, bool load) {
int i,cursor = 0;
struct item_cd* cd = NULL;
@@ -11219,6 +11225,7 @@ void pc_defaults(void) {
pc->global_expiration_timer = pc_global_expiration_timer;
pc->expire_check = pc_expire_check;
pc->db_checkid = pc_db_checkid;
+ pc->validate_levels = pc_validate_levels;
/**
* Autotrade persistency [Ind/Hercules <3]
diff --git a/src/map/pc.h b/src/map/pc.h
index 7e2fa8558..152701119 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1012,6 +1012,8 @@ struct pc_interface {
bool (*db_checkid) (unsigned int class_);
+ void (*validate_levels) (void);
+
/**
* Autotrade persistency [Ind/Hercules <3]
**/
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index c79d9db75..0433cc54c 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -3945,6 +3945,8 @@ struct {
struct HPMHookPoint *HP_pc_expire_check_post;
struct HPMHookPoint *HP_pc_db_checkid_pre;
struct HPMHookPoint *HP_pc_db_checkid_post;
+ struct HPMHookPoint *HP_pc_validate_levels_pre;
+ struct HPMHookPoint *HP_pc_validate_levels_post;
struct HPMHookPoint *HP_pc_autotrade_load_pre;
struct HPMHookPoint *HP_pc_autotrade_load_post;
struct HPMHookPoint *HP_pc_autotrade_update_pre;
@@ -9098,6 +9100,8 @@ struct {
int HP_pc_expire_check_post;
int HP_pc_db_checkid_pre;
int HP_pc_db_checkid_post;
+ int HP_pc_validate_levels_pre;
+ int HP_pc_validate_levels_post;
int HP_pc_autotrade_load_pre;
int HP_pc_autotrade_load_post;
int HP_pc_autotrade_update_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index cab2f169c..a8437c10a 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2003,6 +2003,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(pc->global_expiration_timer, HP_pc_global_expiration_timer) },
{ HP_POP(pc->expire_check, HP_pc_expire_check) },
{ HP_POP(pc->db_checkid, HP_pc_db_checkid) },
+ { HP_POP(pc->validate_levels, HP_pc_validate_levels) },
{ HP_POP(pc->autotrade_load, HP_pc_autotrade_load) },
{ HP_POP(pc->autotrade_update, HP_pc_autotrade_update) },
{ HP_POP(pc->autotrade_start, HP_pc_autotrade_start) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 3feaa780a..f8056c9cb 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -52802,6 +52802,32 @@ bool HP_pc_db_checkid(unsigned int class_) {
}
return retVal___;
}
+void HP_pc_validate_levels(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_pc_validate_levels_pre ) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_validate_levels_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pc_validate_levels_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pc.validate_levels();
+ }
+ if( HPMHooks.count.HP_pc_validate_levels_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_validate_levels_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pc_validate_levels_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
void HP_pc_autotrade_load(void) {
int hIndex = 0;
if( HPMHooks.count.HP_pc_autotrade_load_pre ) {