Add tool type to _thd when placing objects
This commit is contained in:
@@ -105,14 +105,14 @@ struct BuildAirToolbarWindow : Window {
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_AT_AIRPORT:
|
||||
if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT, CM_DDSP_BUILD_AIRPORT)) {
|
||||
ShowBuildAirportPicker(this);
|
||||
this->last_user_action = widget;
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_AT_DEMOLISH:
|
||||
HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -879,13 +879,15 @@ bool DrawTileSelection(const TileInfo *ti, const TileHighlightType &tht) {
|
||||
|
||||
// if (_thd.drawstyle == CM_HT_BLUEPRINT_PLACE) return true;
|
||||
|
||||
if ((_thd.drawstyle & HT_DRAG_MASK) == HT_RECT && _thd.outersize.x > 0) {
|
||||
// if ((_thd.drawstyle & HT_DRAG_MASK) == HT_RECT && _thd.outersize.x > 0) {
|
||||
if (_thd.select_proc == DDSP_BUILD_STATION || _thd.select_proc == DDSP_BUILD_STATION) {
|
||||
// station selector, handled by DrawTileZoning
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((_thd.drawstyle & HT_DRAG_MASK) == HT_RECT && IsInsideSelectedRectangle(ti->x, ti->y)
|
||||
&& _cursor.sprite_seq[0].sprite == GetRailTypeInfo(_cur_railtype)->cursor.depot) {
|
||||
if (_thd.select_proc == CM_DDSP_BUILD_RAIL_DEPOT) {
|
||||
// if ((_thd.drawstyle & HT_DRAG_MASK) == HT_RECT && IsInsideSelectedRectangle(ti->x, ti->y)
|
||||
// && _cursor.sprite_seq[0].sprite == GetRailTypeInfo(_cur_railtype)->cursor.depot) {
|
||||
// DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
|
||||
|
||||
// auto rti = GetRailTypeInfo(_cur_railtype);
|
||||
@@ -983,8 +985,7 @@ HighLightStyle UpdateTileSelection(HighLightStyle new_drawstyle) {
|
||||
// UpdateBlueprintTileSelection(pt, tile);
|
||||
// new_drawstyle = CM_HT_BLUEPRINT_PLACE;
|
||||
// } else
|
||||
if ((_thd.place_mode & HT_DRAG_MASK) == HT_RECT &&
|
||||
_cursor.sprite_seq[0].sprite == GetRailTypeInfo(_cur_railtype)->cursor.depot) {
|
||||
if (_thd.select_proc == CM_DDSP_BUILD_RAIL_DEPOT) {
|
||||
auto dir = _build_depot_direction;
|
||||
if (pt.x != -1) {
|
||||
if (dir >= DiagDirection::DIAGDIR_END) {
|
||||
@@ -993,7 +994,8 @@ HighLightStyle UpdateTileSelection(HighLightStyle new_drawstyle) {
|
||||
_thd.cm_new = ObjectHighlight::make_rail_depot(tile, dir);
|
||||
}
|
||||
new_drawstyle = HT_RECT;
|
||||
} else if (((_thd.place_mode & HT_DRAG_MASK) == HT_RECT || ((_thd.place_mode & HT_DRAG_MASK) == HT_SPECIAL && (_thd.next_drawstyle & HT_DRAG_MASK) == HT_RECT)) && _thd.new_outersize.x > 0 && !_thd.make_square_red) { // station
|
||||
// } else if (((_thd.place_mode & HT_DRAG_MASK) == HT_RECT || ((_thd.place_mode & HT_DRAG_MASK) == HT_SPECIAL && (_thd.next_drawstyle & HT_DRAG_MASK) == HT_RECT)) && _thd.new_outersize.x > 0 && !_thd.make_square_red) { // station
|
||||
} else if (_thd.select_proc == DDSP_BUILD_STATION) { // station
|
||||
if (_thd.size.x >= (int)TILE_SIZE && _thd.size.y >= (int)TILE_SIZE) {
|
||||
auto start_tile = TileXY(_thd.new_pos.x / TILE_SIZE, _thd.new_pos.y / TILE_SIZE);
|
||||
auto end_tile = TileXY(
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
RAIL_SIGNAL,
|
||||
RAIL_BRIDGE,
|
||||
RAIL_TUNNEL,
|
||||
ROAD_STOP,
|
||||
END,
|
||||
};
|
||||
Type type;
|
||||
@@ -126,6 +127,12 @@ public:
|
||||
TileIndexDiffC other_end;
|
||||
} tunnel;
|
||||
} rail;
|
||||
struct {
|
||||
struct {
|
||||
DiagDirection ddir;
|
||||
TileIndexDiffC other_end;
|
||||
} stop;
|
||||
} road;
|
||||
} u;
|
||||
Item(Type type, TileIndexDiffC tdiff)
|
||||
: type{type}, tdiff{tdiff} {}
|
||||
|
||||
@@ -2617,7 +2617,7 @@ struct CompanyWindow : Window
|
||||
this->RaiseButtons();
|
||||
break;
|
||||
}
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this, CM_DDSP_BUILD_HQ);
|
||||
SetTileSelectSize(2, 2);
|
||||
this->LowerWidget(WID_C_BUILD_HQ);
|
||||
this->SetWidgetDirty(WID_C_BUILD_HQ);
|
||||
@@ -2629,7 +2629,7 @@ struct CompanyWindow : Window
|
||||
this->RaiseButtons();
|
||||
break;
|
||||
}
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this, CM_DDSP_BUILD_HQ);
|
||||
SetTileSelectSize(2, 2);
|
||||
this->LowerWidget(WID_C_RELOCATE_HQ);
|
||||
this->SetWidgetDirty(WID_C_RELOCATE_HQ);
|
||||
|
||||
@@ -542,7 +542,7 @@ struct DepotWindow : Window {
|
||||
this->sel = INVALID_VEHICLE;
|
||||
TrainDepotMoveVehicle(v, sel, gdvp.head);
|
||||
} else if (v != nullptr) {
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_DEPOT_MOVE);
|
||||
SetMouseCursorVehicle(v, EIT_IN_DEPOT);
|
||||
_cursor.vehchain = citymania::_fn_mod;
|
||||
|
||||
@@ -763,7 +763,7 @@ struct DepotWindow : Window {
|
||||
SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE
|
||||
};
|
||||
|
||||
SetObjectToPlaceWnd(clone_icons[this->type], PAL_NONE, HT_VEHICLE, this);
|
||||
SetObjectToPlaceWnd(clone_icons[this->type], PAL_NONE, HT_VEHICLE, this, CM_DDSP_DEPOT_CLONE);
|
||||
} else {
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
@@ -135,39 +135,39 @@ struct BuildDocksToolbarWindow : Window {
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_DT_CANAL: // Build canal button
|
||||
HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT, CM_DDSP_BUILD_CANNAL);
|
||||
break;
|
||||
|
||||
case WID_DT_LOCK: // Build lock button
|
||||
HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
|
||||
HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL, CM_DDSP_BUILD_LOCK);
|
||||
break;
|
||||
|
||||
case WID_DT_DEMOLISH: // Demolish aka dynamite button
|
||||
HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
break;
|
||||
|
||||
case WID_DT_DEPOT: // Build depot button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
|
||||
if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT, CM_DDSP_BUILD_SHIP_DEPOT)) ShowBuildDocksDepotPicker(this);
|
||||
break;
|
||||
|
||||
case WID_DT_STATION: // Build station button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
|
||||
if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, CM_DDSP_BUILD_DOCK)) ShowBuildDockStationPicker(this);
|
||||
break;
|
||||
|
||||
case WID_DT_BUOY: // Build buoy button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT, CM_DDSP_BUILD_BUOY);
|
||||
break;
|
||||
|
||||
case WID_DT_RIVER: // Build river button (in scenario editor)
|
||||
if (_game_mode != GM_EDITOR) return;
|
||||
HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT, CM_DDSP_BUILD_RIVER);
|
||||
break;
|
||||
|
||||
case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
|
||||
HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
|
||||
HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL, CM_DDSP_BUILD_AQUEDUCT);
|
||||
break;
|
||||
|
||||
default: return;
|
||||
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) {
|
||||
DoCommandP(0, PM_PAUSED_SAVELOAD, 1, CMD_PAUSE);
|
||||
}
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0, CM_DDSP_ZZZ);
|
||||
|
||||
this->OnInvalidateData(SLIWD_RESCAN_FILES);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ static void _GenerateWorld()
|
||||
if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
||||
_random.SetSeed(_settings_game.game_creation.generation_seed);
|
||||
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0, CM_DDSP_ZZZ);
|
||||
|
||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
|
||||
|
||||
@@ -326,7 +326,7 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
|
||||
|
||||
/* Create toolbars */
|
||||
SetupColoursAndInitialWindow();
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0, CM_DDSP_ZZZ);
|
||||
|
||||
if (_gw.thread.joinable()) _gw.thread.join();
|
||||
|
||||
|
||||
@@ -717,7 +717,7 @@ public:
|
||||
|
||||
this->group_sel = this->vli.index = this->groups[id_g]->index;
|
||||
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_GROUP);
|
||||
|
||||
this->vehicles.ForceRebuild();
|
||||
this->SetDirty();
|
||||
@@ -737,7 +737,7 @@ public:
|
||||
this->SelectGroup(v->group_id);
|
||||
}
|
||||
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_GROUP);
|
||||
SetMouseCursorVehicle(v, EIT_IN_LIST);
|
||||
_cursor.vehchain = true;
|
||||
|
||||
|
||||
@@ -659,7 +659,7 @@ public:
|
||||
DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
|
||||
this->HandleButtonClick(WID_DPI_FUND_WIDGET);
|
||||
} else {
|
||||
HandlePlacePushButton(this, WID_DPI_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_DPI_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT, CM_DDSP_FUND_INDUSTRY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void HandleOnEditText(const char *str)
|
||||
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
|
||||
* @return true if the button is clicked, false if it's unclicked
|
||||
*/
|
||||
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
|
||||
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, ViewportDragDropSelectionProcess cm_process)
|
||||
{
|
||||
if (w->IsWidgetDisabled(widget)) return false;
|
||||
|
||||
@@ -109,7 +109,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyl
|
||||
return false;
|
||||
}
|
||||
|
||||
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number);
|
||||
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number, cm_process);
|
||||
w->LowerWidget(widget);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1011,7 +1011,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
this->InvalidateData();
|
||||
if (click_count == 1) {
|
||||
if (this->editable && this->active_sel != nullptr) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
if (this->editable && this->active_sel != nullptr) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_NEWGRF_SELECT);
|
||||
break;
|
||||
}
|
||||
/* With double click, continue */
|
||||
@@ -1069,7 +1069,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
}
|
||||
this->InvalidateData();
|
||||
if (click_count == 1) {
|
||||
if (this->editable && this->avail_sel != nullptr && !HasBit(this->avail_sel->flags, GCF_INVALID)) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
if (this->editable && this->avail_sel != nullptr && !HasBit(this->avail_sel->flags, GCF_INVALID)) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_NEWGRF_SELECT);
|
||||
break;
|
||||
}
|
||||
/* With double click, continue */
|
||||
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
}
|
||||
|
||||
if (_selected_object_index != -1) {
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_TRANSMITTER, PAL_NONE, HT_RECT, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_TRANSMITTER, PAL_NONE, HT_RECT, this, CM_DDSP_PLACE_OBJECT);
|
||||
}
|
||||
|
||||
this->UpdateButtons(_selected_object_class, _selected_object_index, _selected_object_view);
|
||||
|
||||
@@ -687,7 +687,7 @@ private:
|
||||
HT_NONE, // OPOS_CONDITIONAL
|
||||
HT_VEHICLE, // OPOS_SHARE
|
||||
};
|
||||
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, goto_place_style[type - 1], this);
|
||||
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, goto_place_style[type - 1], this, CM_DDSP_PICK_STATION);
|
||||
this->goto_type = type;
|
||||
this->SetWidgetDirty(WID_O_GOTO);
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ public:
|
||||
|
||||
if (this->vehicle->owner == _local_company) {
|
||||
/* Activate drag and drop */
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_SELECT_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -628,27 +628,27 @@ struct BuildRailToolbarWindow : Window {
|
||||
|
||||
switch (widget) {
|
||||
case WID_RAT_BUILD_NS:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL, DDSP_PLACE_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_BUILD_X:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X, DDSP_PLACE_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_BUILD_EW:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL, DDSP_PLACE_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_BUILD_Y:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y, DDSP_PLACE_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_AUTORAIL:
|
||||
HandlePlacePushButton(this, WID_RAT_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL);
|
||||
HandlePlacePushButton(this, WID_RAT_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL, DDSP_PLACE_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
@@ -675,7 +675,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
do_open = !was_open;
|
||||
}
|
||||
/* close/open the tool */
|
||||
if (was_open != do_open) HandlePlacePushButton(this, WID_RAT_POLYRAIL, GetRailTypeInfo(railtype)->cursor.autorail, HT_RAIL | HT_POLY);
|
||||
if (was_open != do_open) HandlePlacePushButton(this, WID_RAT_POLYRAIL, GetRailTypeInfo(railtype)->cursor.autorail, HT_RAIL | HT_POLY, DDSP_PLACE_RAIL);
|
||||
/* set snapping mode */
|
||||
if (do_open) SetRailSnapMode(do_snap ? RSM_SNAP_TO_RAIL : RSM_NO_SNAP);
|
||||
|
||||
@@ -685,12 +685,12 @@ struct BuildRailToolbarWindow : Window {
|
||||
}
|
||||
|
||||
case WID_RAT_DEMOLISH:
|
||||
HandlePlacePushButton(this, WID_RAT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_RAT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_BUILD_DEPOT:
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT | (HighLightStyle)_build_depot_direction)) {
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT | (HighLightStyle)_build_depot_direction, CM_DDSP_BUILD_RAIL_DEPOT)) {
|
||||
citymania::ResetRotateAutodetection();
|
||||
ShowBuildTrainDepotPicker(this);
|
||||
this->last_user_action = widget;
|
||||
@@ -700,7 +700,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
case WID_RAT_BUILD_WAYPOINT:
|
||||
this->last_user_action = widget;
|
||||
_waypoint_count = StationClass::Get(STAT_CLASS_WAYP)->GetSpecCount();
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT) && _waypoint_count > 1) {
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT, CM_DDSP_BUILD_WAYPOINT) && _waypoint_count > 1) {
|
||||
ShowBuildWaypointPicker(this);
|
||||
}
|
||||
break;
|
||||
@@ -714,12 +714,12 @@ struct BuildRailToolbarWindow : Window {
|
||||
if (was_open) ResetObjectToPlace();
|
||||
if (!was_open || dragdrop != _settings_client.gui.station_dragdrop) {
|
||||
_settings_client.gui.station_dragdrop = dragdrop;
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT))
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT, DDSP_BUILD_STATION))
|
||||
ShowStationBuilder(this);
|
||||
}
|
||||
this->last_user_action = WID_RAT_BUILD_STATION;
|
||||
} else { /* button */
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_RAT_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT, DDSP_BUILD_STATION)) {
|
||||
ShowStationBuilder(this);
|
||||
this->last_user_action = WID_RAT_BUILD_STATION;
|
||||
}
|
||||
@@ -729,7 +729,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
|
||||
case WID_RAT_BUILD_SIGNALS: {
|
||||
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, DDSP_BUILD_SIGNALS);
|
||||
if (started && _settings_client.gui.enable_signal_gui != citymania::_fn_mod) {
|
||||
ShowSignalBuilder(this);
|
||||
}
|
||||
@@ -737,12 +737,12 @@ struct BuildRailToolbarWindow : Window {
|
||||
}
|
||||
|
||||
case WID_RAT_BUILD_BRIDGE:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, CM_DDSP_BUILD_RAIL_BRIDGE);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_RAT_BUILD_TUNNEL:
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL);
|
||||
HandlePlacePushButton(this, WID_RAT_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL, CM_DDSP_BUILD_RAIL_TUNNEL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
@@ -752,7 +752,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_RAT_CONVERT_RAIL:
|
||||
HandlePlacePushButton(this, WID_RAT_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_RAT_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT | HT_DIAGONAL, DDSP_CONVERT_RAIL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -543,28 +543,28 @@ struct BuildRoadToolbarWindow : Window {
|
||||
_one_way_button_clicked = false;
|
||||
switch (widget) {
|
||||
case WID_ROT_ROAD_X:
|
||||
HandlePlacePushButton(this, WID_ROT_ROAD_X, this->rti->cursor.road_nwse, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ROT_ROAD_X, this->rti->cursor.road_nwse, HT_RECT, DDSP_PLACE_ROAD_X_DIR);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_ROAD_Y:
|
||||
HandlePlacePushButton(this, WID_ROT_ROAD_Y, this->rti->cursor.road_swne, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ROT_ROAD_Y, this->rti->cursor.road_swne, HT_RECT, DDSP_PLACE_ROAD_Y_DIR);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_AUTOROAD:
|
||||
HandlePlacePushButton(this, WID_ROT_AUTOROAD, this->rti->cursor.autoroad, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ROT_AUTOROAD, this->rti->cursor.autoroad, HT_RECT, DDSP_PLACE_AUTOROAD);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_DEMOLISH:
|
||||
HandlePlacePushButton(this, WID_ROT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_ROT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_DEPOT:
|
||||
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return;
|
||||
if (HandlePlacePushButton(this, WID_ROT_DEPOT, this->rti->cursor.depot, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_ROT_DEPOT, this->rti->cursor.depot, HT_RECT, CM_DDSP_BUILD_ROAD_DEPOT)) {
|
||||
ShowRoadDepotPicker(this);
|
||||
this->last_started_action = widget;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
case WID_ROT_BUS_STATION:
|
||||
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return;
|
||||
if (HandlePlacePushButton(this, WID_ROT_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_ROT_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT, DDSP_BUILD_BUSSTOP)) {
|
||||
ShowRVStationPicker(this, ROADSTOP_BUS);
|
||||
this->last_started_action = widget;
|
||||
}
|
||||
@@ -580,7 +580,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
case WID_ROT_TRUCK_STATION:
|
||||
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return;
|
||||
if (HandlePlacePushButton(this, WID_ROT_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_ROT_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT, DDSP_BUILD_TRUCKSTOP)) {
|
||||
ShowRVStationPicker(this, ROADSTOP_TRUCK);
|
||||
this->last_started_action = widget;
|
||||
}
|
||||
@@ -594,12 +594,12 @@ struct BuildRoadToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_ROT_BUILD_BRIDGE:
|
||||
HandlePlacePushButton(this, WID_ROT_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ROT_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, CM_DDSP_BUILD_ROAD_BRIDGE);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_BUILD_TUNNEL:
|
||||
HandlePlacePushButton(this, WID_ROT_BUILD_TUNNEL, this->rti->cursor.tunnel, HT_SPECIAL);
|
||||
HandlePlacePushButton(this, WID_ROT_BUILD_TUNNEL, this->rti->cursor.tunnel, HT_SPECIAL, CM_DDSP_BUILD_ROAD_TUNNEL);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
@@ -613,7 +613,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_ROT_CONVERT_ROAD:
|
||||
HandlePlacePushButton(this, WID_ROT_CONVERT_ROAD, this->rti->cursor.convert_road, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ROT_CONVERT_ROAD, this->rti->cursor.convert_road, HT_RECT, DDSP_CONVERT_ROAD);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -259,32 +259,32 @@ struct TerraformToolbarWindow : Window {
|
||||
|
||||
switch (widget) {
|
||||
case WID_TT_LOWER_LAND: // Lower land button
|
||||
HandlePlacePushButton(this, WID_TT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_TT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_TT_RAISE_LAND: // Raise land button
|
||||
HandlePlacePushButton(this, WID_TT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_TT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_TT_LEVEL_LAND: // Level land button
|
||||
HandlePlacePushButton(this, WID_TT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_TT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_TT_DEMOLISH: // Demolish aka dynamite button
|
||||
HandlePlacePushButton(this, WID_TT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_TT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_TT_DEMOLISH_TREES: // Demolish aka dynamite button
|
||||
HandlePlacePushButton(this, WID_TT_DEMOLISH_TREES, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_TT_DEMOLISH_TREES, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH_TREES);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_TT_BUY_LAND: // Buy land button
|
||||
HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT, CM_DDSP_BUY_LAND);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
@@ -293,7 +293,7 @@ struct TerraformToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_TT_PLACE_SIGN: // Place sign button
|
||||
HandlePlacePushButton(this, WID_TT_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_TT_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT, CM_DDSP_PLACE_SIGN);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
@@ -670,32 +670,32 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
|
||||
switch (widget) {
|
||||
case WID_ETT_DEMOLISH: // Demolish aka dynamite button
|
||||
HandlePlacePushButton(this, WID_ETT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_ETT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, CM_DDSP_DEMOLISH);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ETT_LOWER_LAND: // Lower land button
|
||||
HandlePlacePushButton(this, WID_ETT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT);
|
||||
HandlePlacePushButton(this, WID_ETT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ETT_RAISE_LAND: // Raise land button
|
||||
HandlePlacePushButton(this, WID_ETT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT);
|
||||
HandlePlacePushButton(this, WID_ETT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ETT_LEVEL_LAND: // Level land button
|
||||
HandlePlacePushButton(this, WID_ETT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
|
||||
HandlePlacePushButton(this, WID_ETT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ETT_PLACE_ROCKS: // Place rocks button
|
||||
HandlePlacePushButton(this, WID_ETT_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ETT_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate)
|
||||
HandlePlacePushButton(this, WID_ETT_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_ETT_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT, CM_DDSP_TERRAFORM);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
void PlaceProc_DemolishArea(TileIndex tile);
|
||||
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
|
||||
|
||||
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode);
|
||||
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w);
|
||||
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num);
|
||||
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, ViewportDragDropSelectionProcess cm_process);
|
||||
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w, ViewportDragDropSelectionProcess cm_process);
|
||||
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num, ViewportDragDropSelectionProcess cm_process);
|
||||
void ResetObjectToPlace();
|
||||
|
||||
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
|
||||
|
||||
@@ -267,7 +267,7 @@ static CallBackFunction SelectSignTool()
|
||||
ResetObjectToPlace();
|
||||
return CBF_NONE;
|
||||
} else {
|
||||
SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0, CM_DDSP_PLACE_SIGN);
|
||||
return CBF_PLACE_SIGN;
|
||||
}
|
||||
}
|
||||
@@ -278,7 +278,7 @@ static CallBackFunction BuildCompanyHQ(){
|
||||
ResetObjectToPlace();
|
||||
return CBF_NONE;
|
||||
} else {
|
||||
SetObjectToPlace(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0, CM_DDSP_BUILD_HQ);
|
||||
SetTileSelectSize(2, 2);
|
||||
return CBF_BUILD_HQ;
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ static CallBackFunction PlaceLandBlockInfo()
|
||||
ResetObjectToPlace();
|
||||
return CBF_NONE;
|
||||
} else {
|
||||
SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0, CM_DDSP_LAND_INFO);
|
||||
return CBF_PLACE_LANDINFO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1307,7 +1307,7 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_TF_NEW_TOWN:
|
||||
HandlePlacePushButton(this, WID_TF_NEW_TOWN, SPR_CURSOR_TOWN, HT_RECT);
|
||||
HandlePlacePushButton(this, WID_TF_NEW_TOWN, SPR_CURSOR_TOWN, HT_RECT, CM_DDSP_NEW_TOWN);
|
||||
break;
|
||||
|
||||
case WID_TF_RANDOM_TOWN:
|
||||
|
||||
@@ -117,13 +117,13 @@ public:
|
||||
case WID_BT_TYPE_31: case WID_BT_TYPE_32: case WID_BT_TYPE_33: case WID_BT_TYPE_34:
|
||||
if (widget - WID_BT_TYPE_11 >= this->count) break;
|
||||
|
||||
if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT, DDSP_PLANT_TREES)) {
|
||||
this->tree_to_plant = (TreeType)(this->base + widget - WID_BT_TYPE_11);
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_BT_TYPE_RANDOM: // tree of random type.
|
||||
if (HandlePlacePushButton(this, WID_BT_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) {
|
||||
if (HandlePlacePushButton(this, WID_BT_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT, DDSP_PLANT_TREES)) {
|
||||
this->tree_to_plant = TREE_INVALID;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -925,7 +925,7 @@ struct RefitWindow : public Window {
|
||||
this->SetSelectedVehicles(pt.x - nwi->pos_x);
|
||||
this->SetWidgetDirty(WID_VR_VEHICLE_PANEL_DISPLAY);
|
||||
if (!citymania::_fn_mod) {
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this, CM_DDSP_SELECT_REFIT);
|
||||
} else {
|
||||
/* The vehicle selection has changed. */
|
||||
this->InvalidateData(2);
|
||||
|
||||
@@ -3741,9 +3741,9 @@ EventState VpHandlePlaceSizingDrag()
|
||||
* @param mode Mode to perform.
|
||||
* @param w %Window requesting the mode change.
|
||||
*/
|
||||
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
|
||||
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w, ViewportDragDropSelectionProcess cm_process)
|
||||
{
|
||||
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number);
|
||||
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number, cm_process);
|
||||
}
|
||||
|
||||
#include "table/animcursors.h"
|
||||
@@ -3756,7 +3756,7 @@ void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Wind
|
||||
* @param window_class %Window class of the window requesting the mode change.
|
||||
* @param window_num Number of the window in its class requesting the mode change.
|
||||
*/
|
||||
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
|
||||
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num, ViewportDragDropSelectionProcess cm_process)
|
||||
{
|
||||
if (_thd.window_class != WC_INVALID) {
|
||||
/* Undo clicking on button and drag & drop */
|
||||
@@ -3785,6 +3785,7 @@ void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowC
|
||||
}
|
||||
|
||||
_thd.place_mode = mode;
|
||||
_thd.select_proc = cm_process;
|
||||
_thd.window_class = window_class;
|
||||
_thd.window_number = window_num;
|
||||
|
||||
@@ -3803,7 +3804,7 @@ void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowC
|
||||
/** Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows). */
|
||||
void ResetObjectToPlace()
|
||||
{
|
||||
SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0, CM_DDSP_NONE);
|
||||
}
|
||||
|
||||
Point GetViewportStationMiddle(const ViewPort *vp, const Station *st)
|
||||
|
||||
@@ -113,6 +113,7 @@ DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
|
||||
* you've selected it.
|
||||
*/
|
||||
enum ViewportDragDropSelectionProcess {
|
||||
CM_DDSP_NONE, ///< CM Nothing is being built
|
||||
DDSP_DEMOLISH_AREA, ///< Clear area
|
||||
DDSP_DEMOLISH_TREES, ///< Clear trees
|
||||
DDSP_RAISE_AND_LEVEL_AREA, ///< Raise / level area
|
||||
@@ -142,6 +143,46 @@ enum ViewportDragDropSelectionProcess {
|
||||
DDSP_REMOVE_BUSSTOP, ///< Road stop removal (buses)
|
||||
DDSP_REMOVE_TRUCKSTOP, ///< Road stop removal (trucks)
|
||||
DDSP_CONVERT_ROAD, ///< Road conversion
|
||||
|
||||
/* CityMania extras */
|
||||
CM_DDSP_BUILD_HQ,
|
||||
CM_DDSP_DEPOT_MOVE,
|
||||
CM_DDSP_DEPOT_CLONE,
|
||||
CM_DDSP_ZZZ,
|
||||
CM_DDSP_GROUP,
|
||||
CM_DDSP_NEWGRF_SELECT,
|
||||
CM_DDSP_PLACE_OBJECT,
|
||||
CM_DDSP_PICK_STATION,
|
||||
CM_DDSP_SELECT_ORDER,
|
||||
CM_DDSP_PLACE_SIGN,
|
||||
CM_DDSP_LAND_INFO,
|
||||
CM_DDSP_SELECT_REFIT,
|
||||
|
||||
CM_DDSP_DEMOLISH,
|
||||
|
||||
CM_DDSP_BUILD_AIRPORT,
|
||||
|
||||
CM_DDSP_BUILD_CANNAL,
|
||||
CM_DDSP_BUILD_LOCK,
|
||||
CM_DDSP_BUILD_SHIP_DEPOT,
|
||||
CM_DDSP_BUILD_DOCK,
|
||||
CM_DDSP_BUILD_BUOY,
|
||||
CM_DDSP_BUILD_RIVER,
|
||||
CM_DDSP_BUILD_AQUEDUCT,
|
||||
CM_DDSP_BUILD_RAIL_DEPOT,
|
||||
|
||||
CM_DDSP_FUND_INDUSTRY,
|
||||
CM_DDSP_BUILD_WAYPOINT,
|
||||
CM_DDSP_BUILD_RAIL_BRIDGE,
|
||||
CM_DDSP_BUILD_RAIL_TUNNEL,
|
||||
CM_DDSP_BUILD_ROAD_DEPOT,
|
||||
CM_DDSP_BUILD_ROAD_BRIDGE,
|
||||
CM_DDSP_BUILD_ROAD_TUNNEL,
|
||||
|
||||
CM_DDSP_DEMOLISH_TREES,
|
||||
CM_DDSP_TERRAFORM,
|
||||
CM_DDSP_BUY_LAND,
|
||||
CM_DDSP_NEW_TOWN,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user