comparison skillbot.pl @ 39:4dd6009b0d2a

Deleting timer ID if it's already been cancelled
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 07 Dec 2008 14:49:43 +0000
parents a8b60d2968b2
children 19cc55690fd7
comparison
equal deleted inserted replaced
38:a8b60d2968b2 39:4dd6009b0d2a
460 # Nothing training 460 # Nothing training
461 unless (defined $skill) 461 unless (defined $skill)
462 { 462 {
463 # If the char was training before and now has stopped then cancel 463 # If the char was training before and now has stopped then cancel
464 # the announcement 464 # the announcement
465 del_one_shot_timer($f->{timer}) if defined $f->{timer}; 465 if defined $f->{timer} {
466 del_one_shot_timer($f->{timer});
467 delete $f->{timer};
468 }
466 return; 469 return;
467 } 470 }
468 471
469 # Check for changes in the skill, skip or cancel announcement 472 # Check for changes in the skill, skip or cancel announcement
470 if (defined $f->{skill}) { 473 if (defined $f->{skill}) {
471 return if $skill->id eq $f->{skill}->id; 474 return if $skill->id eq $f->{skill}->id;
475
472 del_one_shot_timer($f->{timer}); 476 del_one_shot_timer($f->{timer});
477 delete $f->{timer};
473 } 478 }
474 479
475 my $finish = $skill->finish_time - time(); 480 my $finish = $skill->finish_time - time();
476 my $prefinish = $finish - 60; 481 my $prefinish = $finish - 60;
477 482