changeset 16077:f1fffbd6c714 draft

(svn r20770) -Codechange: move some bits around in CmdMassStartStop's parameters
author rubidium <rubidium@openttd.org>
date Wed, 08 Sep 2010 21:14:41 +0000
parents 5d9e762ad46e
children aef87b55e3b5
files src/depot_gui.cpp src/group_gui.cpp src/vehicle_cmd.cpp src/vehicle_gui.cpp
diffstat 4 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -741,7 +741,7 @@
 
 			case DEPOT_WIDGET_STOP_ALL:
 			case DEPOT_WIDGET_START_ALL:
-				DoCommandP(this->window_number, 0, this->type | (widget == DEPOT_WIDGET_START_ALL ? (1 << 5) : 0), CMD_MASS_START_STOP);
+				DoCommandP(this->window_number, (widget == DEPOT_WIDGET_START_ALL ? (1 << 0) : 0), this->type, CMD_MASS_START_STOP);
 				break;
 
 			case DEPOT_WIDGET_SELL_ALL:
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -481,11 +481,10 @@
 
 			case GRP_WIDGET_START_ALL:
 			case GRP_WIDGET_STOP_ALL: { // Start/stop all vehicles of the list
-				DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
-													| (1 << 6)
-													| (widget == GRP_WIDGET_START_ALL ? (1 << 5) : 0)
+				DoCommandP(0, (1 << 1) | (widget == GRP_WIDGET_START_ALL ? (1 << 0) : 0),
+													((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
+													| (this->group_sel << 16)
 													| this->vehicle_type, CMD_MASS_START_STOP);
-
 				break;
 			}
 
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -433,12 +433,13 @@
  * Starts or stops a lot of vehicles
  * @param tile Tile of the depot where the vehicles are started/stopped (only used for depots)
  * @param flags type of operation
- * @param p1 Station/Order/Depot ID (only used for vehicle list windows)
+ * @param p1 bitmask
+ *   - bit 0 false = start vehicles, true = stop vehicles
+ *   - bit 1 if set, then it's a vehicle list window, not a depot and Tile is ignored in this case
  * @param p2 bitmask
  *   - bit 0-4 Vehicle type
- *   - bit 5 false = start vehicles, true = stop vehicles
- *   - bit 6 if set, then it's a vehicle list window, not a depot and Tile is ignored in this case
  *   - bit 8-11 Vehicle List Window type (ignored unless bit 6 is set)
+ *   - bit 16-31 Station/Order/Depot ID (only used for vehicle list windows)
  * @param text unused
  * @return the cost of this operation or an error
  */
@@ -446,13 +447,13 @@
 {
 	VehicleList list;
 	VehicleType vehicle_type = Extract<VehicleType, 0, 3>(p2);
-	bool start_stop = HasBit(p2, 5);
-	bool vehicle_list_window = HasBit(p2, 6);
+	bool start_stop = HasBit(p1, 0);
+	bool vehicle_list_window = HasBit(p1, 1);
 
 	if (!IsCompanyBuildableVehicleType(vehicle_type)) return CMD_ERROR;
 
 	if (vehicle_list_window) {
-		uint32 id = p1;
+		uint32 id = GB(p2, 16, 16);
 		uint16 window_type = p2 & VLW_MASK;
 
 		if (!GenerateVehicleSortList(&list, vehicle_type, _current_company, id, window_type)) return CMD_ERROR;
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1286,8 +1286,7 @@
 
 			case VLW_WIDGET_STOP_ALL:
 			case VLW_WIDGET_START_ALL:
-				DoCommandP(0, GB(this->window_number, 16, 16),
-						(this->window_number & VLW_MASK) | (1 << 6) | (widget == VLW_WIDGET_START_ALL ? (1 << 5) : 0) | this->vehicle_type, CMD_MASS_START_STOP);
+				DoCommandP(0, (1 << 1) | (widget == VLW_WIDGET_START_ALL ? (1 << 0) : 0), GB(this->window_number, 16, 16) << 16 | (this->window_number & VLW_MASK) | this->vehicle_type, CMD_MASS_START_STOP);
 				break;
 		}
 	}