Fix road stop autorotation
This commit is contained in:
@@ -62,7 +62,6 @@ extern AirportClassID _selected_airport_class; ///< the currently visible airpor
|
||||
extern int _selected_airport_index;
|
||||
extern byte _selected_airport_layout;
|
||||
extern DiagDirection _build_depot_direction; ///< Currently selected depot direction
|
||||
extern DiagDirection _road_station_picker_orientation;
|
||||
extern DiagDirection _road_depot_orientation;
|
||||
extern uint32 _realtime_tick;
|
||||
extern uint32 _cm_funding_layout;
|
||||
@@ -1853,7 +1852,7 @@ HighLightStyle UpdateTileSelection(HighLightStyle new_drawstyle) {
|
||||
if (_thd.select_proc == DDSP_BUILD_STATION)
|
||||
_thd.cm_new = ObjectHighlight::make_rail_station(start_tile, end_tile, _railstation.orientation);
|
||||
else if (_thd.select_proc == DDSP_BUILD_BUSSTOP || _thd.select_proc == DDSP_BUILD_TRUCKSTOP) {
|
||||
auto ddir = _road_station_picker_orientation;
|
||||
auto ddir = _roadstop_gui_settings.orientation;
|
||||
auto ta = TileArea(start_tile, end_tile);
|
||||
if (pt.x != -1) {
|
||||
if (ddir >= DIAGDIR_END && ddir < STATIONDIR_AUTO) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include "cm_main.hpp"
|
||||
#include "cm_command_type.hpp"
|
||||
#include "cm_hotkeys.hpp"
|
||||
#include "cm_minimap.hpp"
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
extern const Station *_viewport_highlight_station;
|
||||
extern TileHighlightData _thd;
|
||||
|
||||
extern DiagDirection _road_station_picker_orientation;
|
||||
extern bool CheckClickOnViewportSign(const Viewport *vp, int x, int y, const ViewportSign *sign);
|
||||
extern Rect ExpandRectWithViewportSignMargins(Rect r, ZoomLevel zoom);
|
||||
extern RoadBits FindRailsToConnect(TileIndex tile);
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
#ifndef CMEXT_COMMANDCOST_HPP
|
||||
#define CMEXT_COMMANDCOST_HPP
|
||||
|
||||
#include "../cm_type.hpp"
|
||||
|
||||
namespace citymania {
|
||||
|
||||
class ObjectTileHighlight;
|
||||
|
||||
namespace ext {
|
||||
|
||||
class CommandCost {
|
||||
public:
|
||||
size_t industry_layout;
|
||||
// std::list<std::shared_ptr<ObjectTileHighlight>> highlight;
|
||||
// void add_highlight(const ObjectTileHighlight &hl) {
|
||||
|
||||
// }
|
||||
};
|
||||
|
||||
} // namespace ext
|
||||
|
||||
@@ -67,7 +67,6 @@ static bool _place_road_end_half;
|
||||
/* CM static */ RoadType _cur_roadtype;
|
||||
|
||||
/* CM static */ DiagDirection _road_depot_orientation;
|
||||
DiagDirection _road_station_picker_orientation;
|
||||
|
||||
struct RoadStopGUISettings {
|
||||
DiagDirection orientation;
|
||||
@@ -1259,9 +1258,11 @@ public:
|
||||
if (RoadTypeIsTram(_cur_roadtype) && _roadstop_gui_settings.orientation < DIAGDIR_END) {
|
||||
_roadstop_gui_settings.orientation = DIAGDIR_END;
|
||||
}
|
||||
if (RoadTypeIsTram(_cur_roadtype) && _road_station_picker_orientation == (DiagDirection)(DIAGDIR_END + 2)) {
|
||||
_road_station_picker_orientation = (DiagDirection)(DIAGDIR_END + 3);
|
||||
|
||||
if (RoadTypeIsTram(_cur_roadtype) && _roadstop_gui_settings.orientation == citymania::STATIONDIR_AUTO) {
|
||||
_roadstop_gui_settings.orientation = citymania::STATIONDIR_AUTO_XY;
|
||||
}
|
||||
|
||||
const RoadTypeInfo *rti = GetRoadTypeInfo(_cur_roadtype);
|
||||
this->GetWidget<NWidgetCore>(WID_BROS_CAPTION)->widget_data = rti->strings.picker_title[rs];
|
||||
|
||||
@@ -1394,16 +1395,16 @@ public:
|
||||
}
|
||||
|
||||
if (hotkey == CM_BROSHK_ROTATE) {
|
||||
if (_road_station_picker_orientation < citymania::STATIONDIR_AUTO) {
|
||||
this->RaiseWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||
if (_road_station_picker_orientation < DIAGDIR_END) {
|
||||
_road_station_picker_orientation = ChangeDiagDir(_road_station_picker_orientation, DIAGDIRDIFF_90RIGHT);
|
||||
} else if (_road_station_picker_orientation == citymania::STATIONDIR_X) {
|
||||
_road_station_picker_orientation = citymania::STATIONDIR_Y;
|
||||
} else if (_road_station_picker_orientation == citymania::STATIONDIR_Y) {
|
||||
_road_station_picker_orientation = citymania::STATIONDIR_X;
|
||||
if (_roadstop_gui_settings.orientation < citymania::STATIONDIR_AUTO) {
|
||||
this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||
if (_roadstop_gui_settings.orientation < DIAGDIR_END) {
|
||||
_roadstop_gui_settings.orientation = ChangeDiagDir(_roadstop_gui_settings.orientation, DIAGDIRDIFF_90RIGHT);
|
||||
} else if (_roadstop_gui_settings.orientation == citymania::STATIONDIR_X) {
|
||||
_roadstop_gui_settings.orientation = citymania::STATIONDIR_Y;
|
||||
} else if (_roadstop_gui_settings.orientation == citymania::STATIONDIR_Y) {
|
||||
_roadstop_gui_settings.orientation = citymania::STATIONDIR_X;
|
||||
}
|
||||
this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||
} else {
|
||||
citymania::RotateAutodetection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user