changeset 7308:45a7fdc97647 draft

(svn r10660) -Codechange: simplified tunnel cost algorithm (bilbo)
author truelight <truelight@openttd.org>
date Mon, 23 Jul 2007 16:15:40 +0000
parents cf51670909bb
children a5e2751395ac
files src/tunnelbridge_cmd.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -505,6 +505,8 @@
 	int tiles_coef = 3;
 	/** Number of tiles from start of tunnel */
 	int tiles = 0;
+	/** Number of tiles at which the cost increase coefficient per tile is halved */
+	int tiles_bump = 25;
 
 	for (;;) {
 		end_tile += delta;
@@ -517,7 +519,10 @@
 		}
 
 		tiles++;
-		if (tiles == 25 || tiles == 50 || tiles == 100 || tiles == 200 || tiles == 400 || tiles == 800) tiles_coef++;
+		if (tiles == tiles_bump) {
+			tiles_coef++;
+			tiles_bump *= 2;
+		}
 
 		cost.AddCost(_price.build_tunnel);
 		cost.AddCost(cost.GetCost() >> tiles_coef); // add a multiplier for longer tunnels