Signals in tunnels and on bridges V3.02 r24031

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V29 r19256

Post by HackaLittleBit »

I do "not" devellop anymore on that patch.
I did not compile before upload.
My next signal patch I will publish soon.

I can not compile here but you have to change the following lines:

CommandCost cost; on line 932 of rail_cmd.cpp you have to move to

if (!CheckTileOwnership(tile)) return CMD_ERROR;
CommandCost cost;

the warning is because MS has difficulties swallowing boolean values.:)
that will do the trick

Tonight I will post updated patch
Regards
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: signals in tunnels and on bridges V29 r19256

Post by ColdIce »

hackalittlebit, I don`t want to get you angry, but that trick worked! :lol: thank you
The rest is confetti!
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: signals in tunnels and on bridges V29 r19256

Post by adf88 »

hackalittlebit wrote:the warning is because MS has difficulties swallowing boolean values.
You cannot assume that

Code: Select all

true == 1
:] don't worry, be happy and checkout my patches
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V29 r19256

Post by HackaLittleBit »

ColdIce Don't worry :)
adf88 wrote:true == 1
your right :P

changed

Code: Select all

sprite = SPR_SIGNALS_BASE + (SIGTYPE_NORMAL - 1) * 16 + variant * 64 + (position << 1) + !IsTunnelBridgeExit(ti->tile);
into

Code: Select all

sprite = SPR_SIGNALS_BASE + ((SIGTYPE_NORMAL - 1) * 16 + variant * 64 + (position << 1) + !IsTunnelBridgeExit(ti->tile));
and silenced warning

3>d:\development\ottd\clean\src\tunnelbridge_cmd.cpp(900) : warning C4308: negative integral constant converted to unsigned type
3>d:\development\ottd\clean\src\tunnelbridge_cmd.cpp(900) : warning C4307: '+' : integral constant overflow

but I still have some difficulty to understand what they mean by "negative integral constant".

patch updated see first post

Regards
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V29 r19268

Post by HackaLittleBit »

Hello

New tunnel bridge patch V2.
we now have working signals on brides.
You can still load an old game with the old signal patch, but you have to change the signals on your wormholes.
Other games should not be a problem.

Decontaminating the game is when you remove all wormholes with signals.
Light or semaphore signals change according to your "build signals before ..." in advanced settings.
The whole system works with on-off signals.
Tunnels and bridges are one way only!
This gives the possibility to define entrance and exit of wormhole.
The bit of the Exit tile "never" changes.
On the exit tile is a fake signal just for the show.:)
The maximum bridge length in the game is 100 tile + 2 tiles for ramp.
Having 16 bits available in m2 gives the possibility to plant 16 signals.
That means 17 blocks. 100 / 17 = 6 tiles per block so every 6 tiles a signal + sign on entrances.
You don't have the possibility to change this block size. (it could be possible in tunnels though).
But I opted for not allowing due to overhead.
The code still uses the distance to other train algorithm.
This is done for efficiency reasons and to make handling of reversed trains easier.
Also Reversed trains make life difficult in wormholes. I solved the reversing by some kind of self healing of the system
That means that in the event of a train reversing in wormhole the system will come back to normal after next trains pass.

For the time being some code is not in the correct place and not optimized
This is done for various reasons and will be corrected later.

Signal placing:
Place signal on tunnel bridge ramp and toggle to desired direction.
Only When dragging one-way signals, signals will be places on wormholes according to direction.

To do:

Adjust signal x,y position
Make trains slow down before signal red inside wormhole.

Connect system to path finder.
The pathfinder should not find a path when it sees a tunnel exit coming towards a wormhole with signal simulation.
At this moment I do not know how to do this. :(
So at this moment you can fool the path finder by having a one way signal after the wormhole.

Have fun and regards :)

EDIT: below is savegame used for testing
Attachments
signals.jpg
signals.jpg (59.46 KiB) Viewed 3951 times
TTo.sav
test game
(23.74 KiB) Downloaded 97 times
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: New V2 signals in tunnels and on bridges V2.01 r19268

Post by ColdIce »

great work!!

Here is a WIN 32 build with your new patch and another one with signals in tunnels and on bridges V2.01, chunnels and Improved Build Station GUI
Attachments
ottd_19269_signalv2.rar
WIN32 BUILD WITH signals in tunnels and on bridges V2.01
(3.95 MiB) Downloaded 130 times
ottd_19269_chunnel_stgui_signtunbrdg.rar
WIN32 BUILD WITH signals in tunnels and on bridges V2.01, chunnels and Improved Build Station GUI
(3.95 MiB) Downloaded 162 times
The rest is confetti!
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New V2 signals in tunnels and on bridges V2.01 r19268

Post by HackaLittleBit »

Made an attempt to connect it to the path finder.
I think it works :shock:

see first page.

EDIT thanks eddy and RB :)
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: New V2 signals in tunnels and on bridges V2.01 r19268

Post by petert »

ColdIce wrote:great work!!

Here is a WIN 32 build with your new patch and another one with signals in tunnels and on bridges V2.01, chunnels and Improved Build Station GUI
For the future, you need to include a COPYING file, it can be found in the main source directory.
Marsman_
Engineer
Engineer
Posts: 2
Joined: 04 Mar 2010 18:24

Re: New V2 signals in tunnels and on bridges V2.02 r19295

Post by Marsman_ »

Is used the compiled version by coldIce and it seems the setting "simulate signals in tunnels, bridges every ... tiles" has disappeared.
Where did it go?
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New V2 signals in tunnels and on bridges V2.02 r19295

Post by HackaLittleBit »

Marsman_ wrote:Is used the compiled version by coldIce and it seems the setting "simulate signals in tunnels, bridges every ... tiles" has disappeared.
Where did it go?
To make working signals I had to make a choice.
So now you have "fixed signal blocks" of 6 tiles in wormholes.
the state of the signals is kept in m2

In the future I can see that being reduced to 4 (102 tiles / 32 bits available = 4), but that would be the smallest possible "block size" without big overhead and slowing down the code.
For me 6 does perfectly. It should not become to easy the game.

Where do I get the 32 bits?

If you would put in m2 an index that would point to an array like this | tile entrance | tile exit | length | 32bits | some state bits | future reserved index |.
the same index is on both entrances with bit m5, 6 defining entrance , exit
I think that an array would actually speed up the game.
No more searching for other wormhole end.

But if you don't like it you still can download the old patch

regards
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: New V2 signals in tunnels and on bridges V2.02 r19295

Post by ColdIce »

so.. here it is a new WIN32 build (with COPYING file this time :P )

patches: New V2 signals in tunnels and on bridges V2.02 r19295
Chunnels

Version: 19358 (see Vehicles for the newest road vehicles setting)



update to version 19373
ottd_19373_signchun.rar
(3.95 MiB) Downloaded 109 times
Attachments
ottd_19358_signalschun.rar
(3.96 MiB) Downloaded 120 times
The rest is confetti!
Marsman_
Engineer
Engineer
Posts: 2
Joined: 04 Mar 2010 18:24

Re: New V2 signals in tunnels and on bridges V2.02 r19373

Post by Marsman_ »

The signals on the bridges don't work in combination with surrounding yapp/pbs signals.

Code: Select all

= normal track
t train
s signal on bridge
b bridge
y yapp signal

===y===y==ty==sbbbbbsbbbbbs=t===y===
When traveling from left to right the left train is still waiting in front of the yapp signal because it is trying to reserve track until the next yapp signal, ignoring the bridge completely. It should try to reserve the track until the first signal which is on the bridge.

I know a workaround is to just put normal signals in front of and after the bridge, but I justed wanted to let you know.
A fix would be useful for intersections in compact areas.

And I do think the return of possible smaller signal intervals would add value to this patch.

Still a great patch though ;)
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New V2 signals in tunnels and on bridges V2.02 r19373

Post by HackaLittleBit »

Marsman_ wrote:The signals on the bridges don't work in combination with surrounding yapp/pbs signals.
Well this was left in sort of intentional for the time being.( two way traffic)
I will leave it in for the time being so that the signal gurus can play around with it.

Remember the patch is meant to be simple.Just make it possible to cross a big mountain or large piece of water
without the usual gymnastics.
Marsman_ wrote:And I do think the return of possible smaller signal intervals would add value to this patch.
Possible but it would influence the bridge length.

You have 17 signal blocks available so each tile 1 signal would mean max bridge length 17 tiles.
17 * 2 = 34, 3 = 51 and so on.

I am not going to change much in the near future (lack of time) :(

Regards
Niels Poulsen
Engineer
Engineer
Posts: 2
Joined: 24 Mar 2010 17:57

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by Niels Poulsen »

Hello,

How do I use these patch.. Wich version is required ?
Any how to?
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by oberhümer »

Read. And look. Please do figure it out yourself in the future - it is not hard.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by petert »

neg wrote:Read. And look. Please do figure it out yourself in the future - it is not hard.
It's actually much simpler (assuming you are on Windows). Just download the binary above.
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by ColdIce »

here.. a nice little shiny WIN32 update.

ONLY SIGNAL IN TUNNELS. Chunnels needs an update :)

revision 19518
Attachments
ottd19518_signtun.rar
(3.92 MiB) Downloaded 489 times
The rest is confetti!
daxcimix
Engineer
Engineer
Posts: 1
Joined: 09 Apr 2010 11:17

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by daxcimix »

Hmm i have a question, i download the rar and extract it, i overwrite all files, when i lunch the game nothing is change, any idea?!
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by HackaLittleBit »

daxcimix wrote:nothing is change
You have to place signal on entrance of tunnel or bridge.
nighthawk_c_m
Engineer
Engineer
Posts: 26
Joined: 14 Apr 2010 06:26

Re: New V2 signals in tunnels and on bridges V2.02 r19495

Post by nighthawk_c_m »

A question, I use the signal patch - works fine unless one train travelled over the bridge, after that signals have to be deleted to allow another train to pass. Any way to work around this problem?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests