Chunnel V23 r27765

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: Chunnel v1 r15422

Post by HackaLittleBit »

EDIT not relevant

Cannot recreate your small tunnel situation.
please explain in more detail.
Last edited by HackaLittleBit on 11 Feb 2009 10:19, edited 1 time in total.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Chunnel v1 r15422

Post by Roujin »

Wolf01 wrote:If tunnel entrances are enough distant I don't know why crossing tunnels should be forbidden, if they don't make your trains exit the tunnel from a wrong exit (try to build a tunnel 'inside' another with the same method you used, if you can) I think they might be allowed, but the entrance must be at least 2-3 tiles away from the intersection (so parallel tunnels should be forbidden)
This is what I mean (side view)
tunnels_crossection.PNG
IMO this might open the path to other nice junctions etc, and if we might get crossing bridges too it should be the same thing, with the top bridge longer than the bottom bridge
We already have crossing tunnels in trunk since long time; only thing is that it's considered a cheat option. This patch should definately not change this, if the author wants to have any chance for trunk inclusion.

The point is (what I reported above and hackalittlebit already fixed) that it was possible with some dirty tricks abusing this patch for making crossing tunnels without having activated the crossing tunnels cheat.

---
If you'd like to have crossing tunnels available in multiplayer (i.e. changing it from a cheat to an advanced setting), this would be a thing for a seperate patch. Keep in mind though that it was decided to make this a cheat for a reason - it's totally unexplainable how you can have two really short tunnels crossing. So just moving it from cheats to advanced settings won't do the trick - you'd have to implement something to make sure the entrances of the tunnels are sufficiently far from each other.

Wouldn't this be a topic for a patch by you, wolf? ;)

edit: just now read your post, hackalittlebit, answering in a minute
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Chunnel v1 r15422

Post by Roujin »

new post to answer hackalittlebit's post:

uhm, I haven't said anything about trains crashing, or did you just test that for yourself?

here's the "small tunnel problem" in steps to create:

Step1: create this kind of terrain and build large undersea tunnel (with the newest version, you have to create that little island in the middle beforehand)
chunnel smalltunnel_1.png
chunnel smalltunnel_1.png (47.15 KiB) Viewed 6400 times
Step2: create this small tunnel
chunnel smalltunnel_2.png
chunnel smalltunnel_2.png (47.34 KiB) Viewed 6403 times
=> the two tunnels are crossing each other.

Strangely, building the small tunnel suddenly leads to me being able to raise some land in positions where it should be prohibited by the large (undersea) tunnel! Before building the small tunnel, I was forbidden to raise there, but now it suddenly works!
chunnel smalltunnel_3.png
chunnel smalltunnel_3.png (44.46 KiB) Viewed 6405 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

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

Re: Chunnel v1 r15422

Post by HackaLittleBit »

Wolf the situation of a tunnel in between a tunnel is not possible (at this moment). Train would come out of wrong entrance.
You can however build a bridge in between.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v1 r15422

Post by HackaLittleBit »

Ok was able to reproduce it
Jee your really a champ. :bow:

Going to have a look at that now
see yah
EDIT see yah TOMORROW and many thanks HackaLittleBit
small.png
small.png (47.89 KiB) Viewed 6412 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v1 r15422

Post by HackaLittleBit »

Ok Roujin did most of your requests.

Pls check for more bugs.

Regards

HackaLittleBit

Known issues: The moment the passing_water switch is on more suitable terrain is required.
Having a look at that now.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v1 r15422

Post by HackaLittleBit »

Ok I think I solved all pending issues.

No known issues anymore
Thanks everybody for their help and suggestions.
EDIT: Still some inconsistencies :oops:
will keep you informed
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v1 r15422

Post by HackaLittleBit »

Ok I think I solved all pending issues.
Please tell me if your not happy with the feature or if changes should be made

Again a special thanks to Roujin

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

Re: Chunnel v9 r15456 Cheating impossible

Post by HackaLittleBit »

Removed the possibility to dynamite water above underwater tunnel.
regards HackaLittleBit
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: Chunnel v9 r15456

Post by Dimme »

Hi hackalittlebit!

Thank you for implementing this :)

I have not tested the patch yet, but if it works fine I think it is a good addition to the possibilities of the game :D

