mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-07 06:39:08 +00:00
(svn r26341) -Fix [FS#5902]: Reroute cargo when automatic distribution is switched off.
This commit is contained in:
parent
997b2634c5
commit
2945e76269
@ -102,8 +102,8 @@ LinkGraphJob::~LinkGraphJob()
|
|||||||
|
|
||||||
/* Swap shares and invalidate ones that are completely deleted. Don't
|
/* Swap shares and invalidate ones that are completely deleted. Don't
|
||||||
* really delete them as we could then end up with unroutable cargo
|
* really delete them as we could then end up with unroutable cargo
|
||||||
* somewhere. Do delete them if automatic distribution has been turned
|
* somewhere. Do delete them and also reroute relevant cargo if
|
||||||
* off for that cargo, though. */
|
* automatic distribution has been turned off for that cargo. */
|
||||||
for (FlowStatMap::iterator it(ge.flows.begin()); it != ge.flows.end();) {
|
for (FlowStatMap::iterator it(ge.flows.begin()); it != ge.flows.end();) {
|
||||||
FlowStatMap::iterator new_it = flows.find(it->first);
|
FlowStatMap::iterator new_it = flows.find(it->first);
|
||||||
if (new_it == flows.end()) {
|
if (new_it == flows.end()) {
|
||||||
@ -111,7 +111,13 @@ LinkGraphJob::~LinkGraphJob()
|
|||||||
it->second.Invalidate();
|
it->second.Invalidate();
|
||||||
++it;
|
++it;
|
||||||
} else {
|
} else {
|
||||||
|
FlowStat shares(INVALID_STATION, 1);
|
||||||
|
it->second.SwapShares(shares);
|
||||||
ge.flows.erase(it++);
|
ge.flows.erase(it++);
|
||||||
|
for (FlowStat::SharesMap::const_iterator shares_it(shares.GetShares()->begin());
|
||||||
|
shares_it != shares.GetShares()->end(); ++shares_it) {
|
||||||
|
RerouteCargo(st, this->Cargo(), shares_it->second, st->index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
it->second.SwapShares(new_it->second);
|
it->second.SwapShares(new_it->second);
|
||||||
|
Loading…
Reference in New Issue
Block a user