(svn r10362) -Codechange: make tunnel costs less exponential for (very) long tunnels.
authorrubidium
Wed, 27 Jun 2007 19:00:14 +0000
changeset 7095 51c5b30176e1
parent 7094 4c66d8a583d2
child 7096 9b231813f232
(svn r10362) -Codechange: make tunnel costs less exponential for (very) long tunnels.
src/tunnelbridge_cmd.cpp
--- a/src/tunnelbridge_cmd.cpp	Wed Jun 27 18:59:42 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp	Wed Jun 27 19:00:14 2007 +0000
@@ -499,6 +499,12 @@
 	}
 
 	end_tile = start_tile;
+
+	/** Tile shift coeficient. Will decrease for very long tunnels to avoid exponential growth of price*/
+	int tiles_coef = 3;
+	/** Number of tiles from start of tunnel */
+	int tiles = 0;
+
 	for (;;) {
 		end_tile += delta;
 		end_tileh = GetTileSlope(end_tile, &end_z);
@@ -509,8 +515,11 @@
 			return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY);
 		}
 
+		tiles++;
+		if (tiles == 25 || tiles == 50 || tiles == 100 || tiles == 200 || tiles == 400 || tiles == 800) tiles_coef++;
+
 		cost.AddCost(_price.build_tunnel);
-		cost.AddCost(cost.GetCost() >> 3); // add a multiplier for longer tunnels
+		cost.AddCost(cost.GetCost() >> tiles_coef); // add a multiplier for longer tunnels
 	}
 
 	/* Add the cost of the entrance */