diff options
author | truelight <truelight@openttd.org> | 2007-07-23 16:15:40 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-07-23 16:15:40 +0000 |
commit | 2f0448ddbaa0e2527b25051c6daf5972f79e2f14 (patch) | |
tree | 2b0a3691920332e851b631733485aa18f6d18e33 /src | |
parent | 98b23edeb3c789ea839a05424d2f802c1c0d6de0 (diff) | |
download | openttd-2f0448ddbaa0e2527b25051c6daf5972f79e2f14.tar.xz |
(svn r10660) -Codechange: simplified tunnel cost algorithm (bilbo)
Diffstat (limited to 'src')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 5a038caf9..1f80a3c4d 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -505,6 +505,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 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 start_tile, uint32 flags, uint32 p1, uint32 } 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 |