changeset 15878:4904a2bf3864 draft

(svn r20560) -Fix: AIs (still/again?) crashing for certain commands
author rubidium <rubidium@openttd.org>
date Thu, 19 Aug 2010 14:25:07 +0000
parents 82c114e71a7d
children 17cb2ee71a84
files src/ai/api/ai_object.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/api/ai_object.cpp
+++ b/src/ai/api/ai_object.cpp
@@ -209,6 +209,11 @@
 	/* Are we only interested in the estimate costs? */
 	bool estimate_only = GetDoCommandMode() != NULL && !GetDoCommandMode()();
 
+#ifdef ENABLE_NETWORK
+	/* Only set p2 when the command does not come from the network. */
+	if (GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = UINT32_MAX;
+#endif
+
 	/* Try to perform the command. */
 	CommandCost res = ::DoCommandPInternal(tile, p1, p2, cmd, _networking ? CcAI : NULL, text, false, estimate_only);