equal
deleted
inserted
replaced
503 |
503 |
504 /** Tile shift coeficient. Will decrease for very long tunnels to avoid exponential growth of price*/ |
504 /** Tile shift coeficient. Will decrease for very long tunnels to avoid exponential growth of price*/ |
505 int tiles_coef = 3; |
505 int tiles_coef = 3; |
506 /** Number of tiles from start of tunnel */ |
506 /** Number of tiles from start of tunnel */ |
507 int tiles = 0; |
507 int tiles = 0; |
|
508 /** Number of tiles at which the cost increase coefficient per tile is halved */ |
|
509 int tiles_bump = 25; |
508 |
510 |
509 for (;;) { |
511 for (;;) { |
510 end_tile += delta; |
512 end_tile += delta; |
511 end_tileh = GetTileSlope(end_tile, &end_z); |
513 end_tileh = GetTileSlope(end_tile, &end_z); |
512 |
514 |
515 if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) { |
517 if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) { |
516 return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY); |
518 return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY); |
517 } |
519 } |
518 |
520 |
519 tiles++; |
521 tiles++; |
520 if (tiles == 25 || tiles == 50 || tiles == 100 || tiles == 200 || tiles == 400 || tiles == 800) tiles_coef++; |
522 if (tiles == tiles_bump) { |
|
523 tiles_coef++; |
|
524 tiles_bump *= 2; |
|
525 } |
521 |
526 |
522 cost.AddCost(_price.build_tunnel); |
527 cost.AddCost(_price.build_tunnel); |
523 cost.AddCost(cost.GetCost() >> tiles_coef); // add a multiplier for longer tunnels |
528 cost.AddCost(cost.GetCost() >> tiles_coef); // add a multiplier for longer tunnels |
524 } |
529 } |
525 |
530 |