I suppose these tunnels behave like ordinary tunnels, but how difficult will it be to give them some extra specifications? They really need to be balanced towards the bridges, and ideally, it should be possible to alter the specs via newGRF. For realism, trains entering the tunnel should go down some levels. This will make trains slow down when going up on the other side, so bridges will be better where they can be built. Maybe it can even be done graphically, so that you see that trains go down when entering a tunnel?
Try my modular airports minigame!

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

Re: Chunnel v9 r15456

Post by HackaLittleBit »

Hi Dimme;

You see I listened to your suggestions in signals in tunnels V7 r15294http://www.tt-forums.net/viewtopic.php?p=754341#p754341.
All these patches I make just for one purpose and that is to get some kind of signals - in - tunnels patch into trunk.
The reason I made this one is just to give some extra playing dimension.
I like to look at trains on single track (and bringing them back by tunnel).
At this moment I would like people to test it in order to submit this one to trunk asap.
I don't think I should make major changes at this moment to this patch.
It looks nice like this and that it fits in the overall game philosophy.
There is another reason for this patch and that is in the future being able to connect various maps together like model railroaders are doing now also.
With a tunnel it should be possible to overcome the synchronization problems( hide train, transfer train etc.)

Regards HackaLittleBit
broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Re: Chunnel v9 r15456

Post by broodje »

I must say I really like your patch. The tunnels fits beautifully in my southern UK game as a replacement for my severn bridges at Bristol :). Like you said, it fit's with the design philosophy of openttd it is a logical addition to the current tunnels.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Chunnel v9 r15456

Post by DJ Nekkid »

what i could wish for is this, and it's _something_ similar...
Attachments
hope.PNG
hope.PNG (74.24 KiB) Viewed 5471 times
Member of the
ImageImage
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v9 r15456

Post by HackaLittleBit »

what i could wish for is this, and it's _something_ similar...
If certain combination's would be disallowed it's no big deal.
Attachments
possible.png
possible.png (103.06 KiB) Viewed 5437 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Chunnel v9 r15456

Post by DJ Nekkid »

i see your point... but still, good idea :)
Member of the
ImageImage
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: Chunnel v9 r15456

Post by Dimme »

hackalittlebit wrote:Hi Dimme;

You see I listened to your suggestions in signals in tunnels V7 r15294http://www.tt-forums.net/viewtopic.php?p=754341#p754341.
All these patches I make just for one purpose and that is to get some kind of signals - in - tunnels patch into trunk.
The reason I made this one is just to give some extra playing dimension.
I like to look at trains on single track (and bringing them back by tunnel).
At this moment I would like people to test it in order to submit this one to trunk asap.
I don't think I should make major changes at this moment to this patch.
It looks nice like this and that it fits in the overall game philosophy.
There is another reason for this patch and that is in the future being able to connect various maps together like model railroaders are doing now also.
With a tunnel it should be possible to overcome the synchronization problems( hide train, transfer train etc.)

Regards HackaLittleBit
Sure, no problem :D

Just trying to be constructive in order to get this patch in trunk. To show the opportunities. But you're right, it is probably best not to make it too big anyway. There are plenty of possibilities to alter the behaviour in later patches, and people can choose to play with it or not.

I'd really like to see this one in trunk :)

Regards Dimme.
Try my modular airports minigame!

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

Re: Chunnel v9 r16135

Post by 2007Alain2007 »

update and build only changes was the STR_ERROR
chunnelv9_r16135.patch
chunnel_v9_r16135.7z
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
nicfer
Director
Director
Posts: 529
Joined: 03 May 2005 20:50
Location: Somewhere in a country called Argentina

Re: Chunnel v9 r15827

Post by nicfer »

Would be cool if you could build tunnels by selecting first the starting tile then the finishing one, but that could lead to unwanted situations like skipping the crossing briges restriction or similar. Similar things could be done with bridges but it would not be possible because of the graphics. At least until someone makes a modular bridges patch, aka RCT style, but then again there's the wormhole stuff again.
Sorry for my english I am argentinian
TTO don't crashes in Windows XP; XP crashes TTO

Formerly known as UnderBuilder.

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

Re: Chunnel v9 r15827

Post by 2007Alain2007 »

V 10 is on the frist post but you need to change lines in terraform_cmd.cpp

Code: Select all

