Changeset - r7308:700f8e251c2f
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-07-23 16:15:40
truelight@openttd.org
(svn r10660) -Codechange: simplified tunnel cost algorithm (bilbo)
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -505,6 +505,8 @@ CommandCost CmdBuildTunnel(TileIndex sta
 
	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 @@ CommandCost CmdBuildTunnel(TileIndex sta
 
		}
 

	
 
		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
0 comments (0 inline, 0 general)