Reimplement station building previews
This commit is contained in:
@@ -38,10 +38,12 @@
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "citymania/cm_highlight.hpp"
|
||||
#include "citymania/cm_hotkeys.hpp"
|
||||
#include "citymania/cm_station_gui.hpp"
|
||||
|
||||
#include "safeguards.h"
|
||||
#include <memory>
|
||||
|
||||
static void ShowBuildDockStationPicker(Window *parent);
|
||||
static void ShowBuildDocksDepotPicker(Window *parent);
|
||||
@@ -171,8 +173,8 @@ struct BuildDocksToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_DT_STATION: // Build station button
|
||||
// if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, CM_DDSP_BUILD_DOCK)) ShowBuildDockStationPicker(this);
|
||||
if (citymania::HandleStationPlacePushButton(this, WID_DT_STATION, std::make_shared<citymania::DockPreview>())) {
|
||||
// if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, CM_DDSP_BUILD_DOCK)) {
|
||||
if (citymania::HandlePlacePushButton(this, WID_DT_STATION, std::make_unique<citymania::DockBuildTool>())) {
|
||||
ShowBuildDockStationPicker(this);
|
||||
}
|
||||
|
||||
@@ -218,14 +220,13 @@ struct BuildDocksToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_DT_STATION: { // Build station button
|
||||
NOT_REACHED(); // CityMania uses tools
|
||||
|
||||
/* Determine the watery part of the dock. */
|
||||
/*
|
||||
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
||||
TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
|
||||
|
||||
if (citymania::UseImprovedStationJoin()) {
|
||||
citymania::PlaceDock(tile, tile_to);
|
||||
break;
|
||||
}
|
||||
|
||||
bool adjacent = citymania::_fn_mod;
|
||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||
@@ -237,7 +238,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||
};
|
||||
|
||||
ShowSelectStationIfNeeded(TileArea(tile, tile_to), proc);
|
||||
break;
|
||||
break; */
|
||||
}
|
||||
|
||||
case WID_DT_BUOY: // Build buoy button
|
||||
@@ -290,7 +291,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||
|
||||
|
||||
citymania::AbortStationPlacement();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user