The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: Ves on June 05, 2013, 11:23:17 PM

Title: constraint[prev][0]=any... bug?
Post by: Ves on June 05, 2013, 11:23:17 PM
Hello James!

I'm sitting here trying to get the constraints to work, but this seems rather odd.....
As I understood it, the line: constraint[next][0]=any would forbid the car in particular to be the last one in the train, without specifying which car should be after.
I would think that as almost everything else, every thing would have a counterpart and therefore the syntax: "constraint[prev]
  • =any[/b]" would be legal. The result would be that the car in particular could not be the first in the train. This is what I cannot get to work. The locos just shows up with green lines in the depot, being able to put first in a convoy.

    You could ask why I would want this feature, while it seems rather odd why I would point out that a car would NOT go first in the train. The reason is I want to put it on a Loco. I have two locos, one is obviously going to be first in the train, but the second loco, I want to be last in the train. The second loco has a different name than the first one and has the line "can_lead_from_rear=1" so it can drag the train when it gets into a sack-station (which is common practice at least in Sweden). If you put can_lead_from_rear=1 on a loco going FIRST in the train, you get som very strange results, but I guess that this would be harder to code....?

    I want that loco to remain invincible because otherwise all the locos would get double up in the depot, and this would be achieved if I could get the line "constraint[prevt][0]=any" to work properly :) The only other sollution as it is now, is 'constraiting' every single car that might be the last one before the rear loco :P

    Is this done like this for a reason, or is it just a mis, or am i just stupid for not understanding something?  :redx: :P
    If it is programmed this way, is it too much to ask for a solution?  :)
Title: Re: constraint[prev][0]=any... bug?
Post by: jamespetts on June 05, 2013, 11:35:25 PM
Thank you for your feedback. This is not actually a bug, since I had not intended to implement constraint[prev][0]=any, as I had not considered any situations in which it would be necessary.

This is an interesting suggestion, which I will bear in mind, and should not be too hard to implement, although I have quite a long queue of development work at present.
Title: Re: constraint[prev][0]=any... bug?
Post by: Ves on June 06, 2013, 07:27:50 AM
ok, yeah I understand you have some busy times!  8)
But thanks for reconsider it! :)

What about the other aspect of the issue, the can_lead_from_rear=1? Would it be possible for the game e.g. to check whether the vehicle with the line is first in the convoy and then ignoring the line, making it possible to put the SAME loco first and last in the train?
Title: Re: constraint[prev][0]=any... bug?
Post by: jamespetts on June 06, 2013, 11:34:37 AM
What do you mean by the same - do you mean the exact same vehicle, or the same type of vehicle?
Title: Re: constraint[prev][0]=any... bug?
Post by: Ves on June 06, 2013, 03:26:15 PM
The exact same vehicle. well ofcourse copys of the same vehicle....

For now I have to make two different version of every loco to make it work.
Example:
name=Rc1
- and -
name=Rc1_can_lead_from_rear

If this was done, the line "can_lead_from_rear=1" would be put in the original loco, and that loco could be put in front and as last one and the desired effect would appear
Title: Re: constraint[prev][0]=any... bug?
Post by: jamespetts on June 06, 2013, 03:54:45 PM
Something to consider...
Title: Re: constraint[prev][0]=any... bug?
Post by: prissi on June 06, 2013, 10:35:20 PM
If you define [next][0]=None, then nothing is allowed to followin, i.e. this must be the last in any consist. That will almost achieve the same as the request. (And is compatible with almost any simutrans version published).
Title: Re: constraint[prev][0]=any... bug?
Post by: Ves on June 07, 2013, 08:36:05 AM
Yes I figured that out as well. But then you remove the possibility to have the the trains drive multiple next to each other ;)
Title: Re: constraint[prev][0]=any... bug?
Post by: neroden on June 12, 2013, 09:11:12 PM
James, I have some ideas for how implementing this constraint (on various types of B-units and cabless locos) could be used to avoid certain bugs in the reverser.  So I think it would be worthwhile to implement.
Title: Re: constraint[prev][0]=any... bug?
Post by: jamespetts on June 12, 2013, 10:20:24 PM
Interesting - can you elaborate on how this would help?
Title: Re: constraint[prev][0]=any... bug?
Post by: neroden on June 12, 2013, 11:26:45 PM
Quote from: jamespetts on June 12, 2013, 10:20:24 PM
Interesting - can you elaborate on how this would help?
I don't think I've quite got it clear in my head yet, but it's an idea for how to detect units which shouldn't run in front.