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

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

Re: signals in tunnels and on bridges V23 r16578

Post by HackaLittleBit »

Another bug fix.

train on bridge/ tunnel after bridge/tunnel was not visible in certain situation and collided.

Code: Select all

				} else { // NOT incoming from the wormhole!
					if (ReverseDiagDir(enterdir) != dir) continue;
					if (!(flags & SF_TRAIN) && HasVehicleOnPos(GetOtherTunnelBridgeEnd(tile), NULL, &TrainOnTileEnum)) {
						flags |= SF_TRAIN;
						if (IsTunnelBridgePairWithSignals(tile)) continue; // still train inside don't touch signal at other side
					}
					tile = GetOtherTunnelBridgeEnd(tile); // just skip to exit tile

Changed into

Code: Select all

				} else { // NOT incoming from the wormhole!
					if (ReverseDiagDir(enterdir) != dir) continue;
					if (!(flags & SF_TRAIN) && HasVehicleOnPos(tile, NULL, &TrainOnTileEnum)) flags |= SF_TRAIN;
					if (IsTunnelBridgePairWithSignals(tile)) continue; 
					tile = GetOtherTunnelBridgeEnd(tile); // just skip to exit tile
see Patch

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

Re: signals in tunnels and on bridges V23 r16578

Post by HackaLittleBit »

hackalittlebit wrote:Another bug fix.
By fixing that one I made another bug. :mrgreen:
signals were not correctly updated.
Now I hope it is really fixed.

Code: Select all

				} else { // NOT incoming from the wormhole!
					if (ReverseDiagDir(enterdir) != dir) continue;
					if (!(flags & SF_TRAIN) && HasVehicleOnPos(tile, NULL, &TrainOnTileEnum)) flags |= SF_TRAIN;
					if (IsTunnelBridgePairWithSignals(tile)) continue; 
					tile = GetOtherTunnelBridgeEnd(tile); // just skip to exit tile

change into

Code: Select all

				} else { // NOT incoming from the wormhole!
					if (ReverseDiagDir(enterdir) != dir) continue;
					if (!(flags & SF_TRAIN) && HasVehicleOnPos(tile, NULL, &TrainOnTileEnum)) {
						flags |= SF_TRAIN;
						if (IsTunnelBridgePairWithSignals(tile)) continue;
					} 
					tile = GetOtherTunnelBridgeEnd(tile); // just skip to exit tile

See patch
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: signals in tunnels and on bridges V24 r16578

Post by 2007Alain2007 »

hi hackalittlebit this i think is the best way to keep your patch up todate becuse otheres can see what lines you are changing this is great for patch packs like the new one around the block from Terkhen

and your doing a great job with this patch what can you not do lol
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V25 r16578

Post by HackaLittleBit »

More two bugs. :|

Assigned tile to cars and boats when leaving bridges ( They drove of the map :)) ).
Putting signals on road bridges/tunnels not possible anymore

For the patch packers :wink:

in rail_cmd.cpp

Code: Select all

	if (IsTileType(tile, MP_TUNNELBRIDGE)) {
into

Code: Select all

	if (IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
and in tunnelbridge_cmd.cpp proc VehicleEnter_TunnelBridge was changed.

PATCH

regards

EDIT screenshot from openttdcoop actual game but now with signal simulation and no traffic jam :)
Attachments
openttdcoop.png
openttdcoop.png (144.69 KiB) Viewed 2047 times
and other folto of difference :)
and other folto of difference :)
difference.png (55.91 KiB) Viewed 1999 times
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: signals in tunnels and on bridges V25 r16578

Post by Terkhen »

I found a crash: load the savegame attached to this post (I was testing using a binary with only this patch applied) and start the trains that are into the depot with the sign. The game will crash just when the second train comes out.
Attachments
SIGNALS_BRIDGES.sav
(12.95 KiB) Downloaded 191 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V25 r16578

Post by HackaLittleBit »

Terkhen wrote:I found a crash
Thanks Terkhen.

