diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2019-12-31 12:43:18 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2020-01-05 20:51:45 +0000 |
commit | ab9042145e429be254ae1ff8a486c98f9b850fe7 (patch) | |
tree | 81f1e5c9654c476b08e66ff170ecc3a5eda2bbf5 | |
parent | d1cead7f251e09e572c73130bad601f7d991ecc6 (diff) | |
download | openttd-ab9042145e429be254ae1ff8a486c98f9b850fe7.tar.xz |
Fix #6667: Also recalculate bridge costs for 'spectated' AI companies
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 00c362e77..9023ea223 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -551,12 +551,12 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u YapfNotifyTrackLayoutChange(tile_start, track); } - /* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST) - * It's unnecessary to execute this command every time for every bridge. So it is done only - * and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated - */ + /* Human players that build bridges get a selection to choose from (DC_QUERY_COST) + * It's unnecessary to execute this command every time for every bridge. + * So it is done only for humans and cost is computed in bridge_gui.cpp. + * For (non-spectated) AI, Towns this has to be of course calculated. */ Company *c = Company::GetIfValid(company); - if (!(flags & DC_QUERY_COST) || (c != nullptr && c->is_ai)) { + if (!(flags & DC_QUERY_COST) || (c != nullptr && c->is_ai && company != _local_company)) { bridge_len += 2; // begin and end tiles/ramps switch (transport_type) { |