|
@@ -1426,13 +1426,13 @@ void VehiclePayment(Vehicle *front_v)
|
|
|
const CargoList::List *cargos = v->cargo.Packets();
|
|
|
|
|
|
for (CargoList::List::const_iterator it = cargos->begin(); it != cargos->end(); it++) {
|
|
|
CargoPacket *cp = *it;
|
|
|
if (!cp->paid_for &&
|
|
|
cp->source != last_visited &&
|
|
|
ge->acceptance &&
|
|
|
HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
|
|
|
(front_v->current_order.flags & OF_TRANSFER) == 0) {
|
|
|
/* Deliver goods to the station */
|
|
|
st->time_since_unload = 0;
|
|
|
|
|
|
/* handle end of route payment */
|
|
|
Money profit = DeliverGoods(cp->count, v->cargo_type, cp->source, last_visited, cp->source_xy, cp->days_in_transit);
|
|
@@ -1542,19 +1542,20 @@ static void LoadUnloadVehicle(Vehicle *v
|
|
|
|
|
|
if (HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) {
|
|
|
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 (ge->acceptance && !(u->current_order.flags & OF_TRANSFER)) {
|
|
|
if (HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OF_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.flags & (OF_UNLOAD | OF_TRANSFER)) {
|
|
|
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
|
|
|
SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP);
|
|
|
|
|
|
result |= 2;
|
|
|
} else {
|
|
|
/* The order changed while unloading (unset unload/transfer) or the
|
|
|
* station does not accept goods anymore. */
|
|
|
CLRBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
|
|
@@ -1625,16 +1626,18 @@ static void LoadUnloadVehicle(Vehicle *v
|
|
|
* removed; that's how TTDPatch behaves too. --pasky */
|
|
|
completely_empty = false;
|
|
|
anything_loaded = true;
|
|
|
|
|
|
ge->cargo.MoveTo(&v->cargo, cap, CargoList::MTA_CARGO_LOAD, st->xy);
|
|
|
|
|
|
unloading_time += cap;
|
|
|
SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP);
|
|
|
st->time_since_load = 0;
|
|
|
st->last_vehicle_type = v->type;
|
|
|
|
|
|
unloading_time += cap;
|
|
|
|
|
|
result |= 2;
|
|
|
}
|
|
|
|
|
|
if (v->cargo.Count() == v->cargo_cap) {
|
|
|
SETBIT(cargo_full, v->cargo_type);
|
|
|
} else {
|