mirror of https://github.com/OpenTTD/OpenTTD
Change: Refactor modifier key handling, split Ctrl into function and remove
parent
acaceb45ba
commit
aea866a42f
|
@ -229,7 +229,7 @@ struct AIConfigWindow : public Window {
|
||||||
case WID_AIC_LIST: { // Select a slot
|
case WID_AIC_LIST: { // Select a slot
|
||||||
this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget);
|
this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget);
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowScriptListWindow((CompanyID)this->selected_slot, _ctrl_pressed);
|
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowScriptListWindow((CompanyID)this->selected_slot, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ struct AIConfigWindow : public Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_AIC_CHANGE: // choose other AI
|
case WID_AIC_CHANGE: // choose other AI
|
||||||
ShowScriptListWindow((CompanyID)this->selected_slot, _ctrl_pressed);
|
ShowScriptListWindow((CompanyID)this->selected_slot, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AIC_CONFIGURE: // change the settings for an AI
|
case WID_AIC_CONFIGURE: // change the settings for an AI
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void PlaceAirport(TileIndex tile)
|
||||||
|
|
||||||
byte airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
|
byte airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
|
||||||
byte layout = _selected_airport_layout;
|
byte layout = _selected_airport_layout;
|
||||||
bool adjacent = _ctrl_pressed;
|
bool adjacent = _fn_pressed;
|
||||||
|
|
||||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||||
if (test) {
|
if (test) {
|
||||||
|
|
|
@ -582,7 +582,7 @@ public:
|
||||||
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
|
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
|
||||||
const Group *g = Group::GetIfValid(this->sel_group);
|
const Group *g = Group::GetIfValid(this->sel_group);
|
||||||
if (g != nullptr) {
|
if (g != nullptr) {
|
||||||
Command<CMD_SET_GROUP_FLAG>::Post(this->sel_group, GroupFlags::GF_REPLACE_WAGON_REMOVAL, !HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL), _ctrl_pressed);
|
Command<CMD_SET_GROUP_FLAG>::Post(this->sel_group, GroupFlags::GF_REPLACE_WAGON_REMOVAL, !HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL), _fn_pressed);
|
||||||
} else {
|
} else {
|
||||||
// toggle renew_keep_length
|
// toggle renew_keep_length
|
||||||
Command<CMD_CHANGE_COMPANY_SETTING>::Post("company.renew_keep_length", Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1);
|
Command<CMD_CHANGE_COMPANY_SETTING>::Post("company.renew_keep_length", Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1);
|
||||||
|
@ -634,9 +634,9 @@ public:
|
||||||
if ((item.flags & EngineDisplayFlags::Shaded) == EngineDisplayFlags::None) e = item.engine_id;
|
if ((item.flags & EngineDisplayFlags::Shaded) == EngineDisplayFlags::None) e = item.engine_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If Ctrl is pressed on the left side and we don't have any engines of the selected type, stop autoreplacing.
|
/* If Fn modifier is pressed on the left side and we don't have any engines of the selected type, stop autoreplacing.
|
||||||
* This is most common when we have finished autoreplacing the engine and want to remove it from the list. */
|
* This is most common when we have finished autoreplacing the engine and want to remove it from the list. */
|
||||||
if (click_side == 0 && _ctrl_pressed && e != INVALID_ENGINE &&
|
if (click_side == 0 && _fn_pressed && e != INVALID_ENGINE &&
|
||||||
(GetGroupNumEngines(_local_company, sel_group, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0)) {
|
(GetGroupNumEngines(_local_company, sel_group, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0)) {
|
||||||
EngineID veh_from = e;
|
EngineID veh_from = e;
|
||||||
Command<CMD_SET_AUTOREPLACE>::Post(this->sel_group, veh_from, INVALID_ENGINE, false);
|
Command<CMD_SET_AUTOREPLACE>::Post(this->sel_group, veh_from, INVALID_ENGINE, false);
|
||||||
|
|
|
@ -376,7 +376,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
||||||
case TRANSPORT_RAIL: last_bridge_type = _last_railbridge_type; break;
|
case TRANSPORT_RAIL: last_bridge_type = _last_railbridge_type; break;
|
||||||
default: break; // water ways and air routes don't have bridge types
|
default: break; // water ways and air routes don't have bridge types
|
||||||
}
|
}
|
||||||
if (_ctrl_pressed && CheckBridgeAvailability(last_bridge_type, bridge_len).Succeeded()) {
|
if (_fn_pressed && CheckBridgeAvailability(last_bridge_type, bridge_len).Succeeded()) {
|
||||||
Command<CMD_BUILD_BRIDGE>::Post(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, CcBuildBridge, end, start, transport_type, last_bridge_type, road_rail_type);
|
Command<CMD_BUILD_BRIDGE>::Post(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, CcBuildBridge, end, start, transport_type, last_bridge_type, road_rail_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1620,7 +1620,7 @@ struct BuildVehicleWindow : Window {
|
||||||
}
|
}
|
||||||
this->SelectEngine(e);
|
this->SelectEngine(e);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
this->OnClick(pt, WID_BV_SHOW_HIDE, 1);
|
this->OnClick(pt, WID_BV_SHOW_HIDE, 1);
|
||||||
} else if (click_count > 1 && !this->listview_mode) {
|
} else if (click_count > 1 && !this->listview_mode) {
|
||||||
this->OnClick(pt, WID_BV_BUILD, 1);
|
this->OnClick(pt, WID_BV_BUILD, 1);
|
||||||
|
|
|
@ -226,7 +226,7 @@ std::tuple<bool, bool, bool> CommandHelperBase::InternalPostBefore(Commands cmd,
|
||||||
* However, in case of incoming network commands,
|
* However, in case of incoming network commands,
|
||||||
* map generation or the pause button we do want
|
* map generation or the pause button we do want
|
||||||
* to execute. */
|
* to execute. */
|
||||||
bool estimate_only = _shift_pressed && IsLocalCompany() && !_generating_world && !network_command && !(flags & CMD_NO_EST);
|
bool estimate_only = _estimate_pressed && IsLocalCompany() && !_generating_world && !network_command && !(flags & CMD_NO_EST);
|
||||||
|
|
||||||
/* We're only sending the command, so don't do
|
/* We're only sending the command, so don't do
|
||||||
* fancy things for 'success'. */
|
* fancy things for 'success'. */
|
||||||
|
|
|
@ -497,11 +497,11 @@ struct CompanyFinancesWindow : Window {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_CF_INCREASE_LOAN: // increase loan
|
case WID_CF_INCREASE_LOAN: // increase loan
|
||||||
Command<CMD_INCREASE_LOAN>::Post(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, _ctrl_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
|
Command<CMD_INCREASE_LOAN>::Post(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, _fn_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_CF_REPAY_LOAN: // repay loan
|
case WID_CF_REPAY_LOAN: // repay loan
|
||||||
Command<CMD_DECREASE_LOAN>::Post(STR_ERROR_CAN_T_REPAY_LOAN, _ctrl_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
|
Command<CMD_DECREASE_LOAN>::Post(STR_ERROR_CAN_T_REPAY_LOAN, _fn_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_CF_INFRASTRUCTURE: // show infrastructure details
|
case WID_CF_INFRASTRUCTURE: // show infrastructure details
|
||||||
|
@ -1017,7 +1017,7 @@ public:
|
||||||
}
|
}
|
||||||
assert(j < LS_END);
|
assert(j < LS_END);
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ToggleBit(this->sel, j);
|
ToggleBit(this->sel, j);
|
||||||
} else {
|
} else {
|
||||||
this->sel = 1 << j;
|
this->sel = 1 << j;
|
||||||
|
@ -1048,7 +1048,7 @@ public:
|
||||||
/* Set company colour livery */
|
/* Set company colour livery */
|
||||||
for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
|
for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
|
||||||
/* Changed colour for the selected scheme, or all visible schemes if CTRL is pressed. */
|
/* Changed colour for the selected scheme, or all visible schemes if CTRL is pressed. */
|
||||||
if (HasBit(this->sel, scheme) || (_ctrl_pressed && _livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme))) {
|
if (HasBit(this->sel, scheme) || (_fn_pressed && _livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme))) {
|
||||||
Command<CMD_SET_COMPANY_COLOUR>::Post(scheme, widget == WID_SCL_PRI_COL_DROPDOWN, colour);
|
Command<CMD_SET_COMPANY_COLOUR>::Post(scheme, widget == WID_SCL_PRI_COL_DROPDOWN, colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2510,7 +2510,7 @@ struct CompanyWindow : Window
|
||||||
|
|
||||||
case WID_C_VIEW_HQ: {
|
case WID_C_VIEW_HQ: {
|
||||||
TileIndex tile = Company::Get((CompanyID)this->window_number)->location_of_HQ;
|
TileIndex tile = Company::Get((CompanyID)this->window_number)->location_of_HQ;
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(tile);
|
ShowExtraViewportWindow(tile);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(tile);
|
ScrollMainWindowToTile(tile);
|
||||||
|
@ -2585,7 +2585,7 @@ struct CompanyWindow : Window
|
||||||
|
|
||||||
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
|
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
|
||||||
{
|
{
|
||||||
if (Command<CMD_BUILD_OBJECT>::Post(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0) && !_shift_pressed) {
|
if (Command<CMD_BUILD_OBJECT>::Post(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0) && !_estimate_pressed) {
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
|
||||||
|
|
||||||
if (wagon == v) return;
|
if (wagon == v) return;
|
||||||
|
|
||||||
Command<CMD_MOVE_RAIL_VEHICLE>::Post(STR_ERROR_CAN_T_MOVE_VEHICLE, v->tile, v->index, wagon == nullptr ? INVALID_VEHICLE : wagon->index, _ctrl_pressed);
|
Command<CMD_MOVE_RAIL_VEHICLE>::Post(STR_ERROR_CAN_T_MOVE_VEHICLE, v->tile, v->index, wagon == nullptr ? INVALID_VEHICLE : wagon->index, _fn_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VehicleCellSize _base_block_sizes_depot[VEH_COMPANY_END]; ///< Cell size for vehicle images in the depot view.
|
static VehicleCellSize _base_block_sizes_depot[VEH_COMPANY_END]; ///< Cell size for vehicle images in the depot view.
|
||||||
|
@ -560,7 +560,7 @@ struct DepotWindow : Window {
|
||||||
} else if (v != nullptr) {
|
} else if (v != nullptr) {
|
||||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||||
SetMouseCursorVehicle(v, EIT_IN_DEPOT);
|
SetMouseCursorVehicle(v, EIT_IN_DEPOT);
|
||||||
_cursor.vehchain = _ctrl_pressed;
|
_cursor.vehchain = _fn_pressed;
|
||||||
|
|
||||||
this->sel = v->index;
|
this->sel = v->index;
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
@ -786,7 +786,7 @@ struct DepotWindow : Window {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_D_LOCATION:
|
case WID_D_LOCATION:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(this->window_number);
|
ShowExtraViewportWindow(this->window_number);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(this->window_number);
|
ScrollMainWindowToTile(this->window_number);
|
||||||
|
@ -854,7 +854,7 @@ struct DepotWindow : Window {
|
||||||
CargoArray capacity{}, loaded{};
|
CargoArray capacity{}, loaded{};
|
||||||
|
|
||||||
/* Display info for single (articulated) vehicle, or for whole chain starting with selected vehicle */
|
/* Display info for single (articulated) vehicle, or for whole chain starting with selected vehicle */
|
||||||
bool whole_chain = (this->type == VEH_TRAIN && _ctrl_pressed);
|
bool whole_chain = (this->type == VEH_TRAIN && _fn_pressed);
|
||||||
|
|
||||||
/* loop through vehicle chain and collect cargoes */
|
/* loop through vehicle chain and collect cargoes */
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
|
@ -900,7 +900,7 @@ struct DepotWindow : Window {
|
||||||
*/
|
*/
|
||||||
bool OnVehicleSelect(const Vehicle *v) override
|
bool OnVehicleSelect(const Vehicle *v) override
|
||||||
{
|
{
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
/* Share-clone, do not open new viewport, and keep tool active */
|
/* Share-clone, do not open new viewport, and keep tool active */
|
||||||
Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true);
|
Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -921,8 +921,8 @@ struct DepotWindow : Window {
|
||||||
*/
|
*/
|
||||||
bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) override
|
bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) override
|
||||||
{
|
{
|
||||||
if (!_ctrl_pressed) {
|
if (!_fn_pressed) {
|
||||||
/* If CTRL is not pressed: If all the vehicles in this list have the same orders, then copy orders */
|
/* If Fn is not pressed: If all the vehicles in this list have the same orders, then copy orders */
|
||||||
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
||||||
return VehiclesHaveSameEngineList(v1, v2);
|
return VehiclesHaveSameEngineList(v1, v2);
|
||||||
})) {
|
})) {
|
||||||
|
@ -937,7 +937,7 @@ struct DepotWindow : Window {
|
||||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, WL_INFO);
|
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, WL_INFO);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If CTRL is pressed: If all the vehicles in this list share orders, then copy orders */
|
/* If Fn is pressed: If all the vehicles in this list share orders, then copy orders */
|
||||||
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
||||||
return VehiclesHaveSameEngineList(v1, v2);
|
return VehiclesHaveSameEngineList(v1, v2);
|
||||||
})) {
|
})) {
|
||||||
|
@ -1039,7 +1039,7 @@ struct DepotWindow : Window {
|
||||||
GetDepotVehiclePtData gdvp = { nullptr, nullptr };
|
GetDepotVehiclePtData gdvp = { nullptr, nullptr };
|
||||||
|
|
||||||
if (this->GetVehicleFromDepotWndPt(pt.x, pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE && sel != INVALID_VEHICLE) {
|
if (this->GetVehicleFromDepotWndPt(pt.x, pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE && sel != INVALID_VEHICLE) {
|
||||||
if (gdvp.wagon != nullptr && gdvp.wagon->index == sel && _ctrl_pressed) {
|
if (gdvp.wagon != nullptr && gdvp.wagon->index == sel && _fn_pressed) {
|
||||||
Command<CMD_REVERSE_TRAIN_DIRECTION>::Post(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE, Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true);
|
Command<CMD_REVERSE_TRAIN_DIRECTION>::Post(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE, Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true);
|
||||||
} else if (gdvp.wagon == nullptr || gdvp.wagon->index != sel) {
|
} else if (gdvp.wagon == nullptr || gdvp.wagon->index != sel) {
|
||||||
this->vehicle_over = INVALID_VEHICLE;
|
this->vehicle_over = INVALID_VEHICLE;
|
||||||
|
@ -1064,7 +1064,7 @@ struct DepotWindow : Window {
|
||||||
this->sel = INVALID_VEHICLE;
|
this->sel = INVALID_VEHICLE;
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
|
||||||
bool sell_cmd = (v->type == VEH_TRAIN && (widget == WID_D_SELL_CHAIN || _ctrl_pressed));
|
bool sell_cmd = (v->type == VEH_TRAIN && (widget == WID_D_SELL_CHAIN || _fn_pressed));
|
||||||
Command<CMD_SELL_VEHICLE>::Post(GetCmdSellVehMsg(v->type), v->tile, v->index, sell_cmd, true, INVALID_CLIENT_ID);
|
Command<CMD_SELL_VEHICLE>::Post(GetCmdSellVehMsg(v->type), v->tile, v->index, sell_cmd, true, INVALID_CLIENT_ID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1101,10 +1101,10 @@ struct DepotWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventState OnCTRLStateChange() override
|
EventState OnFnStateChange() override
|
||||||
{
|
{
|
||||||
if (this->sel != INVALID_VEHICLE) {
|
if (this->sel != INVALID_VEHICLE) {
|
||||||
_cursor.vehchain = _ctrl_pressed;
|
_cursor.vehchain = _fn_pressed;
|
||||||
this->SetWidgetDirty(WID_D_MATRIX);
|
this->SetWidgetDirty(WID_D_MATRIX);
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
||||||
TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
|
TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
|
||||||
|
|
||||||
bool adjacent = _ctrl_pressed;
|
bool adjacent = _fn_pressed;
|
||||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||||
if (test) {
|
if (test) {
|
||||||
return Command<CMD_BUILD_DOCK>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_DOCK>()), tile, INVALID_STATION, adjacent).Succeeded();
|
return Command<CMD_BUILD_DOCK>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_DOCK>()), tile, INVALID_STATION, adjacent).Succeeded();
|
||||||
|
@ -255,10 +255,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
|
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
|
||||||
break;
|
break;
|
||||||
case DDSP_CREATE_WATER:
|
case DDSP_CREATE_WATER:
|
||||||
Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, false);
|
Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, (_game_mode == GM_EDITOR && _fn_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, false);
|
||||||
break;
|
break;
|
||||||
case DDSP_CREATE_RIVER:
|
case DDSP_CREATE_RIVER:
|
||||||
Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_PLACE_RIVERS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, WATER_CLASS_RIVER, _ctrl_pressed);
|
Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_PLACE_RIVERS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, WATER_CLASS_RIVER, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
@ -130,7 +130,7 @@ struct EnginePreviewWindow : Window {
|
||||||
Command<CMD_WANT_ENGINE_PREVIEW>::Post(this->window_number);
|
Command<CMD_WANT_ENGINE_PREVIEW>::Post(this->window_number);
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case WID_EP_NO:
|
case WID_EP_NO:
|
||||||
if (!_shift_pressed) this->Close();
|
if (!_estimate_pressed) this->Close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,12 +255,12 @@ struct GSConfigWindow : public Window {
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_GSC_GSLIST: {
|
case WID_GSC_GSLIST: {
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
if (click_count > 1 && _game_mode != GM_NORMAL) ShowScriptListWindow((CompanyID)OWNER_DEITY, _ctrl_pressed);
|
if (click_count > 1 && _game_mode != GM_NORMAL) ShowScriptListWindow((CompanyID)OWNER_DEITY, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_GSC_CHANGE: // choose other Game Script
|
case WID_GSC_CHANGE: // choose other Game Script
|
||||||
ShowScriptListWindow((CompanyID)OWNER_DEITY, _ctrl_pressed);
|
ShowScriptListWindow((CompanyID)OWNER_DEITY, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GSC_CONTENT_DOWNLOAD:
|
case WID_GSC_CONTENT_DOWNLOAD:
|
||||||
|
|
|
@ -34,8 +34,10 @@ byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
|
||||||
bool _fullscreen;
|
bool _fullscreen;
|
||||||
byte _support8bpp;
|
byte _support8bpp;
|
||||||
CursorVars _cursor;
|
CursorVars _cursor;
|
||||||
bool _ctrl_pressed; ///< Is Ctrl pressed?
|
bool _shift_pressed; ///< Is Shift pressed?
|
||||||
bool _shift_pressed; ///< Is Shift pressed?
|
bool _fn_pressed; ///< Is function modifier pressed?
|
||||||
|
bool _remove_pressed; ///< Is remove modifier pressed?
|
||||||
|
bool _estimate_pressed; ///< Is estimate modifier pressed?
|
||||||
uint16_t _game_speed = 100; ///< Current game-speed; 100 is 1x, 0 is infinite.
|
uint16_t _game_speed = 100; ///< Current game-speed; 100 is 1x, 0 is infinite.
|
||||||
bool _left_button_down; ///< Is left mouse button pressed?
|
bool _left_button_down; ///< Is left mouse button pressed?
|
||||||
bool _left_button_clicked; ///< Is left mouse button clicked?
|
bool _left_button_clicked; ///< Is left mouse button clicked?
|
||||||
|
|
|
@ -52,8 +52,10 @@ extern byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
|
||||||
extern bool _fullscreen;
|
extern bool _fullscreen;
|
||||||
extern byte _support8bpp;
|
extern byte _support8bpp;
|
||||||
extern CursorVars _cursor;
|
extern CursorVars _cursor;
|
||||||
extern bool _ctrl_pressed; ///< Is Ctrl pressed?
|
extern bool _shift_pressed; ///< Is Shift pressed?
|
||||||
extern bool _shift_pressed; ///< Is Shift pressed?
|
extern bool _fn_pressed; ///< Is function modifier pressed?
|
||||||
|
extern bool _remove_pressed; ///< Is remove modifier pressed?
|
||||||
|
extern bool _estimate_pressed; ///< Is esitame modifier pressed?
|
||||||
extern uint16_t _game_speed;
|
extern uint16_t _game_speed;
|
||||||
|
|
||||||
extern bool _left_button_down;
|
extern bool _left_button_down;
|
||||||
|
@ -71,7 +73,7 @@ extern Palette _cur_palette; ///< Current palette
|
||||||
void HandleToolbarHotkey(int hotkey);
|
void HandleToolbarHotkey(int hotkey);
|
||||||
void HandleKeypress(uint keycode, char32_t key);
|
void HandleKeypress(uint keycode, char32_t key);
|
||||||
void HandleTextInput(const char *str, bool marked = false, const char *caret = nullptr, const char *insert_location = nullptr, const char *replacement_end = nullptr);
|
void HandleTextInput(const char *str, bool marked = false, const char *caret = nullptr, const char *insert_location = nullptr, const char *replacement_end = nullptr);
|
||||||
void HandleCtrlChanged();
|
void HandleModifierKeys(bool shift_pressed, bool ctrl_pressed);
|
||||||
void HandleMouseEvents();
|
void HandleMouseEvents();
|
||||||
void UpdateWindows();
|
void UpdateWindows();
|
||||||
void ChangeGameSpeed(bool enable_fast_forward);
|
void ChangeGameSpeed(bool enable_fast_forward);
|
||||||
|
|
|
@ -143,7 +143,7 @@ struct GoalListWindow : public Window {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(xy);
|
ShowExtraViewportWindow(xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(xy);
|
ScrollMainWindowToTile(xy);
|
||||||
|
|
|
@ -757,12 +757,12 @@ public:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
if (v) {
|
if (v) {
|
||||||
if (_ctrl_pressed && this->grouping == GB_SHARED_ORDERS) {
|
if (_fn_pressed && this->grouping == GB_SHARED_ORDERS) {
|
||||||
ShowOrdersWindow(v);
|
ShowOrdersWindow(v);
|
||||||
} else {
|
} else {
|
||||||
this->vehicle_sel = v->index;
|
this->vehicle_sel = v->index;
|
||||||
|
|
||||||
if (_ctrl_pressed && this->grouping == GB_NONE) {
|
if (_fn_pressed && this->grouping == GB_NONE) {
|
||||||
/*
|
/*
|
||||||
* It only makes sense to select a group if not using shared orders
|
* It only makes sense to select a group if not using shared orders
|
||||||
* since two vehicles sharing orders can be from different groups.
|
* since two vehicles sharing orders can be from different groups.
|
||||||
|
@ -818,7 +818,7 @@ public:
|
||||||
case WID_GL_REPLACE_PROTECTION: {
|
case WID_GL_REPLACE_PROTECTION: {
|
||||||
const Group *g = Group::GetIfValid(this->vli.index);
|
const Group *g = Group::GetIfValid(this->vli.index);
|
||||||
if (g != nullptr) {
|
if (g != nullptr) {
|
||||||
Command<CMD_SET_GROUP_FLAG>::Post(this->vli.index, GroupFlags::GF_REPLACE_PROTECTION, !HasBit(g->flags, GroupFlags::GF_REPLACE_PROTECTION), _ctrl_pressed);
|
Command<CMD_SET_GROUP_FLAG>::Post(this->vli.index, GroupFlags::GF_REPLACE_PROTECTION, !HasBit(g->flags, GroupFlags::GF_REPLACE_PROTECTION), _fn_pressed);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -861,7 +861,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_GL_DEFAULT_VEHICLES: // Ungrouped vehicles
|
case WID_GL_DEFAULT_VEHICLES: // Ungrouped vehicles
|
||||||
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, DEFAULT_GROUP, this->vehicle_sel, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, DEFAULT_GROUP, this->vehicle_sel, _fn_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||||
|
|
||||||
this->vehicle_sel = INVALID_VEHICLE;
|
this->vehicle_sel = INVALID_VEHICLE;
|
||||||
this->group_over = INVALID_GROUP;
|
this->group_over = INVALID_GROUP;
|
||||||
|
@ -878,7 +878,7 @@ public:
|
||||||
auto it = this->group_sb->GetScrolledItemFromWidget(this->groups, pt.y, this, WID_GL_LIST_GROUP);
|
auto it = this->group_sb->GetScrolledItemFromWidget(this->groups, pt.y, this, WID_GL_LIST_GROUP);
|
||||||
GroupID new_g = it == this->groups.end() ? NEW_GROUP : (*it)->index;
|
GroupID new_g = it == this->groups.end() ? NEW_GROUP : (*it)->index;
|
||||||
|
|
||||||
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr, new_g, vindex, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr, new_g, vindex, _fn_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ public:
|
||||||
|
|
||||||
case WID_IV_GOTO: {
|
case WID_IV_GOTO: {
|
||||||
Industry *i = Industry::Get(this->window_number);
|
Industry *i = Industry::Get(this->window_number);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(i->location.GetCenterTile());
|
ShowExtraViewportWindow(i->location.GetCenterTile());
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(i->location.GetCenterTile());
|
ScrollMainWindowToTile(i->location.GetCenterTile());
|
||||||
|
@ -1778,7 +1778,7 @@ public:
|
||||||
case WID_ID_INDUSTRY_LIST: {
|
case WID_ID_INDUSTRY_LIST: {
|
||||||
auto it = this->vscroll->GetScrolledItemFromWidget(this->industries, pt.y, this, WID_ID_INDUSTRY_LIST, WidgetDimensions::scaled.framerect.top);
|
auto it = this->vscroll->GetScrolledItemFromWidget(this->industries, pt.y, this, WID_ID_INDUSTRY_LIST, WidgetDimensions::scaled.framerect.top);
|
||||||
if (it != this->industries.end()) {
|
if (it != this->industries.end()) {
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow((*it)->location.tile);
|
ShowExtraViewportWindow((*it)->location.tile);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile((*it)->location.tile);
|
ScrollMainWindowToTile((*it)->location.tile);
|
||||||
|
|
|
@ -333,7 +333,7 @@ struct SelectGameWindow : public Window {
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_SGI_GENERATE_GAME:
|
case WID_SGI_GENERATE_GAME:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
||||||
} else {
|
} else {
|
||||||
ShowGenerateLandscape();
|
ShowGenerateLandscape();
|
||||||
|
|
|
@ -244,7 +244,7 @@ static void HandleLinkClick(Link link)
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(xy);
|
ShowExtraViewportWindow(xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(xy);
|
ScrollMainWindowToTile(xy);
|
||||||
|
|
|
@ -344,7 +344,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_LI_LOCATION:
|
case WID_LI_LOCATION:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(this->tile);
|
ShowExtraViewportWindow(this->tile);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(this->tile);
|
ScrollMainWindowToTile(this->tile);
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ struct NetworkStartServerWindow : public Window {
|
||||||
case WID_NSS_GENERATE_GAME: // Start game
|
case WID_NSS_GENERATE_GAME: // Start game
|
||||||
if (!CheckServerName()) return;
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
||||||
} else {
|
} else {
|
||||||
ShowGenerateLandscape();
|
ShowGenerateLandscape();
|
||||||
|
|
|
@ -1007,7 +1007,7 @@ struct SpriteAlignerWindow : Window {
|
||||||
if (this->offs_start_map.count(this->current_sprite) == 0) {
|
if (this->offs_start_map.count(this->current_sprite) == 0) {
|
||||||
this->offs_start_map[this->current_sprite] = XyOffs(spr->x_offs, spr->y_offs);
|
this->offs_start_map[this->current_sprite] = XyOffs(spr->x_offs, spr->y_offs);
|
||||||
}
|
}
|
||||||
int amt = ScaleByZoom(_ctrl_pressed ? 8 : 1, SpriteAlignerWindow::zoom);
|
int amt = ScaleByZoom(_fn_pressed ? 8 : 1, SpriteAlignerWindow::zoom);
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
/* Move eight units at a time if ctrl is pressed. */
|
/* Move eight units at a time if ctrl is pressed. */
|
||||||
case WID_SA_UP: spr->y_offs -= amt; break;
|
case WID_SA_UP: spr->y_offs -= amt; break;
|
||||||
|
|
|
@ -510,7 +510,7 @@ struct NewsWindow : Window {
|
||||||
} else {
|
} else {
|
||||||
TileIndex tile1 = GetReferenceTile(this->ni->reftype1, this->ni->ref1);
|
TileIndex tile1 = GetReferenceTile(this->ni->reftype1, this->ni->ref1);
|
||||||
TileIndex tile2 = GetReferenceTile(this->ni->reftype2, this->ni->ref2);
|
TileIndex tile2 = GetReferenceTile(this->ni->reftype2, this->ni->ref2);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
if (tile1 != INVALID_TILE) ShowExtraViewportWindow(tile1);
|
if (tile1 != INVALID_TILE) ShowExtraViewportWindow(tile1);
|
||||||
if (tile2 != INVALID_TILE) ShowExtraViewportWindow(tile2);
|
if (tile2 != INVALID_TILE) ShowExtraViewportWindow(tile2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -553,7 +553,7 @@ public:
|
||||||
}
|
}
|
||||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||||
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_BUILD_OBJECT, CcPlaySound_CONSTRUCTION_OTHER,
|
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_BUILD_OBJECT, CcPlaySound_CONSTRUCTION_OTHER,
|
||||||
end_tile, start_tile, spec->Index(), _selected_object_view, (_ctrl_pressed ? true : false));
|
end_tile, start_tile, spec->Index(), _selected_object_view, (_fn_pressed ? true : false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlaceObjectAbort() override
|
void OnPlaceObjectAbort() override
|
||||||
|
|
|
@ -388,7 +388,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
ODTFB_PART_OF_ORDERS,
|
ODTFB_PART_OF_ORDERS,
|
||||||
(_settings_client.gui.new_nonstop && v->IsGroundVehicle()) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
(_settings_client.gui.new_nonstop && v->IsGroundVehicle()) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||||
|
|
||||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
if (_fn_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||||
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
v->type == VEH_TRAIN &&
|
v->type == VEH_TRAIN &&
|
||||||
IsTileOwner(tile, _local_company)) {
|
IsTileOwner(tile, _local_company)) {
|
||||||
order.MakeGoToWaypoint(GetStationIndex(tile));
|
order.MakeGoToWaypoint(GetStationIndex(tile));
|
||||||
if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
|
if (_settings_client.gui.new_nonstop != _fn_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
}
|
}
|
||||||
if (st->facilities & facil) {
|
if (st->facilities & facil) {
|
||||||
order.MakeGoToStation(st->index);
|
order.MakeGoToStation(st->index);
|
||||||
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);
|
if (_fn_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);
|
||||||
if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||||
order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_END);
|
order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_END);
|
||||||
return order;
|
return order;
|
||||||
|
@ -689,16 +689,16 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the skip button.
|
* Handle the click on the skip button.
|
||||||
* If ctrl is pressed, skip to selected order, else skip to current order + 1
|
* If Fn is pressed, skip to selected order, else skip to current order + 1
|
||||||
*/
|
*/
|
||||||
void OrderClick_Skip()
|
void OrderClick_Skip()
|
||||||
{
|
{
|
||||||
/* Don't skip when there's nothing to skip */
|
/* Don't skip when there's nothing to skip */
|
||||||
if (_ctrl_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return;
|
if (_fn_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return;
|
||||||
if (this->vehicle->GetNumOrders() <= 1) return;
|
if (this->vehicle->GetNumOrders() <= 1) return;
|
||||||
|
|
||||||
Command<CMD_SKIP_TO_ORDER>::Post(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER,
|
Command<CMD_SKIP_TO_ORDER>::Post(_fn_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER,
|
||||||
this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()));
|
this->vehicle->tile, this->vehicle->index, _fn_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -717,7 +717,7 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the 'stop sharing' button.
|
* Handle the click on the 'stop sharing' button.
|
||||||
* If 'End of Shared Orders' isn't selected, do nothing. If Ctrl is pressed, call OrderClick_Delete and exit.
|
* If 'End of Shared Orders' isn't selected, do nothing. If Fn is pressed, call OrderClick_Delete and exit.
|
||||||
* To stop sharing this vehicle order list, we copy the orders of a vehicle that share this order list. That way we
|
* To stop sharing this vehicle order list, we copy the orders of a vehicle that share this order list. That way we
|
||||||
* exit the group of shared vehicles while keeping the same order list.
|
* exit the group of shared vehicles while keeping the same order list.
|
||||||
*/
|
*/
|
||||||
|
@ -725,8 +725,8 @@ private:
|
||||||
{
|
{
|
||||||
/* Don't try to stop sharing orders if 'End of Shared Orders' isn't selected. */
|
/* Don't try to stop sharing orders if 'End of Shared Orders' isn't selected. */
|
||||||
if (!this->vehicle->IsOrderListShared() || this->selected_order != this->vehicle->GetNumOrders()) return;
|
if (!this->vehicle->IsOrderListShared() || this->selected_order != this->vehicle->GetNumOrders()) return;
|
||||||
/* If Ctrl is pressed, delete the order list as if we clicked the 'Delete' button. */
|
/* If Fn is pressed, delete the order list as if we clicked the 'Delete' button. */
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
this->OrderClick_Delete();
|
this->OrderClick_Delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -741,13 +741,13 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the refit button.
|
* Handle the click on the refit button.
|
||||||
* If ctrl is pressed, cancel refitting, else show the refit window.
|
* If Fn is pressed, cancel refitting, else show the refit window.
|
||||||
* @param i Selected refit command.
|
* @param i Selected refit command.
|
||||||
* @param auto_refit Select refit for auto-refitting.
|
* @param auto_refit Select refit for auto-refitting.
|
||||||
*/
|
*/
|
||||||
void OrderClick_Refit(int i, bool auto_refit)
|
void OrderClick_Refit(int i, bool auto_refit)
|
||||||
{
|
{
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
/* Cancel refitting */
|
/* Cancel refitting */
|
||||||
Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CARGO_NO_REFIT);
|
Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CARGO_NO_REFIT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1023,7 +1023,7 @@ public:
|
||||||
this->SetWidgetLoweredState(WID_O_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
this->SetWidgetLoweredState(WID_O_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||||
}
|
}
|
||||||
/* Disable refit button if the order is no 'always go' order.
|
/* Disable refit button if the order is no 'always go' order.
|
||||||
* However, keep the service button enabled for refit-orders to allow clearing refits (without knowing about ctrl). */
|
* However, keep the service button enabled for refit-orders to allow clearing refits (without knowing about Fn). */
|
||||||
this->SetWidgetDisabledState(WID_O_REFIT,
|
this->SetWidgetDisabledState(WID_O_REFIT,
|
||||||
(order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT) ||
|
(order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT) ||
|
||||||
(!this->can_do_refit && !order->IsRefit()));
|
(!this->can_do_refit && !order->IsRefit()));
|
||||||
|
@ -1178,7 +1178,7 @@ public:
|
||||||
|
|
||||||
VehicleOrderID sel = this->GetOrderFromPt(pt.y);
|
VehicleOrderID sel = this->GetOrderFromPt(pt.y);
|
||||||
|
|
||||||
if (_ctrl_pressed && sel < this->vehicle->GetNumOrders()) {
|
if (_fn_pressed && sel < this->vehicle->GetNumOrders()) {
|
||||||
TileIndex xy = this->vehicle->GetOrder(sel)->GetLocation(this->vehicle);
|
TileIndex xy = this->vehicle->GetOrder(sel)->GetLocation(this->vehicle);
|
||||||
if (xy != INVALID_TILE) ScrollMainWindowToTile(xy);
|
if (xy != INVALID_TILE) ScrollMainWindowToTile(xy);
|
||||||
return;
|
return;
|
||||||
|
@ -1463,9 +1463,9 @@ public:
|
||||||
/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet.
|
/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet.
|
||||||
* We disallow copying orders of other vehicles if we already have at least one order entry
|
* We disallow copying orders of other vehicles if we already have at least one order entry
|
||||||
* ourself as it easily copies orders of vehicles within a station when we mean the station.
|
* ourself as it easily copies orders of vehicles within a station when we mean the station.
|
||||||
* Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
|
* Obviously if you press Fn on a non-empty orders vehicle you know what you are doing
|
||||||
* TODO: give a warning message */
|
* TODO: give a warning message */
|
||||||
bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
|
bool share_order = _fn_pressed || this->goto_type == OPOS_SHARE;
|
||||||
if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
|
if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
|
||||||
|
|
||||||
if (Command<CMD_CLONE_ORDER>::Post(share_order ? STR_ERROR_CAN_T_SHARE_ORDER_LIST : STR_ERROR_CAN_T_COPY_ORDER_LIST,
|
if (Command<CMD_CLONE_ORDER>::Post(share_order ? STR_ERROR_CAN_T_SHARE_ORDER_LIST : STR_ERROR_CAN_T_COPY_ORDER_LIST,
|
||||||
|
@ -1484,11 +1484,11 @@ public:
|
||||||
*/
|
*/
|
||||||
bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) override
|
bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) override
|
||||||
{
|
{
|
||||||
bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
|
bool share_order = _fn_pressed || this->goto_type == OPOS_SHARE;
|
||||||
if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
|
if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
|
||||||
|
|
||||||
if (!share_order) {
|
if (!share_order) {
|
||||||
/* If CTRL is not pressed: If all the vehicles in this list have the same orders, then copy orders */
|
/* If Fn is not pressed: If all the vehicles in this list have the same orders, then copy orders */
|
||||||
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
||||||
return VehiclesHaveSameOrderList(v1, v2);
|
return VehiclesHaveSameOrderList(v1, v2);
|
||||||
})) {
|
})) {
|
||||||
|
@ -1497,7 +1497,7 @@ public:
|
||||||
ShowErrorMessage(STR_ERROR_CAN_T_COPY_ORDER_LIST, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, WL_INFO);
|
ShowErrorMessage(STR_ERROR_CAN_T_COPY_ORDER_LIST, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, WL_INFO);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If CTRL is pressed: If all the vehicles in this list share orders, then copy orders */
|
/* If Fn is pressed: If all the vehicles in this list share orders, then copy orders */
|
||||||
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
if (AllEqual(begin, end, [](const Vehicle *v1, const Vehicle *v2) {
|
||||||
return v1->FirstShared() == v2->FirstShared();
|
return v1->FirstShared() == v2->FirstShared();
|
||||||
})) {
|
})) {
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai
|
||||||
* @param track track-orientation
|
* @param track track-orientation
|
||||||
* @param sigtype type of the signal
|
* @param sigtype type of the signal
|
||||||
* @param sigvar variant of signal type (normal/semaphore)
|
* @param sigvar variant of signal type (normal/semaphore)
|
||||||
* @param ctrl_pressed true = override signal/semaphore, or pre/exit/combo signal or toggle variant (CTRL-toggle)
|
* @param fn_pressed true = override signal/semaphore, or pre/exit/combo signal or toggle variant (Fn-toggle)
|
||||||
* @param convert_signal convert the present signal type and variant
|
* @param convert_signal convert the present signal type and variant
|
||||||
* @param cycle_start start cycle from this signal type
|
* @param cycle_start start cycle from this signal type
|
||||||
* @param cycle_stop wrap around after this signal type
|
* @param cycle_stop wrap around after this signal type
|
||||||
|
@ -1049,12 +1049,12 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @todo p2 should be replaced by two bits for "along" and "against" the track.
|
* @todo p2 should be replaced by two bits for "along" and "against" the track.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track track, SignalType sigtype, SignalVariant sigvar, bool convert_signal, bool skip_existing_signals, bool ctrl_pressed, SignalType cycle_start, SignalType cycle_stop, uint8_t num_dir_cycle, byte signals_copy)
|
CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track track, SignalType sigtype, SignalVariant sigvar, bool convert_signal, bool skip_existing_signals, bool fn_pressed, SignalType cycle_start, SignalType cycle_stop, uint8_t num_dir_cycle, byte signals_copy)
|
||||||
{
|
{
|
||||||
if (sigtype > SIGTYPE_LAST || sigvar > SIG_SEMAPHORE) return CMD_ERROR;
|
if (sigtype > SIGTYPE_LAST || sigvar > SIG_SEMAPHORE) return CMD_ERROR;
|
||||||
if (cycle_start > cycle_stop || cycle_stop > SIGTYPE_LAST) return CMD_ERROR;
|
if (cycle_start > cycle_stop || cycle_stop > SIGTYPE_LAST) return CMD_ERROR;
|
||||||
|
|
||||||
if (ctrl_pressed) sigvar = (SignalVariant)(sigvar ^ SIG_SEMAPHORE);
|
if (fn_pressed) sigvar = (SignalVariant)(sigvar ^ SIG_SEMAPHORE);
|
||||||
|
|
||||||
/* You can only build signals on plain rail tiles, and the selected track must exist */
|
/* You can only build signals on plain rail tiles, and the selected track must exist */
|
||||||
if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) ||
|
if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) ||
|
||||||
|
@ -1087,7 +1087,7 @@ CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track trac
|
||||||
|
|
||||||
} else if (convert_signal) {
|
} else if (convert_signal) {
|
||||||
/* convert button pressed */
|
/* convert button pressed */
|
||||||
if (ctrl_pressed || GetSignalVariant(tile, track) != sigvar) {
|
if (fn_pressed || GetSignalVariant(tile, track) != sigvar) {
|
||||||
/* it costs money to change signal variant (light or semaphore) */
|
/* it costs money to change signal variant (light or semaphore) */
|
||||||
cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1133,7 +1133,7 @@ CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track trac
|
||||||
} else {
|
} else {
|
||||||
if (convert_signal) {
|
if (convert_signal) {
|
||||||
/* convert signal button pressed */
|
/* convert signal button pressed */
|
||||||
if (ctrl_pressed) {
|
if (fn_pressed) {
|
||||||
/* toggle the present signal variant: SIG_ELECTRIC <-> SIG_SEMAPHORE */
|
/* toggle the present signal variant: SIG_ELECTRIC <-> SIG_SEMAPHORE */
|
||||||
SetSignalVariant(tile, track, (GetSignalVariant(tile, track) == SIG_ELECTRIC) ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
SetSignalVariant(tile, track, (GetSignalVariant(tile, track) == SIG_ELECTRIC) ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||||
/* Query current signal type so the check for PBS signals below works. */
|
/* Query current signal type so the check for PBS signals below works. */
|
||||||
|
@ -1147,7 +1147,7 @@ CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track trac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ctrl_pressed) {
|
} else if (fn_pressed) {
|
||||||
/* cycle between cycle_start and cycle_end */
|
/* cycle between cycle_start and cycle_end */
|
||||||
sigtype = (SignalType)(GetSignalType(tile, track) + 1);
|
sigtype = (SignalType)(GetSignalType(tile, track) + 1);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ CommandCost CmdRemoveRailroadTrack(DoCommandFlag flags, TileIndex end_tile, Tile
|
||||||
CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType railtype, Track track, bool auto_remove_signals);
|
CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType railtype, Track track, bool auto_remove_signals);
|
||||||
CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, Track track);
|
CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, Track track);
|
||||||
CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType railtype, DiagDirection dir);
|
CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType railtype, DiagDirection dir);
|
||||||
CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track track, SignalType sigtype, SignalVariant sigvar, bool convert_signal, bool skip_existing_signals, bool ctrl_pressed, SignalType cycle_start, SignalType cycle_stop, uint8_t num_dir_cycle, byte signals_copy);
|
CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, Track track, SignalType sigtype, SignalVariant sigvar, bool convert_signal, bool skip_existing_signals, bool fn_pressed, SignalType cycle_start, SignalType cycle_stop, uint8_t num_dir_cycle, byte signals_copy);
|
||||||
CommandCost CmdRemoveSingleSignal(DoCommandFlag flags, TileIndex tile, Track track);
|
CommandCost CmdRemoveSingleSignal(DoCommandFlag flags, TileIndex tile, Track track);
|
||||||
CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_start, RailType totype, bool diagonal);
|
CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_start, RailType totype, bool diagonal);
|
||||||
CommandCost CmdBuildSignalTrack(DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, SignalType sigtype, SignalVariant sigvar, bool mode, bool autofill, bool minimise_gaps, byte signal_density);
|
CommandCost CmdBuildSignalTrack(DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, SignalType sigtype, SignalVariant sigvar, bool mode, bool autofill, bool minimise_gaps, byte signal_density);
|
||||||
|
|
|
@ -204,7 +204,7 @@ static void PlaceRail_Station(TileIndex tile)
|
||||||
RailType rt = _cur_railtype;
|
RailType rt = _cur_railtype;
|
||||||
byte numtracks = _settings_client.gui.station_numtracks;
|
byte numtracks = _settings_client.gui.station_numtracks;
|
||||||
byte platlength = _settings_client.gui.station_platlength;
|
byte platlength = _settings_client.gui.station_platlength;
|
||||||
bool adjacent = _ctrl_pressed;
|
bool adjacent = _fn_pressed;
|
||||||
|
|
||||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||||
if (test) {
|
if (test) {
|
||||||
|
@ -246,11 +246,11 @@ static void GenericPlaceSignals(TileIndex tile)
|
||||||
if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr) {
|
if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr) {
|
||||||
/* signal GUI is used */
|
/* signal GUI is used */
|
||||||
Command<CMD_BUILD_SINGLE_SIGNAL>::Post(_convert_signal_button ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
Command<CMD_BUILD_SINGLE_SIGNAL>::Post(_convert_signal_button ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
||||||
tile, track, _cur_signal_type, _cur_signal_variant, _convert_signal_button, false, _ctrl_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
|
tile, track, _cur_signal_type, _cur_signal_variant, _convert_signal_button, false, _fn_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
SignalVariant sigvar = TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC;
|
SignalVariant sigvar = TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC;
|
||||||
Command<CMD_BUILD_SINGLE_SIGNAL>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
Command<CMD_BUILD_SINGLE_SIGNAL>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
||||||
tile, track, _settings_client.gui.default_signal_type, sigvar, false, false, _ctrl_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
|
tile, track, _settings_client.gui.default_signal_type, sigvar, false, false, _fn_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,11 +297,11 @@ static void ToggleRailButton_Remove(Window *w)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the Remove button because of Ctrl state change
|
* Updates the Remove button because of remove modifer state change
|
||||||
* @param w window the button belongs to
|
* @param w window the button belongs to
|
||||||
* @return true iff the remove button was changed
|
* @return true iff the remove button was changed
|
||||||
*/
|
*/
|
||||||
static bool RailToolbar_CtrlChanged(Window *w)
|
static bool RailToolbar_RemoveChanged(Window *w)
|
||||||
{
|
{
|
||||||
if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return false;
|
if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return false;
|
||||||
|
|
||||||
|
@ -393,13 +393,13 @@ static void HandleAutoSignalPlacement()
|
||||||
* in a network game can specify their own signal density */
|
* in a network game can specify their own signal density */
|
||||||
if (_remove_button_clicked) {
|
if (_remove_button_clicked) {
|
||||||
Command<CMD_REMOVE_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL,
|
Command<CMD_REMOVE_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL,
|
||||||
TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, _ctrl_pressed);
|
TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, _fn_pressed);
|
||||||
} else {
|
} else {
|
||||||
bool sig_gui = FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr;
|
bool sig_gui = FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr;
|
||||||
SignalType sigtype = sig_gui ? _cur_signal_type : _settings_client.gui.default_signal_type;
|
SignalType sigtype = sig_gui ? _cur_signal_type : _settings_client.gui.default_signal_type;
|
||||||
SignalVariant sigvar = sig_gui ? _cur_signal_variant : (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
SignalVariant sigvar = sig_gui ? _cur_signal_variant : (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||||
Command<CMD_BUILD_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
Command<CMD_BUILD_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
||||||
TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, sigtype, sigvar, false, _ctrl_pressed, !_settings_client.gui.drag_signals_fixed_distance, _settings_client.gui.drag_signals_density);
|
TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, sigtype, sigvar, false, _fn_pressed, !_settings_client.gui.drag_signals_fixed_distance, _settings_client.gui.drag_signals_density);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
case WID_RAT_BUILD_SIGNALS: {
|
case WID_RAT_BUILD_SIGNALS: {
|
||||||
this->last_user_action = widget;
|
this->last_user_action = widget;
|
||||||
bool started = HandlePlacePushButton(this, WID_RAT_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT);
|
bool started = HandlePlacePushButton(this, WID_RAT_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT);
|
||||||
if (started != _ctrl_pressed) {
|
if (started != _fn_pressed) {
|
||||||
ShowSignalBuilder(this);
|
ShowSignalBuilder(this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -624,7 +624,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
this->UpdateRemoveWidgetStatus(widget);
|
this->UpdateRemoveWidgetStatus(widget);
|
||||||
if (_ctrl_pressed) RailToolbar_CtrlChanged(this);
|
if (_remove_pressed) RailToolbar_RemoveChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventState OnHotkey(int hotkey) override
|
EventState OnHotkey(int hotkey) override
|
||||||
|
@ -723,7 +723,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DDSP_CONVERT_RAIL:
|
case DDSP_CONVERT_RAIL:
|
||||||
Command<CMD_CONVERT_RAIL>::Post(STR_ERROR_CAN_T_CONVERT_RAIL, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, _cur_railtype, _ctrl_pressed);
|
Command<CMD_CONVERT_RAIL>::Post(STR_ERROR_CAN_T_CONVERT_RAIL, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, _cur_railtype, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DDSP_REMOVE_STATION:
|
case DDSP_REMOVE_STATION:
|
||||||
|
@ -731,7 +731,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) {
|
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) {
|
||||||
/* Station */
|
/* Station */
|
||||||
if (_remove_button_clicked) {
|
if (_remove_button_clicked) {
|
||||||
bool keep_rail = !_ctrl_pressed;
|
bool keep_rail = !_fn_pressed;
|
||||||
Command<CMD_REMOVE_FROM_RAIL_STATION>::Post(STR_ERROR_CAN_T_REMOVE_PART_OF_STATION, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, keep_rail);
|
Command<CMD_REMOVE_FROM_RAIL_STATION>::Post(STR_ERROR_CAN_T_REMOVE_PART_OF_STATION, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, keep_rail);
|
||||||
} else {
|
} else {
|
||||||
HandleStationPlacement(start_tile, end_tile);
|
HandleStationPlacement(start_tile, end_tile);
|
||||||
|
@ -739,12 +739,12 @@ struct BuildRailToolbarWindow : Window {
|
||||||
} else {
|
} else {
|
||||||
/* Waypoint */
|
/* Waypoint */
|
||||||
if (_remove_button_clicked) {
|
if (_remove_button_clicked) {
|
||||||
bool keep_rail = !_ctrl_pressed;
|
bool keep_rail = !_fn_pressed;
|
||||||
Command<CMD_REMOVE_FROM_RAIL_WAYPOINT>::Post(STR_ERROR_CAN_T_REMOVE_TRAIN_WAYPOINT, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, keep_rail);
|
Command<CMD_REMOVE_FROM_RAIL_WAYPOINT>::Post(STR_ERROR_CAN_T_REMOVE_TRAIN_WAYPOINT, CcPlaySound_CONSTRUCTION_RAIL, end_tile, start_tile, keep_rail);
|
||||||
} else {
|
} else {
|
||||||
TileArea ta(start_tile, end_tile);
|
TileArea ta(start_tile, end_tile);
|
||||||
Axis axis = select_method == VPM_X_LIMITED ? AXIS_X : AXIS_Y;
|
Axis axis = select_method == VPM_X_LIMITED ? AXIS_X : AXIS_Y;
|
||||||
bool adjacent = _ctrl_pressed;
|
bool adjacent = _fn_pressed;
|
||||||
uint16_t waypoint_type = _cur_waypoint_type;
|
uint16_t waypoint_type = _cur_waypoint_type;
|
||||||
|
|
||||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||||
|
@ -786,10 +786,10 @@ struct BuildRailToolbarWindow : Window {
|
||||||
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
|
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventState OnCTRLStateChange() override
|
EventState OnRemoveStateChange() override
|
||||||
{
|
{
|
||||||
/* do not toggle Remove button by Ctrl when placing station */
|
/* do not toggle Remove button by remove modifier when placing station */
|
||||||
if (!this->IsWidgetLowered(WID_RAT_BUILD_STATION) && !this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT) && RailToolbar_CtrlChanged(this)) return ES_HANDLED;
|
if (!this->IsWidgetLowered(WID_RAT_BUILD_STATION) && !this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT) && RailToolbar_RemoveChanged(this)) return ES_HANDLED;
|
||||||
return ES_NOT_HANDLED;
|
return ES_NOT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
|
||||||
|
|
||||||
RailStationGUISettings params = _railstation;
|
RailStationGUISettings params = _railstation;
|
||||||
RailType rt = _cur_railtype;
|
RailType rt = _cur_railtype;
|
||||||
bool adjacent = _ctrl_pressed;
|
bool adjacent = _fn_pressed;
|
||||||
|
|
||||||
auto proc = [=](bool test, StationID to_join) -> bool {
|
auto proc = [=](bool test, StationID to_join) -> bool {
|
||||||
if (test) {
|
if (test) {
|
||||||
|
|
|
@ -285,11 +285,11 @@ static void ToggleRoadButton_Remove(Window *w)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the Remove button because of Ctrl state change
|
* Updates the Remove button because of remove modifer state change
|
||||||
* @param w window the button belongs to
|
* @param w window the button belongs to
|
||||||
* @return true iff the remove button was changed
|
* @return true iff the remove button was changed
|
||||||
*/
|
*/
|
||||||
static bool RoadToolbar_CtrlChanged(Window *w)
|
static bool RoadToolbar_RemoveChanged(Window *w)
|
||||||
{
|
{
|
||||||
if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
|
if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
this->UpdateOptionWidgetStatus((RoadToolbarWidgets)widget);
|
this->UpdateOptionWidgetStatus((RoadToolbarWidgets)widget);
|
||||||
if (_ctrl_pressed) RoadToolbar_CtrlChanged(this);
|
if (_remove_pressed) RoadToolbar_RemoveChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventState OnHotkey(int hotkey) override
|
EventState OnHotkey(int hotkey) override
|
||||||
|
@ -709,9 +709,9 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
if (this->IsWidgetLowered(WID_ROT_BUS_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_BUS, _cur_roadtype)) {
|
if (this->IsWidgetLowered(WID_ROT_BUS_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_BUS, _cur_roadtype)) {
|
||||||
if (_remove_button_clicked) {
|
if (_remove_button_clicked) {
|
||||||
TileArea ta(start_tile, end_tile);
|
TileArea ta(start_tile, end_tile);
|
||||||
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_BUS], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_BUS, _ctrl_pressed);
|
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_BUS], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_BUS, _fn_pressed);
|
||||||
} else {
|
} else {
|
||||||
PlaceRoadStop(start_tile, end_tile, ROADSTOP_BUS, _ctrl_pressed, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_BUS]);
|
PlaceRoadStop(start_tile, end_tile, ROADSTOP_BUS, _fn_pressed, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_BUS]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -721,9 +721,9 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_TRUCK, _cur_roadtype)) {
|
if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_TRUCK, _cur_roadtype)) {
|
||||||
if (_remove_button_clicked) {
|
if (_remove_button_clicked) {
|
||||||
TileArea ta(start_tile, end_tile);
|
TileArea ta(start_tile, end_tile);
|
||||||
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_TRUCK], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_TRUCK, _ctrl_pressed);
|
Command<CMD_REMOVE_ROAD_STOP>::Post(this->rti->strings.err_remove_station[ROADSTOP_TRUCK], CcPlaySound_CONSTRUCTION_OTHER, ta.tile, ta.w, ta.h, ROADSTOP_TRUCK, _fn_pressed);
|
||||||
} else {
|
} else {
|
||||||
PlaceRoadStop(start_tile, end_tile, ROADSTOP_TRUCK, _ctrl_pressed, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_TRUCK]);
|
PlaceRoadStop(start_tile, end_tile, ROADSTOP_TRUCK, _fn_pressed, _cur_roadtype, this->rti->strings.err_build_station[ROADSTOP_TRUCK]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -741,9 +741,9 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
|
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventState OnCTRLStateChange() override
|
EventState OnRemoveStateChange() override
|
||||||
{
|
{
|
||||||
if (RoadToolbar_CtrlChanged(this)) return ES_HANDLED;
|
if (RoadToolbar_RemoveChanged(this)) return ES_HANDLED;
|
||||||
return ES_NOT_HANDLED;
|
return ES_NOT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1042,12 +1042,12 @@ struct ScriptDebugWindow : public Window {
|
||||||
|
|
||||||
/* Check which button is clicked */
|
/* Check which button is clicked */
|
||||||
if (IsInsideMM(widget, WID_SCRD_COMPANY_BUTTON_START, WID_SCRD_COMPANY_BUTTON_END + 1)) {
|
if (IsInsideMM(widget, WID_SCRD_COMPANY_BUTTON_START, WID_SCRD_COMPANY_BUTTON_END + 1)) {
|
||||||
ChangeToScript((CompanyID)(widget - WID_SCRD_COMPANY_BUTTON_START), _ctrl_pressed);
|
ChangeToScript((CompanyID)(widget - WID_SCRD_COMPANY_BUTTON_START), _fn_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_SCRD_SCRIPT_GAME:
|
case WID_SCRD_SCRIPT_GAME:
|
||||||
ChangeToScript(OWNER_DEITY, _ctrl_pressed);
|
ChangeToScript(OWNER_DEITY, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_SCRD_RELOAD_TOGGLE:
|
case WID_SCRD_RELOAD_TOGGLE:
|
||||||
|
|
|
@ -785,7 +785,7 @@ struct GameOptionsWindow : Window {
|
||||||
|
|
||||||
case WID_GO_GUI_SCALE:
|
case WID_GO_GUI_SCALE:
|
||||||
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE, this->gui_scale)) {
|
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE, this->gui_scale)) {
|
||||||
if (!_ctrl_pressed) this->gui_scale = ((this->gui_scale + 12) / 25) * 25;
|
if (!_fn_pressed) this->gui_scale = ((this->gui_scale + 12) / 25) * 25;
|
||||||
this->SetWidgetDirty(widget);
|
this->SetWidgetDirty(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ struct SignWindow : Window, SignList {
|
||||||
case WID_QES_LOCATION: {
|
case WID_QES_LOCATION: {
|
||||||
const Sign *si = Sign::Get(this->cur_sign);
|
const Sign *si = Sign::Get(this->cur_sign);
|
||||||
TileIndex tile = TileVirtXY(si->x, si->y);
|
TileIndex tile = TileVirtXY(si->x, si->y);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(tile);
|
ShowExtraViewportWindow(tile);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(tile);
|
ScrollMainWindowToTile(tile);
|
||||||
|
@ -565,7 +565,7 @@ void HandleClickOnSign(const Sign *si)
|
||||||
/* If we can't rename the sign, don't even open the rename GUI. */
|
/* If we can't rename the sign, don't even open the rename GUI. */
|
||||||
if (!CompanyCanRenameSign(si)) return;
|
if (!CompanyCanRenameSign(si)) return;
|
||||||
|
|
||||||
if (_ctrl_pressed && (si->owner == _local_company || (si->owner == OWNER_DEITY && _game_mode == GM_EDITOR))) {
|
if (_fn_pressed && (si->owner == _local_company || (si->owner == OWNER_DEITY && _game_mode == GM_EDITOR))) {
|
||||||
RenameSign(si->index, "");
|
RenameSign(si->index, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -792,7 +792,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item = 0)
|
void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item = 0)
|
||||||
{
|
{
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
/* Disable all, except the clicked one */
|
/* Disable all, except the clicked one */
|
||||||
bool changes = false;
|
bool changes = false;
|
||||||
for (int i = begin_legend_item; i != end_legend_item; i++) {
|
for (int i = begin_legend_item; i != end_legend_item; i++) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ template <typename T>
|
||||||
void FindStationsAroundSelection()
|
void FindStationsAroundSelection()
|
||||||
{
|
{
|
||||||
/* With distant join we don't know which station will be selected, so don't show any */
|
/* With distant join we don't know which station will be selected, so don't show any */
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
SetViewportCatchmentSpecializedStation<T>(nullptr, true);
|
SetViewportCatchmentSpecializedStation<T>(nullptr, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,11 +125,11 @@ void FindStationsAroundSelection()
|
||||||
*/
|
*/
|
||||||
void CheckRedrawStationCoverage(const Window *w)
|
void CheckRedrawStationCoverage(const Window *w)
|
||||||
{
|
{
|
||||||
/* Test if ctrl state changed */
|
/* Test if fn modifer state changed */
|
||||||
static bool _last_ctrl_pressed;
|
static bool _last_fn_pressed;
|
||||||
if (_ctrl_pressed != _last_ctrl_pressed) {
|
if (_fn_pressed != _last_fn_pressed) {
|
||||||
_thd.dirty = 0xff;
|
_thd.dirty = 0xff;
|
||||||
_last_ctrl_pressed = _ctrl_pressed;
|
_last_fn_pressed = _fn_pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_thd.dirty & 1) {
|
if (_thd.dirty & 1) {
|
||||||
|
@ -145,10 +145,10 @@ void CheckRedrawStationCoverage(const Window *w)
|
||||||
void CheckRedrawWaypointCoverage(const Window *)
|
void CheckRedrawWaypointCoverage(const Window *)
|
||||||
{
|
{
|
||||||
/* Test if ctrl state changed */
|
/* Test if ctrl state changed */
|
||||||
static bool _last_ctrl_pressed;
|
static bool _last_fn_pressed;
|
||||||
if (_ctrl_pressed != _last_ctrl_pressed) {
|
if (_fn_pressed != _last_fn_pressed) {
|
||||||
_thd.dirty = 0xff;
|
_thd.dirty = 0xff;
|
||||||
_last_ctrl_pressed = _ctrl_pressed;
|
_last_fn_pressed = _fn_pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_thd.dirty & 1) {
|
if (_thd.dirty & 1) {
|
||||||
|
@ -544,7 +544,7 @@ public:
|
||||||
/* do not check HasStationInUse - it is slow and may be invalid */
|
/* do not check HasStationInUse - it is slow and may be invalid */
|
||||||
assert(st->owner == (Owner)this->window_number || st->owner == OWNER_NONE);
|
assert(st->owner == (Owner)this->window_number || st->owner == OWNER_NONE);
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(st->xy);
|
ShowExtraViewportWindow(st->xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(st->xy);
|
ScrollMainWindowToTile(st->xy);
|
||||||
|
@ -557,7 +557,7 @@ public:
|
||||||
case WID_STL_BUS:
|
case WID_STL_BUS:
|
||||||
case WID_STL_AIRPLANE:
|
case WID_STL_AIRPLANE:
|
||||||
case WID_STL_SHIP:
|
case WID_STL_SHIP:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ToggleBit(this->filter.facilities, widget - WID_STL_TRAIN);
|
ToggleBit(this->filter.facilities, widget - WID_STL_TRAIN);
|
||||||
this->ToggleWidgetLoweredState(widget);
|
this->ToggleWidgetLoweredState(widget);
|
||||||
} else {
|
} else {
|
||||||
|
@ -604,7 +604,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_STL_NOCARGOWAITING:
|
case WID_STL_NOCARGOWAITING:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
this->filter.include_empty = !this->filter.include_empty;
|
this->filter.include_empty = !this->filter.include_empty;
|
||||||
this->ToggleWidgetLoweredState(WID_STL_NOCARGOWAITING);
|
this->ToggleWidgetLoweredState(WID_STL_NOCARGOWAITING);
|
||||||
} else {
|
} else {
|
||||||
|
@ -626,8 +626,9 @@ public:
|
||||||
/* Determine the selected cargo type */
|
/* Determine the selected cargo type */
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[widget - WID_STL_CARGOSTART];
|
const CargoSpec *cs = _sorted_cargo_specs[widget - WID_STL_CARGOSTART];
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ToggleBit(this->filter.cargoes, cs->Index());
|
ToggleBit(this->filter.cargoes, cs->Index());
|
||||||
|
|
||||||
this->ToggleWidgetLoweredState(widget);
|
this->ToggleWidgetLoweredState(widget);
|
||||||
} else {
|
} else {
|
||||||
for (uint i = 0; i < _sorted_standard_cargo_specs.size(); i++) {
|
for (uint i = 0; i < _sorted_standard_cargo_specs.size(); i++) {
|
||||||
|
@ -1901,7 +1902,7 @@ struct StationViewWindow : public Window {
|
||||||
void HandleCargoWaitingClick(int row)
|
void HandleCargoWaitingClick(int row)
|
||||||
{
|
{
|
||||||
if (row < 0 || (uint)row >= this->displayed_rows.size()) return;
|
if (row < 0 || (uint)row >= this->displayed_rows.size()) return;
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
this->scroll_to_row = row;
|
this->scroll_to_row = row;
|
||||||
} else {
|
} else {
|
||||||
RowDisplay &display = this->displayed_rows[row];
|
RowDisplay &display = this->displayed_rows[row];
|
||||||
|
@ -1926,7 +1927,7 @@ struct StationViewWindow : public Window {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_SV_LOCATION:
|
case WID_SV_LOCATION:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(Station::Get(this->window_number)->xy);
|
ShowExtraViewportWindow(Station::Get(this->window_number)->xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(Station::Get(this->window_number)->xy);
|
ScrollMainWindowToTile(Station::Get(this->window_number)->xy);
|
||||||
|
@ -2423,7 +2424,7 @@ static bool StationJoinerNeeded(TileArea ta, const StationPickerCmdProc &proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only show the popup, if we press ctrl */
|
/* only show the popup, if we press ctrl */
|
||||||
if (!_ctrl_pressed) return false;
|
if (!_fn_pressed) return false;
|
||||||
|
|
||||||
/* Now check if we could build there */
|
/* Now check if we could build there */
|
||||||
if (!proc(true, INVALID_STATION)) return false;
|
if (!proc(true, INVALID_STATION)) return false;
|
||||||
|
|
|
@ -542,7 +542,7 @@ protected:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPET_LOCATION:
|
case SPET_LOCATION:
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow((TileIndex)pe.referenced_id);
|
ShowExtraViewportWindow((TileIndex)pe.referenced_id);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile((TileIndex)pe.referenced_id);
|
ScrollMainWindowToTile((TileIndex)pe.referenced_id);
|
||||||
|
|
|
@ -82,8 +82,8 @@ struct SubsidyListWindow : Window {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ctrl_pressed || !ScrollMainWindowToTile(xy)) {
|
if (_fn_pressed || !ScrollMainWindowToTile(xy)) {
|
||||||
if (_ctrl_pressed) ShowExtraViewportWindow(xy);
|
if (_fn_pressed) ShowExtraViewportWindow(xy);
|
||||||
|
|
||||||
/* otherwise determine dst coordinate for subsidy and scroll to it */
|
/* otherwise determine dst coordinate for subsidy and scroll to it */
|
||||||
switch (s->dst_type) {
|
switch (s->dst_type) {
|
||||||
|
@ -92,7 +92,7 @@ struct SubsidyListWindow : Window {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(xy);
|
ShowExtraViewportWindow(xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(xy);
|
ScrollMainWindowToTile(xy);
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void GenerateDesertArea(TileIndex end, TileIndex start)
|
||||||
|
|
||||||
TileArea ta(start, end);
|
TileArea ta(start, end);
|
||||||
for (TileIndex tile : ta) {
|
for (TileIndex tile : ta) {
|
||||||
SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
|
SetTropicZone(tile, (_remove_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
|
||||||
Command<CMD_LANDSCAPE_CLEAR>::Post(tile);
|
Command<CMD_LANDSCAPE_CLEAR>::Post(tile);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
|
@ -119,16 +119,16 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t
|
||||||
|
|
||||||
switch (proc) {
|
switch (proc) {
|
||||||
case DDSP_DEMOLISH_AREA:
|
case DDSP_DEMOLISH_AREA:
|
||||||
Command<CMD_CLEAR_AREA>::Post(STR_ERROR_CAN_T_CLEAR_THIS_AREA, CcPlaySound_EXPLOSION, end_tile, start_tile, _ctrl_pressed);
|
Command<CMD_CLEAR_AREA>::Post(STR_ERROR_CAN_T_CLEAR_THIS_AREA, CcPlaySound_EXPLOSION, end_tile, start_tile, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
case DDSP_RAISE_AND_LEVEL_AREA:
|
case DDSP_RAISE_AND_LEVEL_AREA:
|
||||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_RAISE_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_RAISE);
|
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_RAISE_LAND_HERE, CcTerraform, end_tile, start_tile, _fn_pressed, LM_RAISE);
|
||||||
break;
|
break;
|
||||||
case DDSP_LOWER_AND_LEVEL_AREA:
|
case DDSP_LOWER_AND_LEVEL_AREA:
|
||||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LOWER_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_LOWER);
|
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LOWER_LAND_HERE, CcTerraform, end_tile, start_tile, _fn_pressed, LM_LOWER);
|
||||||
break;
|
break;
|
||||||
case DDSP_LEVEL_AREA:
|
case DDSP_LEVEL_AREA:
|
||||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LEVEL_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_LEVEL);
|
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LEVEL_LAND_HERE, CcTerraform, end_tile, start_tile, _fn_pressed, LM_LEVEL);
|
||||||
break;
|
break;
|
||||||
case DDSP_CREATE_ROCKS:
|
case DDSP_CREATE_ROCKS:
|
||||||
GenerateRockyArea(end_tile, start_tile);
|
GenerateRockyArea(end_tile, start_tile);
|
||||||
|
@ -284,7 +284,7 @@ struct TerraformToolbarWindow : Window {
|
||||||
if (TileY(end_tile) == Map::MaxY()) end_tile += TileDiffXY(0, -1);
|
if (TileY(end_tile) == Map::MaxY()) end_tile += TileDiffXY(0, -1);
|
||||||
}
|
}
|
||||||
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_PURCHASE_THIS_LAND, CcPlaySound_CONSTRUCTION_RAIL,
|
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_PURCHASE_THIS_LAND, CcPlaySound_CONSTRUCTION_RAIL,
|
||||||
end_tile, start_tile, OBJECT_OWNED_LAND, 0, (_ctrl_pressed ? true : false));
|
end_tile, start_tile, OBJECT_OWNED_LAND, 0, (_fn_pressed ? true : false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,8 +204,8 @@ struct TimetableWindow : Window {
|
||||||
const Vehicle *vehicle; ///< Vehicle monitored by the window.
|
const Vehicle *vehicle; ///< Vehicle monitored by the window.
|
||||||
bool show_expected; ///< Whether we show expected arrival or scheduled.
|
bool show_expected; ///< Whether we show expected arrival or scheduled.
|
||||||
Scrollbar *vscroll; ///< The scrollbar.
|
Scrollbar *vscroll; ///< The scrollbar.
|
||||||
bool set_start_date_all; ///< Set start date using minutes text entry for all timetable entries (ctrl-click) action.
|
bool set_start_date_all; ///< Set start date using minutes text entry for all timetable entries (Fn-click) action.
|
||||||
bool change_timetable_all; ///< Set wait time or speed for all timetable entries (ctrl-click) action.
|
bool change_timetable_all; ///< Set wait time or speed for all timetable entries (Fn-click) action.
|
||||||
|
|
||||||
TimetableWindow(WindowDesc *desc, WindowNumber window_number) :
|
TimetableWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||||
Window(desc),
|
Window(desc),
|
||||||
|
@ -646,10 +646,10 @@ struct TimetableWindow : Window {
|
||||||
case WID_VT_START_DATE: // Change the date that the timetable starts.
|
case WID_VT_START_DATE: // Change the date that the timetable starts.
|
||||||
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
this->query_widget = WID_VT_START_DATE;
|
this->query_widget = WID_VT_START_DATE;
|
||||||
this->change_timetable_all = _ctrl_pressed;
|
this->change_timetable_all = _fn_pressed;
|
||||||
ShowQueryString(STR_EMPTY, STR_TIMETABLE_START_SECONDS_QUERY, 6, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
|
ShowQueryString(STR_EMPTY, STR_TIMETABLE_START_SECONDS_QUERY, 6, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
|
||||||
} else {
|
} else {
|
||||||
ShowSetDateWindow(this, v->index, TimerGameEconomy::date, TimerGameEconomy::year, TimerGameEconomy::year + MAX_TIMETABLE_START_YEARS, ChangeTimetableStartCallback, reinterpret_cast<void*>(static_cast<uintptr_t>(_ctrl_pressed)));
|
ShowSetDateWindow(this, v->index, TimerGameEconomy::date, TimerGameEconomy::year, TimerGameEconomy::year + MAX_TIMETABLE_START_YEARS, ChangeTimetableStartCallback, reinterpret_cast<void*>(static_cast<uintptr_t>(_fn_pressed)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->change_timetable_all = _ctrl_pressed && (order != nullptr);
|
this->change_timetable_all = _fn_pressed && (order != nullptr);
|
||||||
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
|
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -694,14 +694,14 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->change_timetable_all = _ctrl_pressed && (order != nullptr);
|
this->change_timetable_all = _fn_pressed && (order != nullptr);
|
||||||
ShowQueryString(current, STR_TIMETABLE_CHANGE_SPEED, 31, this, CS_NUMERAL, QSF_NONE);
|
ShowQueryString(current, STR_TIMETABLE_CHANGE_SPEED, 31, this, CS_NUMERAL, QSF_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_VT_CLEAR_TIME: { // Clear waiting time.
|
case WID_VT_CLEAR_TIME: { // Clear waiting time.
|
||||||
auto [order_id, mtf] = PackTimetableArgs(v, this->sel_index, false);
|
auto [order_id, mtf] = PackTimetableArgs(v, this->sel_index, false);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, 0);
|
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, 0);
|
||||||
} else {
|
} else {
|
||||||
Command<CMD_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, order_id, mtf, 0);
|
Command<CMD_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, order_id, mtf, 0);
|
||||||
|
@ -711,7 +711,7 @@ struct TimetableWindow : Window {
|
||||||
|
|
||||||
case WID_VT_CLEAR_SPEED: { // Clear max speed button.
|
case WID_VT_CLEAR_SPEED: { // Clear max speed button.
|
||||||
auto [order_id, mtf] = PackTimetableArgs(v, this->sel_index, true);
|
auto [order_id, mtf] = PackTimetableArgs(v, this->sel_index, true);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, UINT16_MAX);
|
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, UINT16_MAX);
|
||||||
} else {
|
} else {
|
||||||
Command<CMD_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, order_id, mtf, UINT16_MAX);
|
Command<CMD_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, order_id, mtf, UINT16_MAX);
|
||||||
|
@ -720,11 +720,11 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_VT_RESET_LATENESS: // Reset the vehicle's late counter.
|
case WID_VT_RESET_LATENESS: // Reset the vehicle's late counter.
|
||||||
Command<CMD_SET_VEHICLE_ON_TIME>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, _ctrl_pressed);
|
Command<CMD_SET_VEHICLE_ON_TIME>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_VT_AUTOFILL: { // Autofill the timetable.
|
case WID_VT_AUTOFILL: { // Autofill the timetable.
|
||||||
Command<CMD_AUTOFILL_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, !HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE), _ctrl_pressed);
|
Command<CMD_AUTOFILL_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, !HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE), _fn_pressed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1133,7 +1133,7 @@ static CallBackFunction MenuClickHelp(int index)
|
||||||
case 0: return PlaceLandBlockInfo();
|
case 0: return PlaceLandBlockInfo();
|
||||||
case 1: ShowHelpWindow(); break;
|
case 1: ShowHelpWindow(); break;
|
||||||
case 2: IConsoleSwitch(); break;
|
case 2: IConsoleSwitch(); break;
|
||||||
case 3: ShowScriptDebugWindow(INVALID_COMPANY, _ctrl_pressed); break;
|
case 3: ShowScriptDebugWindow(INVALID_COMPANY, _fn_pressed); break;
|
||||||
case 4: ShowScreenshotWindow(); break;
|
case 4: ShowScreenshotWindow(); break;
|
||||||
case 5: ShowFramerateWindow(); break;
|
case 5: ShowFramerateWindow(); break;
|
||||||
case 6: ShowAboutWindow(); break;
|
case 6: ShowAboutWindow(); break;
|
||||||
|
|
|
@ -493,7 +493,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_TV_CENTER_VIEW: // scroll to location
|
case WID_TV_CENTER_VIEW: // scroll to location
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(this->town->xy);
|
ShowExtraViewportWindow(this->town->xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(this->town->xy);
|
ScrollMainWindowToTile(this->town->xy);
|
||||||
|
@ -958,7 +958,7 @@ public:
|
||||||
|
|
||||||
const Town *t = *it;
|
const Town *t = *it;
|
||||||
assert(t != nullptr);
|
assert(t != nullptr);
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(t->xy);
|
ShowExtraViewportWindow(t->xy);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(t->xy);
|
ScrollMainWindowToTile(t->xy);
|
||||||
|
@ -1217,7 +1217,7 @@ public:
|
||||||
tile, this->town_size, this->city, this->town_layout, random, townnameparts, name);
|
tile, this->town_size, this->city, this->town_layout, random, townnameparts, name);
|
||||||
|
|
||||||
/* Rerandomise name, if success and no cost-estimation. */
|
/* Rerandomise name, if success and no cost-estimation. */
|
||||||
if (success && !_shift_pressed) this->RandomTownName();
|
if (success && !_estimate_pressed) this->RandomTownName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||||
{
|
{
|
||||||
if (widget >= WID_TT_BEGIN && widget < WID_TT_END) {
|
if (widget >= WID_TT_BEGIN && widget < WID_TT_END) {
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
/* toggle the bit of the transparencies lock variable */
|
/* toggle the bit of the transparencies lock variable */
|
||||||
ToggleTransparencyLock((TransparencyOption)(widget - WID_TT_BEGIN));
|
ToggleTransparencyLock((TransparencyOption)(widget - WID_TT_BEGIN));
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
|
|
@ -239,7 +239,7 @@ public:
|
||||||
void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
|
void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL && pt.x != -1 && select_proc == DDSP_PLANT_TREES) {
|
if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL && pt.x != -1 && select_proc == DDSP_PLANT_TREES) {
|
||||||
Command<CMD_PLANT_TREE>::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant, _ctrl_pressed);
|
Command<CMD_PLANT_TREE>::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant, _fn_pressed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1155,7 +1155,7 @@ struct RefitWindow : public Window {
|
||||||
|
|
||||||
/* If the selection is not correct, clear it. */
|
/* If the selection is not correct, clear it. */
|
||||||
if (this->num_vehicles != 0) {
|
if (this->num_vehicles != 0) {
|
||||||
if (_ctrl_pressed) this->num_vehicles = UINT8_MAX;
|
if (_fn_pressed) this->num_vehicles = UINT8_MAX;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
|
@ -1178,7 +1178,7 @@ struct RefitWindow : public Window {
|
||||||
this->click_x = GetClickPosition(pt.x - nwi->pos_x);
|
this->click_x = GetClickPosition(pt.x - nwi->pos_x);
|
||||||
this->SetSelectedVehicles(pt.x - nwi->pos_x);
|
this->SetSelectedVehicles(pt.x - nwi->pos_x);
|
||||||
this->SetWidgetDirty(WID_VR_VEHICLE_PANEL_DISPLAY);
|
this->SetWidgetDirty(WID_VR_VEHICLE_PANEL_DISPLAY);
|
||||||
if (!_ctrl_pressed) {
|
if (!_fn_pressed) {
|
||||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||||
} else {
|
} else {
|
||||||
/* The vehicle selection has changed. */
|
/* The vehicle selection has changed. */
|
||||||
|
@ -2074,7 +2074,7 @@ public:
|
||||||
case GB_NONE: {
|
case GB_NONE: {
|
||||||
const Vehicle *v = vehgroup.GetSingleVehicle();
|
const Vehicle *v = vehgroup.GetSingleVehicle();
|
||||||
if (!VehicleClicked(v)) {
|
if (!VehicleClicked(v)) {
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowCompanyGroupForVehicle(v);
|
ShowCompanyGroupForVehicle(v);
|
||||||
} else {
|
} else {
|
||||||
ShowVehicleViewWindow(v);
|
ShowVehicleViewWindow(v);
|
||||||
|
@ -2087,7 +2087,7 @@ public:
|
||||||
assert(vehgroup.NumVehicles() > 0);
|
assert(vehgroup.NumVehicles() > 0);
|
||||||
if (!VehicleClicked(vehgroup)) {
|
if (!VehicleClicked(vehgroup)) {
|
||||||
const Vehicle *v = vehgroup.vehicles_begin[0];
|
const Vehicle *v = vehgroup.vehicles_begin[0];
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowOrdersWindow(v);
|
ShowOrdersWindow(v);
|
||||||
} else {
|
} else {
|
||||||
if (vehgroup.NumVehicles() == 1) {
|
if (vehgroup.NumVehicles() == 1) {
|
||||||
|
@ -2232,10 +2232,10 @@ void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type)
|
||||||
{
|
{
|
||||||
/* If _settings_client.gui.advanced_vehicle_list > 1, display the Advanced list
|
/* If _settings_client.gui.advanced_vehicle_list > 1, display the Advanced list
|
||||||
* if _settings_client.gui.advanced_vehicle_list == 1, display Advanced list only for local company
|
* if _settings_client.gui.advanced_vehicle_list == 1, display Advanced list only for local company
|
||||||
* if _ctrl_pressed, do the opposite action (Advanced list x Normal list)
|
* if _fn_pressed, do the opposite action (Advanced list x Normal list)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((_settings_client.gui.advanced_vehicle_list > (uint)(company != _local_company)) != _ctrl_pressed) {
|
if ((_settings_client.gui.advanced_vehicle_list > (uint)(company != _local_company)) != _fn_pressed) {
|
||||||
ShowCompanyGroup(company, vehicle_type);
|
ShowCompanyGroup(company, vehicle_type);
|
||||||
} else {
|
} else {
|
||||||
ShowVehicleListWindowLocal(company, VL_STANDARD, vehicle_type, company);
|
ShowVehicleListWindowLocal(company, VL_STANDARD, vehicle_type, company);
|
||||||
|
@ -2687,9 +2687,9 @@ struct VehicleDetailsWindow : Window {
|
||||||
const Vehicle *v = Vehicle::Get(this->window_number);
|
const Vehicle *v = Vehicle::Get(this->window_number);
|
||||||
int mod;
|
int mod;
|
||||||
if (!v->ServiceIntervalIsPercent() && TimerGameEconomy::UsingWallclockUnits()) {
|
if (!v->ServiceIntervalIsPercent() && TimerGameEconomy::UsingWallclockUnits()) {
|
||||||
mod = _ctrl_pressed ? 1 : 5;
|
mod = _fn_pressed ? 1 : 5;
|
||||||
} else {
|
} else {
|
||||||
mod = _ctrl_pressed ? 5 : 10;
|
mod = _fn_pressed ? 5 : 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = (widget == WID_VD_DECREASE_SERVICING_INTERVAL) ? -mod : mod;
|
mod = (widget == WID_VD_DECREASE_SERVICING_INTERVAL) ? -mod : mod;
|
||||||
|
@ -3209,7 +3209,7 @@ public:
|
||||||
TileIndex tile = v->current_order.GetLocation(v);
|
TileIndex tile = v->current_order.GetLocation(v);
|
||||||
if (tile == INVALID_TILE) break;
|
if (tile == INVALID_TILE) break;
|
||||||
|
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(tile);
|
ShowExtraViewportWindow(tile);
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(tile);
|
ScrollMainWindowToTile(tile);
|
||||||
|
@ -3218,7 +3218,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_VV_LOCATION: // center main view
|
case WID_VV_LOCATION: // center main view
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(TileVirtXY(v->x_pos, v->y_pos));
|
ShowExtraViewportWindow(TileVirtXY(v->x_pos, v->y_pos));
|
||||||
} else {
|
} else {
|
||||||
const Window *mainwindow = GetMainWindow();
|
const Window *mainwindow = GetMainWindow();
|
||||||
|
@ -3232,20 +3232,20 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_VV_GOTO_DEPOT: // goto hangar
|
case WID_VV_GOTO_DEPOT: // goto hangar
|
||||||
Command<CMD_SEND_VEHICLE_TO_DEPOT>::Post(GetCmdSendToDepotMsg(v), v->index, _ctrl_pressed ? DepotCommand::Service : DepotCommand::None, {});
|
Command<CMD_SEND_VEHICLE_TO_DEPOT>::Post(GetCmdSendToDepotMsg(v), v->index, _fn_pressed ? DepotCommand::Service : DepotCommand::None, {});
|
||||||
break;
|
break;
|
||||||
case WID_VV_REFIT: // refit
|
case WID_VV_REFIT: // refit
|
||||||
ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID, this);
|
ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID, this);
|
||||||
break;
|
break;
|
||||||
case WID_VV_SHOW_ORDERS: // show orders
|
case WID_VV_SHOW_ORDERS: // show orders
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowTimetableWindow(v);
|
ShowTimetableWindow(v);
|
||||||
} else {
|
} else {
|
||||||
ShowOrdersWindow(v);
|
ShowOrdersWindow(v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WID_VV_SHOW_DETAILS: // show details
|
case WID_VV_SHOW_DETAILS: // show details
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowCompanyGroupForVehicle(v);
|
ShowCompanyGroupForVehicle(v);
|
||||||
} else {
|
} else {
|
||||||
ShowVehicleDetailsWindow(v);
|
ShowVehicleDetailsWindow(v);
|
||||||
|
@ -3257,8 +3257,8 @@ public:
|
||||||
* For starting the vehicle the player has to open the depot GUI, which is
|
* For starting the vehicle the player has to open the depot GUI, which is
|
||||||
* most likely already open, but is also visible in the vehicle viewport. */
|
* most likely already open, but is also visible in the vehicle viewport. */
|
||||||
Command<CMD_CLONE_VEHICLE>::Post(_vehicle_msg_translation_table[VCT_CMD_CLONE_VEH][v->type],
|
Command<CMD_CLONE_VEHICLE>::Post(_vehicle_msg_translation_table[VCT_CMD_CLONE_VEH][v->type],
|
||||||
_ctrl_pressed ? nullptr : CcCloneVehicle,
|
_fn_pressed ? nullptr : CcCloneVehicle,
|
||||||
v->tile, v->index, _ctrl_pressed);
|
v->tile, v->index, _fn_pressed);
|
||||||
break;
|
break;
|
||||||
case WID_VV_TURN_AROUND: // turn around
|
case WID_VV_TURN_AROUND: // turn around
|
||||||
assert(v->IsGroundVehicle());
|
assert(v->IsGroundVehicle());
|
||||||
|
|
|
@ -461,10 +461,8 @@ void VideoDriver_Allegro::Stop()
|
||||||
|
|
||||||
void VideoDriver_Allegro::InputLoop()
|
void VideoDriver_Allegro::InputLoop()
|
||||||
{
|
{
|
||||||
bool old_ctrl_pressed = _ctrl_pressed;
|
bool ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG);
|
||||||
|
bool shift_pressed = !!(key_shifts & KB_SHIFT_FLAG);
|
||||||
_ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG);
|
|
||||||
_shift_pressed = !!(key_shifts & KB_SHIFT_FLAG);
|
|
||||||
|
|
||||||
/* Speedup when pressing tab, except when using ALT+TAB
|
/* Speedup when pressing tab, except when using ALT+TAB
|
||||||
* to switch to another application. */
|
* to switch to another application. */
|
||||||
|
@ -477,7 +475,7 @@ void VideoDriver_Allegro::InputLoop()
|
||||||
(key[KEY_RIGHT] ? 4 : 0) |
|
(key[KEY_RIGHT] ? 4 : 0) |
|
||||||
(key[KEY_DOWN] ? 8 : 0);
|
(key[KEY_DOWN] ? 8 : 0);
|
||||||
|
|
||||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
HandleModifierKeys(shift_pressed, ctrl_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDriver_Allegro::MainLoop()
|
void VideoDriver_Allegro::MainLoop()
|
||||||
|
|
|
@ -472,14 +472,12 @@ void VideoDriver_Cocoa::InputLoop()
|
||||||
{
|
{
|
||||||
NSUInteger cur_mods = [ NSEvent modifierFlags ];
|
NSUInteger cur_mods = [ NSEvent modifierFlags ];
|
||||||
|
|
||||||
bool old_ctrl_pressed = _ctrl_pressed;
|
bool ctrl_pressed = (cur_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSEventModifierFlagControl : NSEventModifierFlagCommand)) != 0;
|
||||||
|
bool shift_pressed = (cur_mods & NSEventModifierFlagShift) != 0;
|
||||||
_ctrl_pressed = (cur_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSEventModifierFlagControl : NSEventModifierFlagCommand)) != 0;
|
|
||||||
_shift_pressed = (cur_mods & NSEventModifierFlagShift) != 0;
|
|
||||||
|
|
||||||
this->fast_forward_key_pressed = _tab_is_down;
|
this->fast_forward_key_pressed = _tab_is_down;
|
||||||
|
|
||||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
HandleModifierKeys(shift_pressed, ctrl_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Main game loop. */
|
/** Main game loop. */
|
||||||
|
|
|
@ -575,10 +575,8 @@ void VideoDriver_SDL_Base::InputLoop()
|
||||||
uint32_t mod = SDL_GetModState();
|
uint32_t mod = SDL_GetModState();
|
||||||
const Uint8 *keys = SDL_GetKeyboardState(nullptr);
|
const Uint8 *keys = SDL_GetKeyboardState(nullptr);
|
||||||
|
|
||||||
bool old_ctrl_pressed = _ctrl_pressed;
|
bool ctrl_pressed = !!(mod & KMOD_CTRL);
|
||||||
|
bool shift_pressed = !!(mod & KMOD_SHIFT);
|
||||||
_ctrl_pressed = !!(mod & KMOD_CTRL);
|
|
||||||
_shift_pressed = !!(mod & KMOD_SHIFT);
|
|
||||||
|
|
||||||
/* Speedup when pressing tab, except when using ALT+TAB
|
/* Speedup when pressing tab, except when using ALT+TAB
|
||||||
* to switch to another application. */
|
* to switch to another application. */
|
||||||
|
@ -591,7 +589,7 @@ void VideoDriver_SDL_Base::InputLoop()
|
||||||
(keys[SDL_SCANCODE_RIGHT] ? 4 : 0) |
|
(keys[SDL_SCANCODE_RIGHT] ? 4 : 0) |
|
||||||
(keys[SDL_SCANCODE_DOWN] ? 8 : 0);
|
(keys[SDL_SCANCODE_DOWN] ? 8 : 0);
|
||||||
|
|
||||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
HandleModifierKeys(shift_pressed, ctrl_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDriver_SDL_Base::LoopOnce()
|
void VideoDriver_SDL_Base::LoopOnce()
|
||||||
|
|
|
@ -631,10 +631,8 @@ void VideoDriver_SDL::InputLoop()
|
||||||
int numkeys;
|
int numkeys;
|
||||||
Uint8 *keys = SDL_GetKeyState(&numkeys);
|
Uint8 *keys = SDL_GetKeyState(&numkeys);
|
||||||
|
|
||||||
bool old_ctrl_pressed = _ctrl_pressed;
|
bool ctrl_pressed = !!(mod & KMOD_CTRL);
|
||||||
|
bool shift_pressed = !!(mod & KMOD_SHIFT);
|
||||||
_ctrl_pressed = !!(mod & KMOD_CTRL);
|
|
||||||
_shift_pressed = !!(mod & KMOD_SHIFT);
|
|
||||||
|
|
||||||
/* Speedup when pressing tab, except when using ALT+TAB
|
/* Speedup when pressing tab, except when using ALT+TAB
|
||||||
* to switch to another application. */
|
* to switch to another application. */
|
||||||
|
@ -647,7 +645,7 @@ void VideoDriver_SDL::InputLoop()
|
||||||
(keys[SDLK_RIGHT] ? 4 : 0) |
|
(keys[SDLK_RIGHT] ? 4 : 0) |
|
||||||
(keys[SDLK_DOWN] ? 8 : 0);
|
(keys[SDLK_DOWN] ? 8 : 0);
|
||||||
|
|
||||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
HandleModifierKeys(shift_pressed, ctrl_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDriver_SDL::MainLoop()
|
void VideoDriver_SDL::MainLoop()
|
||||||
|
|
|
@ -848,10 +848,8 @@ void VideoDriver_Win32Base::CheckPaletteAnim()
|
||||||
|
|
||||||
void VideoDriver_Win32Base::InputLoop()
|
void VideoDriver_Win32Base::InputLoop()
|
||||||
{
|
{
|
||||||
bool old_ctrl_pressed = _ctrl_pressed;
|
bool ctrl_pressed = this->has_focus && GetAsyncKeyState(VK_CONTROL) < 0;
|
||||||
|
bool shift_pressed = this->has_focus && GetAsyncKeyState(VK_SHIFT) < 0;
|
||||||
_ctrl_pressed = this->has_focus && GetAsyncKeyState(VK_CONTROL) < 0;
|
|
||||||
_shift_pressed = this->has_focus && GetAsyncKeyState(VK_SHIFT) < 0;
|
|
||||||
|
|
||||||
/* Speedup when pressing tab, except when using ALT+TAB
|
/* Speedup when pressing tab, except when using ALT+TAB
|
||||||
* to switch to another application. */
|
* to switch to another application. */
|
||||||
|
@ -868,7 +866,7 @@ void VideoDriver_Win32Base::InputLoop()
|
||||||
_dirkeys = 0;
|
_dirkeys = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
HandleModifierKeys(shift_pressed, ctrl_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDriver_Win32Base::PollEvent()
|
bool VideoDriver_Win32Base::PollEvent()
|
||||||
|
|
|
@ -2430,7 +2430,7 @@ bool HandleViewportClicked(const Viewport *vp, int x, int y)
|
||||||
Debug(misc, 2, "Vehicle {} (index {}) at {}", v->unitnumber, v->index, fmt::ptr(v));
|
Debug(misc, 2, "Vehicle {} (index {}) at {}", v->unitnumber, v->index, fmt::ptr(v));
|
||||||
if (IsCompanyBuildableVehicleType(v)) {
|
if (IsCompanyBuildableVehicleType(v)) {
|
||||||
v = v->First();
|
v = v->First();
|
||||||
if (_ctrl_pressed && v->owner == _local_company) {
|
if (_fn_pressed && v->owner == _local_company) {
|
||||||
StartStopVehicle(v, true);
|
StartStopVehicle(v, true);
|
||||||
} else {
|
} else {
|
||||||
ShowVehicleViewWindow(v);
|
ShowVehicleViewWindow(v);
|
||||||
|
@ -2572,7 +2572,7 @@ void TileHighlightData::Reset()
|
||||||
*/
|
*/
|
||||||
bool TileHighlightData::IsDraggingDiagonal()
|
bool TileHighlightData::IsDraggingDiagonal()
|
||||||
{
|
{
|
||||||
return (this->place_mode & HT_DIAGONAL) != 0 && _ctrl_pressed && _left_button_down;
|
return (this->place_mode & HT_DIAGONAL) != 0 && _fn_pressed && _left_button_down;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_W_CENTER_VIEW: // scroll to location
|
case WID_W_CENTER_VIEW: // scroll to location
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
ShowExtraViewportWindow(this->GetCenterTile());
|
ShowExtraViewportWindow(this->GetCenterTile());
|
||||||
} else {
|
} else {
|
||||||
ScrollMainWindowToTile(this->GetCenterTile());
|
ScrollMainWindowToTile(this->GetCenterTile());
|
||||||
|
|
|
@ -680,7 +680,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WWT_DEFSIZEBOX: {
|
case WWT_DEFSIZEBOX: {
|
||||||
if (_ctrl_pressed) {
|
if (_fn_pressed) {
|
||||||
w->window_desc->pref_width = w->width;
|
w->window_desc->pref_width = w->width;
|
||||||
w->window_desc->pref_height = w->height;
|
w->window_desc->pref_height = w->height;
|
||||||
} else {
|
} else {
|
||||||
|
@ -714,7 +714,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
||||||
case WWT_STICKYBOX:
|
case WWT_STICKYBOX:
|
||||||
w->flags ^= WF_STICKY;
|
w->flags ^= WF_STICKY;
|
||||||
nw->SetDirty(w);
|
nw->SetDirty(w);
|
||||||
if (_ctrl_pressed) w->window_desc->pref_sticky = (w->flags & WF_STICKY) != 0;
|
if (_fn_pressed) w->window_desc->pref_sticky = (w->flags & WF_STICKY) != 0;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2614,14 +2614,36 @@ void HandleKeypress(uint keycode, char32_t key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of CONTROL key has changed
|
* Handle the modifier key state changes.
|
||||||
*/
|
*/
|
||||||
void HandleCtrlChanged()
|
void HandleModifierKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed)
|
||||||
{
|
{
|
||||||
/* Call the event, start with the uppermost window. */
|
bool old_fn_pressed = _fn_pressed;
|
||||||
for (Window *w : Window::IterateFromFront()) {
|
bool old_remove_pressed = _remove_pressed;
|
||||||
if (w->OnCTRLStateChange() == ES_HANDLED) return;
|
|
||||||
|
_shift_pressed = shift_pressed;
|
||||||
|
|
||||||
|
/* Hardwire modifiers leaving remove inaccessible for now. */
|
||||||
|
_fn_pressed = ctrl_pressed;
|
||||||
|
_remove_pressed = false;
|
||||||
|
_estimate_pressed = shift_pressed;
|
||||||
|
|
||||||
|
if (old_fn_pressed != _fn_pressed) {
|
||||||
|
/* Call the event, start with the uppermost window. */
|
||||||
|
for (Window *w : Window::IterateFromFront()) {
|
||||||
|
if (w->OnFnStateChange() == ES_HANDLED) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old_remove_pressed != _remove_pressed) {
|
||||||
|
/* Call the event, start with the uppermost window. */
|
||||||
|
for (Window *w : Window::IterateFromFront()) {
|
||||||
|
if (w->OnRemoveStateChange() == ES_HANDLED) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
old_fn_pressed = _fn_pressed;
|
||||||
|
old_remove_pressed = _remove_pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -647,12 +647,18 @@ public:
|
||||||
virtual EventState OnHotkey(int hotkey);
|
virtual EventState OnHotkey(int hotkey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of the control key has changed
|
* The state of the function modifier key has changed
|
||||||
* @return #ES_HANDLED if the change has been handled and no other
|
* @return #ES_HANDLED if the change has been handled and no other
|
||||||
* window should receive the event.
|
* window should receive the event.
|
||||||
*/
|
*/
|
||||||
virtual EventState OnCTRLStateChange() { return ES_NOT_HANDLED; }
|
virtual EventState OnFnStateChange() { return ES_NOT_HANDLED; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state of the remove modifier key has changed
|
||||||
|
* @return #ES_HANDLED if the change has been handled and no other
|
||||||
|
* window should receive the event.
|
||||||
|
*/
|
||||||
|
virtual EventState OnRemoveStateChange() { return ES_NOT_HANDLED; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A click with the left mouse button has been made on the window.
|
* A click with the left mouse button has been made on the window.
|
||||||
|
|
Loading…
Reference in New Issue