Issue information

Issue ID
#8570
Status
Confirmed
Severity
None
Started
Ind
Mar 13, 2015 17:44
Last Post
malufett
Mar 13, 2015 17:58
Confirmation
Yes (1)
No (0)

Ind - Mar 13, 2015 17:44

since I don't know the behavior of the statuses I can't really pick why way is correct, I can tell what is happening however.
for example you have this:[code=auto:0] case SC_MAGNETICFIELD: { if( --(sce->val3) <= 0 ) break; // Time out if( sce->val2 == bl->id ) { if( !status->charge(bl,0,50) ) break; // No more SP status should end, and in the next second will end for the other affected players } else { struct block_list *src = map->id2bl(sce->val2); struct status_change *ssc; if( !src || (ssc = status->get_sc(src)) == NULL || !ssc->data[SC_MAGNETICFIELD] ) break; // Source no more under Magnetic Field } sc_timer_next(1000 + tick, status->change_timer, bl->id, data); } break; [/code]which calls sc_timer_next for another 1s -- HOWEVER it does not call return, so it falls at the status_change_end at the bottom of the switch.
same on these two.[code=auto:0] case SC_OVERHEAT_LIMITPOINT: if( --(sce->val1) > 0 ) { // Cooling sc_timer_next(30000 + tick, status->change_timer, bl->id, data); } break; case SC_OVERHEAT: { int damage = st->max_hp / 100; // Suggestion 1% each second if( damage >= st->hp ) damage = st->hp - 1; // Do not kill, just keep you with 1 hp minimum map->freeblock_lock(); status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,0,0,damage,0,0,0)); if( sc->data[type] ) { sc_timer_next(1000 + tick, status->change_timer, bl->id, data); } map->freeblock_unlock(); } break; [/code]there are possibly more.

Ind - Mar 13, 2015 17:48

Update: as I see status_change_end at the bottom[code=auto:0] return status_change_end( bl,type,tid );[/code]sends the old timer id (tid) while sc_timer_next updates only sce->timer
however in status_change_end_[code=auto:0] if (sce->timer != tid && tid != INVALID_TIMER) return 0; [/code]it is handling the invalid. the switch cases i mentioned are still wrong however, as they're moving on while they shouldn't

malufett - Mar 13, 2015 17:58

when 'sc_timer_next' is called it will repeat the same function and end it without calling 'status_change_end'

in that case in every recursion it calls 'status_change_end' which in fact is wrong, cause in every iteration it perform some unnecessary task...

:meow: