diff options
author | belugas <belugas@openttd.org> | 2007-11-04 00:08:57 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-11-04 00:08:57 +0000 |
commit | 56e6282f2f56d741634e30bba86fcfbd941bc285 (patch) | |
tree | 14a742a306f14c4d3afd56b725a7c6ffe7fb0e73 | |
parent | 9e69fc8114012c85cc1194a2ae73fb716dc95dde (diff) | |
download | openttd-56e6282f2f56d741634e30bba86fcfbd941bc285.tar.xz |
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
Patch heavily based on BiBB's work (FS#1383)
37 files changed, 408 insertions, 383 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index 218ace608..dbc6ee251 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -39,13 +39,13 @@ void DrawAircraftDetails(const Vehicle *v, int x, int y) SetDParam(0, u->engine_type); SetDParam(1, u->build_year); SetDParam(2, u->value); - DrawString(x, y, STR_A011_BUILT_VALUE, 0); + DrawString(x, y, STR_A011_BUILT_VALUE, TC_FROMSTRING); SetDParam(0, u->cargo_type); SetDParam(1, u->cargo_cap); SetDParam(2, u->Next()->cargo_type); SetDParam(3, u->Next()->cargo_cap); - DrawString(x, y + 10, (u->Next()->cargo_cap != 0) ? STR_A019_CAPACITY : STR_A01A_CAPACITY, 0); + DrawString(x, y + 10, (u->Next()->cargo_cap != 0) ? STR_A019_CAPACITY : STR_A01A_CAPACITY, TC_FROMSTRING); } if (u->cargo_cap != 0) { @@ -57,13 +57,13 @@ void DrawAircraftDetails(const Vehicle *v, int x, int y) SetDParam(0, u->cargo_type); SetDParam(1, cargo_count); SetDParam(2, u->cargo.Source()); - DrawString(x, y + 21 + y_offset, STR_8813_FROM, 0); + DrawString(x, y + 21 + y_offset, STR_8813_FROM, TC_FROMSTRING); } } } SetDParam(0, v->cargo.FeederShare()); - DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, 0); + DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING); } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 68c95ec3a..1b1fe2a63 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -282,7 +282,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) if (w->window_number == VEH_TRAIN) { /* Draw the selected railtype in the pulldown menu */ RailType railtype = _railtype_selected_in_replace_gui; - DrawString(157, w->widget[14].top + 1, _rail_types_list[railtype], 0x10); + DrawString(157, w->widget[14].top + 1, _rail_types_list[railtype], TC_BLACK); } /* sets up the string for the vehicle that is being replaced to */ @@ -297,7 +297,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED); } - DrawString(145, w->widget[5].top + 1, STR_02BD, 0x10); + DrawString(145, w->widget[5].top + 1, STR_02BD, TC_BLACK); /* Draw the lists */ for(byte i = 0; i < 2; i++) { diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 091a1e686..30e94b30e 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -53,7 +53,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e) SetDParam(0, b->material); DrawSprite(b->sprite, b->pal, 3, 15 + i * 22); - DrawString(44, 15 + i * 22 , STR_500D, 0); + DrawString(44, 15 + i * 22 , STR_500D, TC_FROMSTRING); } break; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 38b74cbb8..408a8baab 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -437,14 +437,14 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const { /* Purchase cost */ SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8); - DrawString(x, y, STR_PURCHASE_INFO_COST, 0); + DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING); y += 10; /* Wagon weight - (including cargo) */ uint weight = GetEngineProperty(engine_number, 0x16, rvi->weight); SetDParam(0, weight); SetDParam(1, (GetCargo(rvi->cargo_type)->weight * GetEngineProperty(engine_number, 0x14, rvi->capacity) >> 4) + weight); - DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, 0); + DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, TC_FROMSTRING); y += 10; /* Wagon speed limit, displayed if above zero */ @@ -452,7 +452,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const uint max_speed = GetEngineProperty(engine_number, 0x09, rvi->max_speed); if (max_speed > 0) { SetDParam(0, max_speed * 10 / 16); - DrawString(x, y, STR_PURCHASE_INFO_SPEED, 0); + DrawString(x, y, STR_PURCHASE_INFO_SPEED, TC_FROMSTRING); y += 10; } } @@ -468,32 +468,32 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons /* Purchase Cost - Engine weight */ SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5); SetDParam(1, weight << multihead); - DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, 0); + DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING); y += 10; /* Max speed - Engine power */ SetDParam(0, GetEngineProperty(engine_number, 0x09, rvi->max_speed) * 10 / 16); SetDParam(1, GetEngineProperty(engine_number, 0x0B, rvi->power) << multihead); - DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, 0); + DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, TC_FROMSTRING); y += 10; /* Max tractive effort - not applicable if old acceleration or maglev */ if (_patches.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) { SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256); - DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, 0); + DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING); y += 10; } /* Running cost */ SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead); - DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); + DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); y += 10; /* Powered wagons power - Powered wagons extra weight */ if (rvi->pow_wag_power != 0) { SetDParam(0, rvi->pow_wag_power); SetDParam(1, rvi->pow_wag_weight); - DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0); + DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, TC_FROMSTRING); y += 10; }; @@ -508,19 +508,19 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R /* Purchase cost - Max speed */ SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5); SetDParam(1, rvi->max_speed * 10 / 32); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); y += 10; /* Running cost */ SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8); - DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); + DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); y += 10; /* Cargo type + capacity */ SetDParam(0, rvi->cargo_type); SetDParam(1, GetEngineProperty(engine_number, 0x0F, rvi->capacity)); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); - DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); y += 10; return y; @@ -532,19 +532,19 @@ static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const Ship /* Purchase cost - Max speed */ SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5); SetDParam(1, GetEngineProperty(engine_number, 0x0B, svi->max_speed) * 10 / 32); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); y += 10; /* Cargo type + capacity */ SetDParam(0, svi->cargo_type); SetDParam(1, GetEngineProperty(engine_number, 0x0D, svi->capacity)); SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY); - DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); y += 10; /* Running cost */ SetDParam(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running >> 8); - DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); + DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); y += 10; return y; @@ -558,7 +558,7 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const /* Purchase cost - Max speed */ SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5); SetDParam(1, avi->max_speed * 10 / 16); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); y += 10; /* Cargo capacity */ @@ -566,20 +566,20 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const if (cargo == CT_INVALID || cargo == CT_PASSENGERS) { SetDParam(0, avi->passenger_capacity); SetDParam(1, avi->mail_capacity); - DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, TC_FROMSTRING); } else { /* Note, if the default capacity is selected by the refit capacity * callback, then the capacity shown is likely to be incorrect. */ SetDParam(0, cargo); SetDParam(1, AircraftDefaultCargoCapacity(cargo, avi)); SetDParam(2, STR_9842_REFITTABLE); - DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); } y += 10; /* Running cost */ SetDParam(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running >> 8); - DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); + DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); y += 10; return y; @@ -624,7 +624,7 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number) SetDParam(1, (capacity * (CountArticulatedParts(engine_number, true) + 1)) << multihead); SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY); } - DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); y += 10; } break; @@ -648,12 +648,12 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number) /* Design date - Life length */ SetDParam(0, ymd.year); SetDParam(1, e->lifelength); - DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0); + DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, TC_FROMSTRING); y += 10; /* Reliability */ SetDParam(0, e->reliability * 100 >> 16); - DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0); + DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, TC_FROMSTRING); y += 10; } @@ -857,11 +857,11 @@ void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, u const uint num_engines = GetGroupNumEngines(_local_player, selected_group, engine); SetDParam(0, engine); - DrawString(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? 0xC : 0x10); + DrawString(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK); DrawVehicleEngine(type, x, y + y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_player)); if (show_count) { SetDParam(0, num_engines); - DrawStringRightAligned(213, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, 0); + DrawStringRightAligned(213, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING); } } } @@ -903,8 +903,8 @@ static void DrawBuildVehicleWindow(Window *w) if (text_end > wi->bottom) ExpandPurchaseInfoWidget(w, text_end - wi->bottom); } - DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], 0x10); - DoDrawString(bv->descending_sort_order ? DOWNARROW : UPARROW, 69, 15, 0x10); + DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], TC_BLACK); + DoDrawString(bv->descending_sort_order ? DOWNARROW : UPARROW, 69, 15, TC_BLACK); } static void BuildVehicleClickEvent(Window *w, WindowEvent *e) diff --git a/src/console.cpp b/src/console.cpp index 76c2562d8..98a017c83 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -88,7 +88,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) DoDrawString(_iconsole_cmdline.buf, 10 + delta, w->height - ICON_LINE_HEIGHT, _icolour_cmd); if (_iconsole_cmdline.caret) - DoDrawString("_", 10 + delta + _iconsole_cmdline.caretxoffs, w->height - ICON_LINE_HEIGHT, 12); + DoDrawString("_", 10 + delta + _iconsole_cmdline.caretxoffs, w->height - ICON_LINE_HEIGHT, TC_WHITE); break; } case WE_MOUSELOOP: @@ -215,7 +215,7 @@ void IConsoleInit() _icolour_err = 3; _icolour_warn = 13; _icolour_dbg = 5; - _icolour_cmd = 2; + _icolour_cmd = TC_GOLD; _iconsole_historypos = ICON_HISTORY_SIZE - 1; _iconsole_mode = ICONSOLE_CLOSED; diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index f89e56400..fb676b5b9 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -175,7 +175,7 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y) /* Number of wagons relative to a standard length wagon (rounded up) */ SetDParam(0, (v->u.rail.cached_total_length + 7) / 8); - DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter + DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter break; case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, 1, WP(w, depot_d).sel); break; @@ -200,7 +200,7 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y) DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, x + diff_x, y + diff_y); SetDParam(0, v->unitnumber); - DrawString(x, y + 2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); + DrawString(x, y + 2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, TC_FROMSTRING); } static void DrawDepotWindow(Window *w) @@ -274,14 +274,14 @@ static void DrawDepotWindow(Window *w) const Vehicle *u; DrawTrainImage(v, x + 50, y, w->hscroll.cap - 29, 0, WP(w,depot_d).sel); - DrawString(x, y + 2, STR_8816, 0); + DrawString(x, y + 2, STR_8816, TC_FROMSTRING); /*Draw the train counter */ i = 0; u = v; do i++; while ((u = u->Next()) != NULL); // Determine length of train SetDParam(0, i); // Set the counter - DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter + DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter } } diff --git a/src/economy.cpp b/src/economy.cpp index 67e704d00..793c0b960 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -514,7 +514,7 @@ void DrawNewsBankrupcy(Window *w) switch (ni->string_id & 0xF0) { case NB_BTROUBLE: - DrawStringCentered(w->width >> 1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0); + DrawStringCentered(w->width >> 1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, TC_FROMSTRING); SetDParam(0, p->index); @@ -526,7 +526,7 @@ void DrawNewsBankrupcy(Window *w) break; case NB_BMERGER: - DrawStringCentered(w->width >> 1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, 0); + DrawStringCentered(w->width >> 1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, TC_FROMSTRING); SetDParam(0, ni->params[0]); SetDParam(1, p->index); SetDParam(2, ni->params[1]); @@ -538,7 +538,7 @@ void DrawNewsBankrupcy(Window *w) break; case NB_BBANKRUPT: - DrawStringCentered(w->width >> 1, 1, STR_705C_BANKRUPT, 0); + DrawStringCentered(w->width >> 1, 1, STR_705C_BANKRUPT, TC_FROMSTRING); SetDParam(0, ni->params[0]); DrawStringMultiCenter( ((w->width - 101) >> 1) + 98, @@ -548,7 +548,7 @@ void DrawNewsBankrupcy(Window *w) break; case NB_BNEWCOMPANY: - DrawStringCentered(w->width >> 1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0); + DrawStringCentered(w->width >> 1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, TC_FROMSTRING); SetDParam(0, p->index); SetDParam(1, ni->params[0]); DrawStringMultiCenter( diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index f164301fd..380b25997 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -80,7 +80,7 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e) DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296); SetDParam(0, engine); - DrawStringCentered(w->width >> 1, 80, STR_ENGINE_NAME, 0x10); + DrawStringCentered(w->width >> 1, 80, STR_ENGINE_NAME, TC_BLACK); dei = &_draw_engine_list[GetEngine(engine)->type]; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 874db1900..845e524b1 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -265,47 +265,47 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) y = (mode == GLWP_HEIGHTMAP) ? 22 : 0; - DrawString( 12, 91 + y, STR_MAPSIZE, 0); - DrawString(119, 91 + y, mapsizes[_patches_newgame.map_x - 6], 0x10); - DrawString(168, 91 + y, STR_BY, 0); - DrawString(182, 91 + y, mapsizes[_patches_newgame.map_y - 6], 0x10); + DrawString( 12, 91 + y, STR_MAPSIZE, TC_FROMSTRING); + DrawString(119, 91 + y, mapsizes[_patches_newgame.map_x - 6], TC_BLACK); + DrawString(168, 91 + y, STR_BY, TC_FROMSTRING); + DrawString(182, 91 + y, mapsizes[_patches_newgame.map_y - 6], TC_BLACK); - DrawString( 12, 113 + y, STR_NUMBER_OF_TOWNS, 0); - DrawString( 12, 131 + y, STR_NUMBER_OF_INDUSTRIES, 0); + DrawString( 12, 113 + y, STR_NUMBER_OF_TOWNS, TC_FROMSTRING); + DrawString( 12, 131 + y, STR_NUMBER_OF_INDUSTRIES, TC_FROMSTRING); if (_game_mode == GM_EDITOR) { - DrawString(118, 113 + y, STR_6836_OFF, 0x10); - DrawString(118, 131 + y, STR_6836_OFF, 0x10); + DrawString(118, 113 + y, STR_6836_OFF, TC_BLACK); + DrawString(118, 131 + y, STR_6836_OFF, TC_BLACK); } else { - DrawString(118, 113 + y, num_towns[_opt_newgame.diff.number_towns], 0x10); - DrawString(118, 131 + y, num_inds[_opt_newgame.diff.number_industries], 0x10); + DrawString(118, 113 + y, num_towns[_opt_newgame.diff.number_towns], TC_BLACK); + DrawString(118, 131 + y, num_inds[_opt_newgame.diff.number_industries], TC_BLACK); } - DrawString( 12, 153 + y, STR_RANDOM_SEED, 0); + DrawString( 12, 153 + y, STR_RANDOM_SEED, TC_FROMSTRING); DrawEditBox(w, &_genseed_query, GLAND_RANDOM_EDITBOX); - DrawString(182, 113 + y, STR_DATE, 0); + DrawString(182, 113 + y, STR_DATE, TC_FROMSTRING); SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); - DrawStringCentered(271, 113 + y, STR_GENERATE_DATE, 0); + DrawStringCentered(271, 113 + y, STR_GENERATE_DATE, TC_FROMSTRING); - DrawString(182, 131 + y, STR_SNOW_LINE_HEIGHT, 0); + DrawString(182, 131 + y, STR_SNOW_LINE_HEIGHT, TC_FROMSTRING); SetDParam(0, _patches_newgame.snow_line_height); - DrawStringCentered(303, 131 + y, STR_SNOW_LINE_HEIGHT_NUM, 0x10); + DrawStringCentered(303, 131 + y, STR_SNOW_LINE_HEIGHT_NUM, TC_BLACK); if (mode == GLWP_GENERATE) { - DrawString( 12, 175, STR_LAND_GENERATOR, 0); - DrawString(118, 175, landscape[_patches_newgame.land_generator], 0x10); + DrawString( 12, 175, STR_LAND_GENERATOR, TC_FROMSTRING); + DrawString(118, 175, landscape[_patches_newgame.land_generator], TC_BLACK); - DrawString( 12, 193, STR_TREE_PLACER, 0); - DrawString(118, 193, tree_placer[_patches_newgame.tree_placer], 0x10); + DrawString( 12, 193, STR_TREE_PLACER, TC_FROMSTRING); + DrawString(118, 193, tree_placer[_patches_newgame.tree_placer], TC_BLACK); - DrawString( 12, 211, STR_TERRAIN_TYPE, 0); - DrawString(118, 211, elevations[_opt_newgame.diff.terrain_type], 0x10); + DrawString( 12, 211, STR_TERRAIN_TYPE, TC_FROMSTRING); + DrawString(118, 211, elevations[_opt_newgame.diff.terrain_type], TC_BLACK); - DrawString( 12, 229, STR_QUANTITY_OF_SEA_LAKES, 0); - DrawString(118, 229, sea_lakes[_opt_newgame.diff.quantity_sea_lakes], 0x10); + DrawString( 12, 229, STR_QUANTITY_OF_SEA_LAKES, TC_FROMSTRING); + DrawString(118, 229, sea_lakes[_opt_newgame.diff.quantity_sea_lakes], TC_BLACK); - DrawString( 12, 247, STR_SMOOTHNESS, 0); - DrawString(118, 247, smoothness[_patches_newgame.tgen_smoothness], 0x10); + DrawString( 12, 247, STR_SMOOTHNESS, TC_FROMSTRING); + DrawString(118, 247, smoothness[_patches_newgame.tgen_smoothness], TC_BLACK); } else { char buffer[512]; @@ -317,17 +317,17 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) SetDParam(1, WP(w, generate_d).y); } GetString(buffer, STR_HEIGHTMAP_SIZE, lastof(buffer)); - DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, 0x10); + DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK); - DrawString( 12, 91, STR_HEIGHTMAP_NAME, 0x10); + DrawString( 12, 91, STR_HEIGHTMAP_NAME, TC_BLACK); SetDParamStr(0, WP(w, generate_d).name); - DrawStringTruncated(114, 91, STR_ORANGE, 0x10, 326 - 114 - GetStringBoundingBox(buffer).width - 5); + DrawStringTruncated(114, 91, STR_ORANGE, TC_BLACK, 326 - 114 - GetStringBoundingBox(buffer).width - 5); - DrawString( 12, 197, STR_TREE_PLACER, 0); - DrawString(118, 197, tree_placer[_patches_newgame.tree_placer], 0x10); + DrawString( 12, 197, STR_TREE_PLACER, TC_FROMSTRING); + DrawString(118, 197, tree_placer[_patches_newgame.tree_placer], TC_BLACK); - DrawString( 12, 215, STR_HEIGHTMAP_ROTATION, 0); - DrawString(118, 215, rotation[_patches_newgame.heightmap_rotation], 0x10); + DrawString( 12, 215, STR_HEIGHTMAP_ROTATION, TC_FROMSTRING); + DrawString(118, 215, rotation[_patches_newgame.heightmap_rotation], TC_BLACK); } break; @@ -619,18 +619,18 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) SetWindowWidgetLoweredState(w, CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); DrawWindowWidgets(w); - DrawStringRightAligned(211, 97, STR_MAPSIZE, 0); - DrawString( 221, 97, mapsizes[_patches_newgame.map_x - 6], 0x10); - DrawStringCentered( 272, 97, STR_BY, 0); - DrawString( 284, 97, mapsizes[_patches_newgame.map_y - 6], 0x10); + DrawStringRightAligned(211, 97, STR_MAPSIZE, TC_FROMSTRING); + DrawString( 221, 97, mapsizes[_patches_newgame.map_x - 6], TC_BLACK); + DrawStringCentered( 272, 97, STR_BY, TC_FROMSTRING); + DrawString( 284, 97, mapsizes[_patches_newgame.map_y - 6], TC_BLACK); - DrawStringRightAligned(211, 115, STR_DATE, 0); + DrawStringRightAligned(211, 115, STR_DATE, TC_FROMSTRING); SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); - DrawStringCentered(271, 115, STR_GENERATE_DATE, 0); + DrawStringCentered(271, 115, STR_GENERATE_DATE, TC_FROMSTRING); - DrawStringRightAligned(278, 133, STR_FLAT_WORLD_HEIGHT, 0); + DrawStringRightAligned(278, 133, STR_FLAT_WORLD_HEIGHT, TC_FROMSTRING); SetDParam(0, _patches_newgame.se_flat_world_height); - DrawStringCentered(303, 133, STR_FLAT_WORLD_HEIGHT_NUM, 0x10); + DrawStringCentered(303, 133, STR_FLAT_WORLD_HEIGHT_NUM, TC_BLACK); break; case WE_CLICK: @@ -807,15 +807,15 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e) DrawFrameRect(19, 20, (w->width - 18), 37, 14, FR_BORDERONLY); DrawFrameRect(20, 21, (int)((w->width - 40) * _tp.percent / 100) + 20, 36, 10, FR_NONE); SetDParam(0, _tp.percent); - DrawStringCentered(90, 25, STR_PROGRESS, 0); + DrawStringCentered(90, 25, STR_PROGRESS, TC_FROMSTRING); /* Tell which class we are generating */ - DrawStringCentered(90, 46, _tp.cls, 0); + DrawStringCentered(90, 46, _tp.cls, TC_FROMSTRING); /* And say where we are in that class */ SetDParam(0, _tp.current); SetDParam(1, _tp.total); - DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, 0); + DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING); SetWindowDirty(w); break; diff --git a/src/gfx.cpp b/src/gfx.cpp index b0802842c..8f8bb3137 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -562,7 +562,7 @@ BoundingRect GetStringBoundingBox(const char *str) * @param x offset from left side of the screen, if negative offset from the right side * @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 + * table/palettes.h or docs/ottd-colourtext-palette.png or the enum TextColour in gfx.h * @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_color) @@ -361,6 +361,28 @@ enum { COLOUR_WHITE }; +/** Colour of the strings, see _string_colormap in table/palettes.h or docs/ottd-colourtext-palette.png */ +enum TextColour { + TC_FROMSTRING = 0x00, + TC_BLUE = 0x00, + TC_SILVER = 0x01, + TC_GOLD = 0x02, + TC_RED = 0x03, + TC_PURPLE = 0x04, + TC_LIGHT_BROWN = 0x05, + TC_ORANGE = 0x06, + TC_GREEN = 0x07, + TC_YELLOW = 0x08, + TC_DARK_GREEN = 0x09, + TC_CREAM = 0x0A, + TC_BROWN = 0x0B, + TC_WHITE = 0x0C, + TC_LIGHT_BLUE = 0x0D, + TC_GREY = 0x0E, + TC_DARK_BLUE = 0x0F, + TC_BLACK = 0x10, +}; + /** * All 16 colour gradients * 8 colours per gradient from darkest (0) to lightest (7) diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 31f51f578..fdd9f1747 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -28,7 +28,7 @@ static uint _legend_excluded_cargo; enum { GRAPH_MAX_DATASETS = 32, - GRAPH_AXIS_LABEL_COLOUR = 16, + GRAPH_AXIS_LABEL_COLOUR = TC_BLACK, GRAPH_AXIS_LINE_COLOUR = 215, GRAPH_X_POSITION_BEGINNING = 44, ///< Start the graph 44 pixels from gw->left @@ -273,7 +273,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e) SetDParam(0, p->index); SetDParam(1, p->index); - DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? 0x10 : 0xC); + DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? TC_BLACK : TC_WHITE); } break; } @@ -738,7 +738,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0); GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour); SetDParam(0, cs->name); - DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0); + DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, TC_FROMSTRING); y += 8; } @@ -753,8 +753,8 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) DrawGraph(&gd); - DrawString(2 + 46, 24 + gd.height + 7, STR_7062_DAYS_IN_TRANSIT, 0); - DrawString(2 + 84, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, 0); + DrawString(2 + 46, 24 + gd.height + 7, STR_7062_DAYS_IN_TRANSIT, TC_FROMSTRING); + DrawString(2 + 84, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, TC_FROMSTRING); break; } @@ -879,7 +879,7 @@ static void CompanyLeagueWndProc(Window *w, WindowEvent *e) SetDParam(2, p->index); SetDParam(3, GetPerformanceTitleFromValue(p->old_economy[1].performance_history)); - DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 0); + DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, TC_FROMSTRING); DrawPlayerIcon(p->index, 27, 16 + i * 10); } @@ -999,11 +999,11 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) total_score += score; } - DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, 0); + DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, TC_FROMSTRING); /* Draw the score */ SetDParam(0, score); - DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0); + DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, TC_FROMSTRING); /* Calculate the %-bar */ x = clamp(val, 0, needed) * 50 / needed; @@ -1023,7 +1023,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) /* Draw it */ SetDParam(0, x); - DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0); + DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING); /* SCORE_LOAN is inversed */ if (i == SCORE_LOAN) val = needed - val; @@ -1038,10 +1038,10 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) case SCORE_MAX_INCOME: case SCORE_MONEY: case SCORE_LOAN: - DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, 0); + DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, TC_FROMSTRING); break; default: - DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, 0); + DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, TC_FROMSTRING); } } diff --git a/src/group_gui.cpp b/src/group_gui.cpp index dff1f0ea0..c0fccca01 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -433,11 +433,11 @@ static void GroupWndProc(Window *w, WindowEvent *e) break; default: NOT_REACHED(); break; } - DrawString(10, y1, str_all_veh, IsAllGroupID(gv->group_sel) ? 12 : 16); + DrawString(10, y1, str_all_veh, IsAllGroupID(gv->group_sel) ? TC_WHITE : TC_BLACK); y1 += 13; - DrawString(10, y1, str_no_group_veh, IsDefaultGroupID(gv->group_sel) ? 12 : 16); + DrawString(10, y1, str_no_group_veh, IsDefaultGroupID(gv->group_sel) ? TC_WHITE : TC_BLACK); max = min(w->vscroll.pos + w->vscroll.cap, gl->l.list_length); for (i = w->vscroll.pos ; i < max ; ++i) { @@ -449,16 +449,16 @@ static void GroupWndProc(Window *w, WindowEvent *e) /* draw the selected group in white, else we draw it in black */ SetDParam(0, g->index); - DrawString(10, y1, STR_GROUP_NAME, (gv->group_sel == g->index) ? 12 : 16); + DrawString(10, y1, STR_GROUP_NAME, (gv->group_sel == g->index) ? TC_WHITE : TC_BLACK); /* draw the number of vehicles of the group */ SetDParam(0, g->num_vehicle); - DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (gv->group_sel == g->index) ? 12 : 16); + DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (gv->group_sel == g->index) ? TC_WHITE : TC_BLACK); } /* Draw Matrix Vehicle according to the vehicle list built before */ - DrawString(285, 15, _vehicle_sort_listing[gv->l.sort_type], 0x10); - DoDrawString(gv->l.flags & VL_DESC ? DOWNARROW : UPARROW, 269, 15, 0x10); + DrawString(285, 15, _vehicle_sort_listing[gv->l.sort_type], TC_BLACK); + DoDrawString(gv->l.flags & VL_DESC ? DOWNARROW : UPARROW, 269, 15, TC_BLACK); max = min(w->vscroll2.pos + w->vscroll2.cap, gv->l.list_length); for (i = w->vscroll2.pos ; i < max ; ++i) { @@ -470,17 +470,17 @@ static void GroupWndProc(Window *w, WindowEvent *e) DrawVehicleProfitButton(v, x, y2 + 13); SetDParam(0, v->unitnumber); - DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), 0); + DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), TC_FROMSTRING); if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2); SetDParam(0, v->profit_this_year); SetDParam(1, v->profit_last_year); - DrawString(x + 19, y2 + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0); + DrawString(x + 19, y2 + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING); if (IsValidGroupID(v->group_id)) { SetDParam(0, v->group_id); - DrawString(x + 19, y2, STR_GROUP_TINY_NAME, 16); + DrawString(x + 19, y2, STR_GROUP_TINY_NAME, TC_BLACK); } y2 += w->resize.step_height; @@ -140,7 +140,7 @@ void BuildFileList(); void SetFiosType(const byte fiostype); /* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */ -extern const byte _fios_colors[]; +extern const TextColour _fios_colors[]; /* bridge_gui.cpp */ void ShowBuildBridgeWindow(uint start, uint end, byte type); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 27d3dd291..83e29ea91 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -166,13 +166,13 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) bool selected = WP(w, fnd_d).index == i + w->vscroll.pos; if (_fund_gui.index[i + w->vscroll.pos] == INVALID_INDUSTRYTYPE) { - DrawString(21, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? 12 : 6); + DrawString(21, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE); continue; } const IndustrySpec *indsp = GetIndustrySpec(_fund_gui.index[i + w->vscroll.pos]); /* Draw the name of the industry in white is selected, otherwise, in orange */ - DrawStringTruncated(20, y + offset, indsp->name, selected ? 12 : 6, max_width - 25); + DrawStringTruncated(20, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE, max_width - 25); GfxFillRect(x, y + 1 + offset, x + 10, y + 7 + offset, selected ? 15 : 0); GfxFillRect(x + 1, y + 2 + offset, x + 9, y + 6 + offset, indsp->map_colour); } @@ -184,7 +184,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) if (_game_mode != GM_EDITOR) { SetDParam(0, indsp->GetConstructionCost()); - DrawStringTruncated(x_str, y_str, STR_482F_COST, 0, max_width); + DrawStringTruncated(x_str, y_str, STR_482F_COST, TC_FROMSTRING, max_width); y_str += 11; } @@ -197,7 +197,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) if (p > 0) str++; SetDParam(p++, GetCargo(indsp->accepts_cargo[j])->name); } - DrawStringTruncated(x_str, y_str, str, 0, max_width); + DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width); y_str += 11; /* Draw the produced cargos, if any. Otherwhise, will print "Nothing" */ @@ -209,7 +209,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) if (p > 0) str++; SetDParam(p++, GetCargo(indsp->produced_cargo[j])->name); } - DrawStringTruncated(x_str, y_str, str, 0, max_width); + DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width); y_str += 11; /* Get the additional purchase info text, if it has not already been */ @@ -460,13 +460,13 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) if (i->accepts_cargo[j] == CT_INVALID) continue; has_accept = true; if (first) { - DrawString(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, 0); + DrawString(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING); y += 10; first = false; } SetDParam(0, i->accepts_cargo[j]); SetDParam(1, i->incoming_cargo_waiting[j]); - DrawString(4, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, 0); + DrawString(4, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, TC_FROMSTRING); y += 10; } } else { @@ -479,7 +479,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) SetDParam(p++, GetCargo(i->accepts_cargo[j])->name); } if (has_accept) { - DrawString(2, y, str, 0); + DrawString(2, y, str, TC_FROMSTRING); y += 10; } } @@ -489,7 +489,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) if (i->produced_cargo[j] == CT_INVALID) continue; if (first) { if (has_accept) y += 10; - DrawString(2, y, STR_482A_PRODUCTION_LAST_MONTH, 0); + DrawString(2, y, STR_482A_PRODUCTION_LAST_MONTH, TC_FROMSTRING); y += 10; WP(w, indview_d).production_offset_y = y; first = false; @@ -499,7 +499,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) SetDParam(1, i->last_month_production[j]); SetDParam(2, i->last_month_pct_transported[j] * 100 >> 8); - DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), y, STR_482B_TRANSPORTED, 0); + DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), y, STR_482B_TRANSPORTED, TC_FROMSTRING); /* Let's put out those buttons.. */ if (IsProductionAlterable(i)) { DrawArrowButtons(5, y, 3, (WP(w, indview_d).clicked_line == j + 1) ? WP(w, indview_d).clicked_button : 0, @@ -517,7 +517,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) y += 10; PrepareTextRefStackUsage(6); - DrawString(2, y, message, 0); + DrawString(2, y, message, TC_FROMSTRING); StopTextRefStackUsage(); } } @@ -783,7 +783,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) SetVScrollCount(w, _num_industry_sort); DrawWindowWidgets(w); - DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, 0x10); + DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, TC_BLACK); p = w->vscroll.pos; n = 0; @@ -801,13 +801,13 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) SetDParam(4, i->last_month_production[1]); SetDParam(5, i->last_month_pct_transported[0] * 100 >> 8); SetDParam(6, i->last_month_pct_transported[1] * 100 >> 8); - DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_TWO, 0); + DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_TWO, TC_FROMSTRING); } else { SetDParam(3, i->last_month_pct_transported[0] * 100 >> 8); - DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM, 0); + DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM, TC_FROMSTRING); } } else { - DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_NOPROD, 0); + DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_NOPROD, TC_FROMSTRING); } p++; if (++n == w->vscroll.cap) break; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index b6314c676..9d25e6354 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -465,7 +465,7 @@ static void MenuWndProc(Window *w, WindowEvent *e) y = 1; for (; count != 0; count--, string++, sel--) { - byte color = HASBIT(dis, 0) ? 14 : (sel == 0) ? 12 : 16; + TextColour color = HASBIT(dis, 0) ? TC_GREY : (sel == 0) ? TC_WHITE : TC_BLACK; if (sel == 0) GfxFillRect(x, y, x + w->width - 3, y + 9, 0); if (HASBIT(chk, 0)) DrawString(x + 2, y, STR_CHECKMARK, color); @@ -566,7 +566,8 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: { int x,y; - byte sel, color; + byte sel; + TextColour color; Player *p; uint16 chk; @@ -583,7 +584,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) if (sel == 0) { GfxFillRect(x, y, x + 238, y + 9, 0); } - DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, 0x0); + DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, TC_FROMSTRING); y += 10; sel--; } @@ -599,8 +600,8 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) SetDParam(0, p->index); SetDParam(1, p->index); - color = (p->index == sel) ? 0xC : 0x10; - if (chk&1) color = 14; + color = (p->index == sel) ? TC_WHITE : TC_BLACK; + if (chk&1) color = TC_GREY; DrawString(x + 19, y, STR_7021, color); y += 10; @@ -1869,12 +1870,12 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); - DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, 0); + DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING); /* We hide this panel when the toolbar space gets too small */ if (w->widget[4].left != w->widget[4].right) { - DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 1, STR_0221_OPENTTD, 0); - DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 11, STR_0222_SCENARIO_EDITOR, 0); + DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); + DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING); } break; @@ -2049,7 +2050,7 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width) old_dpi = _cur_dpi; _cur_dpi = &tmp_dpi; - x = DoDrawString(buffer, pos, 0, 13); + x = DoDrawString(buffer, pos, 0, TC_LIGHT_BLUE); _cur_dpi = old_dpi; return x > 0; @@ -2064,22 +2065,22 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); SetDParam(0, _date); DrawStringCentered( - 70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, 0 + 70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING ); if (p != NULL) { /* Draw player money */ SetDParam(0, p->player_money); - DrawStringCentered(w->widget[2].left + 70, 1, STR_0004, 0); + DrawStringCentered(w->widget[2].left + 70, 1, STR_0004, TC_FROMSTRING); } /* Draw status bar */ if (w->message.msg) { // true when saving is active - DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_SAVING_GAME, 0); + DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING); } else if (_do_autosave) { - DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_032F_AUTOSAVE, 0); + DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING); } else if (_pause_game) { - DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_0319_PAUSED, 0); + DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING); } else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) { /* Draw the scrolling news text */ if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1, w->widget[1].right - w->widget[1].left - 2)) { @@ -2087,14 +2088,14 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) if (p != NULL) { /* This is the default text */ SetDParam(0, p->index); - DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_02BA, 0); + DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_02BA, TC_FROMSTRING); } } } else { if (p != NULL) { /* This is the default text */ SetDParam(0, p->index); - DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_02BA, 0); + DrawStringCenteredTruncated(w->widget[1].left + 1, w->widget[1].right - 1, 1, STR_02BA, TC_FROMSTRING); } } @@ -2417,3 +2418,4 @@ void InitializeMainGui() + diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index e3b644927..f45e56c11 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -60,13 +60,13 @@ static void LandInfoWndProc(Window *w, WindowEvent *e) if (e->event == WE_PAINT) { DrawWindowWidgets(w); - DoDrawStringCentered(140, 16, _landinfo_data[0], 13); - DoDrawStringCentered(140, 27, _landinfo_data[1], 0); - DoDrawStringCentered(140, 38, _landinfo_data[2], 0); - DoDrawStringCentered(140, 49, _landinfo_data[3], 0); - DoDrawStringCentered(140, 60, _landinfo_data[4], 0); + DoDrawStringCentered(140, 16, _landinfo_data[0], TC_LIGHT_BLUE); + DoDrawStringCentered(140, 27, _landinfo_data[1], TC_FROMSTRING); + DoDrawStringCentered(140, 38, _landinfo_data[2], TC_FROMSTRING); + DoDrawStringCentered(140, 49, _landinfo_data[3], TC_FROMSTRING); + DoDrawStringCentered(140, 60, _landinfo_data[4], TC_FROMSTRING); if (_landinfo_data[5][0] != '\0') DrawStringMultiCenter(140, 76, BindCString(_landinfo_data[5]), w->width - 4); - if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], 0); + if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], TC_FROMSTRING); } } @@ -265,13 +265,13 @@ static void AboutWindowProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); /* Show original copyright and revision version */ - DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, 0); - DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, 0); + DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING); + DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, TC_FROMSTRING); /* Show all scrolling credits */ for (i = 0; i < lengthof(credits); i++) { if (y >= 50 && y < (w->height - 40)) { - DoDrawString(credits[i], 10, y, 0x10); + DoDrawString(credits[i], 10, y, TC_BLACK); } y += 10; } @@ -279,8 +279,8 @@ static void AboutWindowProc(Window *w, WindowEvent *e) /* If the last text has scrolled start anew from the start */ if (y < 50) WP(w, scroller_d).height = w->height - 40; - DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", 16); - DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0); + DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", TC_BLACK); + DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, TC_FROMSTRING); } break; case WE_MOUSELOOP: // Timer to scroll the text and adjust the new top if (WP(w, scroller_d).counter++ % 3 == 0) { @@ -1087,8 +1087,8 @@ void DrawEditBox(Window *w, querystr_d *string, int wid) if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; - DoDrawString(tb->buf, delta, 0, 8); - if (tb->caret) DoDrawString("_", tb->caretxoffs + delta, 0, 12); + DoDrawString(tb->buf, delta, 0, TC_YELLOW); + if (tb->caret) DoDrawString("_", tb->caretxoffs + delta, 0, TC_WHITE); _cur_dpi = old_dpi; } @@ -1370,7 +1370,10 @@ static const Widget _save_dialog_widgets[] = { }; /* Colors for fios types */ -const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5, 6, 6, 8}; +const TextColour _fios_colors[] = { + TC_LIGHT_BLUE, TC_DARK_GREEN, TC_DARK_GREEN, TC_ORANGE, TC_LIGHT_BROWN, + TC_ORANGE, TC_LIGHT_BROWN, TC_ORANGE, TC_ORANGE, TC_YELLOW +}; void BuildFileList() { @@ -1401,8 +1404,8 @@ static void DrawFiosTexts(uint maxw) } if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot); - DrawString(2, 37, str, 0); - DoDrawStringTruncated(path, 2, 27, 16, maxw); + DrawString(2, 37, str, TC_FROMSTRING); + DoDrawStringTruncated(path, 2, 27, TC_BLACK, maxw); } static void MakeSortedSaveGameList() @@ -1491,7 +1494,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) DoDrawString( _savegame_sort_order & SORT_DESCENDING ? DOWNARROW : UPARROW, _savegame_sort_order & SORT_BY_NAME ? w->widget[2].right - 9 : w->widget[3].right - 9, - 15, 16 + 15, TC_BLACK ); y = w->widget[7].top + 1; @@ -1900,7 +1903,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e) } break; } - DrawString(50, y + 1, ce->str, 0); + DrawString(50, y + 1, ce->str, TC_FROMSTRING); y += 12; } diff --git a/src/music_gui.cpp b/src/music_gui.cpp index c90aa5c5a..2848844d2 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -207,25 +207,25 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e) GfxFillRect(3, 23, 3 + 177, 23 + 191, 0); GfxFillRect(251, 23, 251 + 177, 23 + 191, 0); - DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0); + DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, TC_FROMSTRING); SetDParam(0, STR_01D5_ALL + msf.playlist); - DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0); + DrawStringCentered(340, 15, STR_01EF_PROGRAM, TC_FROMSTRING); for (i = 1; i <= NUM_SONGS_AVAILABLE; i++) { SetDParam(0, i); SetDParam(2, i); SetDParam(1, SPECSTR_SONGNAME); - DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, 0); + DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, TC_FROMSTRING); } for (i = 0; i != 6; i++) { - DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? 0xC : 0x10); + DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? TC_WHITE : TC_BLACK); } - DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, 0); + DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, TC_FROMSTRING); #if 0 - DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, 0); + DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, TC_FROMSTRING); #endif y = 23; @@ -233,7 +233,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e) SetDParam(0, i); SetDParam(1, SPECSTR_SONGNAME); SetDParam(2, i); - DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, 0); + DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, TC_FROMSTRING); y += 6; } break; @@ -367,7 +367,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e) SetDParam(0, _music_wnd_cursong); str = (_music_wnd_cursong < 10) ? STR_01E4_0 : STR_01E5; } - DrawString(62, 46, str, 0); + DrawString(62, 46, str, TC_FROMSTRING); str = STR_01E6; if (_song_is_active != 0 && _music_wnd_cursong != 0) { @@ -375,21 +375,21 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e) SetDParam(0, SPECSTR_SONGNAME); SetDParam(1, _music_wnd_cursong); } - DrawStringCentered(155, 46, str, 0); + DrawStringCentered(155, 46, str, TC_FROMSTRING); - DrawString(60, 38, STR_01E8_TRACK_XTITLE, 0); + DrawString(60, 38, STR_01E8_TRACK_XTITLE, TC_FROMSTRING); for (i = 0; i != 6; i++) { - DrawStringCentered(25 + i * 50, 59, STR_01D5_ALL + i, msf.playlist == i ? 0xC : 0x10); + DrawStringCentered(25 + i * 50, 59, STR_01D5_ALL + i, msf.playlist == i ? TC_WHITE : TC_BLACK); } - DrawStringCentered(31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? 0xC : 0x10)); - DrawStringCentered(269, 43, STR_01EA_PROGRAM, 0); - DrawStringCentered(141, 15, STR_01DB_MUSIC_VOLUME, 0); - DrawStringCentered(141, 29, STR_01DD_MIN_MAX, 0); - DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, 0); - DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0); + DrawStringCentered(31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? TC_WHITE : TC_BLACK)); + DrawStringCentered(269, 43, STR_01EA_PROGRAM, TC_FROMSTRING); + DrawStringCentered(141, 15, STR_01DB_MUSIC_VOLUME, TC_FROMSTRING); + DrawStringCentered(141, 29, STR_01DD_MIN_MAX, TC_FROMSTRING); + DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, TC_FROMSTRING); + DrawStringCentered(247, 29, STR_01DD_MIN_MAX, TC_FROMSTRING); DrawFrameRect(108, 23, 174, 26, 14, FR_LOWERED); DrawFrameRect(214, 23, 280, 26, 14, FR_LOWERED); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index f81799755..4c87531dc 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -255,14 +255,14 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e) DrawEditBox(w, &WP(w, network_ql_d).q, 3); - DrawString(9, 23, STR_NETWORK_CONNECTION, 2); - DrawString(w->widget[3].left - 100, 23, STR_NETWORK_PLAYER_NAME, 2); + DrawString(9, 23, STR_NETWORK_CONNECTION, TC_GOLD); + DrawString(w->widget[3].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD); /* Sort based on widgets: name, clients, compatibility */ switch (ld->sort_type) { - case 6 - 6: DoDrawString(arrow, w->widget[6].right - 10, 42, 0x10); break; - case 7 - 6: DoDrawString(arrow, w->widget[7].right - 10, 42, 0x10); break; - case 8 - 6: DoDrawString(arrow, w->widget[8].right - 10, 42, 0x10); break; + case 6 - 6: DoDrawString(arrow, w->widget[6].right - 10, 42, TC_BLACK); break; + case 7 - 6: DoDrawString(arrow, w->widget[7].right - 10, 42, TC_BLACK); break; + case 8 - 6: DoDrawString(arrow, w->widget[8].right - 10, 42, TC_BLACK); break; } { // draw list of games @@ -282,13 +282,13 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e) if (cur_item == sel) GfxFillRect(w->widget[6].left + 1, y - 2, w->widget[8].right - 1, y + 9, 10); SetDParamStr(0, cur_item->info.server_name); - DrawStringTruncated(w->widget[6].left + 5, y, STR_02BD, 16, max_name_width); + DrawStringTruncated(w->widget[6].left + 5, y, STR_02BD, TC_BLACK, max_name_width); SetDParam(0, cur_item->info.clients_on); SetDParam(1, cur_item->info.clients_max); SetDParam(2, cur_item->info.companies_on); SetDParam(3, cur_item->info.companies_max); - DrawStringCentered(w->widget[7].left + 39, y, STR_NETWORK_GENERAL_ONLINE, 2); + DrawStringCentered(w->widget[7].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD); // only draw icons if the server is online if (cur_item->online) { @@ -311,71 +311,71 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e) /* Draw the right menu */ GfxFillRect(w->widget[15].left + 1, 43, w->widget[15].right - 1, 92, 157); if (sel == NULL) { - DrawStringCentered(w->widget[15].left + 115, 58, STR_NETWORK_GAME_INFO, 0); + DrawStringCentered(w->widget[15].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING); } else if (!sel->online) { SetDParamStr(0, sel->info.server_name); - DrawStringCentered(w->widget[15].left + 115, 68, STR_ORANGE, 0); // game name + DrawStringCentered(w->widget[15].left + 115, 68, STR_ORANGE, TC_FROMSTRING); // game name - DrawStringCentered(w->widget[15].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, 0); // server offline + DrawStringCentered(w->widget[15].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // server offline } else { // show game info uint16 y = 100; const uint16 x = w->widget[15].left + 5; - DrawStringCentered(w->widget[15].left + 115, 48, STR_NETWORK_GAME_INFO, 0); + DrawStringCentered(w->widget[15].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING); SetDParamStr(0, sel->info.server_name); - DrawStringCenteredTruncated(w->widget[15].left, w->widget[15].right, 62, STR_ORANGE, 16); // game name + DrawStringCenteredTruncated(w->widget[15].left, w->widget[15].right, 62, STR_ORANGE, TC_BLACK); // game name SetDParamStr(0, sel->info.map_name); - DrawStringCenteredTruncated(w->widget[15].left, w->widget[15].right, 74, STR_02BD, 16); // map name + DrawStringCenteredTruncated(w->widget[15].left, w->widget[15].right, 74, STR_02BD, TC_BLACK); // map name SetDParam(0, sel->info.clients_on); SetDParam(1, sel->info.clients_max); SetDParam(2, sel->info.companies_on); SetDParam(3, sel->info.companies_max); - DrawString(x, y, STR_NETWORK_CLIENTS, 2); + DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD); y += 10; SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang); - DrawString(x, y, STR_NETWORK_LANGUAGE, 2); // server language + DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language y += 10; SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set); - DrawString(x, y, STR_NETWORK_TILESET, 2); // tileset + DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset y += 10; SetDParam(0, sel->info.map_width); SetDParam(1, sel->info.map_height); - DrawString(x, y, STR_NETWORK_MAP_SIZE, 2); // map size + DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size y += 10; SetDParamStr(0, sel->info.server_revision); - DrawString(x, y, STR_NETWORK_SERVER_VERSION, 2); // server version + DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version y += 10; SetDParamStr(0, sel->info.hostname); SetDParam(1, sel->port); - DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, 2); // server address + DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address y += 10; SetDParam(0, sel->info.start_date); - DrawString(x, y, STR_NETWORK_START_DATE, 2); // start date + DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date y += 10; SetDParam(0, sel->info.game_date); - DrawString(x, y, STR_NETWORK_CURRENT_DATE, 2); // current date + DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date y += 10; y += 2; if (!sel->info.compatible) { - DrawStringCentered(w->widget[15].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, 0); // server mismatch + DrawStringCentered(w->widget[15].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch } else if (sel->info.clients_on == sel->info.clients_max) { // Show: server full, when clients_on == clients_max - DrawStringCentered(w->widget[15].left + 115, y, STR_NETWORK_SERVER_FULL, 0); // server full + DrawStringCentered(w->widget[15].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full } else if (sel->info.use_password) { - DrawStringCentered(w->widget[15].left + 115, y, STR_NETWORK_PASSWORD, 0); // password warning + DrawStringCentered(w->widget[15].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning } y += 10; @@ -627,17 +627,17 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e) GfxFillRect(11, 63, 258, 215, 0xD7); DrawEditBox(w, &WP(w, network_ql_d).q, 3); - DrawString(10, 22, STR_NETWORK_NEW_GAME_NAME, 2); + DrawString(10, 22, STR_NETWORK_NEW_GAME_NAME, TC_GOLD); - DrawString(10, 43, STR_NETWORK_SELECT_MAP, 2); + DrawString(10, 43, STR_NETWORK_SELECT_MAP, TC_GOLD); - DrawString(280, 63, STR_NETWORK_CONNECTION, 2); - DrawString(280, 95, STR_NETWORK_NUMBER_OF_CLIENTS, 2); - DrawString(280, 127, STR_NETWORK_NUMBER_OF_COMPANIES, 2); - DrawString(280, 159, STR_NETWORK_NUMBER_OF_SPECTATORS, 2); - DrawString(280, 191, STR_NETWORK_LANGUAGE_SPOKEN, 2); + DrawString(280, 63, STR_NETWORK_CONNECTION, TC_GOLD); + DrawString(280, 95, STR_NETWORK_NUMBER_OF_CLIENTS, TC_GOLD); + DrawString(280, 127, STR_NETWORK_NUMBER_OF_COMPANIES, TC_GOLD); + DrawString(280, 159, STR_NETWORK_NUMBER_OF_SPECTATORS, TC_GOLD); + DrawString(280, 191, STR_NETWORK_LANGUAGE_SPOKEN, TC_GOLD); - if (_network_game_info.use_password) DoDrawString("*", 408, 23, 3); + if (_network_game_info.use_password) DoDrawString("*", 408, 23, TC_RED); // draw list of maps pos = w->vscroll.pos; @@ -647,7 +647,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e) GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour if (pos == 0) { - DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, 9); + DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN); } else { DoDrawString(item->title, 14, y, _fios_colors[item->type] ); } @@ -896,7 +896,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); SetDParamStr(0, gi->server_name); - DrawString(10, 22, STR_NETWORK_PREPARE_TO_JOIN, 2); + DrawString(10, 22, STR_NETWORK_PREPARE_TO_JOIN, TC_GOLD); /* Draw company list */ pos = w->vscroll.pos; @@ -906,7 +906,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) if (nd->company == company) GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour - DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, 16, 135 - 13); + DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, TC_BLACK, 135 - 13); if (_network_player_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y); /* If the company's income was positive puts a green dot else a red dot */ @@ -920,7 +920,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) /* Draw info about selected company when it is selected in the left window */ GfxFillRect(174, 39, 403, 75, 157); - DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, 0); + DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING); if (nd->company != (byte)-1) { const uint x = 183; const uint trunc_width = w->widget[6].right - x; @@ -930,31 +930,31 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) SetDParam(1, nd->server->info.clients_max); SetDParam(2, nd->server->info.companies_on); SetDParam(3, nd->server->info.companies_max); - DrawString(x, y, STR_NETWORK_CLIENTS, 2); + DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD); y += 10; SetDParamStr(0, _network_player_info[nd->company].company_name); - DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, 2, trunc_width); + DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width); y += 10; SetDParam(0, _network_player_info[nd->company].inaugurated_year); - DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, 2); // inauguration year + DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year y += 10; SetDParam(0, _network_player_info[nd->company].company_value); - DrawString(x, y, STR_NETWORK_VALUE, 2); // company value + DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value y += 10; SetDParam(0, _network_player_info[nd->company].money); - DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, 2); // current balance + DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance y += 10; SetDParam(0, _network_player_info[nd->company].income); - DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, 2); // last year's income + DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income y += 10; SetDParam(0, _network_player_info[nd->company].performance); - DrawString(x, y, STR_NETWORK_PERFORMANCE, 2); // performance + DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance y += 10; SetDParam(0, _network_player_info[nd->company].num_vehicle[0]); @@ -962,7 +962,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) SetDParam(2, _network_player_info[nd->company].num_vehicle[2]); SetDParam(3, _network_player_info[nd->company].num_vehicle[3]); SetDParam(4, _network_player_info[nd->company].num_vehicle[4]); - DrawString(x, y, STR_NETWORK_VEHICLES, 2); // vehicles + DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles y += 10; SetDParam(0, _network_player_info[nd->company].num_station[0]); @@ -970,11 +970,11 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) SetDParam(2, _network_player_info[nd->company].num_station[2]); SetDParam(3, _network_player_info[nd->company].num_station[3]); SetDParam(4, _network_player_info[nd->company].num_station[4]); - DrawString(x, y, STR_NETWORK_STATIONS, 2); // stations + DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations y += 10; SetDParamStr(0, _network_player_info[nd->company].players); - DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, 2, trunc_width); // players + DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players } } break; @@ -1311,7 +1311,7 @@ static void ClientListPopupWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: { int i, y, sel; - byte colour; + TextColour colour; DrawWindowWidgets(w); // Draw the actions @@ -1323,9 +1323,9 @@ static void ClientListPopupWndProc(Window *w, WindowEvent *e) if (sel-- == 0) { // Selected item, highlight it GfxFillRect(1, y, 150 - 2, y + CLNWND_ROWSIZE - 1, 0); - colour = 0xC; + colour = TC_WHITE; } else { - colour = 0x10; + colour = TC_BLACK; } DoDrawString(_clientlist_action[i], 4, y, colour); @@ -1362,7 +1362,7 @@ static void ClientListWndProc(Window *w, WindowEvent *e) case WE_PAINT: { NetworkClientInfo *ci; int y, i = 0; - byte colour; + TextColour colour; // Check if we need to reset the height if (!CheckClientListHeight(w)) break; @@ -1374,9 +1374,9 @@ static void ClientListWndProc(Window *w, WindowEvent *e) FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { if (_selected_clientlist_item == i++) { // Selected item, highlight it GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0); - colour = 0xC; + colour = TC_WHITE; } else { - colour = 0x10; + colour = TC_BLACK; } if (ci->client_index == NETWORK_SERVER_INDEX) { @@ -1463,7 +1463,7 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e) uint8 progress; // used for progress bar DrawWindowWidgets(w); - DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, 14); + DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY); switch (_network_join_status) { case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING: case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO: @@ -1471,13 +1471,13 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e) break; case NETWORK_JOIN_STATUS_WAITING: SetDParam(0, _network_join_waiting); - DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, 14); + DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY); progress = 15; // third stage is 15% break; case NETWORK_JOIN_STATUS_DOWNLOADING: SetDParam(0, _network_join_kbytes); SetDParam(1, _network_join_kbytes_total); - DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, 14); + DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY); /* Fallthrough */ default: /* Waiting is 15%, so the resting receivement of map is maximum 70% */ progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total; @@ -1701,7 +1701,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e) assert(WP(w, chatquerystr_d).caption < lengthof(chat_captions)); msg = chat_captions[WP(w, chatquerystr_d).caption]; - DrawStringRightAligned(w->widget[2].left - 2, w->widget[2].top + 1, msg, 16); + DrawStringRightAligned(w->widget[2].left - 2, w->widget[2].top + 1, msg, TC_BLACK); DrawEditBox(w, &WP(w, chatquerystr_d), 2); } break; diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index e1479d125..17e80656f 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -143,7 +143,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) /* Draw selection background */ if (h) GfxFillRect(3, y, w->width - 15, y + 9, 156); - DoDrawStringTruncated(text, 4, y, h ? 0xC : 0x6, w->width - 18); + DoDrawStringTruncated(text, 4, y, h ? TC_WHITE : TC_ORANGE, w->width - 18); y += 10; } n++; @@ -370,7 +370,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) DrawSprite(SPR_SQUARE, pal, 5, y + 2); if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2); txtoffset = c->error != NULL ? 35 : 25; - DoDrawStringTruncated(text, txtoffset, y + 3, WP(w, newgrf_d).sel == c ? 0xC : 0x10, w->width - txtoffset - 10); + DoDrawStringTruncated(text, txtoffset, y + 3, WP(w, newgrf_d).sel == c ? TC_WHITE : TC_BLACK, w->width - txtoffset - 10); y += 14; } } diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 3af2b27f5..a8d8b0e36 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -106,7 +106,7 @@ void DrawNewsBorder(const Window *w) GfxFillRect(left, top, right, top, 0xD7); GfxFillRect(left, bottom, right, bottom, 0xD7); - DrawString(left + 2, top + 1, STR_00C6, 0); + DrawString(left + 2, top + 1, STR_00C6, TC_FROMSTRING); } static void NewsWindowProc(Window *w, WindowEvent *e) @@ -126,10 +126,10 @@ static void NewsWindowProc(Window *w, WindowEvent *e) case NM_THIN: { DrawNewsBorder(w); - DrawString(2, 1, STR_00C6, 0); + DrawString(2, 1, STR_00C6, TC_FROMSTRING); SetDParam(0, ni->date); - DrawStringRightAligned(428, 1, STR_01FF, 0); + DrawStringRightAligned(428, 1, STR_01FF, TC_FROMSTRING); if (!(ni->flags & NF_VIEWPORT)) { CopyInDParam(0, ni->params, lengthof(ni->params)); @@ -704,9 +704,9 @@ static void MessageHistoryWndProc(Window *w, WindowEvent *e) const NewsItem *ni = &_news_items[getNews(p)]; SetDParam(0, ni->date); - DrawString(4, y, STR_SHORT_DATE, 12); + DrawString(4, y, STR_SHORT_DATE, TC_WHITE); - DrawNewsString(82, y, 12, ni, w->width - 95); + DrawNewsString(82, y, TC_WHITE, ni, w->width - 95); y += 12; } break; @@ -832,11 +832,11 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e) for (i = 0, y = 26; i < NT_END; i++, y += 12, val >>= 2) { /* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division, * which will give centered position */ - DrawStringCentered(51, y + 1, message_opt[val & 0x3], 0x10); + DrawStringCentered(51, y + 1, message_opt[val & 0x3], TC_BLACK); } /* Draw the general bottom button string as well */ - DrawStringCentered(51, y + 10, message_opt[WP(w, def_d).data_1], 0x10); + DrawStringCentered(51, y + 10, message_opt[WP(w, def_d).data_1], TC_BLACK); } break; case WE_CLICK: diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 2dd5714a8..27ea5646e 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -238,9 +238,8 @@ static void DrawOrdersWindow(Window *w) default: break; } - const byte colour = (i == WP(w,order_d).sel) ? 0xC : 0x10; SetDParam(0, i + 1); - DrawString(2, y, str, colour); + DrawString(2, y, str, (i == WP(w,order_d).sel) ? TC_WHITE : TC_BLACK); y += 10; } @@ -251,8 +250,7 @@ static void DrawOrdersWindow(Window *w) if (i - w->vscroll.pos < w->vscroll.cap) { str = shared_orders ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; - const byte colour = (i == WP(w,order_d).sel) ? 0xC : 0x10; - DrawString(2, y, str, colour); + DrawString(2, y, str, (i == WP(w,order_d).sel) ? TC_WHITE : TC_BLACK); } } diff --git a/src/player_gui.cpp b/src/player_gui.cpp index 977e3ec31..8180b7b1b 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -39,10 +39,10 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode) if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status /* draw categories */ - DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0); + DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING); for (i = 0; i != 13; i++) - DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, 0); - DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, 0); + DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, TC_FROMSTRING); + DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, TC_FROMSTRING); /* draw the price columns */ year = _cur_year - 2; @@ -52,7 +52,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode) do { if (year >= p->inaugurated_year) { SetDParam(0, year); - DrawStringRightAlignedUnderline(x, 15, STR_7010, 0); + DrawStringRightAlignedUnderline(x, 15, STR_7010, TC_FROMSTRING); sum = 0; for (i = 0; i != 13; i++) { /* draw one row in the price column */ @@ -63,14 +63,14 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode) str = STR_701E; if (cost < 0) { cost = -cost; str++; } SetDParam(0, cost); - DrawStringRightAligned(x, 27 + i * 10, str, 0); + DrawStringRightAligned(x, 27 + i * 10, str, TC_FROMSTRING); } } str = STR_701E; if (sum < 0) { sum = -sum; str++; } SetDParam(0, sum); - DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0); + DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, TC_FROMSTRING); GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215); x += 95; @@ -83,27 +83,27 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode) /* draw max loan aligned to loan below (y += 10) */ SetDParam(0, _economy.max_loan); - DrawString(202, y + 10, STR_MAX_LOAN, 0); + DrawString(202, y + 10, STR_MAX_LOAN, TC_FROMSTRING); } else { y = 15; } - DrawString(2, y, STR_7026_BANK_BALANCE, 0); + DrawString(2, y, STR_7026_BANK_BALANCE, TC_FROMSTRING); SetDParam(0, p->player_money); - DrawStringRightAligned(182, y, STR_7028, 0); + DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); y += 10; - DrawString(2, y, STR_7027_LOAN, 0); + DrawString(2, y, STR_7027_LOAN, TC_FROMSTRING); SetDParam(0, p->current_loan); - DrawStringRightAligned(182, y, STR_7028, 0); + DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); y += 12; GfxFillRect(182 - 75, y - 2, 182, y - 2, 215); SetDParam(0, p->player_money - p->current_loan); - DrawStringRightAligned(182, y, STR_7028, 0); + DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); } static const Widget _player_finances_widgets[] = { @@ -331,14 +331,14 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e) DrawSprite(p->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y); } - DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? 0xC : 0x10); + DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK); DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y); - DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? 0xC : 2); + DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD); if (_loaded_newgrf_features.has_2CC) { DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y); - DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? 0xC : 2); + DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD); } y += 14; @@ -658,7 +658,7 @@ static const Widget _select_player_face_adv_widgets[] = { void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 val, bool is_bool_widget) { /* Write the label in gold (0x2) to the left of the button. */ - DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, 0x2); + DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, TC_GOLD); if (!IsWindowWidgetDisabled(w, widget_index)) { if (is_bool_widget) { @@ -672,7 +672,7 @@ void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ DrawStringCentered(w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 + - IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, 0xC); + IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, TC_WHITE); } } @@ -985,7 +985,7 @@ static void DrawPlayerVehiclesAmount(PlayerID player) uint air = 0; uint ship = 0; - DrawString(x, y, STR_7039_VEHICLES, 0); + DrawString(x, y, STR_7039_VEHICLES, TC_FROMSTRING); FOR_ALL_VEHICLES(v) { if (v->owner == player) { @@ -1000,29 +1000,29 @@ static void DrawPlayerVehiclesAmount(PlayerID player) } if (train + road + air + ship == 0) { - DrawString(x + 70, y, STR_7042_NONE, 0); + DrawString(x + 70, y, STR_7042_NONE, TC_FROMSTRING); } else { if (train != 0) { SetDParam(0, train); - DrawString(x + 70, y, STR_TRAINS, 0); + DrawString(x + 70, y, STR_TRAINS, TC_FROMSTRING); y += 10; } if (road != 0) { SetDParam(0, road); - DrawString(x + 70, y, STR_ROAD_VEHICLES, 0); + DrawString(x + 70, y, STR_ROAD_VEHICLES, TC_FROMSTRING); y += 10; } if (air != 0) { SetDParam(0, air); - DrawString(x + 70, y, STR_AIRCRAFT, 0); + DrawString(x + 70, y, STR_AIRCRAFT, TC_FROMSTRING); y += 10; } if (ship != 0) { SetDParam(0, ship); - DrawString(x + 70, y, STR_SHIPS, 0); + DrawString(x + 70, y, STR_SHIPS, TC_FROMSTRING); } } } @@ -1052,7 +1052,7 @@ static void DrawCompanyOwnerText(const Player *p) } } - if (num >= 0) DrawString(120, 124, STR_707D_OWNED_BY + num, 0); + if (num >= 0) DrawString(120, 124, STR_707D_OWNED_BY + num, TC_FROMSTRING); } /** @@ -1105,11 +1105,11 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); SetDParam(0, p->inaugurated_year); - DrawString(110, 25, STR_7038_INAUGURATED, 0); + DrawString(110, 25, STR_7038_INAUGURATED, TC_FROMSTRING); DrawPlayerVehiclesAmount((PlayerID)w->window_number); - DrawString(110, 48, STR_7006_COLOR_SCHEME, 0); + DrawString(110, 48, STR_7006_COLOR_SCHEME, TC_FROMSTRING); /* Draw company-colour bus */ DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49); @@ -1119,7 +1119,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94); SetDParam(0, CalculateCompanyValue(p)); - DrawString(110, 114, STR_7076_COMPANY_VALUE, 0); + DrawString(110, 114, STR_7076_COMPANY_VALUE, TC_FROMSTRING); DrawCompanyOwnerText(p); @@ -1396,10 +1396,10 @@ static void HighScoreWndProc(Window *w, WindowEvent *e) /* Draw Highscore peepz */ for (i = 0; i < lengthof(_highscore_table[0]); i++) { SetDParam(0, i + 1); - DrawString(x + 40, y + 140 + (i * 55), STR_0212, 0x10); + DrawString(x + 40, y + 140 + (i * 55), STR_0212, TC_BLACK); if (hs[i].company[0] != '\0') { - uint16 colour = (WP(w, highscore_d).rank == (int8)i) ? 0x3 : 0x10; // draw new highscore in red + TextColour colour = (WP(w, highscore_d).rank == (int8)i) ? TC_RED : TC_BLACK; // draw new highscore in red DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour); SetDParam(0, hs[i].title); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 14077bde6..5abf18d39 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -809,10 +809,10 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) _cur_dpi = old_dpi; } - DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, 0); - DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, 0); - DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, 0); - DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); + DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, TC_FROMSTRING); + DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, TC_FROMSTRING); + DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING); + DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING); DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad); @@ -827,9 +827,9 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT)); } - DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? 12 : 16, 118); + DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); } else { - DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? 12 : 16, 118); + DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); } y += 14; @@ -1369,3 +1369,4 @@ void SetDefaultRailGui() } } + diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index cf472d054..97aa325af 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -28,7 +28,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y) SetDParam(0, v->engine_type); SetDParam(1, v->build_year); SetDParam(2, v->value); - DrawString(x, y + y_offset, STR_9011_BUILT_VALUE, 0); + DrawString(x, y + y_offset, STR_9011_BUILT_VALUE, TC_FROMSTRING); if (RoadVehHasArticPart(v)) { AcceptedCargo max_cargo; @@ -58,7 +58,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y) } SetDParamStr(0, capacity); - DrawStringTruncated(x, y + 10 + y_offset, STR_JUST_STRING, 0, 380 - x); + DrawStringTruncated(x, y + 10 + y_offset, STR_JUST_STRING, TC_BLUE, 380 - x); for (const Vehicle *u = v; u != NULL; u = u->Next()) { str = STR_8812_EMPTY; @@ -68,7 +68,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y) SetDParam(2, u->cargo.Source()); str = STR_8813_FROM; } - DrawString(x, y + 21 + y_offset, str, 0); + DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING); y_offset += 11; } @@ -77,7 +77,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y) } else { SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); - DrawString(x, y + 10 + y_offset, STR_9012_CAPACITY, 0); + DrawString(x, y + 10 + y_offset, STR_9012_CAPACITY, TC_FROMSTRING); str = STR_8812_EMPTY; if (!v->cargo.Empty()) { @@ -86,12 +86,12 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y) SetDParam(2, v->cargo.Source()); str = STR_8813_FROM; } - DrawString(x, y + 21 + y_offset, str, 0); + DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING); } /* Draw Transfer credits text */ SetDParam(0, v->cargo.FeederShare()); - DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, 0); + DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index bafb993c5..aa255f31d 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -155,7 +155,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) SetWindowWidgetLoweredState(w, 28, _fullscreen); DrawWindowWidgets(w); - DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen + DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen } break; case WE_CLICK: @@ -485,14 +485,14 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e) GfxFillRect(16, y + 1, 16 + 8, y + 8, color); } - DrawStringCentered(10, y, STR_6819, 0); - DrawStringCentered(20, y, STR_681A, 0); + DrawStringCentered(10, y, STR_6819, TC_FROMSTRING); + DrawStringCentered(20, y, STR_681A, TC_FROMSTRING); value = _game_setting_info[i].str + ((GDType*)&_opt_mod_temp.diff)[i]; if (i == 4) value *= 1000; // XXX - handle currency option SetDParam(0, value); - DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, 0); + DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, TC_FROMSTRING); y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit } @@ -857,7 +857,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) SetDParam(1, value); } } - DrawString(30, y, (sdb->str) + disabled, 0); + DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING); y += 11; } break; @@ -1031,8 +1031,8 @@ void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, b DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : FR_NONE); DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE); - DrawStringCentered(x + 5, y + 1, STR_6819, 0); // [<] - DrawStringCentered(x + 15, y + 1, STR_681A, 0); // [>] + DrawStringCentered(x + 5, y + 1, STR_6819, TC_FROMSTRING); // [<] + DrawStringCentered(x + 15, y + 1, STR_681A, TC_FROMSTRING); // [>] /* Grey out the buttons that aren't clickable */ if (!clickable_left) @@ -1056,37 +1056,37 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e) DrawArrowButtons(10, y, 3, GB(clk, 0, 2), true, true); SetDParam(0, 1); SetDParam(1, 1); - DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); + DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, TC_FROMSTRING); y += 12; // separator DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 2, 2) ? FR_LOWERED : FR_NONE); - x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, 0); - DoDrawString(_str_separator, x + 4, y + 1, 6); + x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, TC_FROMSTRING); + DoDrawString(_str_separator, x + 4, y + 1, TC_ORANGE); y += 12; // prefix DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 4, 2) ? FR_LOWERED : FR_NONE); - x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, 0); - DoDrawString(_custom_currency.prefix, x + 4, y + 1, 6); + x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, TC_FROMSTRING); + DoDrawString(_custom_currency.prefix, x + 4, y + 1, TC_ORANGE); y += 12; // suffix DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 6, 2) ? FR_LOWERED : FR_NONE); - x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, 0); - DoDrawString(_custom_currency.suffix, x + 4, y + 1, 6); + x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, TC_FROMSTRING); + DoDrawString(_custom_currency.suffix, x + 4, y + 1, TC_ORANGE); y += 12; // switch to euro DrawArrowButtons(10, y, 3, GB(clk, 8, 2), true, true); SetDParam(0, _custom_currency.to_euro); - DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, 0); + DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, TC_FROMSTRING); y += 12; // Preview y += 12; SetDParam(0, 10000); - DrawString(35, y + 1, STR_CURRENCY_PREVIEW, 0); + DrawString(35, y + 1, STR_CURRENCY_PREVIEW, TC_FROMSTRING); break; } diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp index e08ea3948..d2d2f1a90 100644 --- a/src/ship_gui.cpp +++ b/src/ship_gui.cpp @@ -52,11 +52,11 @@ void DrawShipDetails(const Vehicle *v, int x, int y) SetDParam(0, v->engine_type); SetDParam(1, v->build_year); SetDParam(2, v->value); - DrawString(x, y, STR_9816_BUILT_VALUE, 0); + DrawString(x, y, STR_9816_BUILT_VALUE, TC_FROMSTRING); SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); - DrawString(x, y + 10, STR_9817_CAPACITY, 0); + DrawString(x, y + 10, STR_9817_CAPACITY, TC_FROMSTRING); StringID str = STR_8812_EMPTY; if (!v->cargo.Empty()) { @@ -65,9 +65,9 @@ void DrawShipDetails(const Vehicle *v, int x, int y) SetDParam(2, v->cargo.Source()); str = STR_8813_FROM; } - DrawString(x, y + 21, str, 0); + DrawString(x, y + 21, str, TC_FROMSTRING); /* Draw Transfer credits text */ SetDParam(0, v->cargo.FeederShare()); - DrawString(x, y + 33, STR_FEEDER_CARGO_VALUE, 0); + DrawString(x, y + 33, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING); } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index e5c8dff78..440749743 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -75,7 +75,7 @@ static void SignListWndProc(Window *w, WindowEvent *e) /* No signs? */ if (w->vscroll.count == 0) { - DrawString(2, y, STR_304A_NONE, 0); + DrawString(2, y, STR_304A_NONE, TC_FROMSTRING); return; } @@ -90,7 +90,7 @@ static void SignListWndProc(Window *w, WindowEvent *e) DrawPlayerIcon(si->owner, 4, y + 1); SetDParam(0, si->index); - DrawString(22, y, STR_SIGN_NAME, 8); + DrawString(22, y, STR_SIGN_NAME, TC_YELLOW); y += 10; } } @@ -321,3 +321,4 @@ void ShowRenameSignWindow(const Sign *si) } + diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index cfc7ce8eb..9e6d0b64b 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -681,7 +681,7 @@ skip_column: y < dpi->top + dpi->height) { /* And draw it. */ SetDParam(0, t->index); - DrawString(x, y, STR_2056, 12); + DrawString(x, y, STR_2056, TC_WHITE); } } } @@ -752,9 +752,9 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) /* Industry name must be formated, since it's not in tiny font in the specs. * So, draw with a parameter and use the STR_7065 string, which is tiny, black */ SetDParam(0, tbl->legend); - DrawString(x + 11, y, STR_7065, 0); + DrawString(x + 11, y, STR_7065, TC_FROMSTRING); } else { - DrawString(x + 11, y, tbl->legend, 0); + DrawString(x + 11, y, tbl->legend, TC_FROMSTRING); } tbl += 1; diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 735725fa7..bff5fa97c 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -79,7 +79,7 @@ static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount } } - DrawString(x + 1, y, cs->abbrev, 0x10); + DrawString(x + 1, y, cs->abbrev, TC_BLACK); /* Draw green/red ratings bar (fits into 14 pixels) */ y += 8; @@ -314,9 +314,9 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); /* draw sorting criteria string */ - DrawString(85, 26, _station_sort_listing[sl->sort_type], 0x10); + DrawString(85, 26, _station_sort_listing[sl->sort_type], TC_BLACK); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10); + DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, TC_BLACK); int cg_ofst; int x = 89; @@ -330,23 +330,23 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) cg_ofst = HASBIT(_cargo_filter, c) ? 2 : 1; GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour); - DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10); + DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK); x += 14; i++; } x += 6; cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1; - DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, 16); + DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK); x += 14; cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_CARGOALL) ? 2 : 1; - DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16); + DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK); cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_FACILALL) ? 2 : 1; - DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16); + DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK); if (w->vscroll.count == 0) { // player has no stations - DrawString(xb, 40, STR_304A_NONE, 0); + DrawString(xb, 40, STR_304A_NONE, TC_FROMSTRING); return; } @@ -362,7 +362,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) SetDParam(0, st->index); SetDParam(1, st->facilities); - x = DrawString(xb, y, STR_3049_0, 0) + 5; + x = DrawString(xb, y, STR_3049_0, TC_FROMSTRING) + 5; /* show cargo waiting and station ratings */ for (CargoID j = 0; j < NUM_CARGO; j++) { @@ -729,7 +729,7 @@ static void DrawStationViewWindow(Window *w) if (!st->goods[i].cargo.Empty()) str = STR_EMPTY; } SetDParam(0, str); - DrawString(x, y, STR_0008_WAITING, 0); + DrawString(x, y, STR_0008_WAITING, TC_FROMSTRING); y += 10; } @@ -742,7 +742,7 @@ static void DrawStationViewWindow(Window *w) DrawCargoIcons(i, waiting, x, y); SetDParam(1, waiting); SetDParam(0, i); - DrawStringRightAligned(x + 234, y, STR_0009, 0); + DrawStringRightAligned(x + 234, y, STR_0009, TC_FROMSTRING); y += 10; } } else { @@ -751,13 +751,13 @@ static void DrawStationViewWindow(Window *w) DrawCargoIcons(i, waiting, x, y); SetDParam(1, waiting); SetDParam(0, i); - DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, 0); + DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, TC_FROMSTRING); y += 10; } if (pos > -5 && --pos < 0) { SetDParam(0, st->goods[i].cargo.Source()); - DrawStringRightAligned(x + 234, y, STR_000B, 0); + DrawStringRightAligned(x + 234, y, STR_000B, TC_FROMSTRING); y += 10; } } @@ -789,7 +789,7 @@ static void DrawStationViewWindow(Window *w) *b = '\0'; DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245); } else { - DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, 0); + DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING); y = 77; for (CargoID i = 0; i < NUM_CARGO; i++) { @@ -802,7 +802,7 @@ static void DrawStationViewWindow(Window *w) SetDParam(0, cs->name); SetDParam(2, ge->rating * 101 >> 8); SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5)); - DrawString(8, y, STR_303D, 0); + DrawString(8, y, STR_303D, TC_FROMSTRING); y += 10; } } diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 6af1e003e..9b9bb6f3e 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -94,7 +94,7 @@ static void DrawSubsidiesWindow(const Window *w) y = 15; x = 1; - DrawString(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, 0); + DrawString(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING); y += 10; num = 0; @@ -103,21 +103,21 @@ static void DrawSubsidiesWindow(const Window *w) int x2; SetupSubsidyDecodeParam(s, 1); - x2 = DrawString(x + 2, y, STR_2027_FROM_TO, 0); + x2 = DrawString(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING); SetDParam(0, _date - ymd.day + 384 - s->age * 32); - DrawString(x2, y, STR_2028_BY, 0); + DrawString(x2, y, STR_2028_BY, TC_FROMSTRING); y += 10; num++; } } if (num == 0) { - DrawString(x + 2, y, STR_202A_NONE, 0); + DrawString(x + 2, y, STR_202A_NONE, TC_FROMSTRING); y += 10; } - DrawString(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, 0); + DrawString(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING); y += 10; num = 0; @@ -130,16 +130,16 @@ static void DrawSubsidiesWindow(const Window *w) PlayerID player = GetStation(s->to)->owner; SetDParam(3, player); - xt = DrawString(x + 2, y, STR_202C_FROM_TO, 0); + xt = DrawString(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING); SetDParam(0, _date - ymd.day + 768 - s->age * 32); - DrawString(xt, y, STR_202D_UNTIL, 0); + DrawString(xt, y, STR_202D_UNTIL, TC_FROMSTRING); y += 10; num++; } } - if (num == 0) DrawString(x + 2, y, STR_202A_NONE, 0); + if (num == 0) DrawString(x + 2, y, STR_202A_NONE, TC_FROMSTRING); } static void SubsidiesListWndProc(Window *w, WindowEvent *e) diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 73292fcdb..e6ac218b9 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -141,8 +141,7 @@ static void DrawTimetableWindow(Window *w) default: break; } - const byte colour = (i == selected) ? 0xC : 0x10; - DrawString(2, y, STR_TIMETABLE_GO_TO, colour); + DrawString(2, y, STR_TIMETABLE_GO_TO, (i == selected) ? TC_WHITE : TC_BLACK); order_id++; @@ -162,8 +161,7 @@ static void DrawTimetableWindow(Window *w) string = STR_TIMETABLE_TRAVEL_FOR; } - const byte colour = (i == selected) ? 0xC : 0x10; - DrawString(12, y, string, colour); + DrawString(12, y, string, (i == selected) ? TC_WHITE : TC_BLACK); if (final_order) break; } @@ -186,16 +184,16 @@ static void DrawTimetableWindow(Window *w) if (total_time != 0) { SetTimetableParams(0, 1, total_time); - DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, 0x10); + DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK); } } y += 10; if (v->lateness_counter == 0 || (!_patches.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { - DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, 0x10); + DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK); } else { SetTimetableParams(0, 1, abs(v->lateness_counter)); - DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, 0x10); + DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK); } } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 6bc8374eb..2f7381e62 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -146,7 +146,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) SetDParam(0, w->window_number); DrawWindowWidgets(w); - DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, 0); + DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, TC_FROMSTRING); /* Draw list of players */ y = 25; @@ -172,7 +172,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) DrawSprite(SPR_BLOT, PALETTE_TO_RED, 18, y); } - DrawString(28, y, STR_2024, 0); + DrawString(28, y, STR_2024, TC_FROMSTRING); y += 10; } } @@ -184,14 +184,14 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) int pos = w->vscroll.pos; if (--pos < 0) { - DrawString(2, y, STR_2045_ACTIONS_AVAILABLE, 0); + DrawString(2, y, STR_2045_ACTIONS_AVAILABLE, TC_FROMSTRING); y += 10; } for (i = 0; buttons; i++, buttons >>= 1) { if (pos <= -5) break; ///< Draw only the 5 fitting lines if ((buttons & 1) && --pos < 0) { - DrawString(3, y, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i, 6); + DrawString(3, y, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i, TC_ORANGE); y += 10; } } @@ -272,15 +272,15 @@ static void TownViewWndProc(Window *w, WindowEvent *e) SetDParam(0, t->population); SetDParam(1, t->num_houses); - DrawString(2, 107, STR_2006_POPULATION, 0); + DrawString(2, 107, STR_2006_POPULATION, TC_FROMSTRING); SetDParam(0, t->act_pass); SetDParam(1, t->max_pass); - DrawString(2, 117, STR_200D_PASSENGERS_LAST_MONTH_MAX, 0); + DrawString(2, 117, STR_200D_PASSENGERS_LAST_MONTH_MAX, TC_FROMSTRING); SetDParam(0, t->act_mail); SetDParam(1, t->max_mail); - DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, 0); + DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING); DrawWindowViewport(w); break; @@ -466,7 +466,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) SetVScrollCount(w, _num_town_sort); DrawWindowWidgets(w); - DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10); + DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, TC_BLACK); { int n = 0; @@ -480,14 +480,14 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) SetDParam(0, t->index); SetDParam(1, t->population); - DrawString(2, y, STR_2057, 0); + DrawString(2, y, STR_2057, TC_FROMSTRING); y += 10; i++; if (++n == w->vscroll.cap) break; // max number of towns in 1 window } SetDParam(0, GetWorldPopulation()); - DrawString(3, w->height - 12 + 2, STR_TOWN_POPULATION, 0); + DrawString(3, w->height - 12 + 2, STR_TOWN_POPULATION, TC_FROMSTRING); } } break; diff --git a/src/train_gui.cpp b/src/train_gui.cpp index dce7e5e87..419e6bb26 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -124,7 +124,7 @@ static void TrainDetailsCargoTab(const Vehicle *v, int x, int y) SetDParam(3, _patches.freight_trains); str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM; } - DrawString(x, y, str, 0); + DrawString(x, y, str, TC_FROMSTRING); } } @@ -133,12 +133,12 @@ static void TrainDetailsInfoTab(const Vehicle *v, int x, int y) if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) { SetDParam(0, v->engine_type); SetDParam(1, v->value); - DrawString(x, y, STR_882D_VALUE, 0x10); + DrawString(x, y, STR_882D_VALUE, TC_BLACK); } else { SetDParam(0, v->engine_type); SetDParam(1, v->build_year); SetDParam(2, v->value); - DrawString(x, y, STR_882C_BUILT_VALUE, 0x10); + DrawString(x, y, STR_882C_BUILT_VALUE, TC_BLACK); } } @@ -148,7 +148,7 @@ static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y) SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); SetDParam(2, _patches.freight_trains); - DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, 0); + DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, TC_FROMSTRING); } } @@ -240,7 +240,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs } /* draw total cargo tab */ - DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, 0); + DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, TC_FROMSTRING); for (CargoID i = 0; i < NUM_CARGO; i++) { if (max_cargo[i] > 0 && --vscroll_pos < 0 && vscroll_pos > -vscroll_cap) { y += 14; @@ -249,10 +249,10 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs SetDParam(2, i); // {SHORTCARGO} #1 SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2 SetDParam(4, _patches.freight_trains); - DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0); + DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, TC_FROMSTRING); } } SetDParam(0, v->cargo.FeederShare()); - DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0); + DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING); } } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b32222096..2f35c9da1 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -288,10 +288,10 @@ static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint /* Draw the list, and find the selected cargo (by its position in list) */ for (i = 0; i < num_lines; i++) { - byte colour = 16; + TextColour colour = TC_BLACK; if (sel == 0) { selected = &refit[i]; - colour = 12; + colour = TC_WHITE; } if (i >= pos && i < pos + rows) { @@ -346,7 +346,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e) SetDParam(0, WP(w, refit_d).cargo->cargo); SetDParam(1, _returned_refit_capacity); SetDParam(2, cost.GetCost()); - DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0); + DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, TC_FROMSTRING); } } } break; @@ -906,14 +906,14 @@ void DrawSmallOrderList(const Vehicle *v, int x, int y) sel = v->cur_order_index; FOR_VEHICLE_ORDERS(v, order) { - if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, 16); + if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK); sel--; if (order->type == OT_GOTO_STATION) { if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue; SetDParam(0, order->dest); - DrawString(x, y, STR_A036, 0); + DrawString(x, y, STR_A036, TC_FROMSTRING); y += 6; if (++i == 4) break; @@ -986,9 +986,9 @@ static void DrawVehicleListWindow(Window *w) DrawWindowWidgets(w); /* draw sorting criteria string */ - DrawString(85, 15, _vehicle_sort_listing[vl->l.sort_type], 0x10); + DrawString(85, 15, _vehicle_sort_listing[vl->l.sort_type], TC_BLACK); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(vl->l.flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, 0x10); + DoDrawString(vl->l.flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, TC_BLACK); max = min(w->vscroll.pos + w->vscroll.cap, vl->l.list_length); for (i = w->vscroll.pos; i < max; ++i) { @@ -999,7 +999,7 @@ static void DrawVehicleListWindow(Window *w) SetDParam(1, v->profit_last_year); DrawVehicleImage(v, x + 19, y + 6, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0, INVALID_VEHICLE); - DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0); + DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING); if ((v->type == VEH_TRAIN && v->string_id != STR_SV_TRAIN_NAME) || (v->type == VEH_ROAD && v->string_id != STR_SV_ROADVEH_NAME) || @@ -1008,7 +1008,7 @@ static void DrawVehicleListWindow(Window *w) /* The vehicle got a name so we will print it */ SetDParam(0, v->index); - DrawString(x + 19, y, STR_01AB, 0); + DrawString(x + 19, y, STR_01AB, TC_FROMSTRING); } if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, y); @@ -1020,7 +1020,7 @@ static void DrawVehicleListWindow(Window *w) } SetDParam(0, v->unitnumber); - DrawString(x, y + 2, str, 0); + DrawString(x, y + 2, str, TC_FROMSTRING); DrawVehicleProfitButton(v, x, y + 13); @@ -1491,7 +1491,7 @@ static void DrawVehicleDetailsWindow(Window *w) SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); SetDParam(2, v->max_age / 366); SetDParam(3, v->GetDisplayRunningCost()); - DrawString(2, 15, _vehicle_translation_table[VST_VEHICLE_AGE_RUNNING_COST_YR][v->type], 0); + DrawString(2, 15, _vehicle_translation_table[VST_VEHICLE_AGE_RUNNING_COST_YR][v->type], TC_FROMSTRING); /* Draw max speed */ switch (v->type) { @@ -1502,14 +1502,14 @@ static void DrawVehicleDetailsWindow(Window *w) SetDParam(3, v->u.rail.cached_max_te / 1000); DrawString(2, 25, (_patches.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ? STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : - STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, 0); + STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING); break; case VEH_ROAD: case VEH_SHIP: case VEH_AIRCRAFT: SetDParam(0, v->GetDisplayMaxSpeed()); - DrawString(2, 25, _vehicle_translation_table[VST_VEHICLE_MAX_SPEED][v->type], 0); + DrawString(2, 25, _vehicle_translation_table[VST_VEHICLE_MAX_SPEED][v->type], TC_FROMSTRING); break; default: NOT_REACHED(); @@ -1518,17 +1518,17 @@ static void DrawVehicleDetailsWindow(Window *w) /* Draw profit */ SetDParam(0, v->profit_this_year); SetDParam(1, v->profit_last_year); - DrawString(2, 35, _vehicle_translation_table[VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR][v->type], 0); + DrawString(2, 35, _vehicle_translation_table[VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR][v->type], TC_FROMSTRING); /* Draw breakdown & reliability */ SetDParam(0, v->reliability * 100 >> 16); SetDParam(1, v->breakdowns_since_last_service); - DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], 0); + DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING); /* Draw service interval text */ SetDParam(0, v->service_interval); SetDParam(1, v->date_of_last_service); - DrawString(13, w->height - (v->type != VEH_TRAIN ? 11 : 23), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0); + DrawString(13, w->height - (v->type != VEH_TRAIN ? 11 : 23), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING); switch (v->type) { case VEH_TRAIN: @@ -2026,7 +2026,7 @@ static void DrawVehicleViewWindow(Window *w) /* draw the flag plus orders */ DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, w->widget[VVW_WIDGET_START_STOP_VEH].top + 1); - DrawStringCenteredTruncated(w->widget[VVW_WIDGET_START_STOP_VEH].left + 8, w->widget[VVW_WIDGET_START_STOP_VEH].right, w->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, 0); + DrawStringCenteredTruncated(w->widget[VVW_WIDGET_START_STOP_VEH].left + 8, w->widget[VVW_WIDGET_START_STOP_VEH].right, w->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING); DrawWindowViewport(w); } diff --git a/src/viewport.cpp b/src/viewport.cpp index 484301151..e03a3b948 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1500,7 +1500,7 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss * otherwise colors from _string_colormap are assumed. */ colour = _colour_gradient[ss->color][6] | IS_PALETTE_COLOR; } else { - colour = 16; + colour = TC_BLACK; } DrawString( UnScaleByZoom(ss->x, zoom), UnScaleByZoom(ss->y, zoom) - (ss->width & 0x8000 ? 2 : 0), diff --git a/src/widget.cpp b/src/widget.cpp index cd0c68adf..0fe09ac1a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -229,7 +229,7 @@ void DrawWindowWidgets(const Window *w) if ((wi->type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++; - DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, 0); + DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, TC_FROMSTRING); goto draw_default; } @@ -244,7 +244,7 @@ void DrawWindowWidgets(const Window *w) StringID str = wi->data; DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED); - if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, 0, r.right - r.left - 10); + if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_FROMSTRING, r.right - r.left - 10); goto draw_default; } @@ -302,11 +302,11 @@ void DrawWindowWidgets(const Window *w) /* draw up/down buttons */ clicked = ((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP); DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : FR_NONE); - DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, 0x10); + DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, TC_BLACK); clicked = (((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN)); DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE); - DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); + DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, TC_BLACK); c1 = _colour_gradient[wi->color&0xF][3]; c2 = _colour_gradient[wi->color&0xF][7]; @@ -334,11 +334,11 @@ void DrawWindowWidgets(const Window *w) /* draw up/down buttons */ clicked = ((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2)); DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : FR_NONE); - DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, 0x10); + DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, TC_BLACK); clicked = ((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2)); DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE); - DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); + DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, TC_BLACK); c1 = _colour_gradient[wi->color&0xF][3]; c2 = _colour_gradient[wi->color&0xF][7]; @@ -397,7 +397,7 @@ void DrawWindowWidgets(const Window *w) int c1,c2; int x2 = r.left; // by default the left side is the left side of the widget - if (wi->data != 0) x2 = DrawString(r.left + 6, r.top, wi->data, 0); + if (wi->data != 0) x2 = DrawString(r.left + 6, r.top, wi->data, TC_FROMSTRING); c1 = _colour_gradient[wi->color][3]; c2 = _colour_gradient[wi->color][7]; @@ -446,7 +446,7 @@ void DrawWindowWidgets(const Window *w) assert(r.right - r.left == 10); // ensure the same sizes are used everywhere DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_NONE); - DrawString(r.left + 2, r.top + 2, STR_00C5, 0); + DrawString(r.left + 2, r.top + 2, STR_00C5, TC_FROMSTRING); break; } @@ -530,7 +530,7 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e) if (y >= 0 && y <= height) { if (WP(w,dropdown_d).items[i] != STR_NULL) { if (sel == 0) GfxFillRect(x + 1, y, x + width, y + 9, 0); - DrawStringTruncated(x + 2, y, WP(w,dropdown_d).items[i], sel == 0 ? 12 : 16, x + width); + DrawStringTruncated(x + 2, y, WP(w,dropdown_d).items[i], sel == 0 ? TC_WHITE : TC_BLACK, x + width); if (HASBIT(WP(w,dropdown_d).disabled_state, i)) { GfxFillRect(x, y, x + width, y + 9, |