diff options
Diffstat (limited to 'src/engine_gui.cpp')
-rw-r--r-- | src/engine_gui.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index 75a41768a..8c39d1ffe 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -49,17 +49,17 @@ static const Widget _engine_preview_widgets[] = { }; typedef void DrawEngineProc(int x, int y, EngineID engine, SpriteID pal); -typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw); +typedef void DrawEngineInfoProc(EngineID, int left, int right, int top, int bottom); struct DrawEngineInfo { DrawEngineProc *engine_proc; DrawEngineInfoProc *info_proc; }; -static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw); -static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw); -static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw); -static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw); +static void DrawTrainEngineInfo(EngineID engine, int left, int right, int top, int bottom); +static void DrawRoadVehEngineInfo(EngineID engine, int left, int right, int top, int bottom); +static void DrawShipEngineInfo(EngineID engine, int left, int right, int top, int bottom); +static void DrawAircraftEngineInfo(EngineID engine, int left, int right, int top, int bottom); static const DrawEngineInfo _draw_engine_list[4] = { { DrawTrainEngine, DrawTrainEngineInfo }, @@ -80,7 +80,7 @@ struct EnginePreviewWindow : Window { EngineID engine = this->window_number; SetDParam(0, GetEngineCategoryName(engine)); - DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296); + DrawStringMultiLine(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 14, 74, STR_8101_WE_HAVE_JUST_DESIGNED_A, SA_CENTER); SetDParam(0, engine); DrawString(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 80, STR_ENGINE_NAME, TC_BLACK, SA_CENTER); @@ -89,7 +89,7 @@ struct EnginePreviewWindow : Window { int width = this->width; dei->engine_proc(width >> 1, 100, engine, 0); - dei->info_proc(engine, width >> 1, 130, width - 52); + dei->info_proc(engine, this->widget[EPW_BACKGROUND].left + 26, this->widget[EPW_BACKGROUND].right - 26, 100, 160); } virtual void OnClick(Point pt, int widget) @@ -130,7 +130,7 @@ uint GetTotalCapacityOfArticulatedParts(EngineID engine, VehicleType type) return total; } -static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw) +static void DrawTrainEngineInfo(EngineID engine, int left, int right, int top, int bottom) { const Engine *e = GetEngine(engine); @@ -148,10 +148,10 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw) } else { SetDParam(5, CT_INVALID); } - DrawStringMultiCenter(x, y, STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER, maxw); + DrawStringMultiLine(left, right, top, bottom, STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER, SA_CENTER); } -static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw) +static void DrawAircraftEngineInfo(EngineID engine, int left, int right, int top, int bottom) { const Engine *e = GetEngine(engine); CargoID cargo = e->GetDefaultCargoType(); @@ -163,7 +163,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(3, e->u.air.mail_capacity); SetDParam(4, e->GetRunningCost()); - DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw); + DrawStringMultiLine(left, right, top, bottom, STR_A02E_COST_MAX_SPEED_CAPACITY, SA_CENTER); } else { SetDParam(0, e->GetCost()); SetDParam(1, e->GetDisplayMaxSpeed()); @@ -171,11 +171,11 @@ static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(3, e->GetDisplayDefaultCapacity()); SetDParam(4, e->GetRunningCost()); - DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw); + DrawStringMultiLine(left, right, top, bottom, STR_982E_COST_MAX_SPEED_CAPACITY, SA_CENTER); } } -static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw) +static void DrawRoadVehEngineInfo(EngineID engine, int left, int right, int top, int bottom) { const Engine *e = GetEngine(engine); @@ -190,10 +190,10 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(3, CT_INVALID); } - DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw); + DrawStringMultiLine(left, right, top, bottom, STR_902A_COST_SPEED_RUNNING_COST, SA_CENTER); } -static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw) +static void DrawShipEngineInfo(EngineID engine, int left, int right, int top, int bottom) { const Engine *e = GetEngine(engine); @@ -202,7 +202,7 @@ static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(2, e->GetDefaultCargoType()); SetDParam(3, e->GetDisplayDefaultCapacity()); SetDParam(4, e->GetRunningCost()); - DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw); + DrawStringMultiLine(left, right, top, bottom, STR_982E_COST_MAX_SPEED_CAPACITY, SA_CENTER); } void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni) @@ -211,16 +211,16 @@ void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni) const DrawEngineInfo *dei = &_draw_engine_list[GetEngine(engine)->type]; SetDParam(0, GetEngineCategoryName(engine)); - DrawStringMultiCenter(w->width >> 1, 20, STR_NEW_VEHICLE_NOW_AVAILABLE, w->width - 2); + DrawStringMultiLine(1, w->width - 2, 0, 40, STR_NEW_VEHICLE_NOW_AVAILABLE, SA_CENTER); GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); SetDParam(0, engine); - DrawStringMultiCenter(w->width >> 1, 57, STR_NEW_VEHICLE_TYPE, w->width - 2); + DrawStringMultiLine(1, w->width - 2, 40, 74, STR_NEW_VEHICLE_TYPE, SA_CENTER); dei->engine_proc(w->width >> 1, 88, engine, 0); GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOUR); - dei->info_proc(engine, w->width >> 1, 129, w->width - 52); + dei->info_proc(engine, 26, w->width - 26, 100, 160); } |