r5667 - trunk/server/rcon2irc
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jan 26 01:56:54 EST 2009
Author: div0
Date: 2009-01-26 01:56:54 -0500 (Mon, 26 Jan 2009)
New Revision: 5667
Modified:
trunk/server/rcon2irc/rcon2irc.pl
Log:
fix color translation
Modified: trunk/server/rcon2irc/rcon2irc.pl
===================================================================
--- trunk/server/rcon2irc/rcon2irc.pl 2009-01-26 06:56:44 UTC (rev 5666)
+++ trunk/server/rcon2irc/rcon2irc.pl 2009-01-26 06:56:54 UTC (rev 5667)
@@ -129,9 +129,9 @@
sub color_rgb2basic($)
{
my ($data) = @_;
- my ($r, $g, $b) = @$data;
- my $min = [sort ($r, $g, $b)]->[0];
- my $max = [sort ($r, $g, $b)]->[-1];
+ my ($R, $G, $B) = @$data;
+ my $min = [sort { $a <=> $b } ($R, $G, $B)]->[0];
+ my $max = [sort { $a <=> $b } ($R, $G, $B)]->[-1];
my $v = $max / 15;
my $s = ($max == $min) ? 0 : 1 - $min/$max;
@@ -147,17 +147,17 @@
{
$h = 0;
}
- elsif($max == $r)
+ elsif($max == $R)
{
- $h = (60 * ($g - $b) / ($max - $min)) % 360;
+ $h = (60 * ($G - $B) / ($max - $min)) % 360;
}
- elsif($max == $g)
+ elsif($max == $G)
{
- $h = (60 * ($b - $r) / ($max - $min)) + 120;
+ $h = (60 * ($B - $R) / ($max - $min)) + 120;
}
- elsif($max == $b)
+ elsif($max == $B)
{
- $h = (60 * ($r - $g) / ($max - $min)) + 240;
+ $h = (60 * ($R - $G) / ($max - $min)) + 240;
}
return 1 if $h < 36;
More information about the nexuiz-commits
mailing list