Add hotkey for blueprint rotation
This commit is contained in:
@@ -64,6 +64,7 @@ static const SignalType _default_signal_type[] = {SIGTYPE_NORMAL, SIGTYPE_PBS, S
|
|||||||
static const int HOTKEY_MASK = 0x1000;
|
static const int HOTKEY_MASK = 0x1000;
|
||||||
static const int HOTKEY_POLYRAIL = 0x1000;
|
static const int HOTKEY_POLYRAIL = 0x1000;
|
||||||
static const int HOTKEY_NEW_POLYRAIL = 0x1001;
|
static const int HOTKEY_NEW_POLYRAIL = 0x1001;
|
||||||
|
static const int HOTKEY_BLUEPRINT_ROTATE = 0x1002;
|
||||||
static const int HOTKEY_BUILD_STATION_SIZED = 0x1010; ///< Build a station in fixed size mode.
|
static const int HOTKEY_BUILD_STATION_SIZED = 0x1010; ///< Build a station in fixed size mode.
|
||||||
static const int HOTKEY_BUILD_STATION_DRAGDROP = 0x1011; ///< Build a station in dragdrop mode.
|
static const int HOTKEY_BUILD_STATION_DRAGDROP = 0x1011; ///< Build a station in dragdrop mode.
|
||||||
|
|
||||||
@@ -793,6 +794,12 @@ struct BuildRailToolbarWindow : Window {
|
|||||||
case HOTKEY_BUILD_STATION_DRAGDROP:
|
case HOTKEY_BUILD_STATION_DRAGDROP:
|
||||||
this->last_user_action = hotkey;
|
this->last_user_action = hotkey;
|
||||||
return this->Window::OnHotkey(WID_RAT_BUILD_STATION);
|
return this->Window::OnHotkey(WID_RAT_BUILD_STATION);
|
||||||
|
|
||||||
|
case HOTKEY_BLUEPRINT_ROTATE:
|
||||||
|
if (this->last_user_action == CM_WID_RAT_BLUEPRINT_PLACE) {
|
||||||
|
citymania::RotateActiveBlueprint();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Window::OnHotkey(hotkey);
|
return Window::OnHotkey(hotkey);
|
||||||
@@ -971,10 +978,6 @@ struct BuildRailToolbarWindow : Window {
|
|||||||
|
|
||||||
EventState CM_OnRemoveModStateChange() override
|
EventState CM_OnRemoveModStateChange() override
|
||||||
{
|
{
|
||||||
if (this->last_user_action == CM_WID_RAT_BLUEPRINT_PLACE) {
|
|
||||||
citymania::RotateActiveBlueprint();
|
|
||||||
return ES_HANDLED;
|
|
||||||
}
|
|
||||||
auto new_remove = citymania::RailToolbar_RemoveModChanged(this, _cm_invert_remove, _remove_button_clicked, false);
|
auto new_remove = citymania::RailToolbar_RemoveModChanged(this, _cm_invert_remove, _remove_button_clicked, false);
|
||||||
if (new_remove != _remove_button_clicked) {
|
if (new_remove != _remove_button_clicked) {
|
||||||
_remove_button_clicked = new_remove;
|
_remove_button_clicked = new_remove;
|
||||||
@@ -1023,6 +1026,8 @@ static Hotkey railtoolbar_hotkeys[] = {
|
|||||||
Hotkey('T', "tunnel", WID_RAT_BUILD_TUNNEL),
|
Hotkey('T', "tunnel", WID_RAT_BUILD_TUNNEL),
|
||||||
Hotkey('R', "remove", WID_RAT_REMOVE),
|
Hotkey('R', "remove", WID_RAT_REMOVE),
|
||||||
Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
|
Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
|
||||||
|
Hotkey((uint16)0, "cm_blueprint", CM_WID_RAT_BLUEPRINT),
|
||||||
|
Hotkey(CM_WKC_MOUSE_MIDDLE, "cm_blueprint_rotate", HOTKEY_BLUEPRINT_ROTATE),
|
||||||
HOTKEY_LIST_END
|
HOTKEY_LIST_END
|
||||||
};
|
};
|
||||||
HotkeyList BuildRailToolbarWindow::hotkeys("railtoolbar", railtoolbar_hotkeys, RailToolbarGlobalHotkeys);
|
HotkeyList BuildRailToolbarWindow::hotkeys("railtoolbar", railtoolbar_hotkeys, RailToolbarGlobalHotkeys);
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
TileIndex tile_start = p1;
|
TileIndex tile_start = p1;
|
||||||
TileIndex tile_end = end_tile;
|
TileIndex tile_end = end_tile;
|
||||||
|
|
||||||
fprintf(stderr, "BRIDGE %d %d %d %d\n", tile_start, tile_end, bridge_type, railtype);
|
|
||||||
if (company == OWNER_DEITY) {
|
if (company == OWNER_DEITY) {
|
||||||
if (transport_type != TRANSPORT_ROAD) return CMD_ERROR;
|
if (transport_type != TRANSPORT_ROAD) return CMD_ERROR;
|
||||||
const Town *town = CalcClosestTownFromTile(tile_start);
|
const Town *town = CalcClosestTownFromTile(tile_start);
|
||||||
|
|||||||
Reference in New Issue
Block a user