[nexuiz-commits] r6950 - trunk/misc/tools

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Jun 9 15:25:16 EDT 2009


Author: div0
Date: 2009-06-09 15:25:16 -0400 (Tue, 09 Jun 2009)
New Revision: 6950

Modified:
   trunk/misc/tools/midi2cfg-ng.pl
Log:
random bot choice should be better


Modified: trunk/misc/tools/midi2cfg-ng.pl
===================================================================
--- trunk/misc/tools/midi2cfg-ng.pl	2009-06-09 19:17:48 UTC (rev 6949)
+++ trunk/misc/tools/midi2cfg-ng.pl	2009-06-09 19:25:16 UTC (rev 6950)
@@ -71,10 +71,15 @@
 @allmidievents = sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } @allmidievents;
 
 
+sub unsort(@)
+{
+	return map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, rand] } @_;
+}
 
 
 
 
+
 sub botconfig_read($)
 {
 	my ($fn) = @_;
@@ -315,7 +320,7 @@
 
 	my $overflow = 0;
 
-	for(@busybots_allocated)
+	for(unsort @busybots_allocated)
 	{
 		my $canplay = busybot_note_on_bot $_, $time, $channel, $note, 0;
 		if($canplay > 0)
@@ -328,7 +333,7 @@
 		# wrong
 	}
 
-	for(map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, rand] } keys %$busybots)
+	for(unsort keys %$busybots)
 	{
 		next if $busybots->{$_}->{count} <= 0;
 		my $bot = Storable::dclone $busybots->{$_};



More information about the nexuiz-commits mailing list