Changeset - r21242:f9186ba6c34b
[Not reviewed]
master
0 1 0
fonsinchen - 11 years ago 2014-02-10 18:55:03
fonsinchen@openttd.org
(svn r26330) -Fix: the theoretical case of rerouting cargo from one VehicleCargoList to another.
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/cargoaction.cpp
Show inline comments
 
@@ -221,14 +221,13 @@ bool VehicleCargoReroute::operator()(Car
 
	if (cp_new == NULL) cp_new = cp;
 
	if (cp_new->NextStation() == this->avoid || cp_new->NextStation() == this->avoid2) {
 
		cp->SetNextStation(this->ge->GetVia(cp_new->SourceStation(), this->avoid, this->avoid2));
 
	}
 
	if (this->source != this->destination) {
 
		this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
 
		this->source->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
 
		this->destination->action_counts[VehicleCargoList::MTA_TRANSFER] += cp_new->Count();
 
		this->destination->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
 
	}
 

	
 
	/* Legal, as front pushing doesn't invalidate iterators in std::list. */
 
	this->destination->packets.push_front(cp_new);
 
	return cp_new == cp;
 
}
0 comments (0 inline, 0 general)