src/economy.cpp
changeset 10119 9b29b2296969
parent 10109 2c2afb6c4ea1
child 10121 b82006b98b4a
equal deleted inserted replaced
10118:8f5246e74ecf 10119:9b29b2296969
  1471 	/* Start unloading in at the first possible moment */
  1471 	/* Start unloading in at the first possible moment */
  1472 	front_v->load_unload_time_rem = 1;
  1472 	front_v->load_unload_time_rem = 1;
  1473 
  1473 
  1474 	for (Vehicle *v = front_v; v != NULL; v = v->Next()) {
  1474 	for (Vehicle *v = front_v; v != NULL; v = v->Next()) {
  1475 		/* No cargo to unload */
  1475 		/* No cargo to unload */
  1476 		if (v->cargo_cap == 0 || v->cargo.Empty()) continue;
  1476 		if (v->cargo_cap == 0 || v->cargo.Empty() || front_v->current_order.GetUnloadType() & OUFB_NO_UNLOAD) continue;
  1477 
  1477 
  1478 		/* All cargo has already been paid for, no need to pay again */
  1478 		/* All cargo has already been paid for, no need to pay again */
  1479 		if (!v->cargo.UnpaidCargo()) {
  1479 		if (!v->cargo.UnpaidCargo()) {
  1480 			SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
  1480 			SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
  1481 			continue;
  1481 			continue;
  1597 			if (cb_load_amount != CALLBACK_FAILED && cb_load_amount != 0) load_amount = cb_load_amount & 0xFF;
  1597 			if (cb_load_amount != CALLBACK_FAILED && cb_load_amount != 0) load_amount = cb_load_amount & 0xFF;
  1598 		}
  1598 		}
  1599 
  1599 
  1600 		GoodsEntry *ge = &st->goods[v->cargo_type];
  1600 		GoodsEntry *ge = &st->goods[v->cargo_type];
  1601 
  1601 
  1602 		if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING)) {
  1602 		if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
  1603 			uint cargo_count = v->cargo.Count();
  1603 			uint cargo_count = v->cargo.Count();
  1604 			uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
  1604 			uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
  1605 			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
  1605 			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
  1606 
  1606 
  1607 			if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
  1607 			if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
  1636 
  1636 
  1637 			continue;
  1637 			continue;
  1638 		}
  1638 		}
  1639 
  1639 
  1640 		/* Do not pick up goods that we unloaded */
  1640 		/* Do not pick up goods that we unloaded */
  1641 		if (u->current_order.GetUnloadType() & OUFB_UNLOAD) continue;
  1641 		if ((u->current_order.GetUnloadType() & OUFB_UNLOAD) || (u->current_order.GetLoadType() & OLFB_NO_LOAD)) continue;
  1642 
  1642 
  1643 		/* update stats */
  1643 		/* update stats */
  1644 		int t;
  1644 		int t;
  1645 		switch (u->type) {
  1645 		switch (u->type) {
  1646 			case VEH_TRAIN: t = u->u.rail.cached_max_speed; break;
  1646 			case VEH_TRAIN: t = u->u.rail.cached_max_speed; break;