summaryrefslogtreecommitdiff
path: root/src/map/script.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-03-10 02:20:23 +0100
committerHaru <haru@dotalux.com>2014-03-10 02:20:23 +0100
commit1a4a16ee5c798a6ef9c583fb3f6fc63a7c0ae35e (patch)
tree6d29c2fae504b077375f4d5b2360b7c1cc539957 /src/map/script.h
parent829bdc85fdb5aa2c95bc1df0f473df6225cc3b52 (diff)
downloadhercules-1a4a16ee5c798a6ef9c583fb3f6fc63a7c0ae35e.tar.gz
hercules-1a4a16ee5c798a6ef9c583fb3f6fc63a7c0ae35e.tar.bz2
hercules-1a4a16ee5c798a6ef9c583fb3f6fc63a7c0ae35e.tar.xz
hercules-1a4a16ee5c798a6ef9c583fb3f6fc63a7c0ae35e.zip
Fixed a crash caused by NPC variable references in callfunc
- Fixes bugreport:8074, thanks to ahmadshidqi http://hercules.ws/board/tracker/issue-8074-help-crash/ - Also fixed some DBMap allocation mistakes introduced in 4f3156b. - Added testcases to the self-test script. - Made possible thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.h')
-rw-r--r--src/map/script.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/map/script.h b/src/map/script.h
index ff947bf79..73ba7303e 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -401,6 +401,8 @@ struct hQueueIterator {
struct script_state {
struct script_stack* stack;
+ struct reg_db **pending_refs; ///< References to .vars returned by sub-functions, pending deletion.
+ int pending_ref_count; ///< Amount of pending_refs currently stored.
int start,end;
int pos;
enum e_script_state state;
@@ -589,6 +591,7 @@ struct script_interface {
void (*free_vars) (struct DBMap *var_storage);
struct script_state* (*alloc_state) (struct script_code* rootscript, int pos, int rid, int oid);
void (*free_state) (struct script_state* st);
+ void (*add_pending_ref) (struct script_state *st, struct reg_db *ref);
void (*run_autobonus) (const char *autobonus,int id, int pos);
void (*cleararray_pc) (struct map_session_data* sd, const char* varname, void* value);
void (*setarray_pc) (struct map_session_data* sd, const char* varname, uint32 idx, void* value, int* refcache);