--- a/src/economy.cpp Tue Apr 08 11:54:53 2008 +0000
+++ b/src/economy.cpp Sat Apr 12 21:38:49 2008 +0000
@@ -1476,7 +1476,7 @@
for (Vehicle *v = front_v; v != NULL; v = v->Next()) {
/* No cargo to unload */
- if (v->cargo_cap == 0 || v->cargo.Empty()) continue;
+ if (v->cargo_cap == 0 || v->cargo.Empty() || front_v->current_order.GetUnloadType() & OUFB_NO_UNLOAD) continue;
/* All cargo has already been paid for, no need to pay again */
if (!v->cargo.UnpaidCargo()) {
@@ -1492,7 +1492,7 @@
if (!cp->paid_for &&
cp->source != last_visited &&
HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
- (front_v->current_order.GetUnloadType() & OFB_TRANSFER) == 0) {
+ (front_v->current_order.GetUnloadType() & OUFB_TRANSFER) == 0) {
/* Deliver goods to the station */
st->time_since_unload = 0;
@@ -1505,8 +1505,8 @@
result |= 1;
SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
- } else if (front_v->current_order.GetUnloadType() & (OFB_UNLOAD | OFB_TRANSFER)) {
- if (!cp->paid_for && (front_v->current_order.GetUnloadType() & OFB_TRANSFER) != 0) {
+ } else if (front_v->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) {
+ if (!cp->paid_for && (front_v->current_order.GetUnloadType() & OUFB_TRANSFER) != 0) {
Money profit = GetTransportedGoodsIncome(
cp->count,
/* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */
@@ -1559,7 +1559,7 @@
/* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) {
- if (_patches.improved_load && HasBit(v->current_order.GetLoadType(), OF_FULL_LOAD)) {
+ if (_patches.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
/* 'Reserve' this cargo for this vehicle, because we were first. */
for (; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1602,17 +1602,17 @@
GoodsEntry *ge = &st->goods[v->cargo_type];
- if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING)) {
+ if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
uint cargo_count = v->cargo.Count();
uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
- if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OFB_TRANSFER)) {
+ if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
/* The cargo has reached it's final destination, the packets may now be destroyed */
remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
result |= 1;
- } else if (u->current_order.GetUnloadType() & (OFB_UNLOAD | OFB_TRANSFER)) {
+ } else if (u->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) {
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
@@ -1640,8 +1640,8 @@
continue;
}
- /* Do not pick up goods that we unloaded */
- if (u->current_order.GetUnloadType() & OFB_UNLOAD) continue;
+ /* Do not pick up goods when we have no-load set. */
+ if (u->current_order.GetLoadType() & OLFB_NO_LOAD) continue;
/* update stats */
int t;
@@ -1713,7 +1713,7 @@
* all wagons at the same time instead of using the same 'improved'
* loading algorithm for the wagons (only fill wagon when there is
* enough to fill the previous wagons) */
- if (_patches.improved_load && HasBit(u->current_order.GetLoadType(), OF_FULL_LOAD)) {
+ if (_patches.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
/* Update left cargo */
for (v = u; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1732,8 +1732,8 @@
}
} else {
bool finished_loading = true;
- if (HasBit(v->current_order.GetLoadType(), OF_FULL_LOAD)) {
- if (_patches.full_load_any) {
+ if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {
+ if (v->current_order.GetLoadType() == OLF_FULL_LOAD_ANY) {
/* if the aircraft carries passengers and is NOT full, then
* continue loading, no matter how much mail is in */
if ((v->type == VEH_AIRCRAFT && IsCargoInClass(v->cargo_type, CC_PASSENGERS) && v->cargo_cap != v->cargo.Count()) ||