Index: src/terraform_cmd.cpp
===================================================================
--- src/terraform_cmd.cpp	(revision 15829)
+++ src/terraform_cmd.cpp	(working copy)
@@ -303,9 +303,10 @@
 				return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 			}
 			/* Check if tunnel would take damage */
-			if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
+			if (IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
 				_terraform_err_tile = tile; // highlight the tile above the tunnel
-				return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
+				if (direction == -1) return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
+				if (direction == 1) return_cmd_error(STR_ERROR_MUST_DEMOLISH_TUNNEL_FIRST);
 			}
 			/* Check tiletype-specific things, and add extra-cost */
 			const bool curr_gen = _generating_world;
Index: src/tunnel_map.cpp
===================================================================
--- src/tunnel_map.cpp	(revision 15829)
+++ src/tunnel_map.cpp	(working copy)
@@ -41,18 +41,14 @@
 bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
 {
 	TileIndexDiff delta = TileOffsByDiagDir(dir);
-	uint height;
-
-	do {
+	for (;;) {
 		tile -= delta;
 		if (!IsValidTile(tile)) return false;
-		height = GetTileZ(tile);
-	} while (z < height);
-
-	return
-		z == height &&
-		IsTunnelTile(tile) &&
-		GetTunnelBridgeDirection(tile) == dir;
+		if (GetTileZ(tile) != z) continue;
+		if (!IsTunnelTile(tile)) continue;
+		if(dir == GetTunnelBridgeDirection(tile)) return true;
+		return false;
+	}
 }

 /**
Index: src/tunnelbridge_cmd.cpp
===================================================================
--- src/tunnelbridge_cmd.cpp	(revision 15829)
+++ src/tunnelbridge_cmd.cpp	(working copy)
@@ -504,7 +504,9 @@
 	} else {
 		tunnel_in_way_dir = (TileY(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SE : DIAGDIR_NW;
 	}
-
+	if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(start_tile, start_z, tunnel_in_way_dir)) {
+		return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
+	}
 	end_tile = start_tile;

 	/** Tile shift coeficient. Will decrease for very long tunnels to avoid exponential growth of price*/
@@ -513,18 +515,33 @@
 	int tiles = 0;
 	/** Number of tiles at which the cost increase coefficient per tile is halved */
 	int tiles_bump = 25;
+	/** Tunnel under water flag */
+	bool passing_water = false;

 	for (;;) {
 		end_tile += delta;
 		if (!IsValidTile(end_tile)) return_cmd_error(STR_TUNNEL_THROUGH_MAP_BORDER);
 		end_tileh = GetTileSlope(end_tile, &end_z);

-		if (start_z == end_z) break;
+		if (start_z == end_z && IsTunnelTile(end_tile)) return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);

+		if (end_z > start_z || end_tileh == InclinedSlope(ReverseDiagDir(direction))) passing_water = false;
+
+		if (IsTileType(end_tile + delta, MP_WATER) && !IsWaterTile(start_tile - delta) && end_z == 0) {
+			if (GetWaterTileType(end_tile + delta) == WATER_TILE_CLEAR ||
+				GetWaterTileType(end_tile + delta) == WATER_TILE_COAST) passing_water = true;
+		}
+
 		if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) {
 			return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
 		}

+		if (start_z == end_z && !passing_water) {
+			/* Don't allow tunnel inbetween existing tunnel */
+			if (IsTunnelInWayDir(end_tile, start_z, direction)) return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
+			break;
+		}
+
 		tiles++;
 		if (tiles == tiles_bump) {
 			tiles_coef++;
Index: src/water_cmd.cpp
===================================================================
--- src/water_cmd.cpp	(revision 15829)
+++ src/water_cmd.cpp	(working copy)
@@ -355,6 +355,9 @@
 				return_cmd_error(STR_ERROR_TOO_CLOSE_TO_EDGE_OF_MAP);
 			}

+			/* Don't allow water to be cleared above underwater tunnels */
+			if (IsTunnelInWay(tile, 0)) return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
+
 			/* Make sure no vehicle is on the tile */
 			if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;


For Community Integrated Version http://code.google.com/p/civopenttd/
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: Chunnel v10 r16237

Post by Sensation Lover »

hi all,

can someone provide even a working ziped Open TTD folder with the under water tunnel and signals simulation on bridges and tunnels please for those like me who don't understand nothing of patching even if you draw an explicit scheme of how to do it. Pretty Pleeeeease! :bow:
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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests