News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

[Code v3.6] Ware Merging

Started by knightly, May 10, 2009, 02:42:39 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

knightly

Hi James,

In the following code from ware_t::can_merge_with() :

Quote

   return index  == w.index  &&
      ziel  == w.ziel  &&
      // Only merge the destination *position* if the load is not freight
      (index < 3 || zielpos == w.zielpos) &&
      origin == w.origin;


I suppose the expression in blue should be index < 2 instead? Since pax and mail are hard-coded as 0 and 1 respectively.

If it is correct, then also in ware_t :

Quote
   bool is_passenger() const {  return index==0; }
   bool is_mail() const {  return index==1; }
   bool is_freight() const {  return index>2; }

this should also be changed to index>=2, right?

jamespetts

Ahh, that seems to make sense...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

knightly

gerw has confirmed here that is_freight() is correct with index>2. So, please ignore the 2nd point in my first post. Thank you for your attention.

jamespetts

Knightly,

wouldn't that also mean that the first one was correct, too? If index > 2 is freight, then index < 3 is non-freight, isn't it?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

knightly

Sorry, I am not sure. I don't know if there will be any unexpected side-effects. But ST STD uses index<2, so probably it's safer to follow.