Author Topic: Cape Town to Cairo  (Read 429 times)

0 Members and 1 Guest are viewing this topic.

Offline jameskuyper

Cape Town to Cairo
« on: October 13, 2017, 08:18:19 PM »
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?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4277
  • Total likes: 195
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Cape Town to Cairo
« Reply #1 on: October 16, 2017, 07:33:18 PM »
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.