summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-07 15:20:31 +0000
committerrubidium <rubidium@openttd.org>2007-08-07 15:20:31 +0000
commitc46e445e69f50d5b5a95e3e46fb3eed1efdb7656 (patch)
treed96722811d3b8b7cb54fe12d32dc41147a3a4159 /src/gfx.cpp
parenta7e37d8592d702b06679eba14a386dd779b61786 (diff)
downloadopenttd-c46e445e69f50d5b5a95e3e46fb3eed1efdb7656.tar.xz
(svn r10820) -Codechange: make negative currencies red and restore the colour from before the currency was printed; this removes the need to make two strings for printing currencies (one for positive currencies and one for negative currencies).
-Fix [FS#1036]: do not use green for currencies as it is practically unreadable on CRT monitors.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index c915b38f5..ecbf97048 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -495,10 +495,10 @@ int DoDrawString(const char *string, int x, int y, uint16 real_color)
DrawPixelInfo *dpi = _cur_dpi;
FontSize size = _cur_fontsize;
WChar c;
- byte color;
int xo = x, yo = y;
- color = real_color & 0xFF;
+ byte color = real_color & 0xFF;
+ byte previous_color = color;
if (color != 0xFE) {
if (x >= dpi->left + dpi->width ||
@@ -548,8 +548,12 @@ skip_cont:;
y += GetCharacterHeight(size);
goto check_bounds;
} else if (c >= SCC_BLUE && c <= SCC_BLACK) { // change color?
+ previous_color = color;
color = (byte)(c - SCC_BLUE);
goto switch_color;
+ } else if (c == SCC_PREVIOUS_COLOUR) { // revert to the previous color
+ Swap(color, previous_color);
+ goto switch_color;
} else if (c == SCC_SETX) { // {SETX}
x = xo + (byte)*string++;
} else if (c == SCC_SETXY) {// {SETXY}