diff options
author | Haru <haru@dotalux.com> | 2013-11-27 03:21:45 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-03 16:28:08 +0100 |
commit | 6f55c00e72ca6db130a84fe92218f73a777428f4 (patch) | |
tree | e3f25d1ad5b3dbb06371941fc9fd8cb66a5411a9 /src/map/script.c | |
parent | 470ab15023f09dc823e8ce8ac818e0bbe8a95aef (diff) | |
download | hercules-6f55c00e72ca6db130a84fe92218f73a777428f4.tar.gz hercules-6f55c00e72ca6db130a84fe92218f73a777428f4.tar.bz2 hercules-6f55c00e72ca6db130a84fe92218f73a777428f4.tar.xz hercules-6f55c00e72ca6db130a84fe92218f73a777428f4.zip |
Questlog fixes
- Improved memory usage of the quest log system. (saves up to 75kB per
online character). Fixes issue #133.
- Fixed various issues with quest entries disappearing from characters
without an apparent reason, or monster kill counters getting stuck -
the issues were caused by a de-synchronization between the two
parallel questlog arrays in map_session_data.
- Added some code documentation.
- Thanks to Ind.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/map/script.c b/src/map/script.c index 853f0c44f..79d2ac969 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15889,20 +15889,20 @@ BUILDIN(questinfo) return true; } -BUILDIN(setquest) -{ +BUILDIN(setquest) { struct map_session_data *sd = script->rid2sd(st); unsigned short i; - - if (!sd) - return false; + int quest_id; + nullpo_retr(false,sd); - quest->add(sd, script_getnum(st, 2)); + quest_id = script_getnum(st, 2); + + quest->add(sd, quest_id); // If questinfo is set, remove quest bubble once quest is set. for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; - if( qi->quest_id == script_getnum(st, 2) ) { + if( qi->quest_id == quest_id ) { #if PACKETVER >= 20120410 clif->quest_show_event(sd, &qi->nd->bl, 9999, 0); #else @@ -15914,8 +15914,7 @@ BUILDIN(setquest) return true; } -BUILDIN(erasequest) -{ +BUILDIN(erasequest) { struct map_session_data *sd = script->rid2sd(st); nullpo_retr(false,sd); @@ -15923,8 +15922,7 @@ BUILDIN(erasequest) return true; } -BUILDIN(completequest) -{ +BUILDIN(completequest) { struct map_session_data *sd = script->rid2sd(st); nullpo_retr(false,sd); @@ -15932,8 +15930,7 @@ BUILDIN(completequest) return true; } -BUILDIN(changequest) -{ +BUILDIN(changequest) { struct map_session_data *sd = script->rid2sd(st); nullpo_retr(false,sd); @@ -15941,15 +15938,14 @@ BUILDIN(changequest) return true; } -BUILDIN(checkquest) -{ +BUILDIN(checkquest) { struct map_session_data *sd = script->rid2sd(st); - quest_check_type type = HAVEQUEST; + enum quest_check_type type = HAVEQUEST; nullpo_retr(false,sd); if( script_hasdata(st, 3) ) - type = (quest_check_type)script_getnum(st, 3); + type = (enum quest_check_type)script_getnum(st, 3); script_pushint(st, quest->check(sd, script_getnum(st, 2), type)); |