Add road stops flag for drive-through stops only
This commit is contained in:
@@ -80,6 +80,8 @@
|
|||||||
<span class="indent">Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using the <span class="code">one_way_info</span> variable.</span></p>
|
<span class="indent">Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using the <span class="code">one_way_info</span> variable.</span></p>
|
||||||
<p><b>RST_GENERAL_FLAG_NO_CATENARY</b><br />
|
<p><b>RST_GENERAL_FLAG_NO_CATENARY</b><br />
|
||||||
<span class="indent">Do not show catenary graphics. (This only takes effect from <span class="code">road_stops</span> version 2).</span></p>
|
<span class="indent">Do not show catenary graphics. (This only takes effect from <span class="code">road_stops</span> version 2).</span></p>
|
||||||
|
<p><b>RSF_GENERAL_FLAG_DRIVE_THROUGH_ONLY</b><br />
|
||||||
|
<span class="indent">Only allow drive-through stops (not bay stops). (This only takes effect from <span class="code">road_stops</span> version 2).</span></p>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>minimum_bridge_height</td><td>Array of 6 items [0..255, ...]</td><td>Minimum clearances required for a bridge for each of the <a href="#roadstop_views">6 views/rotations</a> (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px).</td></tr>
|
<tr><td>minimum_bridge_height</td><td>Array of 6 items [0..255, ...]</td><td>Minimum clearances required for a bridge for each of the <a href="#roadstop_views">6 views/rotations</a> (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px).</td></tr>
|
||||||
<tr><td>disallowed_bridge_pillars</td><td>Array of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...]</td><td>
|
<tr><td>disallowed_bridge_pillars</td><td>Array of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...]</td><td>
|
||||||
|
@@ -151,6 +151,7 @@
|
|||||||
<tr><td>0</td><td>1</td><td>Callback 141 needs random bits in variable 10</td></tr>
|
<tr><td>0</td><td>1</td><td>Callback 141 needs random bits in variable 10</td></tr>
|
||||||
<tr><td>1</td><td>2</td><td>Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50.</td></tr>
|
<tr><td>1</td><td>2</td><td>Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50.</td></tr>
|
||||||
<tr><td>2</td><td>4</td><td>Do not catenary graphics.</br>This requires <font face="monospace">road_stops</font>, version 2.</td></tr>
|
<tr><td>2</td><td>4</td><td>Do not catenary graphics.</br>This requires <font face="monospace">road_stops</font>, version 2.</td></tr>
|
||||||
|
<tr><td>3</td><td>8</td><td>Only allow drive-through stops (not bay stops).</br>This requires <font face="monospace">road_stops</font>, version 2.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
The default value is 0 (no flags enabled).
|
The default value is 0 (no flags enabled).
|
||||||
</p>
|
</p>
|
||||||
|
@@ -67,6 +67,7 @@ enum RoadStopSpecFlags {
|
|||||||
RSF_CB141_RANDOM_BITS, ///< Callback 141 needs random bits.
|
RSF_CB141_RANDOM_BITS, ///< Callback 141 needs random bits.
|
||||||
RSF_NO_ONE_WAY_OVERLAY, ///< Do not show one-way road overlays.
|
RSF_NO_ONE_WAY_OVERLAY, ///< Do not show one-way road overlays.
|
||||||
RSF_NO_CATENARY, ///< Do not show catenary.
|
RSF_NO_CATENARY, ///< Do not show catenary.
|
||||||
|
RSF_DRIVE_THROUGH_ONLY, ///< Stop is drive-through only.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RoadStopSpecIntlFlags {
|
enum RoadStopSpecIntlFlags {
|
||||||
|
@@ -1209,6 +1209,19 @@ private:
|
|||||||
this->vscrollList->ScrollTowards(pos);
|
this->vscrollList->ScrollTowards(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckOrientationValid()
|
||||||
|
{
|
||||||
|
if (_roadstop_gui_settings.orientation >= DIAGDIR_END) return;
|
||||||
|
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||||
|
if (spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) {
|
||||||
|
this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||||
|
_roadstop_gui_settings.orientation = DIAGDIR_END;
|
||||||
|
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||||
|
this->SetDirty();
|
||||||
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
|
BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
|
||||||
{
|
{
|
||||||
@@ -1291,6 +1304,7 @@ public:
|
|||||||
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
||||||
|
|
||||||
this->EnsureSelectedClassIsVisible();
|
this->EnsureSelectedClassIsVisible();
|
||||||
|
this->CheckOrientationValid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1479,8 +1493,10 @@ public:
|
|||||||
case WID_BROS_STATION_Y: {
|
case WID_BROS_STATION_Y: {
|
||||||
StationType st = GetRoadStationTypeByWindowClass(this->window_class);
|
StationType st = GetRoadStationTypeByWindowClass(this->window_class);
|
||||||
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||||
if (spec == nullptr) {
|
bool disabled = (spec != nullptr && widget < WID_BROS_STATION_X && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY));
|
||||||
|
if (spec == nullptr || disabled) {
|
||||||
StationPickerDrawSprite(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE);
|
StationPickerDrawSprite(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||||
|
if (disabled) GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK, FILLRECT_CHECKER);
|
||||||
} else {
|
} else {
|
||||||
DrawRoadStopTile(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), _cur_roadtype, spec, st, (int)widget - WID_BROS_STATION_NE);
|
DrawRoadStopTile(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), _cur_roadtype, spec, st, (int)widget - WID_BROS_STATION_NE);
|
||||||
}
|
}
|
||||||
@@ -1523,7 +1539,9 @@ public:
|
|||||||
if (spec == nullptr) {
|
if (spec == nullptr) {
|
||||||
StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, _roadstop_gui_settings.orientation);
|
StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, _roadstop_gui_settings.orientation);
|
||||||
} else {
|
} else {
|
||||||
DrawRoadStopTile(x, y, _cur_roadtype, spec, st, (uint8)_roadstop_gui_settings.orientation);
|
DiagDirection orientation = _roadstop_gui_settings.orientation;
|
||||||
|
if (orientation < DIAGDIR_END && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) orientation = DIAGDIR_END;
|
||||||
|
DrawRoadStopTile(x, y, _cur_roadtype, spec, st, (uint8)orientation);
|
||||||
}
|
}
|
||||||
_cur_dpi = old_dpi;
|
_cur_dpi = old_dpi;
|
||||||
}
|
}
|
||||||
@@ -1554,6 +1572,10 @@ public:
|
|||||||
case WID_BROS_STATION_NW:
|
case WID_BROS_STATION_NW:
|
||||||
case WID_BROS_STATION_X:
|
case WID_BROS_STATION_X:
|
||||||
case WID_BROS_STATION_Y:
|
case WID_BROS_STATION_Y:
|
||||||
|
if (widget < WID_BROS_STATION_X) {
|
||||||
|
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||||
|
if (spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) return;
|
||||||
|
}
|
||||||
this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||||
_roadstop_gui_settings.orientation = (DiagDirection)(widget - WID_BROS_STATION_NE);
|
_roadstop_gui_settings.orientation = (DiagDirection)(widget - WID_BROS_STATION_NE);
|
||||||
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||||
@@ -1585,6 +1607,7 @@ public:
|
|||||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX);
|
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX);
|
||||||
matrix->SetCount(_roadstop_gui_settings.roadstop_count);
|
matrix->SetCount(_roadstop_gui_settings.roadstop_count);
|
||||||
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
||||||
|
this->CheckOrientationValid();
|
||||||
}
|
}
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
@@ -1609,6 +1632,7 @@ public:
|
|||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
|
this->CheckOrientationValid();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2092,6 +2092,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|||||||
if (roadstopspec != nullptr) {
|
if (roadstopspec != nullptr) {
|
||||||
if (type && roadstopspec->stop_type != ROADSTOPTYPE_FREIGHT && roadstopspec->stop_type != ROADSTOPTYPE_ALL) return CMD_ERROR;
|
if (type && roadstopspec->stop_type != ROADSTOPTYPE_FREIGHT && roadstopspec->stop_type != ROADSTOPTYPE_ALL) return CMD_ERROR;
|
||||||
if (!type && roadstopspec->stop_type != ROADSTOPTYPE_PASSENGER && roadstopspec->stop_type != ROADSTOPTYPE_ALL) return CMD_ERROR;
|
if (!type && roadstopspec->stop_type != ROADSTOPTYPE_PASSENGER && roadstopspec->stop_type != ROADSTOPTYPE_ALL) return CMD_ERROR;
|
||||||
|
if (!is_drive_through && HasBit(roadstopspec->flags, RSF_DRIVE_THROUGH_ONLY)) return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the requested road stop is too big */
|
/* Check if the requested road stop is too big */
|
||||||
|
Reference in New Issue
Block a user