summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-06-29 12:09:55 +0000
committerrubidium <rubidium@openttd.org>2013-06-29 12:09:55 +0000
commitbdb62c14e2e7f2ce66aa538f5bed209b6b464cc3 (patch)
tree1a1bf98628f802657fa93693f92e06d6088439eb /src
parent66b7123ed91113d147f01206b36a2c8be683c17f (diff)
downloadopenttd-bdb62c14e2e7f2ce66aa538f5bed209b6b464cc3.tar.xz
(svn r25513) -Fix [FS#5623]: the high score's company/president name was stored with encoded string codes, causing it to cause trouble when the encoding of the string codes changes. Furthermore, check the incoming dangerous content better
Diffstat (limited to 'src')
-rw-r--r--src/highscore.cpp2
-rw-r--r--src/highscore_gui.cpp3
-rw-r--r--src/lang/english.txt3
3 files changed, 5 insertions, 3 deletions
diff --git a/src/highscore.cpp b/src/highscore.cpp
index 0a38acf2e..2ce2d9bda 100644
--- a/src/highscore.cpp
+++ b/src/highscore.cpp
@@ -172,7 +172,7 @@ void LoadFromHighScore()
i = SP_SAVED_HIGHSCORE_END;
break;
}
- *lastof(hs->company) = '\0';
+ str_validate(hs->company, lastof(hs->company), SVS_NONE);
hs->title = EndGameGetPerformanceTitleFromValue(hs->score);
}
}
diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp
index 5485866aa..9b832e3f5 100644
--- a/src/highscore_gui.cpp
+++ b/src/highscore_gui.cpp
@@ -190,7 +190,8 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow {
if (hs[i].company[0] != '\0') {
TextColour colour = (this->rank == i) ? TC_RED : TC_BLACK; // draw new highscore in red
- DrawString(pt.x + 71, pt.x + 569, pt.y + 140 + (i * 55), hs[i].company, colour);
+ SetDParamStr(0, hs[i].company);
+ DrawString(pt.x + 71, pt.x + 569, pt.y + 140 + (i * 55), STR_JUST_BIG_RAW_STRING, colour);
SetDParam(0, hs[i].title);
SetDParam(1, hs[i].score);
DrawString(pt.x + 71, pt.x + 569, pt.y + 140 + FONT_HEIGHT_LARGE + (i * 55), STR_HIGHSCORE_STATS, colour);
diff --git a/src/lang/english.txt b/src/lang/english.txt
index a2242c48f..5a00db959 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -663,7 +663,7 @@ STR_HIGHSCORE_PERFORMANCE_TITLE_CAPITALIST :Capitalist
STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE :Magnate
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Mogul
STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Tycoon of the Century
-STR_HIGHSCORE_NAME :{BIG_FONT}{PRESIDENT_NAME}, {COMPANY}
+STR_HIGHSCORE_NAME :{PRESIDENT_NAME}, {COMPANY}
STR_HIGHSCORE_STATS :{BIG_FONT}'{STRING}' ({COMMA})
STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} achieves '{STRING}' status!
STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} of {COMPANY} achieves '{STRING}' status!
@@ -4817,6 +4817,7 @@ STR_JUST_DATE_ISO :{DATE_ISO}
STR_JUST_STRING :{STRING}
STR_JUST_STRING_STRING :{STRING}{STRING}
STR_JUST_RAW_STRING :{RAW_STRING}
+STR_JUST_BIG_RAW_STRING :{BIG_FONT}{RAW_STRING}
# Slightly 'raw' stringcodes with colour or size
STR_BLACK_COMMA :{BLACK}{COMMA}