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/quest.h | |
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/quest.h')
-rw-r--r-- | src/map/quest.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/map/quest.h b/src/map/quest.h index 0725a8c46..28815a6c3 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -5,7 +5,9 @@ #ifndef _QUEST_H_ #define _QUEST_H_ -struct s_quest_db { +#define MAX_QUEST_DB (60355+1) // Highest quest ID + 1 + +struct quest_db { int id; unsigned int time; int mob[MAX_QUEST_OBJECTIVES]; @@ -14,23 +16,31 @@ struct s_quest_db { //char name[NAME_LENGTH]; }; -typedef enum quest_check_type { HAVEQUEST, PLAYTIME, HUNTING } quest_check_type; +// Questlog check types +enum quest_check_type { + HAVEQUEST, ///< Query the state of the given quest + PLAYTIME, ///< Check if the given quest has been completed or has yet to expire + HUNTING, ///< Check if the given hunting quest's requirements have been met +}; struct quest_interface { - struct s_quest_db db[MAX_QUEST_DB]; + struct quest_db *db_data[MAX_QUEST_DB]; ///< Quest database + struct quest_db dummy; ///< Dummy entry for invalid quest lookups /* */ void (*init) (bool minimal); + void (*final) (void); void (*reload) (void); /* */ - int (*search_db) (int quest_id); + struct quest_db *(*db) (int quest_id); int (*pc_login) (TBL_PC *sd); int (*add) (TBL_PC *sd, int quest_id); int (*change) (TBL_PC *sd, int qid1, int qid2); int (*delete) (TBL_PC *sd, int quest_id); int (*update_objective_sub) (struct block_list *bl, va_list ap); void (*update_objective) (TBL_PC *sd, int mob_id); - int (*update_status) (TBL_PC *sd, int quest_id, quest_state qs); - int (*check) (TBL_PC *sd, int quest_id, quest_check_type type); + int (*update_status) (TBL_PC *sd, int quest_id, enum quest_state qs); + int (*check) (TBL_PC *sd, int quest_id, enum quest_check_type type); + void (*clear) (void); int (*read_db) (void); }; |