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 | c2398842870cc90c3ba0a7d6e66c06c311ae5e1a (patch) | |
tree | 2b0a3691920332e851b631733485aa18f6d18e33 | |
parent | 1583b5b4db32e598f77ebf1ded545a5d1203b79a (diff) | |
download | openttd-c2398842870cc90c3ba0a7d6e66c06c311ae5e1a.tar.xz |
(svn r10660) -Codechange: simplified tunnel cost algorithm (bilbo)
-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 |