Page 1 of 1

Bug in remove signal

Posted: 01 May 2009 22:07
by GeekToo
While analysing a deadlock situation for Train Convoy I encounted the following: if you remove a signal on a tile in a direction, indicated by the front tile, it also removes the signal in the other direction. I reduced the code to the following to illustrate the bug:

Code: Select all

AIRail.BuildSignal(prv_tile, pprv_tile, AIRail.SIGNALTYPE_PBS);
AIRail.BuildSignal(prv_tile, tile, AIRail.SIGNALTYPE_PBS);
AIRail.RemoveSignal(prv_tile, tile);
This will remove both signals.
If this is intended behaviour, I think it is very counter-intuitive (why else would you have to specify a front tile for removal?

Re: Bug in remove signal

Posted: 02 May 2009 14:57
by glx
Same happens for human players I think.

Re: Bug in remove signal

Posted: 02 May 2009 15:43
by planetmaker
Not sure I grasp the problem entirely.
This is the best a human can do:
start
start
Bordeaux Transport, 07-05-2002.png (5.95 KiB) Viewed 1859 times
select track piece where to remove signals (lower track on the selected tile)
select track piece where to remove signals (lower track on the selected tile)
Bordeaux Transport, 12-05-2002.png (5.92 KiB) Viewed 1861 times
signals removed on lower track of that tile
signals removed on lower track of that tile
Bordeaux Transport, 14-05-2002.png (7.6 KiB) Viewed 1862 times

Re: Bug in remove signal

Posted: 02 May 2009 16:03
by GeekToo
glx:
As a human player, I don't need to specify the front tile, just clicking on a tile with signals with the magic bulldozer will remove them.
And when you give a direction by dragging, indeed all signals are removed in both directions.

But for an AI, it does not really make sense to have to specify the fronttile, when all signals are removed anyway. The presence of the front_tile parameter causes the confusion. If it wasn't present, the function would do the same. Now that it is present, it leads to the belief you can delete a signal depending on the direction.

So either removing the front_tile parameter, or delete signals per direction (my personal preference) would be better than the current situation, in my opinion.

planetmaker: that situation is a little more complex, just try on a sw-ne track with signals in both directions. No matter what direction you drag (AI has to specify direction), signals in both directions are removed

Re: Bug in remove signal

Posted: 02 May 2009 16:05
by Yexo
GeekToo wrote:So either removing the front_tile parameter, or delete signals per direction (my personal preference) would be better than the current situation, in my opinion.
Indeed, my prefered solution would also be to only remove the signals in one direction, thus keeping the front_tile parameter.

Re: Bug in remove signal

Posted: 02 May 2009 16:30
by planetmaker
GeekToo wrote:planetmaker: that situation is a little more complex, just try on a sw-ne track with signals in both directions. No matter what direction you drag (AI has to specify direction), signals in both directions are removed
Ah, ok, thx for clearification :)