Bug in remove signal

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Bug in remove signal

Post 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?
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Bug in remove signal

Post by glx »

Same happens for human players I think.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Bug in remove signal

Post 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 1860 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 1862 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 1863 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Bug in remove signal

Post 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
Last edited by GeekToo on 02 May 2009 16:08, edited 1 time in total.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Bug in remove signal

Post 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.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Bug in remove signal

Post 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 :)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 10 guests