Merge remote-tracking branch 'upstream/master' into 13.0
This commit is contained in:
+82
-117
@@ -34,6 +34,9 @@
|
||||
#include "strings_func.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "date_func.h"
|
||||
#include "station_cmd.h"
|
||||
#include "road_cmd.h"
|
||||
#include "tunnelbridge_cmd.h"
|
||||
|
||||
#include "widgets/road_widget.h"
|
||||
|
||||
@@ -51,29 +54,17 @@ static void ShowRoadDepotPicker(Window *parent);
|
||||
static bool _remove_button_clicked;
|
||||
static bool _one_way_button_clicked;
|
||||
|
||||
/**
|
||||
* Define the values of the RoadFlags
|
||||
* @see CmdBuildLongRoad
|
||||
*/
|
||||
enum RoadFlags {
|
||||
RF_NONE = 0x00,
|
||||
RF_START_HALFROAD_Y = 0x01, // The start tile in Y-dir should have only a half road
|
||||
RF_END_HALFROAD_Y = 0x02, // The end tile in Y-dir should have only a half road
|
||||
RF_DIR_Y = 0x04, // The direction is Y-dir
|
||||
RF_DIR_X = RF_NONE, // Dummy; Dir X is set when RF_DIR_Y is not set
|
||||
RF_START_HALFROAD_X = 0x08, // The start tile in X-dir should have only a half road
|
||||
RF_END_HALFROAD_X = 0x10, // The end tile in X-dir should have only a half road
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(RoadFlags)
|
||||
|
||||
static RoadFlags _place_road_flag;
|
||||
static Axis _place_road_dir;
|
||||
static bool _place_road_start_half_x;
|
||||
static bool _place_road_start_half_y;
|
||||
static bool _place_road_end_half;
|
||||
|
||||
/* CM static */ RoadType _cur_roadtype;
|
||||
|
||||
/* CM static */ DiagDirection _road_depot_orientation;
|
||||
DiagDirection _road_station_picker_orientation;
|
||||
|
||||
void CcPlaySound_CONSTRUCTION_OTHER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcPlaySound_CONSTRUCTION_OTHER(Commands cmd, const CommandCost &result, TileIndex tile)
|
||||
{
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
|
||||
}
|
||||
@@ -96,14 +87,11 @@ static void PlaceRoad_Bridge(TileIndex tile, Window *w)
|
||||
/**
|
||||
* Callback executed after a build road tunnel command has been called.
|
||||
*
|
||||
* @param cmd unused
|
||||
* @param result Whether the build succeeded.
|
||||
* @param start_tile Starting tile of the tunnel.
|
||||
* @param p1 bit 0-3 railtype or roadtypes
|
||||
* bit 8-9 transport type
|
||||
* @param p2 unused
|
||||
* @param cmd unused
|
||||
*/
|
||||
void CcBuildRoadTunnel(const CommandCost &result, TileIndex start_tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcBuildRoadTunnel(Commands cmd, const CommandCost &result, TileIndex start_tile)
|
||||
{
|
||||
if (result.Succeeded()) {
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, start_tile);
|
||||
@@ -131,16 +119,15 @@ void ConnectRoadToStructure(TileIndex tile, DiagDirection direction)
|
||||
/* if there is a roadpiece just outside of the station entrance, build a connecting route */
|
||||
if (IsNormalRoadTile(tile)) {
|
||||
if (GetRoadBits(tile, GetRoadTramType(_cur_roadtype)) != ROAD_NONE) {
|
||||
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, CMD_BUILD_ROAD);
|
||||
Command<CMD_BUILD_ROAD>::Post(tile, DiagDirToRoadBits(ReverseDiagDir(direction)), _cur_roadtype, DRD_NONE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir)
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
ConnectRoadToStructure(tile, dir);
|
||||
@@ -148,32 +135,26 @@ void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2
|
||||
|
||||
/**
|
||||
* Command callback for building road stops.
|
||||
* @param cmd Unused.
|
||||
* @param result Result of the build road stop command.
|
||||
* @param tile Start tile.
|
||||
* @param p1 bit 0..7: Width of the road stop.
|
||||
* bit 8..15: Length of the road stop.
|
||||
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
||||
* bit 1: 0 For normal stops, 1 for drive-through.
|
||||
* bit 2: Allow stations directly adjacent to other stations.
|
||||
* bit 3..4: Entrance direction (#DiagDirection) for normal stops.
|
||||
* bit 3: #Axis of the road for drive-through stops.
|
||||
* bit 5..9: The roadtype.
|
||||
* bit 16..31: Station ID to join (NEW_STATION if build new one).
|
||||
* @param cmd Unused.
|
||||
* @param width Width of the road stop.
|
||||
* @param length Length of the road stop.
|
||||
* @param is_drive_through False for normal stops, true for drive-through.
|
||||
* @param dir Entrance direction (#DiagDirection) for normal stops. Converted to the axis for drive-through stops.
|
||||
* @see CmdBuildRoadStop
|
||||
*/
|
||||
void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8 width, uint8 length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, StationID, bool)
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
DiagDirection dir = (DiagDirection)GB(p2, 3, 2);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
TileArea roadstop_area(tile, GB(p1, 0, 8), GB(p1, 8, 8));
|
||||
TileArea roadstop_area(tile, width, length);
|
||||
for (TileIndex cur_tile : roadstop_area) {
|
||||
ConnectRoadToStructure(cur_tile, dir);
|
||||
/* For a drive-through road stop build connecting road for other entrance. */
|
||||
if (HasBit(p2, 1)) ConnectRoadToStructure(cur_tile, ReverseDiagDir(dir));
|
||||
if (is_drive_through) ConnectRoadToStructure(cur_tile, ReverseDiagDir(dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,32 +162,34 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2,
|
||||
* Place a new road stop.
|
||||
* @param start_tile First tile of the area.
|
||||
* @param end_tile Last tile of the area.
|
||||
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
||||
* bit 2: Allow stations directly adjacent to other stations.
|
||||
* bit 5..10: The roadtypes.
|
||||
* @param cmd Command to use.
|
||||
* @param stop_type Type of stop (bus/truck).
|
||||
* @param adjacent Allow stations directly adjacent to other stations.
|
||||
* @param rt The roadtypes.
|
||||
* @param err_msg Error message to show.
|
||||
* @see CcRoadStop()
|
||||
*/
|
||||
static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd)
|
||||
static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg)
|
||||
{
|
||||
if (citymania::UseImprovedStationJoin()) {
|
||||
citymania::PlaceRoadStop(start_tile, end_tile, p2, cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(_thd.cm.type == citymania::ObjectHighlight::Type::ROAD_STOP);
|
||||
uint8 ddir = _thd.cm.ddir;
|
||||
SB(p2, 16, 16, INVALID_STATION); // no station to join
|
||||
TileArea ta(start_tile, end_tile);
|
||||
assert(_thd.cm.type == citymania::ObjectHighlight::Type::ROAD_STOP);
|
||||
DiagDirection ddir = _thd.cm.ddir;
|
||||
bool drive_through = ddir >= DIAGDIR_END;
|
||||
if (drive_through) ddir = static_cast<DiagDirection>(ddir - DIAGDIR_END); // Adjust picker result to actual direction.
|
||||
|
||||
if (ddir >= DIAGDIR_END) { // drive-through stops
|
||||
SetBit(p2, 1);
|
||||
ddir -= DIAGDIR_END;
|
||||
}
|
||||
p2 |= ddir << 3; // Set the DiagDirecion into p2 bits 3 and 4.
|
||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||
if (test) {
|
||||
return Command<CMD_BUILD_ROAD_STOP>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_ROAD_STOP>()), ta.tile, ta.w, ta.h, stop_type, drive_through, ddir, rt, INVALID_STATION, adjacent).Succeeded();
|
||||
} else {
|
||||
return Command<CMD_BUILD_ROAD_STOP>::Post(err_msg, CcRoadStop, ta.tile, ta.w, ta.h, stop_type, drive_through, ddir, rt, to_join, adjacent);
|
||||
}
|
||||
};
|
||||
|
||||
CommandContainer cmdcont = { ta.tile, (uint32)(ta.w | ta.h << 8), p2, cmd, CcRoadStop, "" };
|
||||
ShowSelectStationIfNeeded(cmdcont, ta);
|
||||
ShowSelectStationIfNeeded(ta, proc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -544,21 +527,21 @@ struct BuildRoadToolbarWindow : Window {
|
||||
_one_way_button_clicked = RoadTypeIsRoad(this->roadtype) ? this->IsWidgetLowered(WID_ROT_ONE_WAY) : false;
|
||||
switch (this->last_started_action) {
|
||||
case WID_ROT_ROAD_X:
|
||||
_place_road_flag = RF_DIR_X;
|
||||
if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
|
||||
_place_road_dir = AXIS_X;
|
||||
_place_road_start_half_x = _tile_fract_coords.x >= 8;
|
||||
VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR);
|
||||
break;
|
||||
|
||||
case WID_ROT_ROAD_Y:
|
||||
_place_road_flag = RF_DIR_Y;
|
||||
if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
|
||||
_place_road_dir = AXIS_Y;
|
||||
_place_road_start_half_y = _tile_fract_coords.y >= 8;
|
||||
VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR);
|
||||
break;
|
||||
|
||||
case WID_ROT_AUTOROAD:
|
||||
_place_road_flag = RF_NONE;
|
||||
if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
|
||||
if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
|
||||
_place_road_dir = INVALID_AXIS;
|
||||
_place_road_start_half_x = _tile_fract_coords.x >= 8;
|
||||
_place_road_start_half_y = _tile_fract_coords.y >= 8;
|
||||
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD);
|
||||
break;
|
||||
|
||||
@@ -572,8 +555,8 @@ struct BuildRoadToolbarWindow : Window {
|
||||
assert(_thd.cm.type == citymania::ObjectHighlight::Type::ROAD_DEPOT);
|
||||
ddir = _thd.cm.ddir;
|
||||
}
|
||||
DoCommandP(tile, _cur_roadtype << 2 | ddir, 0,
|
||||
CMD_BUILD_ROAD_DEPOT | CMD_MSG(this->rti->strings.err_depot), CcRoadDepot);
|
||||
Command<CMD_BUILD_ROAD_DEPOT>::Post(this->rti->strings.err_depot, CcRoadDepot,
|
||||
tile, _cur_roadtype, ddir);
|
||||
if (citymania::_fn_mod == _settings_client.gui.cm_keep_depot_tools)
|
||||
ResetObjectToPlace();
|
||||
break;
|
||||
@@ -591,8 +574,8 @@ struct BuildRoadToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_ROT_BUILD_TUNNEL:
|
||||
DoCommandP(tile, _cur_roadtype | (TRANSPORT_ROAD << 8), 0,
|
||||
CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel);
|
||||
Command<CMD_BUILD_TUNNEL>::Post(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE, CcBuildRoadTunnel,
|
||||
tile, TRANSPORT_ROAD, _cur_roadtype);
|
||||
break;
|
||||
|
||||
case WID_ROT_CONVERT_ROAD:
|
||||
@@ -633,30 +616,26 @@ struct BuildRoadToolbarWindow : Window {
|
||||
* bits and if needed we set them again. */
|
||||
switch (select_proc) {
|
||||
case DDSP_PLACE_ROAD_X_DIR:
|
||||
_place_road_flag &= ~RF_END_HALFROAD_X;
|
||||
if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
|
||||
_place_road_end_half = pt.x & 8;
|
||||
break;
|
||||
|
||||
case DDSP_PLACE_ROAD_Y_DIR:
|
||||
_place_road_flag &= ~RF_END_HALFROAD_Y;
|
||||
if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
|
||||
_place_road_end_half = pt.y & 8;
|
||||
break;
|
||||
|
||||
case DDSP_PLACE_AUTOROAD:
|
||||
_place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
|
||||
if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
|
||||
if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
|
||||
|
||||
/* For autoroad we need to update the
|
||||
* direction of the road */
|
||||
if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
|
||||
( (_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) ))) {
|
||||
/* Set dir = X */
|
||||
_place_road_flag &= ~RF_DIR_Y;
|
||||
_place_road_dir = AXIS_X;
|
||||
_place_road_end_half = pt.x & 8;
|
||||
} else {
|
||||
/* Set dir = Y */
|
||||
_place_road_flag |= RF_DIR_Y;
|
||||
_place_road_dir = AXIS_Y;
|
||||
_place_road_end_half = pt.y & 8;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -698,31 +677,27 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
case DDSP_PLACE_ROAD_X_DIR:
|
||||
case DDSP_PLACE_ROAD_Y_DIR:
|
||||
case DDSP_PLACE_AUTOROAD:
|
||||
/* Flag description:
|
||||
* Use the first three bits (0x07) if dir == Y
|
||||
* else use the last 2 bits (X dir has
|
||||
* not the 3rd bit set) */
|
||||
case DDSP_PLACE_AUTOROAD: {
|
||||
bool start_half = _place_road_dir == AXIS_Y ? _place_road_start_half_y : _place_road_start_half_x;
|
||||
|
||||
/* Even if _cur_roadtype_id is a uint8 we only use 5 bits so
|
||||
* we could ignore the last 3 bits and reuse them for other
|
||||
* flags */
|
||||
_place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
|
||||
|
||||
DoCommandP(start_tile, end_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 10),
|
||||
_remove_button_clicked ?
|
||||
CMD_REMOVE_LONG_ROAD | CMD_MSG(this->rti->strings.err_remove_road) :
|
||||
CMD_BUILD_LONG_ROAD | CMD_MSG(this->rti->strings.err_build_road), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
if (_remove_button_clicked) {
|
||||
Command<CMD_REMOVE_LONG_ROAD>::Post(this->rti->strings.err_remove_road, CcPlaySound_CONSTRUCTION_OTHER,
|
||||
end_tile, start_tile, _cur_roadtype, _place_road_dir, start_half, _place_road_end_half);
|
||||
} else {
|
||||
Command<CMD_BUILD_LONG_ROAD>::Post(this->rti->strings.err_build_road, CcPlaySound_CONSTRUCTION_OTHER,
|
||||
end_tile, start_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ? DRD_NORTHBOUND : DRD_NONE, start_half, _place_road_end_half, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DDSP_BUILD_BUSSTOP:
|
||||
case DDSP_REMOVE_BUSSTOP:
|
||||
if (this->IsWidgetLowered(WID_ROT_BUS_STATION)) {
|
||||
if (_remove_button_clicked) {
|
||||
TileArea ta(start_tile, end_tile);
|
||||
DoCommandP(ta.tile, ta.w | ta.h << 8, (citymania::_fn_mod ? 2 : 0) | ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(this->rti->strings.err_remove_station[ROADSTOP_BUS]), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_BUS], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_BUS, citymania::_fn_mod);
|
||||
} else {
|
||||
PlaceRoadStop(start_tile, end_tile, _cur_roadtype << 5 | (citymania::_fn_mod << 2) | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_BUS]));
|
||||
PlaceRoadStop(start_tile, end_tile, ROADSTOP_BUS, citymania::_fn_mod, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_BUS]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -732,15 +707,15 @@ struct BuildRoadToolbarWindow : Window {
|
||||
if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION)) {
|
||||
if (_remove_button_clicked) {
|
||||
TileArea ta(start_tile, end_tile);
|
||||
DoCommandP(ta.tile, ta.w | ta.h << 8, (citymania::_fn_mod << 1) | ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(this->rti->strings.err_remove_station[ROADSTOP_TRUCK]), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_TRUCK], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_TRUCK, citymania::_fn_mod);
|
||||
} else {
|
||||
PlaceRoadStop(start_tile, end_tile, _cur_roadtype << 5 | (citymania::_fn_mod << 2) | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_TRUCK]));
|
||||
PlaceRoadStop(start_tile, end_tile, ROADSTOP_TRUCK, citymania::_fn_mod, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_TRUCK]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DDSP_CONVERT_ROAD:
|
||||
DoCommandP(end_tile, start_tile, _cur_roadtype, CMD_CONVERT_ROAD | CMD_MSG(rti->strings.err_convert_road), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
Command<CMD_CONVERT_ROAD>::Post(rti->strings.err_convert_road, CcPlaySound_CONSTRUCTION_OTHER, end_tile, start_tile, _cur_roadtype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -748,7 +723,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
void OnPlacePresize(Point pt, TileIndex tile) override
|
||||
{
|
||||
DoCommand(tile, _cur_roadtype | (TRANSPORT_ROAD << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL);
|
||||
Command<CMD_BUILD_TUNNEL>::Do(DC_AUTO, tile, TRANSPORT_ROAD, _cur_roadtype);
|
||||
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
|
||||
}
|
||||
|
||||
@@ -1233,18 +1208,16 @@ public:
|
||||
|
||||
/* 'Accepts' and 'Supplies' texts. */
|
||||
StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY;
|
||||
int top = this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->pos_y + this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->current_y + WD_PAR_VSEP_NORMAL;
|
||||
NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(WID_BROS_BACKGROUND);
|
||||
int right = back_nwi->pos_x + back_nwi->current_x;
|
||||
int bottom = back_nwi->pos_y + back_nwi->current_y;
|
||||
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL;
|
||||
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL;
|
||||
top = DrawStationAuthorityText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top) + WD_PAR_VSEP_NORMAL;
|
||||
Rect r = this->GetWidget<NWidgetBase>(WID_BROS_ACCEPTANCE)->GetCurrentRect();
|
||||
int top = r.top + ScaleGUITrad(WD_PAR_VSEP_NORMAL);
|
||||
top = DrawStationCoverageAreaText(r.left, r.right, top, sct, rad, false) + ScaleGUITrad(WD_PAR_VSEP_NORMAL);
|
||||
top = DrawStationCoverageAreaText(r.left, r.right, top, sct, rad, true) + ScaleGUITrad(WD_PAR_VSEP_NORMAL);
|
||||
top = DrawStationAuthorityText(r.left, r.right, top) + ScaleGUITrad(WD_PAR_VSEP_NORMAL);
|
||||
/* Resize background if the window is too small.
|
||||
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
|
||||
* (This is the case, if making the window bigger moves the mouse into the window.) */
|
||||
if (top > bottom) {
|
||||
ResizeWindow(this, 0, top - bottom, false);
|
||||
if (top > r.bottom) {
|
||||
ResizeWindow(this, 0, top - r.bottom, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,11 +1359,7 @@ static const NWidgetPart _nested_road_station_picker_widgets[] = {
|
||||
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),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
@@ -1399,7 +1368,7 @@ static const NWidgetPart _nested_road_station_picker_widgets[] = {
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_BROS_ACCEPTANCE), SetPadding(0, WD_FRAMERECT_RIGHT, 0, WD_FRAMERECT_LEFT), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -1438,12 +1407,8 @@ static const NWidgetPart _nested_tram_station_picker_widgets[] = {
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_STATION_XY_AUTO), SetMinimalSize(274, 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(134, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
@@ -1452,7 +1417,7 @@ static const NWidgetPart _nested_tram_station_picker_widgets[] = {
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_BROS_ACCEPTANCE), SetPadding(0, WD_FRAMERECT_RIGHT, 0, WD_FRAMERECT_LEFT), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user