src/economy.cpp
changeset 7970 204ece3a05d5
parent 7954 774f46ff9444
child 7988 6075538f6111
equal deleted inserted replaced
7969:9050701304bd 7970:204ece3a05d5
  1427 
  1427 
  1428 		for (CargoList::List::const_iterator it = cargos->begin(); it != cargos->end(); it++) {
  1428 		for (CargoList::List::const_iterator it = cargos->begin(); it != cargos->end(); it++) {
  1429 			CargoPacket *cp = *it;
  1429 			CargoPacket *cp = *it;
  1430 			if (!cp->paid_for &&
  1430 			if (!cp->paid_for &&
  1431 					cp->source != last_visited &&
  1431 					cp->source != last_visited &&
  1432 					ge->acceptance &&
  1432 					HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
  1433 					(front_v->current_order.flags & OF_TRANSFER) == 0) {
  1433 					(front_v->current_order.flags & OF_TRANSFER) == 0) {
  1434 				/* Deliver goods to the station */
  1434 				/* Deliver goods to the station */
  1435 				st->time_since_unload = 0;
  1435 				st->time_since_unload = 0;
  1436 
  1436 
  1437 				/* handle end of route payment */
  1437 				/* handle end of route payment */
  1543 		if (HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) {
  1543 		if (HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) {
  1544 			uint cargo_count = v->cargo.Count();
  1544 			uint cargo_count = v->cargo.Count();
  1545 			uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
  1545 			uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
  1546 			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
  1546 			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
  1547 
  1547 
  1548 			if (ge->acceptance && !(u->current_order.flags & OF_TRANSFER)) {
  1548 			if (HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OF_TRANSFER)) {
  1549 				/* The cargo has reached it's final destination, the packets may now be destroyed */
  1549 				/* The cargo has reached it's final destination, the packets may now be destroyed */
  1550 				remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
  1550 				remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
  1551 
  1551 
  1552 				result |= 1;
  1552 				result |= 1;
  1553 			} else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
  1553 			} else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
  1554 				remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
  1554 				remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
       
  1555 				SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP);
  1555 
  1556 
  1556 				result |= 2;
  1557 				result |= 2;
  1557 			} else {
  1558 			} else {
  1558 				/* The order changed while unloading (unset unload/transfer) or the
  1559 				/* The order changed while unloading (unset unload/transfer) or the
  1559 				 * station does not accept goods anymore. */
  1560 				 * station does not accept goods anymore. */
  1626 			completely_empty = false;
  1627 			completely_empty = false;
  1627 			anything_loaded = true;
  1628 			anything_loaded = true;
  1628 
  1629 
  1629 			ge->cargo.MoveTo(&v->cargo, cap, CargoList::MTA_CARGO_LOAD, st->xy);
  1630 			ge->cargo.MoveTo(&v->cargo, cap, CargoList::MTA_CARGO_LOAD, st->xy);
  1630 
  1631 
  1631 			unloading_time += cap;
  1632 			SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP);
  1632 			st->time_since_load = 0;
  1633 			st->time_since_load = 0;
  1633 			st->last_vehicle_type = v->type;
  1634 			st->last_vehicle_type = v->type;
       
  1635 
       
  1636 			unloading_time += cap;
  1634 
  1637 
  1635 			result |= 2;
  1638 			result |= 2;
  1636 		}
  1639 		}
  1637 
  1640 
  1638 		if (v->cargo.Count() == v->cargo_cap) {
  1641 		if (v->cargo.Count() == v->cargo_cap) {