mirror of https://github.com/OpenTTD/OpenTTD
(svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask
parent
a40d6951d1
commit
b7f36808ac
|
@ -501,8 +501,8 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
|
||||||
|
|
||||||
if (p2 & DEPOT_MASS_SEND) {
|
if (p2 & DEPOT_MASS_SEND) {
|
||||||
/* Mass goto depot requested */
|
/* Mass goto depot requested */
|
||||||
if (!ValidVLWFlags(p2 & VLW_FLAGS)) return CMD_ERROR;
|
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
|
||||||
return SendAllVehiclesToDepot(VEH_Aircraft, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_FLAGS), p1);
|
return SendAllVehiclesToDepot(VEH_Aircraft, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
||||||
|
|
|
@ -368,8 +368,8 @@ int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
if (p2 & DEPOT_MASS_SEND) {
|
if (p2 & DEPOT_MASS_SEND) {
|
||||||
/* Mass goto depot requested */
|
/* Mass goto depot requested */
|
||||||
if (!ValidVLWFlags(p2 & VLW_FLAGS)) return CMD_ERROR;
|
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
|
||||||
return SendAllVehiclesToDepot(VEH_Road, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_FLAGS), p1);
|
return SendAllVehiclesToDepot(VEH_Road, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
||||||
|
|
|
@ -1011,8 +1011,8 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
if (p2 & DEPOT_MASS_SEND) {
|
if (p2 & DEPOT_MASS_SEND) {
|
||||||
/* Mass goto depot requested */
|
/* Mass goto depot requested */
|
||||||
if (!ValidVLWFlags(p2 & VLW_FLAGS)) return CMD_ERROR;
|
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
|
||||||
return SendAllVehiclesToDepot(VEH_Ship, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_FLAGS), p1);
|
return SendAllVehiclesToDepot(VEH_Ship, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
||||||
|
|
|
@ -1945,8 +1945,8 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
if (p2 & DEPOT_MASS_SEND) {
|
if (p2 & DEPOT_MASS_SEND) {
|
||||||
/* Mass goto depot requested */
|
/* Mass goto depot requested */
|
||||||
if (!ValidVLWFlags(p2 & VLW_FLAGS)) return CMD_ERROR;
|
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
|
||||||
return SendAllVehiclesToDepot(VEH_Train, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_FLAGS), p1);
|
return SendAllVehiclesToDepot(VEH_Train, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_CREATE: {
|
case WE_CREATE: {
|
||||||
uint16 window_type = w->window_number & VLW_FLAGS;
|
uint16 window_type = w->window_number & VLW_MASK;
|
||||||
vl->vehicle_type = GB(w->window_number, 11, 5);
|
vl->vehicle_type = GB(w->window_number, 11, 5);
|
||||||
w->caption_color = GB(w->window_number, 0, 8); // PlayerID
|
w->caption_color = GB(w->window_number, 0, 8); // PlayerID
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||||
int i;
|
int i;
|
||||||
const PlayerID owner = (PlayerID)w->caption_color;
|
const PlayerID owner = (PlayerID)w->caption_color;
|
||||||
const Player *p = GetPlayer(owner);
|
const Player *p = GetPlayer(owner);
|
||||||
const uint16 window_type = w->window_number & VLW_FLAGS;
|
const uint16 window_type = w->window_number & VLW_MASK;
|
||||||
const StationID station = (window_type == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
|
const StationID station = (window_type == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
|
||||||
const OrderID order = (window_type == VLW_SHARED_ORDERS) ? GB(w->window_number, 16, 16) : INVALID_ORDER;
|
const OrderID order = (window_type == VLW_SHARED_ORDERS) ? GB(w->window_number, 16, 16) : INVALID_ORDER;
|
||||||
|
|
||||||
|
@ -1392,7 +1392,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
assert(vl->l.list_length != 0);
|
assert(vl->l.list_length != 0);
|
||||||
DoCommandP(0, GB(w->window_number, 16, 16) /* StationID or OrderID (depending on VLW). Nomatter which one it is, it's needed here */,
|
DoCommandP(0, GB(w->window_number, 16, 16) /* StationID or OrderID (depending on VLW). Nomatter which one it is, it's needed here */,
|
||||||
(w->window_number & VLW_FLAGS) | DEPOT_MASS_SEND | (_ctrl_pressed ? DEPOT_SERVICE : 0), NULL, CMD_SEND_TO_DEPOT(vl->vehicle_type));
|
(w->window_number & VLW_MASK) | DEPOT_MASS_SEND | (_ctrl_pressed ? DEPOT_SERVICE : 0), NULL, CMD_SEND_TO_DEPOT(vl->vehicle_type));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10: // Right button
|
case 10: // Right button
|
||||||
|
@ -1417,7 +1417,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
case WE_TICK: /* resort the list every 20 seconds orso (10 days) */
|
case WE_TICK: /* resort the list every 20 seconds orso (10 days) */
|
||||||
if (--vl->l.resort_timer == 0) {
|
if (--vl->l.resort_timer == 0) {
|
||||||
StationID station = ((w->window_number & VLW_FLAGS) == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
|
StationID station = ((w->window_number & VLW_MASK) == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
|
||||||
PlayerID owner = (PlayerID)w->caption_color;
|
PlayerID owner = (PlayerID)w->caption_color;
|
||||||
|
|
||||||
DEBUG(misc, 1) ("Periodic resort %d list player %d station %d", vl->vehicle_type, owner, station);
|
DEBUG(misc, 1) ("Periodic resort %d list player %d station %d", vl->vehicle_type, owner, station);
|
||||||
|
|
|
@ -17,10 +17,10 @@ void ResortVehicleLists(void);
|
||||||
|
|
||||||
/* Vehicle List Window type flags */
|
/* Vehicle List Window type flags */
|
||||||
enum {
|
enum {
|
||||||
VLW_FLAGS = (1 << 8)|(1 << 9)|(1 << 10),
|
VLW_STANDARD = 0 << 8,
|
||||||
VLW_STANDARD = 0,
|
|
||||||
VLW_SHARED_ORDERS = 1 << 8,
|
VLW_SHARED_ORDERS = 1 << 8,
|
||||||
VLW_STATION_LIST = 2 << 8,
|
VLW_STATION_LIST = 2 << 8,
|
||||||
|
VLW_MASK = 0x700,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool ValidVLWFlags(uint16 flags)
|
static inline bool ValidVLWFlags(uint16 flags)
|
||||||
|
|
Loading…
Reference in New Issue