summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-18 01:42:21 +0000
committersmatz <smatz@openttd.org>2008-02-18 01:42:21 +0000
commit38969fe46df17a6c11a4247d24742df371d5db70 (patch)
treed6f479c209b924198d55266613fdf91d5fbe2e4c
parentd75cccf5d53d5c8c206993b8aa34114e7e9844f1 (diff)
downloadopenttd-38969fe46df17a6c11a4247d24742df371d5db70.tar.xz
(svn r12171) -Fix [FS#609]: return correct bridge price for AI when DC_QUERY_COST is set (patch by Raimar Falke)
It never happens in current code, but it is better to be ready for it
-rw-r--r--src/tunnelbridge_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index c838b87b1..92ec6b851 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -33,6 +33,7 @@
#include "sound_func.h"
#include "signal_func.h"
#include "tunnelbridge.h"
+#include "player_base.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -429,7 +430,7 @@ not_valid_below:;
* 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
*/
- if (!(flags & DC_QUERY_COST)) {
+ if (!(flags & DC_QUERY_COST) || (IsValidPlayer(_current_player) && GetPlayer(_current_player)->is_ai)) {
bridge_len += 2; // begin and end tiles/ramps
if (IsValidPlayer(_current_player) && !_is_old_ai_player)