(svn r12171) -Fix [FS#609]: return correct bridge price for AI when DC_QUERY_COST is set (patch by Raimar Falke)
authorsmatz
Mon, 18 Feb 2008 01:42:21 +0000
changeset 9086 15623eec24dd
parent 9085 093e03dad31f
child 9087 c6ff1721bb00
(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
src/tunnelbridge_cmd.cpp
--- a/src/tunnelbridge_cmd.cpp	Sun Feb 17 21:27:44 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp	Mon Feb 18 01:42:21 2008 +0000
@@ -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 @@
 	 * 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)