Page 6 of 14

Re: signals in tunnels and on bridges V23 r16578

Posted: 14 Jun 2009 18:36
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

Re: signals in tunnels and on bridges V23 r16578

Posted: 14 Jun 2009 22:25
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

Re: signals in tunnels and on bridges V24 r16578

Posted: 15 Jun 2009 00:36
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

Re: signals in tunnels and on bridges V25 r16578

Posted: 15 Jun 2009 15:07
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 :)

Re: signals in tunnels and on bridges V25 r16578

Posted: 25 Jun 2009 17:24
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.

Re: signals in tunnels and on bridges V25 r16578

Posted: 25 Jun 2009 20:26
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 6028 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 6033 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.:(

Re: signals in tunnels and on bridges V25 r16578

Posted: 10 Aug 2009 11:52
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

Re: signals in tunnels and on bridges V25 r16578

Posted: 13 Aug 2009 17:43
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?

Re: signals in tunnels and on bridges V25 r16578

Posted: 13 Aug 2009 22:06
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

Re: signals in tunnels and on bridges V25 r16578

Posted: 13 Aug 2009 22:41
by xZise
Hmm,
for some reasons its working now o.O

Sincerely
xZise

Re: signals in tunnels and on bridges V25 r16578

Posted: 14 Sep 2009 18:44
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?.

Re: signals in tunnels and on bridges V25 r16578

Posted: 14 Sep 2009 21:08
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

Re: signals in tunnels and on bridges V25 r16578

Posted: 14 Sep 2009 21:30
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

Re: signals in tunnels and on bridges V26 r17543

Posted: 14 Sep 2009 23:31
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

Re: signals in tunnels and on bridges V26 r17543

Posted: 15 Sep 2009 13:49
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

Re: signals in tunnels and on bridges V26 r17543

Posted: 15 Sep 2009 23:06
by HackaLittleBit
2007Alain2007 wrote:Hi hackalittlebit

tunnels now dont have signals

also .etc
Thank Alain.

Fixed, see first post

Regards

Re: signals in tunnels and on bridges V26 r17552

Posted: 22 Sep 2009 11:46
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

Re: signals in tunnels and on bridges V26 r17552

Posted: 22 Sep 2009 14:35
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.

Re: signals in tunnels and on bridges V26 r17552

Posted: 22 Sep 2009 17:57
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

Re: signals in tunnels and on bridges V26 r17552

Posted: 22 Sep 2009 22:32
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