Changeset - r28785:6d8519a18fd4
[Not reviewed]
master
0 3 0
Tyler Trahan - 10 months ago 2024-02-18 15:43:44
tyler@tylertrahan.com
Change: When adding orders, Ctrl+Click on a depot to unbunch, instead of service if required (#12023)
3 files changed with 13 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -4604,25 +4604,25 @@ STR_ORDERS_SKIP_TOOLTIP                 
 

	
 
STR_ORDERS_DELETE_BUTTON                                        :{BLACK}Delete
 
STR_ORDERS_DELETE_TOOLTIP                                       :{BLACK}Delete the highlighted order
 
STR_ORDERS_DELETE_ALL_TOOLTIP                                   :{BLACK}Delete all orders
 
STR_ORDERS_STOP_SHARING_BUTTON                                  :{BLACK}Stop sharing
 
STR_ORDERS_STOP_SHARING_TOOLTIP                                 :{BLACK}Stop sharing the order list. Ctrl+Click to additionally delete all orders for this vehicle
 

	
 
STR_ORDERS_GO_TO_BUTTON                                         :{BLACK}Go To
 
STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Go to nearest depot
 
STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Go to nearest hangar
 
STR_ORDER_CONDITIONAL                                           :Conditional order jump
 
STR_ORDER_SHARE                                                 :Share orders
 
STR_ORDERS_GO_TO_TOOLTIP                                        :{BLACK}Insert a new order before the highlighted order, or add to end of list. Ctrl+Click on a station for 'full load any cargo', on a waypoint to invert the 'non-stop by default' setting, or on a depot for 'service'. Click on another vehicle to copy its orders or Ctrl+Click to share orders. A depot order disables automatic servicing of the vehicle
 
STR_ORDERS_GO_TO_TOOLTIP                                        :{BLACK}Insert a new order before the highlighted order, or add to end of list. Ctrl+Click on a station for 'full load any cargo', on a waypoint to invert the 'non-stop by default' setting, or on a depot for 'unbunch'. Click on another vehicle to copy its orders or Ctrl+Click to share orders. A depot order disables automatic servicing of the vehicle
 

	
 
STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP                  :{BLACK}Show all vehicles that share this schedule
 

	
 
# String parts to build the order string
 
STR_ORDER_GO_TO_WAYPOINT                                        :Go via {WAYPOINT}
 
STR_ORDER_GO_NON_STOP_TO_WAYPOINT                               :Go non-stop via {WAYPOINT}
 

	
 
STR_ORDER_SERVICE_AT                                            :Service at
 
STR_ORDER_SERVICE_NON_STOP_AT                                   :Service non-stop at
 

	
 
STR_ORDER_NEAREST_DEPOT                                         :the nearest
 
STR_ORDER_NEAREST_HANGAR                                        :the nearest Hangar
src/order_cmd.cpp
Show inline comments
 
@@ -809,25 +809,25 @@ CommandCost CmdInsertOrder(DoCommandFlag
 

	
 
						case VEH_SHIP:
 
							if (!IsShipDepotTile(dp->xy)) return CMD_ERROR;
 
							break;
 

	
 
						default: return CMD_ERROR;
 
					}
 
				}
 
			}
 

	
 
			if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && !v->IsGroundVehicle()) return CMD_ERROR;
 
			if (new_order.GetDepotOrderType() & ~(ODTFB_PART_OF_ORDERS | ((new_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0 ? ODTFB_SERVICE : 0))) return CMD_ERROR;
 
			if (new_order.GetDepotActionType() & ~(ODATFB_HALT | ODATFB_NEAREST_DEPOT)) return CMD_ERROR;
 
			if (new_order.GetDepotActionType() & ~(ODATFB_HALT | ODATFB_NEAREST_DEPOT | ODATFB_UNBUNCH)) return CMD_ERROR;
 
			if ((new_order.GetDepotOrderType() & ODTFB_SERVICE) && (new_order.GetDepotActionType() & ODATFB_HALT)) return CMD_ERROR;
 
			break;
 
		}
 

	
 
		case OT_GOTO_WAYPOINT: {
 
			const Waypoint *wp = Waypoint::GetIfValid(new_order.GetDestination());
 
			if (wp == nullptr) return CMD_ERROR;
 

	
 
			switch (v->type) {
 
				default: return CMD_ERROR;
 

	
 
				case VEH_TRAIN: {
src/order_gui.cpp
Show inline comments
 
@@ -389,26 +389,35 @@ static Order GetOrderCmdFromTile(const V
 
	/* Hack-ish; unpack order 0, so everything gets initialised with either zero
 
	 * or a suitable default value for the variable. Then also override the index
 
	 * as it is not coming from a pool, so would be initialised. */
 
	Order order(0);
 
	order.index = 0;
 

	
 
	/* check depot first */
 
	if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsTileOwner(tile, _local_company)) {
 
		order.MakeGoToDepot(v->type == VEH_AIRCRAFT ? GetStationIndex(tile) : GetDepotIndex(tile),
 
				ODTFB_PART_OF_ORDERS,
 
				(_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 (_ctrl_pressed) {
 
			/* Don't allow a new unbunching order if we already have one. */
 
			if (v->HasUnbunchingOrder()) {
 
				ShowErrorMessage(STR_ERROR_CAN_T_INSERT_NEW_ORDER, STR_ERROR_UNBUNCHING_ONLY_ONE_ALLOWED, WL_ERROR);
 
				/* Return an empty order to bail out. */
 
				order.Free();
 
				return order;
 
			} else {
 
				order.SetDepotActionType(ODATFB_UNBUNCH);
 
			}
 
		}
 
		return order;
 
	}
 

	
 
	/* check rail waypoint */
 
	if (IsRailWaypointTile(tile) &&
 
			v->type == VEH_TRAIN &&
 
			IsTileOwner(tile, _local_company)) {
 
		order.MakeGoToWaypoint(GetStationIndex(tile));
 
		if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
 
		return order;
 
	}
 

	
0 comments (0 inline, 0 general)