Hi,
I've compiled your patch applied to r160003 with MSVC on WinXP and I think I've found a bug: the game asserts on
Code:
template<class ANNOTATION>
void MultiCommodityFlow::Dijkstra(NodeID from, PathVector & paths) {
...
annos.erase(dest); //line 124 in mfc.cpp
...
}
with "invalid operator<"
You can reproduce it building two stations and a bus (I haven't tried any other type of transport) connecting them (A->B). The assertion will pop up some time after the bus reaches both bus stops for the first time (probably on first graph recalculation).
I had some time and started debugging your code and I think I've found the cause. The
Code:
bool DistanceAnnotation::comp::operator()
can't be used as predicate because it's not strict when x == y as in that case it returns true. I've changed it to
Code:
bool DistanceAnnotation::comp::operator()(const DistanceAnnotation * x, const DistanceAnnotation * y) const {
if(x == y)
return false;
return !greater(x->GetAnnotation(), y->GetAnnotation(), x, y);
}and the problem was gone. Also after confirming that I can build one route and keep playing I've created a second line B->C with one bus and tried to reproduce the "freeze" bug, but it hasn't occurred (let it run on fast forward for more then 2 game years).
I've attached a save, the assert (or freeze if it's the same problem) should appear on 7th March 1950.
I hope these informations will help you to finish this great patch
