changeset 34:8b631d17dfd0

Fixed some stuff after talking to dom -- yeah it could have been done simpler if he told me yesterday :P
author df
date Sun, 07 Dec 2008 11:16:49 +0000
parents 48df6d55427b
children b0436bc63f9e
files skillbot.pl
diffstat 1 files changed, 3 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/skillbot.pl	Sun Dec 07 09:44:59 2008 +0000
+++ b/skillbot.pl	Sun Dec 07 11:16:49 2008 +0000
@@ -260,10 +260,10 @@
 	# lists the chars in order of shortest training time
 	if ($msg =~ /^\!next/i) {
 		my $nreply = "Training: ";
-		my (@fc) = (order_friend_copy @friends);
 		
-		foreach (@fc) 
-			$nreply .= $_->{char}->name . " (" . $_->{skill}->time_remaining . ") | ";
+		for my $f (sort { $a->{skill}->finish_time <=> $b->{skill}->finish_time } grep(defined $_->{skill}, @friends)) {
+			$nreply .= $f->{char}->name . " (" . $f->{skill}->time_remaining . ") | ";
+		}
 		
 		$self->privmsg('#' . $config{channel}, $nreply);
 	}
@@ -508,23 +508,6 @@
 	});
 }
 
-=pod
-
-Returns a copy of the input @friends that is ordered by training time
-and doesnt contain any chars that are not in training.
-
-=cut
-sub order_friend_copy
-{
-	my @friendcopy;
-	foreach ($_)
-		push(@friendcopy, $_) unless defined($_->{char}->skill->in_training);
-	
-	sort { $a->{skill}->finish_time <=> $b->{skill}->finish_time } @friendcopy;
-	
-	return @friendcopy;
-}
-
 END {
 	cleanup_and_die();
 }