--- a/src/gfx.cpp Sun Apr 15 10:30:00 2007 +0000
+++ b/src/gfx.cpp Sun Apr 22 19:06:48 2007 +0000
@@ -201,7 +201,7 @@
static void GfxSetPixel(int x, int y, int color)
{
const DrawPixelInfo* dpi = _cur_dpi;
- if ((x-=dpi->left) < 0 || x>=dpi->width || (y-=dpi->top)<0 || y>=dpi->height)
+ if ((x -= dpi->left) < 0 || x >= dpi->width || (y -= dpi->top)<0 || y >= dpi->height)
return;
dpi->dst_ptr[y * dpi->pitch + x] = color;
}
@@ -275,7 +275,7 @@
/** Truncate a given string to a maximum width if neccessary.
* If the string is truncated, add three dots ('...') to show this.
- * @param *dest string that is checked and possibly truncated
+ * @param *str string that is checked and possibly truncated
* @param maxw maximum width in pixels of the string
* @return new width of (truncated) string */
static int TruncateString(char *str, int maxw)
@@ -413,11 +413,11 @@
/** 'Correct' a string to a maximum length. Longer strings will be cut into
* additional lines at whitespace characters if possible. The string parameter
* is modified with terminating characters mid-string which are the
- * placeholders for the newlines.<br/>
+ * placeholders for the newlines.
* The string WILL be truncated if there was no whitespace for the current
* line's maximum width.
*
- * @note To know if the the terminating '\0' is the string end or just a
+ * @note To know if the terminating '\0' is the string end or just a
* newline, the returned 'num' value should be consulted. The num'th '\0',
* starting with index 0 is the real string end.
*
@@ -461,7 +461,7 @@
switch (c) {
case '\0': return num + (size << 16); break;
case SCC_SETX: str++; break;
- case SCC_SETXY: str +=2; break;
+ case SCC_SETXY: str += 2; break;
case SCC_TINYFONT: size = FS_SMALL; break;
case SCC_BIGFONT: size = FS_LARGE; break;
case '\n': goto end_of_inner_loop;
@@ -487,7 +487,7 @@
* @param x Centre the string around this pixel width
* @param y Draw the string at this pixel height (first line's bottom)
* @param str String to draw
- * @param max Maximum width the string can have before it is wrapped */
+ * @param maxw Maximum width the string can have before it is wrapped */
void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
{
char buffer[512];
@@ -509,7 +509,7 @@
for (;;) {
w = GetStringBoundingBox(src).width;
- DoDrawString(src, x - (w>>1), y, 0xFE);
+ DoDrawString(src, x - (w >> 1), y, 0xFE);
_cur_fontsize = _last_fontsize;
for (;;) {
@@ -524,7 +524,7 @@
} else if (c == SCC_SETX) {
src++;
} else if (c == SCC_SETXY) {
- src+=2;
+ src += 2;
}
}
}
@@ -574,7 +574,7 @@
} else if (c == SCC_SETX) {
src++;
} else if (c == SCC_SETXY) {
- src+=2;
+ src += 2;
}
}
}
@@ -626,7 +626,7 @@
/** Draw a string at the given coordinates with the given colour
* @param string the string to draw
* @param x offset from left side of the screen, if negative offset from the right side
- * @param x offset from top side of the screen, if negative offset from the bottom
+ * @param y offset from top side of the screen, if negative offset from the bottom
* @param real_color colour of the string, see _string_colormap in
* table/palettes.h or docs/ottd-colourtext-palette.png
* @return the x-coordinates where the drawing has finished. If nothing is drawn
@@ -643,7 +643,7 @@
if (color != 0xFE) {
if (x >= dpi->left + dpi->width ||
- x + _screen.width*2 <= dpi->left ||
+ x + _screen.width * 2 <= dpi->left ||
y >= dpi->top + dpi->height ||
y + _screen.height <= dpi->top)
return x;
@@ -652,10 +652,11 @@
switch_color:;
if (real_color & IS_PALETTE_COLOR) {
_string_colorremap[1] = color;
- _string_colorremap[2] = 215;
+ _string_colorremap[2] = _use_dos_palette ? 1 : 215;
} else {
- _string_colorremap[1] = _string_colormap[color].text;
- _string_colorremap[2] = _string_colormap[color].shadow;
+ uint palette = _use_dos_palette ? 1 : 0;
+ _string_colorremap[1] = _string_colormap[palette][color].text;
+ _string_colorremap[2] = _string_colormap[palette][color].shadow;
}
_color_remap_ptr = _string_colorremap;
}