But I was aware of it already
It is an old one with a new face :(
See this
I am working on it but I have difficulties to find the right solution.
The problem is in this little piece of code in signal.cpp

Code: Select all

			case MP_TUNNELBRIDGE: {
				if (GetTileOwner(tile) != owner) continue;
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) continue;
				DiagDirection dir = GetTunnelBridgeDirection(tile);

				if (enterdir == INVALID_DIAGDIR) { // incoming from the wormhole
					if (!(flags & SF_TRAIN) && IsTunnelBridgePairWithSignals(tile)) {
						if (HasVehicleOnPos(tile, NULL, &TrainOnTunnelBridgeTileEnum)) flags |= SF_TRAIN;
					} else {
						if (HasVehicleOnPos(tile, NULL, &TrainOnTileEnum)) flags |= SF_TRAIN;
					}
					enterdir = dir;
					exitdir = ReverseDiagDir(dir);
					tile += TileOffsByDiagDir(exitdir); // just skip to next tile
				} else { // NOT incoming from the wormhole!
					if (ReverseDiagDir(enterdir) != dir) continue;
					if (!(flags & SF_TRAIN) && HasVehicleOnPos(tile, NULL, &TrainOnTileEnum)) {
						flags |= SF_TRAIN;
						if (IsTunnelBridgePairWithSignals(tile)) continue;
					} 
					tile = GetOtherTunnelBridgeEnd(tile); // just skip to exit tile
					enterdir = INVALID_DIAGDIR;
					exitdir = INVALID_DIAGDIR;
				}
				}
				break;
Especially this line

Code: Select all

if (IsTunnelBridgePairWithSignals(tile)) continue;
I even found more strange behaviour.
One that could interest the developpers

