diff options
author | rubidium <rubidium@openttd.org> | 2009-04-26 10:45:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-26 10:45:07 +0000 |
commit | 11c6d30e77ab52b233b3a16a17054d2d65c8f410 (patch) | |
tree | 94a31f7394b1807c0e08ec0094bd77dd6abe09b2 | |
parent | fc63e376168adb7b12d9eca43c3bac3751297c3a (diff) | |
download | openttd-11c6d30e77ab52b233b3a16a17054d2d65c8f410.tar.xz |
(svn r16156) -Codechange: make the parameters of DrawStringMultiline the same as for DrawString (except the addition of the bottom parameter)
-rw-r--r-- | src/cheat_gui.cpp | 2 | ||||
-rw-r--r-- | src/company_gui.cpp | 4 | ||||
-rw-r--r-- | src/engine_gui.cpp | 16 | ||||
-rw-r--r-- | src/gfx.cpp | 5 | ||||
-rw-r--r-- | src/gfx_func.h | 2 | ||||
-rw-r--r-- | src/highscore_gui.cpp | 6 | ||||
-rw-r--r-- | src/misc_gui.cpp | 10 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 4 | ||||
-rw-r--r-- | src/news_gui.cpp | 16 |
9 files changed, 33 insertions, 32 deletions
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 1583fd487..d63aaf2be 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -151,7 +151,7 @@ struct CheatWindow : Window { virtual void OnPaint() { this->DrawWidgets(); - DrawStringMultiLine(20, this->width - 20, 15, 45, STR_CHEATS_WARNING, SA_CENTER); + DrawStringMultiLine(20, this->width - 20, 15, 45, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER); for (int i = 0, x = 0, y = 45; i != lengthof(_cheats_ui); i++) { const CheatEntry *ce = &_cheats_ui[i]; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 6d1ee4a67..529fe2cd5 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1568,7 +1568,7 @@ struct CompanyWindow : Window /* "xxx (Manager)" */ SetDParam(0, c->index); - DrawStringMultiLine(48 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 48 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 135, 157, STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, SA_CENTER); + DrawStringMultiLine(48 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 48 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 135, 157, STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, TC_FROMSTRING, SA_CENTER); /* "Inaugurated:" */ SetDParam(0, c->inaugurated_year); @@ -1745,7 +1745,7 @@ struct BuyCompanyWindow : Window { SetDParam(0, c->index); SetDParam(1, c->bankrupt_value); - DrawStringMultiLine(95, 333, 26, 116, STR_BUY_COMPANY_MESSAGE, SA_CENTER); + DrawStringMultiLine(95, 333, 26, 116, STR_BUY_COMPANY_MESSAGE, TC_FROMSTRING, SA_CENTER); } virtual void OnClick(Point pt, int widget) diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index bf4873065..e87643dc5 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -95,7 +95,7 @@ struct EnginePreviewWindow : Window { EngineID engine = this->window_number; SetDParam(0, GetEngineCategoryName(engine)); - DrawStringMultiLine(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 18, 80, STR_ENGINE_PREVIEW_MESSAGE, SA_CENTER); + DrawStringMultiLine(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 18, 80, STR_ENGINE_PREVIEW_MESSAGE, TC_FROMSTRING, SA_CENTER); SetDParam(0, engine); DrawString(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 80, STR_ENGINE_NAME, TC_BLACK, SA_CENTER); @@ -163,7 +163,7 @@ static void DrawTrainEngineInfo(EngineID engine, int left, int right, int top, i } else { SetDParam(5, CT_INVALID); } - DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER, SA_CENTER); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER, TC_FROMSTRING, SA_CENTER); } static void DrawAircraftEngineInfo(EngineID engine, int left, int right, int top, int bottom) @@ -180,7 +180,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int left, int right, int top SetDParam(5, e->u.air.mail_capacity); SetDParam(6, e->GetRunningCost()); - DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_CAPACITY_RUNCOST, SA_CENTER); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_CAPACITY_RUNCOST, TC_FROMSTRING, SA_CENTER); } else { SetDParam(0, e->GetCost()); SetDParam(1, e->GetDisplayMaxSpeed()); @@ -188,7 +188,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int left, int right, int top SetDParam(3, e->GetDisplayDefaultCapacity()); SetDParam(4, e->GetRunningCost()); - DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, SA_CENTER); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, TC_FROMSTRING, SA_CENTER); } } @@ -207,7 +207,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int left, int right, int top, } SetDParam(4, e->GetRunningCost()); - DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, SA_CENTER); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, TC_FROMSTRING, SA_CENTER); } static void DrawShipEngineInfo(EngineID engine, int left, int right, int top, int bottom) @@ -219,7 +219,7 @@ static void DrawShipEngineInfo(EngineID engine, int left, int right, int top, in SetDParam(2, e->GetDefaultCargoType()); SetDParam(3, e->GetDisplayDefaultCapacity()); SetDParam(4, e->GetRunningCost()); - DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, SA_CENTER); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_MAX_SPEED_CAPACITY_RUNCOST, TC_FROMSTRING, SA_CENTER); } void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni) @@ -228,12 +228,12 @@ void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni) const DrawEngineInfo *dei = &_draw_engine_list[GetEngine(engine)->type]; SetDParam(0, GetEngineCategoryName(engine)); - DrawStringMultiLine(1, w->width - 2, 0, 56, STR_NEW_VEHICLE_NOW_AVAILABLE, SA_CENTER); + DrawStringMultiLine(1, w->width - 2, 0, 56, STR_NEW_VEHICLE_NOW_AVAILABLE, TC_FROMSTRING, SA_CENTER); GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); SetDParam(0, engine); - DrawStringMultiLine(1, w->width - 2, 56, 88, STR_NEW_VEHICLE_TYPE, SA_CENTER); + DrawStringMultiLine(1, w->width - 2, 56, 88, STR_NEW_VEHICLE_TYPE, TC_FROMSTRING, SA_CENTER); dei->engine_proc(w->width >> 1, 88, engine, 0); GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOUR); diff --git a/src/gfx.cpp b/src/gfx.cpp index 48f559ce0..f67698dd6 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -677,10 +677,11 @@ int GetStringHeight(StringID str, int maxw) * @param align The alignment of the string when drawing left-to-right. In the * case a right-to-left language is chosen this is inverted so it * will be drawn in the right direction. + * @param underline Whether to underline all strings * * @return The bottom to where we have written. */ -int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, StringAlignment align) +int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour, StringAlignment align, bool underline) { int maxw = right - left; int maxh = bottom - top; @@ -708,7 +709,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, for (;;) { char buf2[DRAW_STRING_BUFFER]; strecpy(buf2, src, lastof(buf2)); - DrawString(left, right, y, buf2, lastof(buf2), TC_FROMSTRING, align, false, false); + DrawString(left, right, y, buf2, lastof(buf2), colour, align, underline, false); _cur_fontsize = _last_fontsize; for (;;) { diff --git a/src/gfx_func.h b/src/gfx_func.h index ceecc45e8..7354a9f7e 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -97,7 +97,7 @@ DECLARE_ENUM_AS_BIT_SET(StringAlignment); int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false); int DrawString(int left, int right, int top, StringID str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false); -int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, StringAlignment align = SA_LEFT); +int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false); void DrawCharCentered(uint32 c, int x, int y, TextColour colour); diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index 90b36892f..842b6d045 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -102,11 +102,11 @@ struct EndGameWindow : EndGameHighScoreBaseWindow { SetDParam(0, c->index); SetDParam(1, c->index); SetDParam(2, EndGameGetPerformanceTitleFromValue(c->old_economy[0].performance_history)); - DrawStringMultiLine(x, x + 640, y + 140, y + 206, STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS, SA_CENTER); + DrawStringMultiLine(x, x + 640, y + 140, y + 206, STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS, TC_FROMSTRING, SA_CENTER); } else { SetDParam(0, c->index); SetDParam(1, EndGameGetPerformanceTitleFromValue(c->old_economy[0].performance_history)); - DrawStringMultiLine(x, x + 640, y + 90, y + 210, STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS, SA_CENTER); + DrawStringMultiLine(x, x + 640, y + 90, y + 210, STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS, TC_FROMSTRING, SA_CENTER); } } }; @@ -142,7 +142,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow { SetDParam(0, ORIGINAL_END_YEAR); SetDParam(1, this->window_number + STR_DIFFICULTY_LEVEL_EASY); - DrawStringMultiLine(x + 70, x + 570, y, y + 140, !_networking ? STR_HIGHSCORE_TOP_COMPANIES_WHO_REACHED : STR_HIGHSCORE_TOP_COMPANIES_NETWORK_GAME, SA_CENTER); + DrawStringMultiLine(x + 70, x + 570, y, y + 140, !_networking ? STR_HIGHSCORE_TOP_COMPANIES_WHO_REACHED : STR_HIGHSCORE_TOP_COMPANIES_NETWORK_GAME, TC_FROMSTRING, SA_CENTER); /* Draw Highscore peepz */ for (uint8 i = 0; i < lengthof(_highscore_table[0]); i++) { diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index b6d09c861..6be80da6e 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -99,7 +99,7 @@ public: if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) { SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]); - DrawStringMultiLine(this->widget[LIW_BACKGROUND].left + 2, this->widget[LIW_BACKGROUND].right - 2, y, y + 22, STR_JUST_RAW_STRING, SA_CENTER); + DrawStringMultiLine(this->widget[LIW_BACKGROUND].left + 2, this->widget[LIW_BACKGROUND].right - 2, y, y + 22, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER); } } @@ -509,8 +509,8 @@ public: DrawCompanyManagerFace(c->face, c->colour, 2, 16); } - DrawStringMultiLine(1, this->width - 1, y[2], y[3] , this->message_2, SA_CENTER); - if (this->message_1 != INVALID_STRING_ID) DrawStringMultiLine(1, this->width - 1, y[0], y[1], this->message_1, SA_CENTER); + DrawStringMultiLine(1, this->width - 1, y[2], y[3] , this->message_2, TC_FROMSTRING, SA_CENTER); + if (this->message_1 != INVALID_STRING_ID) DrawStringMultiLine(1, this->width - 1, y[0], y[1], this->message_1, TC_FROMSTRING, SA_CENTER); /* Switch back to the normal text ref. stack for NewGRF texts */ SwitchToNormalRefStack(); @@ -681,7 +681,7 @@ struct TooltipsWindow : public Window for (uint arg = 0; arg < this->paramcount; arg++) { SetDParam(arg, this->params[arg]); } - DrawStringMultiLine(1, this->width - 1, 0, this->height, this->string_id, SA_CENTER); + DrawStringMultiLine(1, this->width - 1, 0, this->height, this->string_id, TC_FROMSTRING, SA_CENTER); } virtual void OnMouseLoop() @@ -1319,7 +1319,7 @@ struct QueryWindow : public Window { this->DrawWidgets(); CopyInDParam(0, this->params, lengthof(this->params)); - DrawStringMultiLine(1, this->width - 1, 14, 62, this->message, SA_CENTER); + DrawStringMultiLine(1, this->width - 1, 14, 62, this->message, TC_FROMSTRING, SA_CENTER); } virtual void OnClick(Point pt, int widget) diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 1e9885e2d..b850f1979 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -136,7 +136,7 @@ public: SetDParamStr(0, this->name); SetDParam(1, this->downloaded_files); SetDParam(2, this->total_files); - DrawStringMultiLine(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 43, 67, STR_CONTENT_DOWNLOAD_FILE, SA_CENTER); + DrawStringMultiLine(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 43, 67, STR_CONTENT_DOWNLOAD_FILE, TC_FROMSTRING, SA_CENTER); } else { DrawString(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 50, STR_CONTENT_DOWNLOAD_INITIALISE, TC_GREY, SA_CENTER); } @@ -435,7 +435,7 @@ public: if (this->selected == NULL) return; /* And fill the rest of the details when there's information to place there */ - DrawStringMultiLine(this->widget[NCLWW_DETAILS].left + 5, this->widget[NCLWW_DETAILS].right - 5, this->widget[NCLWW_DETAILS].top + 25, this->widget[NCLWW_DETAILS].top + 50, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + this->selected->state, SA_CENTER); + DrawStringMultiLine(this->widget[NCLWW_DETAILS].left + 5, this->widget[NCLWW_DETAILS].right - 5, this->widget[NCLWW_DETAILS].top + 25, this->widget[NCLWW_DETAILS].top + 50, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + this->selected->state, TC_FROMSTRING, SA_CENTER); /* Also show the total download size, so keep some space from the bottom */ const uint max_y = this->widget[NCLWW_DETAILS].bottom - 15; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 99b886544..27386043d 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -53,7 +53,7 @@ static void DrawNewsBankrupcy(Window *w, const NewsItem *ni) GfxFillRect(3, 23, 3 + 91, 23 + 118, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOUR); SetDParamStr(0, cni->president_name); - DrawStringMultiLine(49 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 49 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 141, 169, STR_JUST_RAW_STRING, SA_CENTER); + DrawStringMultiLine(49 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 49 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 141, 169, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER); switch (ni->subtype) { case NS_COMPANY_TROUBLE: @@ -61,7 +61,7 @@ static void DrawNewsBankrupcy(Window *w, const NewsItem *ni) SetDParam(0, ni->params[2]); - DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION, SA_CENTER); + DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION, TC_FROMSTRING, SA_CENTER); break; case NS_COMPANY_MERGER: @@ -69,20 +69,20 @@ static void DrawNewsBankrupcy(Window *w, const NewsItem *ni) SetDParam(0, ni->params[2]); SetDParam(1, ni->params[3]); SetDParam(2, ni->params[4]); - DrawStringMultiLine(100, w->width - 2, 20, 169, ni->params[4] == 0 ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION, SA_CENTER); + DrawStringMultiLine(100, w->width - 2, 20, 169, ni->params[4] == 0 ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION, TC_FROMSTRING, SA_CENTER); break; case NS_COMPANY_BANKRUPT: DrawString(0, w->width, 1, STR_NEWS_COMPANY_BANKRUPT_TITLE, TC_FROMSTRING, SA_CENTER); SetDParam(0, ni->params[2]); - DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION, SA_CENTER); + DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION, TC_FROMSTRING, SA_CENTER); break; case NS_COMPANY_NEW: DrawString(0, w->width, 1, STR_NEWS_COMPANY_LAUNCH_TITLE, TC_FROMSTRING, SA_CENTER); SetDParam(0, ni->params[2]); SetDParam(1, ni->params[3]); - DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION, SA_CENTER); + DrawStringMultiLine(100, w->width - 2, 20, 169, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION, TC_FROMSTRING, SA_CENTER); break; default: @@ -208,7 +208,7 @@ struct NewsWindow : Window { if (!(this->ni->flags & NF_VIEWPORT)) { CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); - DrawStringMultiLine(2, this->width - 2, 20, this->height, this->ni->string_id, SA_CENTER); + DrawStringMultiLine(2, this->width - 2, 20, this->height, this->ni->string_id, TC_FROMSTRING, SA_CENTER); } else { /* Back up transparency options to draw news view */ TransparencyOptionBits to_backup = _transparency_opt; @@ -224,7 +224,7 @@ struct NewsWindow : Window { ); CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); - DrawStringMultiLine(2, this->width - 2, 0, 58, this->ni->string_id, SA_CENTER); + DrawStringMultiLine(2, this->width - 2, 0, 58, this->ni->string_id, TC_FROMSTRING, SA_CENTER); } break; } @@ -237,7 +237,7 @@ struct NewsWindow : Window { } else { this->DrawViewport(); CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); - DrawStringMultiLine(2, this->width - 2, 64, this->height, this->ni->string_id, SA_CENTER); + DrawStringMultiLine(2, this->width - 2, 64, this->height, this->ni->string_id, TC_FROMSTRING, SA_CENTER); } break; } |