summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-09 11:04:42 +0000
committerfrosch <frosch@openttd.org>2008-08-09 11:04:42 +0000
commit3c2128dedba5c6c4e9687121951b07a9946bb355 (patch)
tree07f662772954451d538a72634876d1daa132c774 /src
parent82ada4b3d070905d344a76b2756c48403e3de741 (diff)
downloadopenttd-3c2128dedba5c6c4e9687121951b07a9946bb355.tar.xz
(svn r14030) -Fix (r14027): true != false, also rename the parameter to make 'true' and 'false' more intuitively useable.
Diffstat (limited to 'src')
-rw-r--r--src/gfx.cpp16
-rw-r--r--src/gfx_func.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index d5749c1b6..fe1a4755b 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -677,7 +677,7 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
src = buffer;
for (;;) {
- DoDrawString(src, x, y, 0xFE, false);
+ DoDrawString(src, x, y, 0xFE, true);
_cur_fontsize = _last_fontsize;
for (;;) {
@@ -770,14 +770,16 @@ void DrawCharCentered(WChar c, int x, int y, uint16 real_color)
* @param y Offset from top side of the screen, if negative offset from the bottom
* @param real_colour Colour of the string, see _string_colormap in
* table/palettes.h or docs/ottd-colourtext-palette.png or the enum TextColour in gfx_type.h
- * @param multiline_skipping By default, always test the available space where to draw the string.
- When in multipline drawing, it would already be done,
- so no need to re-perform the same kind (more or less) of verifications.
- It's not only an optimisation, it's also a way to ensures the string will be parsed
+ * @param parse_string_also_when_clipped
+ * By default, always test the available space where to draw the string.
+ * When in multipline drawing, it would already be done,
+ * so no need to re-perform the same kind (more or less) of verifications.
+ * It's not only an optimisation, it's also a way to ensures the string will be parsed
+ * (as there are certain side effects on global variables, which are important for the next line)
* @return the x-coordinates where the drawing has finished.
* If nothing is drawn, the originally passed x-coordinate is returned
*/
-int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool multiline_skipping)
+int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool parse_string_also_when_clipped)
{
DrawPixelInfo *dpi = _cur_dpi;
FontSize size = _cur_fontsize;
@@ -787,7 +789,7 @@ int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool mult
byte colour = real_colour & 0xFF; // extract the 8 bits colour index that is required for the mapping
byte previous_colour = colour;
- if (!multiline_skipping) {
+ if (!parse_string_also_when_clipped) {
/* in "mode multiline", the available space have been verified. Not in regular one.
* So if the string cannot be drawn, return the original start to say so.*/
if (x >= dpi->left + dpi->width ||
diff --git a/src/gfx_func.h b/src/gfx_func.h
index 99736fa15..2e848f588 100644
--- a/src/gfx_func.h
+++ b/src/gfx_func.h
@@ -87,7 +87,7 @@ int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
int DrawString(int x, int y, StringID str, uint16 color);
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
-int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool multiline_skipping = false);
+int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool parse_string_also_when_clipped = false);
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);