Page 8 of 14

Re: signals in tunnels and on bridges V29 r19256

Posted: 26 Feb 2010 15:40
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

Re: signals in tunnels and on bridges V29 r19256

Posted: 26 Feb 2010 16:28
by ColdIce
hackalittlebit, I don`t want to get you angry, but that trick worked! :lol: thank you

Re: signals in tunnels and on bridges V29 r19256

Posted: 26 Feb 2010 19:13
by adf88
hackalittlebit wrote:the warning is because MS has difficulties swallowing boolean values.
You cannot assume that

Code: Select all

true == 1

Re: signals in tunnels and on bridges V29 r19256

Posted: 26 Feb 2010 20:03
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

Re: signals in tunnels and on bridges V29 r19268

Posted: 26 Feb 2010 23:49
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

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

Posted: 27 Feb 2010 11:51
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

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

Posted: 27 Feb 2010 17:19
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 :)

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

Posted: 28 Feb 2010 22:21
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.

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

Posted: 04 Mar 2010 18:33
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?

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

Posted: 04 Mar 2010 19:31
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

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

Posted: 06 Mar 2010 17:07
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 185 times

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

Posted: 11 Mar 2010 20:03
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 ;)

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

Posted: 12 Mar 2010 23:03
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

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

Posted: 24 Mar 2010 18:00
by Niels Poulsen
Hello,

How do I use these patch.. Wich version is required ?
Any how to?

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

Posted: 25 Mar 2010 00:23
by oberhümer
Read. And look. Please do figure it out yourself in the future - it is not hard.

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

Posted: 25 Mar 2010 00:28
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.

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

Posted: 26 Mar 2010 09:13
by ColdIce
here.. a nice little shiny WIN32 update.

ONLY SIGNAL IN TUNNELS. Chunnels needs an update :)

revision 19518

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

Posted: 09 Apr 2010 11:20
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?!

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

Posted: 09 Apr 2010 12:21
by HackaLittleBit
daxcimix wrote:nothing is change
You have to place signal on entrance of tunnel or bridge.

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

Posted: 17 Apr 2010 21:00
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?