New station joining UI (WIP)
This commit is contained in:
@@ -105,8 +105,8 @@ static void FindStationsAroundSelection()
|
||||
{
|
||||
/* With distant join we don't know which station will be selected, so don't show any */
|
||||
if (_ctrl_pressed) {
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
citymania::SetStationBiildingPossibility(citymania::BuildingPossibility::QUERY);
|
||||
// SetViewportCatchmentStation(nullptr, true);
|
||||
// citymania::SetStationBiildingStatus(citymania::StationBulidingStatus::JOIN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ static void FindStationsAroundSelection()
|
||||
TileArea ta(TileXY(max<int>(0, x - max_c), max<int>(0, y - max_c)), TileXY(min<int>(MapMaxX(), x + location.w + max_c), min<int>(MapMaxY(), y + location.h + max_c)));
|
||||
|
||||
Station *adjacent = nullptr;
|
||||
auto cmbp = citymania::BuildingPossibility::OK;
|
||||
auto cmbp = citymania::StationBulidingStatus::NEW;
|
||||
|
||||
/* Direct loop instead of FindStationsAroundTiles as we are not interested in catchment area */
|
||||
TILE_AREA_LOOP(tile, ta) {
|
||||
@@ -138,7 +138,7 @@ static void FindStationsAroundSelection()
|
||||
}
|
||||
}
|
||||
SetViewportCatchmentStation(adjacent, true);
|
||||
citymania::SetStationBiildingPossibility(cmbp);
|
||||
citymania::SetStationBiildingStatus(citymania::StationBulidingStatus::JOIN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,6 +148,7 @@ static void FindStationsAroundSelection()
|
||||
*/
|
||||
void CheckRedrawStationCoverage(const Window *w)
|
||||
{
|
||||
return; // CM has better redraw handling
|
||||
/* Test if ctrl state changed */
|
||||
static bool _last_ctrl_pressed;
|
||||
if (_ctrl_pressed != _last_ctrl_pressed) {
|
||||
@@ -2454,18 +2455,19 @@ struct SelectStationWindow : WindowPopup {
|
||||
{
|
||||
if (widget != WID_JS_PANEL || T::EXPECTED_FACIL == FACIL_WAYPOINT) {
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
citymania::SetStationBiildingPossibility(citymania::BuildingPossibility::QUERY);
|
||||
citymania::SetStationBiildingStatus(citymania::StationBulidingStatus::QUERY);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Show coverage area of station under cursor */
|
||||
uint st_index = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_JS_PANEL, WD_FRAMERECT_TOP);
|
||||
citymania::SetStationBiildingPossibility(citymania::BuildingPossibility::OK);
|
||||
if (st_index == 0 || st_index > _stations_nearby_list.size()) {
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
citymania::SetStationBiildingStatus(citymania::StationBulidingStatus::NEW);
|
||||
} else {
|
||||
st_index--;
|
||||
SetViewportCatchmentStation(Station::Get(_stations_nearby_list[st_index]), true);
|
||||
citymania::SetStationBiildingStatus(citymania::StationBulidingStatus::JOIN);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2522,6 +2524,20 @@ static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta)
|
||||
template <class T>
|
||||
void ShowSelectBaseStationIfNeeded(const CommandContainer &cmd, TileArea ta)
|
||||
{
|
||||
// CM No need to show window anymore
|
||||
auto join_to = citymania::GetStationToJoin();
|
||||
auto cmd2 = cmd;
|
||||
SetBit(cmd2.p2, 2);
|
||||
if (_ctrl_pressed) SB(cmd2.p2, 16, 16, NEW_STATION);
|
||||
else if (join_to) SB(cmd2.p2, 16, 16, join_to->index);
|
||||
else {
|
||||
SB(cmd2.p2, 16, 16, INVALID_STATION);
|
||||
ClrBit(cmd2.p2, 2);
|
||||
}
|
||||
|
||||
DoCommandP(&cmd2);
|
||||
return;
|
||||
|
||||
if (StationJoinerNeeded<T>(cmd, ta)) {
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
new SelectStationWindow<T>(&_select_station_desc, cmd, ta);
|
||||
|
||||
Reference in New Issue
Block a user