When I take the signal away here my game goes in a loop
crs1.png
crs1.png (46.95 KiB) Viewed 6008 times
When I take the signal away here the game throws a assert on line 218 of signal.cpp(adding duplicate data)
crs2.png
crs2.png (45.48 KiB) Viewed 6013 times
It is very simple to avoid this situation.
Just build signal before closing loop with bridge/tunnel.
As you can see on this screen shot there are no ("real") signals between the two bridges. So this provokes the crash.Image
Yet a small price to pay for this feature :)
Unfortunately this issue will have to wait till more time is available for me.:(
Attachments
crs3.png
crs3.png (17.69 KiB) Viewed 2764 times
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: signals in tunnels and on bridges V25 r16578

Post by xZise »

I applied your patch, but it doesn't work. In the advanced settings the distance is set to 8, but the trains doesn't "see" the signals in the tunnels.

I build two tunnels and at each end a 180° curve and one waypoint. No chance :( I also applied your chunnel patch. Could there be a context?

Sincerely
xZise
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: signals in tunnels and on bridges V25 r16578

Post by Wasila »

In the attached picture the northern bridge (with signals) works perfectly. The southern bridge, however, doesn't work. While the signals have been installed, the bridge still only allows one train at a time. I have tested numerous solutions putting PBS signals on the space in front, but nothing has worked. Could someone please help me?
Attachments
GlobalTrans, 12th Mar 1948.png
(114.84 KiB) Downloaded 129 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V25 r16578

Post by HackaLittleBit »

xZise did you read my wiki?

Wasila Put signal at arrows place, that should do the trick.
Please send save game by Personal Message so that I can have a look at it.
Regards

HackaLittleBit
Attachments
psh.png
psh.png (195 KiB) Viewed 5392 times
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: signals in tunnels and on bridges V25 r16578

Post by xZise »

Hmm,
for some reasons its working now o.O

Sincerely
xZise
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: signals in tunnels and on bridges V25 r16578

Post by Terkhen »

In the last version of the patch, signals don't appear in bridges (I checked it with the last version you posted too). I guess this is another proof that nobody reports problems with patch packs :D

I have a feature request too. Could you make that the kind of signal (semaphore or light) built at a tunnel / bridge is dependent on the currently selected kind of signal?.
User avatar
Sensation Lover
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 26 Feb 2009 09:17
Skype: Aron Bogdan Silviu
Location: Torino, Italy
Contact:

Re: signals in tunnels and on bridges V25 r16578

Post by Sensation Lover »

Hi hackalittlebit and terkhen

I have your TPPP terkhen and is happening a crush becouse of the signals in tunnels... when the train in the depot try to go to the station (passing through diferent tunnels with signals) the game crush... and is becouse of that (not 100% sure) cuz without the signals the game don't crush. i provide you the save game and the pictures of the crush... And it is possible to adjust that without losing that game pretty please :bow: )

P.S. The .sav is too big (15mb) and i get borred waiting for upload (i waited more then 10 mins... can i mail you that? PM with your mail or tell me another solution

Let me know if u need something else (a part the save game).

Regards,
Sensation <3
Attachments
pictures.zip
(420.67 KiB) Downloaded 202 times
I was in:
Austria,Belgium,Brazil,China,France,Germany,Hungary,Indonesia,Italy,Luxemburg,Malaysia,Mexico,Netherlands,Norway,Panamà,Poland,Romania,
Saudi Arabia,Singapore,Slovenia,Spain,Switzerland,Thailand,U.K.,Ukraine,U.S.A.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V25 r16578

Post by HackaLittleBit »

Terkhen wrote:In the last version of the patch, signals don't appear in bridges
Really :roll: shame on me.
Going to have a look at now and will let you know.
Sensation Lover wrote:Hi hackalittlebit and terkhen etc.
read some posts up because that may be the problem.
The safest way of using this patch is by putting real signals directly before and after the tunnel/bridge.
Thank you anyhow for reporting the problem.

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

Re: signals in tunnels and on bridges V26 r17543

Post by HackaLittleBit »

Terkhen wrote:In the last version of the patch, signals don't appear in bridges
Fixed.
Terkhen wrote:I have a feature request too. Could you make that the kind of signal (semaphore or light) built at a tunnel / bridge is dependent on the currently selected kind of signal?.
Ill have a look at that later.

HackaLittleBit
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: signals in tunnels and on bridges V26 r17543

Post by 2007Alain2007 »

Hi hackalittlebit

tunnels now dont have signals

also fort it might be help fall

code change in trunk

Code: Select all

load_unload_time_rem
to

Code: Select all

time_counter
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V26 r17543

Post by HackaLittleBit »

2007Alain2007 wrote:Hi hackalittlebit

tunnels now dont have signals

also .etc
Thank Alain.

Fixed, see first post

Regards
fivejc
Engineer
Engineer
Posts: 12
Joined: 22 Sep 2009 08:03

Re: signals in tunnels and on bridges V26 r17552

Post by fivejc »

I have a "strange" problem with my savegame created with openttd compiled with this patch. Any suggestions??

Link to the topic with problem :http://www.tt-forums.net/viewtopic.php?f=31&t=45238
Last edited by fivejc on 22 Sep 2009 17:56, edited 1 time in total.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V26 r17552

Post by HackaLittleBit »

fivejc wrote:I have a "strange" problem with my savegame created with openttd compiled with this patch.
If you play with a patch pack I will not asume responsibility.

In order for me to help you, you have to be more specific.

e.g. what you have patched, messages, crashlog, savegame etc. etc.

I can tell you that my signal patch does not have conflict with save games as far as I know.
I do not know what changed in trunk the last two days, I have to check that.


Regards.
fivejc
Engineer
Engineer
Posts: 12
Joined: 22 Sep 2009 08:03

Re: signals in tunnels and on bridges V26 r17552

Post by fivejc »

hackalittlebit wrote: ...

In order for me to help you, you have to be more specific.

e.g. what you have patched, messages, crashlog, savegame etc. etc....
http://www.tt-forums.net/viewtopic.php?f=31&t=45238
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V26 r17552

Post by HackaLittleBit »

fivejc wrote:Any suggestions??
1. Try loading older save game, I can't load the one you send. :(
The game is verifying the vehicle ID's and encounters a non valid ID while it is loading and aborts.
So maybe savegame is corrupted.

2..Try with an old autosave game.

3.Another possibility is conflicting .grf files.


My patch only changes two free bits and this does not interfere with anything at "this" moment.

Hope this helps :)

Regards HackaLittleBit
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 14 guests