News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

constraint[prev][0]=any... bug?

Started by Ves, June 05, 2013, 11:23:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ves

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?  :)

jamespetts

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.
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.

Ves

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?

jamespetts

What do you mean by the same - do you mean the exact same vehicle, or the same type of vehicle?
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.

Ves

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

jamespetts

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.

prissi

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).

Ves

Yes I figured that out as well. But then you remove the possibility to have the the trains drive multiple next to each other ;)

neroden

#8
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.

jamespetts

Interesting - can you elaborate on how this would help?
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.

neroden

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.