|
@@ -506,25 +506,25 @@ int32 CmdSendAircraftToHangar(TileIndex
|
|
|
}
|
|
|
|
|
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
|
|
|
|
|
v = GetVehicle(p1);
|
|
|
|
|
|
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
|
|
|
|
|
|
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
|
|
|
if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
|
|
|
/* We called with a different DEPOT_SERVICE setting.
|
|
|
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
|
|
|
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
|
|
|
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
|
|
|
if (flags & DC_EXEC) {
|
|
|
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
|
|
|
if (flags & DC_EXEC) {
|
|
|
if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
|
|
|
v->current_order.type = OT_DUMMY;
|
|
|
v->current_order.flags = 0;
|
|
@@ -1906,33 +1906,33 @@ static uint GetNumTerminals(const Airpor
|
|
|
|
|
|
for (i = Airport->terminals[0]; i > 0; i--) num += Airport->terminals[i];
|
|
|
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport)
|
|
|
{
|
|
|
AirportFTA *temp;
|
|
|
Station *st;
|
|
|
|
|
|
/* example of more terminalgroups
|
|
|
{0,HANGAR,NOTHING_block,1}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER_block,1}, {0,0,N,1},
|
|
|
Heading 255 denotes a group. We see 2 groups here:
|
|
|
1. group 0 -- TERM_GROUP1_block (check block)
|
|
|
2. group 1 -- TERM_GROUP2_ENTER_block (check block)
|
|
|
First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it
|
|
|
looks at the corresponding terminals of that group. If no free ones are found, other
|
|
|
possible groups are checked (in this case group 1, since that is after group 0). If that
|
|
|
fails, then attempt fails and plane waits
|
|
|
*/
|
|
|
* {0,HANGAR,NOTHING_block,1}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER_block,1}, {0,0,N,1},
|
|
|
* Heading 255 denotes a group. We see 2 groups here:
|
|
|
* 1. group 0 -- TERM_GROUP1_block (check block)
|
|
|
* 2. group 1 -- TERM_GROUP2_ENTER_block (check block)
|
|
|
* First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it
|
|
|
* looks at the corresponding terminals of that group. If no free ones are found, other
|
|
|
* possible groups are checked (in this case group 1, since that is after group 0). If that
|
|
|
* fails, then attempt fails and plane waits
|
|
|
*/
|
|
|
if (Airport->terminals[0] > 1) {
|
|
|
st = GetStation(v->u.air.targetairport);
|
|
|
temp = Airport->layout[v->u.air.pos].next_in_chain;
|
|
|
while (temp != NULL) {
|
|
|
if (temp->heading == 255) {
|
|
|
if (!HASBITS(st->airport_flags, temp->block)) {
|
|
|
int target_group;
|
|
|
int i;
|
|
|
int group_start = 0;
|
|
|
int group_end;
|
|
|
|
|
|
//read which group do we want to go to?
|