diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/src/map/script.c b/src/map/script.c index 1dff4c202..be346cb92 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2609,7 +2609,7 @@ void* get_val2(struct script_state* st, int64 uid, struct DBMap** ref) { **/ void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct DBMap** ref) { const char *name = script->get_str(script_getvarid(uid)); - struct DBMap *src = script->array_src(st, sd ? sd : st->rid ? map->id2sd(st->rid) : NULL, name, ref); + struct DBMap *src = script->array_src(st, sd ? sd : st->rid ? map->id2sd(st->rid) : NULL, name, ref);\ struct script_array *sa = NULL; bool insert = false; @@ -4847,17 +4847,8 @@ BUILDIN(callfunc) const char* name = reference_getname(data); if( name[0] == '.' ) { if( !ref ) { - ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 2); + ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1); ref[0] = (name[1] == '@' ? st->stack->var_function : st->script->script_vars); - if( name[1] == '@' ) { - if( !st->stack->array_function_db ) - st->stack->array_function_db = idb_alloc(DB_OPT_BASE); - ref[1] = st->stack->array_function_db; - } else { - if( !st->script->script_arrays_db ) - st->script->script_arrays_db = idb_alloc(DB_OPT_BASE); - ref[1] = st->script->script_arrays_db; - } } data->ref = ref; } @@ -4906,11 +4897,8 @@ BUILDIN(callsub) const char* name = reference_getname(data); if( name[0] == '.' && name[1] == '@' ) { if ( !ref ) { - ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 2); + ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1); ref[0] = st->stack->var_function; - if( !st->stack->array_function_db ) - st->stack->array_function_db = idb_alloc(DB_OPT_BASE); - ref[1] = st->stack->array_function_db; } data->ref = ref; } @@ -4983,16 +4971,12 @@ BUILDIN(return) const char* name = reference_getname(data); if( name[0] == '.' && name[1] == '@' ) {// scope variable - if( !data->ref || data->ref[0] == st->stack->var_function ) + if( !data->ref || data->ref == (DBMap**)&st->stack->var_function ) script->get_val(st, data);// current scope, convert to value } else if( name[0] == '.' && !data->ref ) {// script variable, link to current script - data->ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 2); - data->ref[0] = st->script->script_vars; - if( !st->script->script_arrays_db ) - st->script->script_arrays_db = idb_alloc(DB_OPT_BASE); - data->ref[1] = st->script->script_arrays_db; + data->ref = &st->script->script_vars; } } } @@ -9884,7 +9868,7 @@ BUILDIN(sc_start) { } if( bl ) - status->change_start(NULL, bl, type, 10000, val1, 0, 0, val4, tick, 2); + status->change_start(bl, type, 10000, val1, 0, 0, val4, tick, 2); return true; } @@ -9922,7 +9906,7 @@ BUILDIN(sc_start2) { } if( bl ) - status->change_start(NULL, bl, type, rate, val1, 0, 0, val4, tick, 2); + status->change_start(bl, type, rate, val1, 0, 0, val4, tick, 2); return true; } @@ -9962,7 +9946,7 @@ BUILDIN(sc_start4) { } if( bl ) - status->change_start(NULL, bl, type, 10000, val1, val2, val3, val4, tick, 2); + status->change_start(bl, type, 10000, val1, val2, val3, val4, tick, 2); return true; } @@ -10029,7 +10013,7 @@ BUILDIN(getscrate) { bl = map->id2bl(st->rid); if (bl) - rate = status->get_sc_def(bl, bl, (sc_type)type, 10000, 10000, 0); + rate = status->get_sc_def(bl, (sc_type)type, 10000, 10000, 0); script_pushint(st,rate); return true; @@ -13275,7 +13259,7 @@ BUILDIN(summon) md->deletetimer = timer->add(tick+(timeout>0?timeout*1000:60000),mob->timer_delete,md->bl.id,0); mob->spawn (md); //Now it is ready for spawning. clif->specialeffect(&md->bl,344,AREA); - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); + sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); } return true; } @@ -15828,7 +15812,7 @@ BUILDIN(mercenary_sc_start) { tick = script_getnum(st,3); val1 = script_getnum(st,4); - status->change_start(NULL, &sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2); + status->change_start(&sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2); return true; } @@ -17060,7 +17044,7 @@ BUILDIN(setmounting) { if( sd->sc.data[SC_ALL_RIDING] ) status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER); else - sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 0, -1); + sc_start(&sd->bl, SC_ALL_RIDING, 100, 0, -1); script_pushint(st,1);//in both cases, return 1. } return true; @@ -17611,8 +17595,8 @@ BUILDIN(montransform) { sprintf(msg, msg_txt(1485), monster->name); // Traaaansformation-!! %s form!! clif->ShowScript(&sd->bl, msg); status_change_end(bl, SC_MONSTER_TRANSFORM, INVALID_TIMER); // Clear previous - sc_start2(NULL, bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick); - sc_start4(NULL, bl, type, 100, val1, val2, val3, val4, tick); + sc_start2(bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick); + sc_start4(bl, type, 100, val1, val2, val3, val4, tick); } return true; } |