Changeset - r1530:c89d38477ba0
[Not reviewed]
master
0 6 0
celestar - 19 years ago 2005-03-20 08:43:29
celestar@openttd.org
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
6 files changed with 40 insertions and 26 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -575,7 +575,7 @@ static void CheckIfAircraftNeedsService(
 
		return;
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			v->current_order.flags & OF_FULL_LOAD)
 
			v->current_order.flags & OF_HALT_IN_DEPOT)
 
		return;
 

	
 
	if (_patches.gotodepot && VehicleHasDepotOrders(v))
 
@@ -1313,9 +1313,9 @@ static void AircraftEnterHangar(Vehicle 
 
		v->current_order.type = OT_NOTHING;
 
		v->current_order.flags = 0;
 

	
 
		if (old_order.flags & OF_UNLOAD) {
 
		if (HASBIT(old_order.flags, OFB_PART_OF_ORDERS)) {
 
			v->cur_order_index++;
 
		} else if (old_order.flags & OF_FULL_LOAD) { // force depot visit
 
		} else if (HASBIT(old_order.flags, OFB_HALT_IN_DEPOT)) { // force depot visit
 
			v->vehstatus |= VS_STOPPED;
 
			InvalidateWindowClasses(WC_AIRCRAFT_LIST);
 

	
order.h
Show inline comments
 
@@ -16,16 +16,25 @@ enum {
 

	
 
/* Order flags -- please use OFB instead OF and use HASBIT/SETBIT/CLEARBIT */
 
enum {
 
	OF_UNLOAD    = 0x2,
 
	OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
 
	//Flags for stations:
 
	OF_UNLOAD         = 0x2,
 
	OF_FULL_LOAD      = 0x4, // Also used when to force an aircraft into a depot
 

	
 
	//Flags for depots:
 
	OF_PART_OF_ORDERS	= 0x2,
 
	OF_HALT_IN_DEPOT  = 0x4,
 

	
 
	//Common flags
 
	OF_NON_STOP  = 0x8
 
};
 

	
 
/* Order flags bits */
 
enum {
 
	OFB_UNLOAD    = 1,
 
	OFB_FULL_LOAD = 2,
 
	OFB_NON_STOP  = 3
 
	OFB_UNLOAD         = 1,
 
	OFB_FULL_LOAD      = 2,
 
	OFB_PART_OF_ORDERS = 1,
 
	OFB_HALT_IN_DEPOT  = 2,
 
	OFB_NON_STOP       = 3
 
};
 

	
 
/* Possible clone options */
order_gui.c
Show inline comments
 
@@ -167,7 +167,7 @@ static Order GetOrderCmdFromTile(Vehicle
 
			if (v->type == VEH_Train && _map_owner[tile] == _local_player) {
 
				if ((_map5[tile]&0xFC)==0xC0) {
 
					order.type = OT_GOTO_DEPOT;
 
					order.flags = OF_UNLOAD;
 
					order.flags = OF_PART_OF_ORDERS;
 
					order.station = GetDepotByTile(tile)->index;
 
					return order;
 
				}
 
@@ -177,7 +177,7 @@ static Order GetOrderCmdFromTile(Vehicle
 
		case MP_STREET:
 
			if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && _map_owner[tile] == _local_player) {
 
				order.type = OT_GOTO_DEPOT;
 
				order.flags = OF_UNLOAD;
 
				order.flags = OF_PART_OF_ORDERS;
 
				order.station = GetDepotByTile(tile)->index;
 
				return order;
 
			}
 
@@ -187,7 +187,7 @@ static Order GetOrderCmdFromTile(Vehicle
 
			if (v->type != VEH_Aircraft) break;
 
			if ( IsAircraftHangarTile(tile) && _map_owner[tile] == _local_player) {
 
				order.type = OT_GOTO_DEPOT;
 
				order.flags = OF_UNLOAD | OF_NON_STOP;
 
				order.flags = OF_PART_OF_ORDERS | OF_NON_STOP;	//XXX - whats the nonstop stuff doing here?
 
				order.station = _map2[tile];
 
				return order;
 
			}
 
@@ -202,7 +202,7 @@ static Order GetOrderCmdFromTile(Vehicle
 
				case 0x83: tile-= TILE_XY(0,1); break;
 
				}
 
				order.type = OT_GOTO_DEPOT;
 
				order.flags = OF_UNLOAD;
 
				order.flags = OF_PART_OF_ORDERS;
 
				order.station = GetDepotByTile(tile)->index;
 
				return order;
 
			}
roadveh_cmd.c
Show inline comments
 
@@ -334,8 +334,10 @@ int32 CmdSendRoadVehToDepot(int x, int y
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT) {
 
		if (flags & DC_EXEC) {
 
			if (v->current_order.flags & OF_UNLOAD)
 

	
 
			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
 
				v->cur_order_index++;
 

	
 
			v->current_order.type = OT_DUMMY;
 
			v->current_order.flags = 0;
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
@@ -349,7 +351,7 @@ int32 CmdSendRoadVehToDepot(int x, int y
 

	
 
	if (flags & DC_EXEC) {
 
		v->current_order.type = OT_GOTO_DEPOT;
 
		v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
 
		v->current_order.flags = OF_NON_STOP | OF_HALT_IN_DEPOT;
 
		v->current_order.station = depot->index;
 
		v->dest_tile = depot->xy;
 
		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
@@ -1531,9 +1533,9 @@ void RoadVehEnterDepot(Vehicle *v)
 
		v->current_order.flags = 0;
 

	
 
		// Part of the orderlist?
 
		if (t.flags & OF_UNLOAD) {
 
		if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
 
			v->cur_order_index++;
 
		} else if (t.flags & OF_FULL_LOAD) {
 
		} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
 
			v->vehstatus |= VS_STOPPED;
 
			if (v->owner == _local_player) {
 
				SetDParam(0, v->unitnumber);
 
@@ -1583,7 +1585,7 @@ static void CheckIfRoadVehNeedsService(V
 
	// Don't interfere with a depot visit scheduled by the user, or a
 
	// depot visit by the order list.
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			(v->current_order.flags & (OF_FULL_LOAD | OF_UNLOAD)) != 0)
 
			(v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
 
		return;
 

	
 
	//If we already got a slot at a stop, use that FIRST, and go to a depot later
ship_cmd.c
Show inline comments
 
@@ -108,7 +108,7 @@ static void CheckIfShipNeedsService(Vehi
 
		return;
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			v->current_order.flags & OF_FULL_LOAD)
 
			v->current_order.flags & OF_HALT_IN_DEPOT)
 
		return;
 

	
 
	if (_patches.gotodepot && VehicleHasDepotOrders(v))
 
@@ -430,9 +430,9 @@ static void ShipEnterDepot(Vehicle *v)
 
		v->current_order.type = OT_DUMMY;
 
		v->current_order.flags = 0;
 

	
 
		if (t.flags & OF_UNLOAD) {
 
		if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
 
			v->cur_order_index++;
 
		} else if (t.flags & OF_FULL_LOAD) {
 
		} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
 
			v->vehstatus |= VS_STOPPED;
 
			if (v->owner == _local_player) {
 
				SetDParam(0, v->unitnumber);
 
@@ -993,7 +993,10 @@ int32 CmdSendShipToDepot(int x, int y, u
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT) {
 
		if (flags & DC_EXEC) {
 
			if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
 

	
 
			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
 
				v->cur_order_index++;
 

	
 
			v->current_order.type = OT_DUMMY;
 
			v->current_order.flags = 0;
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
@@ -1006,7 +1009,7 @@ int32 CmdSendShipToDepot(int x, int y, u
 
		if (flags & DC_EXEC) {
 
			v->dest_tile = depot->xy;
 
			v->current_order.type = OT_GOTO_DEPOT;
 
			v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
 
			v->current_order.flags = OF_NON_STOP | OF_HALT_IN_DEPOT;
 
			v->current_order.station = depot->index;
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
		}
train_cmd.c
Show inline comments
 
@@ -1353,7 +1353,7 @@ int32 CmdTrainGotoDepot(int x, int y, ui
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT) {
 
		if (flags & DC_EXEC) {
 
			if (v->current_order.flags & OF_UNLOAD) {
 
			if (HASBIT(v->current_order.flags, OF_PART_OF_ORDERS)) {
 
				v->u.rail.days_since_order_progr = 0;
 
				v->cur_order_index++;
 
			}
 
@@ -2956,10 +2956,10 @@ void TrainEnterDepot(Vehicle *v, uint ti
 
		v->current_order.type = OT_DUMMY;
 
		v->current_order.flags = 0;
 

	
 
		if (t.flags & OF_UNLOAD) { // Part of the orderlist?
 
		if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) { // Part of the orderlist?
 
			v->u.rail.days_since_order_progr = 0;
 
			v->cur_order_index++;
 
		} else if (t.flags & OF_FULL_LOAD) { // User initiated?
 
		} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) { // User initiated?
 
			v->vehstatus |= VS_STOPPED;
 
			if (v->owner == _local_player) {
 
				SetDParam(0, v->unitnumber);
 
@@ -2995,7 +2995,7 @@ static void CheckIfTrainNeedsService(Veh
 
	// Don't interfere with a depot visit scheduled by the user, or a
 
	// depot visit by the order list.
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			(v->current_order.flags & (OF_FULL_LOAD | OF_UNLOAD)) != 0)
 
			(v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
 
		return;
 

	
 
	tfdd = FindClosestTrainDepot(v);
0 comments (0 inline, 0 general)