diff --git a/novattd.sublime-project b/novattd.sublime-project index 9cbd597a45..9e4b590fa9 100644 --- a/novattd.sublime-project +++ b/novattd.sublime-project @@ -3,7 +3,8 @@ [ { "follow_symlinks": true, - "path": "." + "path": ".", + "file_exclude_patterns": ["*.cod"] } ] } diff --git a/src/lang/english.txt b/src/lang/english.txt index a563816fe9..369604956d 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2413,6 +2413,8 @@ STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION :{WHITE}Passenge STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP :{BLACK}Select passenger tram station orientation STR_STATION_BUILD_CARGO_TRAM_ORIENTATION :{WHITE}Freight Tram Station Orientation STR_STATION_BUILD_CARGO_TRAM_ORIENTATION_TOOLTIP :{BLACK}Select freight tram station orientation +STR_STATION_BUILD_ORIENTATION_AUTO :{BLACK}Auto +STR_STATION_BUILD_ORIENTATION_AUTO_TOOLTIP :{BLACK}Automatically select suitable station orientation # Waterways toolbar (last two for SE only) STR_WATERWAYS_TOOLBAR_CAPTION :{WHITE}Waterways Construction @@ -2966,6 +2968,7 @@ STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_WINTER :{ORANGE}{STRING STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED_GENERAL :{ORANGE}{STRING}{GREEN} delivered STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{RED} (still required) STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{GREEN} (delivered) +STR_TOWN_VIEW_POP_HOUSES_RATIO :{BLACK}P/h ratio: {ORANGE}{NUM} {NUM} STR_TOWN_VIEW_TOWN_GROWS_EVERY :{BLACK}Town grows every {ORANGE}{COMMA}{BLACK} day{P "" s} STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED :{BLACK}Town grows every {ORANGE}{COMMA}{BLACK} day{P "" s} (funded) STR_TOWN_VIEW_TOWN_GROW_STOPPED :{BLACK}Town is {RED}not{BLACK} growing diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 5bee6bc806..4c46d516c2 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -415,6 +415,40 @@ static void HandleAutoSignalPlacement() } +// FIXME duplicate from road_gui.cpp +static DiagDirection TileFractCoordsToDiagDir() { + bool diag = (_tile_fract_coords.x + _tile_fract_coords.y) < 16; + if (_tile_fract_coords.x < _tile_fract_coords.y) { + return diag ? DIAGDIR_NE : DIAGDIR_SE; + } + return diag ? DIAGDIR_NW : DIAGDIR_SW; +} + +/* + * Selects orientation for rail object (depot) + */ +static DiagDirection AutodetectRailObjectDirection(TileIndex tile) { + return TileFractCoordsToDiagDir(); + // RoadBits bits = FindRoadsToConnect(tile); + // if (HasExactlyOneBit(bits)) + // return RoadBitsToDiagDir(bits); + // if (bits == ROAD_NONE) + // bits = ROAD_ALL; + // RoadBits frac_bits = DiagDirToRoadBits(TileFractCoordsToDiagDir()); + // if (HasExactlyOneBit(frac_bits & bits)) + // return RoadBitsToDiagDir(frac_bits & bits); + // frac_bits |= MirrorRoadBits(frac_bits); + // if (HasExactlyOneBit(frac_bits & bits)) + // return RoadBitsToDiagDir(frac_bits & bits); + // for (DiagDirection ddir = DIAGDIR_BEGIN; ddir < DIAGDIR_END; ddir++) { + // if (DiagDirToRoadBits(ddir) & bits) + // return ddir; + // } + NOT_REACHED(); +} + + + /** Rail toolbar management class. */ struct BuildRailToolbarWindow : Window { RailType railtype; ///< Rail type to build. @@ -625,6 +659,7 @@ struct BuildRailToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { + DiagDirection ddir; switch (this->last_user_action) { case WID_RAT_BUILD_NS: VpStartPlaceSizing(tile, VPM_FIX_VERTICAL | VPM_RAILDIRS, DDSP_PLACE_RAIL); @@ -652,7 +687,11 @@ struct BuildRailToolbarWindow : Window { break; case WID_RAT_BUILD_DEPOT: - DoCommandP(tile, _cur_railtype, _build_depot_direction, + ddir = _build_depot_direction; + if (ddir == DIAGDIR_NW + 1) { + ddir = AutodetectRailObjectDirection(tile); + } + DoCommandP(tile, _cur_railtype, ddir, CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT), CcRailDepot); break; @@ -1713,6 +1752,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { case WID_BRAD_DEPOT_SE: case WID_BRAD_DEPOT_SW: case WID_BRAD_DEPOT_NW: + case WID_BRAD_DEPOT_AUTO: this->RaiseWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); _build_depot_direction = (DiagDirection)(widget - WID_BRAD_DEPOT_NE); this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); @@ -1731,23 +1771,24 @@ static const NWidgetPart _nested_build_depot_widgets[] = { EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(NWID_SPACER), SetMinimalSize(0, 3), - NWidget(NWID_HORIZONTAL_LTR), + NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NW), SetMinimalSize(66, 50), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SW), SetMinimalSize(66, 50), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NE), SetMinimalSize(66, 50), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SE), SetMinimalSize(66, 50), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAD_DEPOT_AUTO), SetMinimalSize(134, 12), + SetDataTip(STR_STATION_BUILD_ORIENTATION_AUTO, STR_STATION_BUILD_ORIENTATION_AUTO_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 3), @@ -1865,7 +1906,7 @@ static void ShowBuildWaypointPicker(Window *parent) */ void InitializeRailGui() { - _build_depot_direction = DIAGDIR_NW; + _build_depot_direction = (DiagDirection)(DIAGDIR_NW + 1); } /** diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 6b9d5add03..c1fb6f6a6f 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -11,7 +11,9 @@ #include "stdafx.h" #include "gui.h" +#include "cmd_helper.h" #include "window_gui.h" +#include "station_func.h" #include "station_gui.h" #include "terraform_gui.h" #include "viewport_func.h" @@ -208,6 +210,111 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) } } + +static RoadBits FindRoadsToConnect(TileIndex tile) { + RoadBits bits = ROAD_NONE; + DiagDirection ddir; + // Prioritize roadbits that head in this direction + for (ddir = DIAGDIR_BEGIN; ddir < DIAGDIR_END; ddir++) { + TileIndex cur_tile = TileAddByDiagDir(tile, ddir); + if (GetAnyRoadBits(cur_tile, ROADTYPE_ROAD, true) & + DiagDirToRoadBits(ReverseDiagDir(ddir))) { + bits |= DiagDirToRoadBits(ddir); + } + } + if (bits != ROAD_NONE) { + return bits; + } + // Try to connect to any road passing by + for (ddir = DIAGDIR_BEGIN; ddir < DIAGDIR_END; ddir++) { + TileIndex cur_tile = TileAddByDiagDir(tile, ddir); + if (HasTileRoadType(cur_tile, ROADTYPE_ROAD) && (GetTileType(cur_tile) == MP_ROAD) && + (GetRoadTileType(cur_tile) == ROAD_TILE_NORMAL)) { + bits |= DiagDirToRoadBits(ddir); + } + } + return bits; +} + +static DiagDirection RoadBitsToDiagDir(RoadBits bits) { + if (bits < ROAD_SE) { + return bits == ROAD_NW ? DIAGDIR_NW : DIAGDIR_SW; + } + return bits == ROAD_SE ? DIAGDIR_SE : DIAGDIR_NE; +} + +static DiagDirection TileFractCoordsToDiagDir() { + bool diag = (_tile_fract_coords.x + _tile_fract_coords.y) < 16; + if (_tile_fract_coords.x < _tile_fract_coords.y) { + return diag ? DIAGDIR_NE : DIAGDIR_SE; + } + return diag ? DIAGDIR_NW : DIAGDIR_SW; +} +/* + * Selects orientation for road object (depot, terminal station) + */ +static DiagDirection AutodetectRoadObjectDirection(TileIndex tile) { + RoadBits bits = FindRoadsToConnect(tile); + if (HasExactlyOneBit(bits)) + return RoadBitsToDiagDir(bits); + if (bits == ROAD_NONE) + bits = ROAD_ALL; + RoadBits frac_bits = DiagDirToRoadBits(TileFractCoordsToDiagDir()); + if (HasExactlyOneBit(frac_bits & bits)) + return RoadBitsToDiagDir(frac_bits & bits); + frac_bits |= MirrorRoadBits(frac_bits); + if (HasExactlyOneBit(frac_bits & bits)) + return RoadBitsToDiagDir(frac_bits & bits); + for (DiagDirection ddir = DIAGDIR_BEGIN; ddir < DIAGDIR_END; ddir++) { + if (DiagDirToRoadBits(ddir) & bits) + return ddir; + } + NOT_REACHED(); +} + + +static bool CheckDriveThroughRoadStopDirection(TileArea area, RoadBits r) { + TILE_AREA_LOOP(tile, area) { + if (!HasTileRoadType(tile, ROADTYPE_ROAD)) continue; + if (GetTileType(tile) != MP_ROAD) continue; + if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) continue; + if (GetRoadBits(tile, ROADTYPE_ROAD) & ~r) return false; + } + return true; +} + + +/* + * Automaticaly selects direction to use for road stop. + * @param area road stop area + * @return selected direction + */ +static DiagDirection AutodetectDriveThroughRoadStopDirection(TileArea area) { + bool se_suits, ne_suits; + + // Check which direction is available + // If both are not use SE, building will fail anyway + se_suits = CheckDriveThroughRoadStopDirection(area, ROAD_Y); + ne_suits = CheckDriveThroughRoadStopDirection(area, ROAD_X); + if (!ne_suits) return DIAGDIR_SE; + if (!se_suits) return DIAGDIR_NE; + + // Build station along the longer direction + if (area.w > area.h) return DIAGDIR_NE; + if (area.w < area.h) return DIAGDIR_SE; + + return AutodetectRoadObjectDirection(area.tile); + // Check tile fractional coords + // if (((_tile_fract_coords.x < _tile_fract_coords.y && + // (_tile_fract_coords.x + _tile_fract_coords.y) < 16) || + // (_tile_fract_coords.x > _tile_fract_coords.y && + // (_tile_fract_coords.x + _tile_fract_coords.y) > 16) )) { + // return DIAGDIR_NE; + // } + // return DIAGDIR_SE; +} + + /** * Place a new road stop. * @param start_tile First tile of the area. @@ -222,14 +329,21 @@ static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, u { uint8 ddir = _road_station_picker_orientation; SB(p2, 16, 16, INVALID_STATION); // no station to join + TileArea ta(start_tile, end_tile); if (ddir >= DIAGDIR_END) { - SetBit(p2, 1); // It's a drive-through stop. - ddir -= DIAGDIR_END; // Adjust picker result to actual direction. + if (ddir < DIAGDIR_END + 2) { + SetBit(p2, 1); // It's a drive-through stop. + ddir -= DIAGDIR_END; // Adjust picker result to actual direction. + } else if (ddir == DIAGDIR_END + 2) { + ddir = AutodetectRoadObjectDirection(start_tile); + } else if (ddir == DIAGDIR_END + 3) { + SetBit(p2, 1); // It's a drive-through stop. + ddir = AutodetectDriveThroughRoadStopDirection(ta); + } } p2 |= ddir << 6; // Set the DiagDirecion into p2 bits 6 and 7. - TileArea ta(start_tile, end_tile); CommandContainer cmdcont = { ta.tile, ta.w | ta.h << 8, p2, cmd, CcRoadStop, "" }; ShowSelectStationIfNeeded(cmdcont, ta); } @@ -497,6 +611,7 @@ struct BuildRoadToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { + DiagDirection ddir; _remove_button_clicked = this->IsWidgetLowered(WID_ROT_REMOVE); _one_way_button_clicked = this->IsWidgetLowered(WID_ROT_ONE_WAY); switch (this->last_started_action) { @@ -529,7 +644,11 @@ struct BuildRoadToolbarWindow : Window { break; case WID_ROT_DEPOT: - DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, + ddir = _road_depot_orientation; + if (ddir == DIAGDIR_NW + 1) { + ddir = AutodetectRoadObjectDirection(tile); + } + DoCommandP(tile, _cur_roadtype << 2 | ddir, 0, CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); break; @@ -903,7 +1022,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); if ( _cur_roadtype == ROADTYPE_TRAM) { this->GetWidget(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; - for (int i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) this->GetWidget(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; + for (int i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_AUTO; i++) this->GetWidget(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; } this->FinishInitNested(TRANSPORT_ROAD); @@ -923,6 +1042,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { case WID_BROD_DEPOT_NE: case WID_BROD_DEPOT_SW: case WID_BROD_DEPOT_SE: + case WID_BROD_DEPOT_AUTO: this->RaiseWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); _road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE); this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); @@ -943,25 +1063,38 @@ static const NWidgetPart _nested_build_road_depot_widgets[] = { EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(NWID_SPACER), SetMinimalSize(0, 3), - NWidget(NWID_HORIZONTAL_LTR), + NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), SetFill(0, 0), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NW), SetMinimalSize(66, 50), + SetFill(0, 0), + SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NE), SetMinimalSize(66, 50), + SetFill(0, 0), + SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), SetFill(0, 0), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SW), SetMinimalSize(66, 50), + SetFill(0, 0), + SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SE), SetMinimalSize(66, 50), + SetFill(0, 0), + SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROD_DEPOT_AUTO), SetMinimalSize(134, 12), + SetDataTip(STR_STATION_BUILD_ORIENTATION_AUTO, STR_STATION_BUILD_ORIENTATION_AUTO_TOOLTIP), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), + EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 3), EndContainer(), }; @@ -1054,6 +1187,8 @@ struct BuildRoadStationWindow : public PickerWindowBase { case WID_BROS_STATION_NW: case WID_BROS_STATION_X: case WID_BROS_STATION_Y: + case WID_BROS_STATION_AUTO: + case WID_BROS_STATION_XY_AUTO: this->RaiseWidget(_road_station_picker_orientation + WID_BROS_STATION_NE); _road_station_picker_orientation = (DiagDirection)(widget - WID_BROS_STATION_NE); this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE); @@ -1105,6 +1240,15 @@ static const NWidgetPart _nested_rv_station_picker_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), EndContainer(), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), + NWidget(NWID_SPACER), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_STATION_AUTO), SetMinimalSize(134, 12), + SetDataTip(STR_STATION_BUILD_ORIENTATION_AUTO, STR_STATION_BUILD_ORIENTATION_AUTO_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_STATION_XY_AUTO), SetMinimalSize(66, 12), + SetDataTip(STR_STATION_BUILD_ORIENTATION_AUTO, STR_STATION_BUILD_ORIENTATION_AUTO_TOOLTIP), + NWidget(NWID_SPACER), SetFill(1, 0), + EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 1), NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 3a88929fc3..b27c6f4866 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -400,6 +400,10 @@ public: SetDParam(5, this->town->cb_houses_removed_last_month); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_GROWTH_TILES); + SetDParam(0, 10 * this->town->cache.population / this->town->cache.num_houses); + SetDParam(1, 10 * this->town->cache.potential_pop / this->town->cache.num_houses); + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_POP_HOUSES_RATIO); + bool first = true; for (int i = TE_BEGIN; i < TE_END; i++) { if (this->town->goal[i] == 0) continue; diff --git a/src/widgets/rail_widget.h b/src/widgets/rail_widget.h index 48940fea6d..2895e0adf7 100644 --- a/src/widgets/rail_widget.h +++ b/src/widgets/rail_widget.h @@ -100,10 +100,11 @@ enum BuildSignalWidgets { /** Widgets of the #BuildRailDepotWindow class. */ enum BuildRailDepotWidgets { /* Name starts with BRA instead of BR, because of collision with BuildRoadDepotWidgets */ - WID_BRAD_DEPOT_NE, ///< Build a depot with the entrance in the north east. - WID_BRAD_DEPOT_SE, ///< Build a depot with the entrance in the south east. - WID_BRAD_DEPOT_SW, ///< Build a depot with the entrance in the south west. - WID_BRAD_DEPOT_NW, ///< Build a depot with the entrance in the north west. + WID_BRAD_DEPOT_NE, ///< Build a depot with the entrance in the north east. + WID_BRAD_DEPOT_SE, ///< Build a depot with the entrance in the south east. + WID_BRAD_DEPOT_SW, ///< Build a depot with the entrance in the south west. + WID_BRAD_DEPOT_NW, ///< Build a depot with the entrance in the north west. + WID_BRAD_DEPOT_AUTO, ///< Build a depot, autoselect entrance. }; /** Widgets of the #BuildRailWaypointWindow class. */ diff --git a/src/widgets/road_widget.h b/src/widgets/road_widget.h index a936063413..3c778635cb 100644 --- a/src/widgets/road_widget.h +++ b/src/widgets/road_widget.h @@ -32,27 +32,30 @@ enum RoadToolbarWidgets { /** Widgets of the #BuildRoadDepotWindow class. */ enum BuildRoadDepotWidgets { /* Name starts with BRO instead of BR, because of collision with BuildRailDepotWidgets */ - WID_BROD_CAPTION, ///< Caption of the window. - WID_BROD_DEPOT_NE, ///< Depot with NE entry. - WID_BROD_DEPOT_SE, ///< Depot with SE entry. - WID_BROD_DEPOT_SW, ///< Depot with SW entry. - WID_BROD_DEPOT_NW, ///< Depot with NW entry. + WID_BROD_CAPTION, ///< Caption of the window. + WID_BROD_DEPOT_NE, ///< Depot with NE entry. + WID_BROD_DEPOT_SE, ///< Depot with SE entry. + WID_BROD_DEPOT_SW, ///< Depot with SW entry. + WID_BROD_DEPOT_NW, ///< Depot with NW entry. + WID_BROD_DEPOT_AUTO, ///< Depot with automatically selected entry. }; /** Widgets of the #BuildRoadStationWindow class. */ enum BuildRoadStationWidgets { /* Name starts with BRO instead of BR, because of collision with BuildRailStationWidgets */ - WID_BROS_CAPTION, ///< Caption of the window. - WID_BROS_BACKGROUND, ///< Background of the window. - WID_BROS_STATION_NE, ///< Terminal station with NE entry. - WID_BROS_STATION_SE, ///< Terminal station with SE entry. - WID_BROS_STATION_SW, ///< Terminal station with SW entry. - WID_BROS_STATION_NW, ///< Terminal station with NW entry. - WID_BROS_STATION_X, ///< Drive-through station in x-direction. - WID_BROS_STATION_Y, ///< Drive-through station in y-direction. - WID_BROS_LT_OFF, ///< Turn off area highlight. - WID_BROS_LT_ON, ///< Turn on area highlight. - WID_BROS_INFO, ///< Station acceptance info. + WID_BROS_CAPTION, ///< Caption of the window. + WID_BROS_BACKGROUND, ///< Background of the window. + WID_BROS_STATION_NE, ///< Terminal station with NE entry. + WID_BROS_STATION_SE, ///< Terminal station with SE entry. + WID_BROS_STATION_SW, ///< Terminal station with SW entry. + WID_BROS_STATION_NW, ///< Terminal station with NW entry. + WID_BROS_STATION_X, ///< Drive-through station in x-direction. + WID_BROS_STATION_Y, ///< Drive-through station in y-direction. + WID_BROS_STATION_AUTO, ///< Terminal station, autodetect direction. + WID_BROS_STATION_XY_AUTO, ///< Drive-through station, autodetect direction. + WID_BROS_LT_OFF, ///< Turn off area highlight. + WID_BROS_LT_ON, ///< Turn on area highlight. + WID_BROS_INFO, ///< Station acceptance info. }; #endif /* WIDGETS_ROAD_WIDGET_H */