Make modifier key functions configurable

This commit is contained in:
dP
2020-07-13 01:35:07 +03:00
parent 4af1a255df
commit 7441767ed8
55 changed files with 366 additions and 146 deletions

View File

@@ -29,6 +29,8 @@
#include "table/sprites.h"
#include "citymania/cm_hotkeys.hpp"
#include "safeguards.h"
static const int LEVEL_WIDTH = 10; ///< Indenting width of a sub-group in pixels
@@ -734,7 +736,7 @@ public:
this->vehicle_sel = v->index;
if (_ctrl_pressed) {
if (citymania::_fn_mod) {
this->SelectGroup(v->group_id);
}
@@ -783,7 +785,7 @@ public:
case WID_GL_REPLACE_PROTECTION: {
const Group *g = Group::GetIfValid(this->vli.index);
if (g != nullptr) {
DoCommandP(0, this->vli.index, (g->replace_protection ? 0 : 1) | (_ctrl_pressed << 1), CMD_SET_GROUP_REPLACE_PROTECTION);
DoCommandP(0, this->vli.index, (g->replace_protection ? 0 : 1) | (citymania::_fn_mod ? 2 : 0), CMD_SET_GROUP_REPLACE_PROTECTION);
}
break;
}
@@ -826,7 +828,7 @@ public:
{
switch (widget) {
case WID_GL_DEFAULT_VEHICLES: // Ungrouped vehicles
DoCommandP(0, DEFAULT_GROUP, this->vehicle_sel | (_ctrl_pressed ? 1 << 31 : 0), CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE));
DoCommandP(0, DEFAULT_GROUP, this->vehicle_sel | (citymania::_fn_mod ? 1 << 31 : 0), CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE));
this->vehicle_sel = INVALID_VEHICLE;
this->group_over = INVALID_GROUP;
@@ -843,7 +845,7 @@ public:
uint id_g = this->group_sb->GetScrolledRowFromWidget(pt.y, this, WID_GL_LIST_GROUP, 0, this->tiny_step_height);
GroupID new_g = id_g >= this->groups.size() ? NEW_GROUP : this->groups[id_g]->index;
DoCommandP(0, new_g, vindex | (_ctrl_pressed ? 1 << 31 : 0), CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE), new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr);
DoCommandP(0, new_g, vindex | (citymania::_fn_mod ? 1 << 31 : 0), CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE), new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr);
break;
}