The International Simutrans Forum

 

Author Topic: constraint[prev][0]=any... bug?  (Read 1886 times)

0 Members and 1 Guest are viewing this topic.

Offline Ves

  • Devotee
  • *
  • Posts: 1677
  • Languages: EN, SV, DK
constraint[prev][0]=any... bug?
« 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][0]=any" 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?  :)
« Last Edit: June 05, 2013, 11:32:18 PM by ViolinVictor »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: constraint[prev][0]=any... bug?
« Reply #1 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.

Offline Ves

  • Devotee
  • *
  • Posts: 1677
  • Languages: EN, SV, DK
Re: constraint[prev][0]=any... bug?
« Reply #2 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?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: constraint[prev][0]=any... bug?
« Reply #3 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?

Offline Ves

  • Devotee
  • *
  • Posts: 1677
  • Languages: EN, SV, DK
Re: constraint[prev][0]=any... bug?
« Reply #4 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

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: constraint[prev][0]=any... bug?
« Reply #5 on: June 06, 2013, 03:54:45 PM »
Something to consider...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: constraint[prev][0]=any... bug?
« Reply #6 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).

Offline Ves

  • Devotee
  • *
  • Posts: 1677
  • Languages: EN, SV, DK
Re: constraint[prev][0]=any... bug?
« Reply #7 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 ;)

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
Re: constraint[prev][0]=any... bug?
« Reply #8 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.
« Last Edit: June 12, 2013, 10:16:27 PM by neroden »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: constraint[prev][0]=any... bug?
« Reply #9 on: June 12, 2013, 10:20:24 PM »
Interesting - can you elaborate on how this would help?

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
Re: constraint[prev][0]=any... bug?
« Reply #10 on: June 12, 2013, 11:26:45 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.