News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Cape Town to Cairo

Started by jameskuyper, October 13, 2017, 08:18:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jameskuyper

I am thinking about (and at this point, I might never get past the "thinking about it" phase) implementing a version of the "Cape Town to Cairo" scenario from Railroad Tycoon II. The victory condition would be shipping a certain minimum number of passengers and mail per year from Cape Town to Cairo (and vice versa). I only want the count of passengers and mail that had a started in Cape Town, and ended in Cairo (and vice-versa). Would halt_x::get_freight_to_halt() give me this information? I could easily imagine that this function would return only the amount shipped directly from the first halt to the second one, and would not include passengers and mail that stopped over at one or more intermediate halts along the way.
I could also imagine that function would include passengers and halts for which CapeTown or Cairo were only intermediate halts for a longer trip. That wouldn't be a problem. In fact, I'd prefer it that way.

Obviously, to use this function, I have to iterate over all halts in Cairo and all halts in Cape Town and total the counts. What's the easiest way to do that (I've figured out a couple of hard ways)? Or is there an alternative way to get it directly from the City objects?

Dwachs

halt_x::get_freight_to_halt only returns number of freight that are scheduled to this halt, i.e., the next the freight has to be unloaded, which is not the destination. Unfortunately, the simutrans program does not track the origins of freight, so there is no statistics available internally how much freight is transported from halt A to halt B. There is the possibility to check if two halts are connected - this can be used for such a scenario as well.
Parsley, sage, rosemary, and maggikraut.