diff options
author | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-28 22:15:18 +0000 |
---|---|---|
committer | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-28 22:15:18 +0000 |
commit | b6a5ac44371ff714d18a04f3acbe29955ace07aa (patch) | |
tree | ea97e1dc9254a40f2b6eb0bdac6418c024fda20d /src/map/script.c | |
parent | 4f2de079cdabfa86b609a5ad15df3a4c1c58437b (diff) | |
download | hercules-b6a5ac44371ff714d18a04f3acbe29955ace07aa.tar.gz hercules-b6a5ac44371ff714d18a04f3acbe29955ace07aa.tar.bz2 hercules-b6a5ac44371ff714d18a04f3acbe29955ace07aa.tar.xz hercules-b6a5ac44371ff714d18a04f3acbe29955ace07aa.zip |
- Fixed an issue with the instance variable storage system never being initialised (since unknown revision)
- Combined both string and integer instance variables into a single DBMap* structure
- Fixed a missing new-line at the end of src/common/conf.h causing warnings
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15998 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/map/script.c b/src/map/script.c index 0428d7a26..856b2d95e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2541,15 +2541,12 @@ void get_val(struct script_state* st, struct script_data* data) } break; case '\'': - { - struct DBMap* n = NULL; if (st->instance_id) { - n = instance[st->instance_id].svar; + data->u.str = (char*)idb_get(instance[st->instance_id].vars,reference_getuid(data)); } else { - ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to 0\n", name); + ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to \"\"\n", name); + data->u.str = NULL; } - data->u.str = (char*)idb_get(n,reference_getuid(data)); - } break; default: data->u.str = pc_readglobalreg_str(sd, name); @@ -2606,12 +2603,12 @@ void get_val(struct script_state* st, struct script_data* data) } break; case '\'': - { - struct DBMap* n = NULL; if( st->instance_id ) - n = instance[st->instance_id].ivar; - data->u.num = (int)idb_iget(n,reference_getuid(data)); - } + data->u.num = (int)idb_iget(instance[st->instance_id].vars,reference_getuid(data)); + else { + ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to 0\n", name); + data->u.num = 0; + } break; default: data->u.num = pc_readglobalreg(sd, name); @@ -2668,8 +2665,8 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam return 1; case '\'': if( st->instance_id ) { - idb_remove(instance[st->instance_id].svar, num); - if( str[0] ) idb_put(instance[st->instance_id].svar, num, aStrdup(str)); + idb_remove(instance[st->instance_id].vars, num); + if( str[0] ) idb_put(instance[st->instance_id].vars, num, aStrdup(str)); } return 1; default: @@ -2716,9 +2713,9 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam return 1; case '\'': if( st->instance_id ) { - idb_remove(instance[st->instance_id].ivar, num); + idb_remove(instance[st->instance_id].vars, num); if( val != 0 ) - idb_iput(instance[st->instance_id].ivar, num, val); + idb_iput(instance[st->instance_id].vars, num, val); } return 1; default: |