summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-02-24 17:35:23 +0100
committerHaru <haru@dotalux.com>2014-03-05 22:35:03 +0100
commit4f3156b78f807553b11f37a7d0c898f6e358495b (patch)
tree1a329c6b4b17f2b6ae4ba113f494efbd67d3c996 /src/map/pc.c
parentd25cc9b7dbc103cf1454db37159ffffeedaac149 (diff)
downloadhercules-4f3156b78f807553b11f37a7d0c898f6e358495b.tar.gz
hercules-4f3156b78f807553b11f37a7d0c898f6e358495b.tar.bz2
hercules-4f3156b78f807553b11f37a7d0c898f6e358495b.tar.xz
hercules-4f3156b78f807553b11f37a7d0c898f6e358495b.zip
Ref redesign, part 3
- Updated several functions to properly use the data structures defined in parts 1 and 2. - Special thanks to Ind for his help on this, as well as the previous two parts. - Fixes some crashes related to variable references passed back and forth between nested callfunc/callsub scopes (related: 2669e9a, 3259f89, 4f2de07) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index ff152b556..87f14bcd9 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8127,11 +8127,11 @@ void pc_setreg(struct map_session_data* sd, int64 reg, int val) {
if( val ) {
i64db_iput(sd->regs.vars, reg, val);
if( index )
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
} else {
i64db_remove(sd->regs.vars, reg);
if( index )
- script->array_update(&sd->regs.arrays, reg, true);
+ script->array_update(&sd->regs, reg, true);
}
}
@@ -8166,7 +8166,7 @@ void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) {
ers_free(pc->str_reg_ers, p);
} else {
if( index )
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
}
} else {
if( sd->regs.vars->remove(sd->regs.vars, DB->i642key(reg), &prev) ) {
@@ -8175,7 +8175,7 @@ void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) {
aFree(p->value);
ers_free(pc->str_reg_ers, p);
if( index )
- script->array_update(&sd->regs.arrays, reg, true);
+ script->array_update(&sd->regs, reg, true);
}
}
}
@@ -8265,12 +8265,12 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val) {
if( (p = i64db_get(sd->regs.vars, reg) ) ) {
if( val ) {
if( !p->value && index ) /* its a entry that was deleted, so we reset array */
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
p->value = val;
} else {
p->value = 0;
if( index )
- script->array_update(&sd->regs.arrays, reg, true);
+ script->array_update(&sd->regs, reg, true);
}
if( !pc->reg_load )
p->flag.update = 1;/* either way, it will require either delete or replace */
@@ -8278,7 +8278,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val) {
DBData prev;
if( index )
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
p = ers_alloc(pc->num_reg_ers, struct script_reg_num);
@@ -8318,12 +8318,12 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val)
if( p->value )
aFree(p->value);
else if ( index ) /* a entry that was deleted, so we reset */
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
p->value = aStrdup(val);
} else {
p->value = NULL;
if( index )
- script->array_update(&sd->regs.arrays, reg, true);
+ script->array_update(&sd->regs, reg, true);
}
if( !pc->reg_load )
p->flag.update = 1;/* either way, it will require either delete or replace */
@@ -8331,7 +8331,7 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val)
DBData prev;
if( index )
- script->array_update(&sd->regs.arrays, reg, false);
+ script->array_update(&sd->regs, reg, false);
p = ers_alloc(pc->str_reg_ers, struct script_reg_str);