Patch by H�seyin Uslu <[email protected]>

Check color passed on command line, make sure foreground and background
are not the same.

svn path=/trunk/; revision=8263
This commit is contained in:
Gé van Geldorp
2004-02-19 17:04:11 +00:00
parent 3ea2262879
commit ecfd9db944
+15 -8
View File
@@ -1,4 +1,4 @@
/* $Id: color.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $
/* $Id: color.c,v 1.4 2004/02/19 17:04:11 gvg Exp $
*
* COLOR.C - color internal command.
*
@@ -68,19 +68,26 @@ VOID SetScreenColor (WORD wColor, BOOL bFill)
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
if (bFill == TRUE)
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
GetConsoleScreenBufferInfo (hConsole, &csbi);
ConErrPuts (_T("Same colors error! (Background and foreground can't be the same color)"));
}
else
{
if (bFill == TRUE)
{
GetConsoleScreenBufferInfo (hConsole, &csbi);
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute (hConsole,
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute (hConsole,
(WORD)(wColor & 0x00FF),
(csbi.dwSize.X)*(csbi.dwSize.Y),
coPos,
&dwWritten);
}
SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF));
}
SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF));
}
}