diff options
author | rubidium <rubidium@openttd.org> | 2010-08-19 14:25:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-19 14:25:07 +0000 |
commit | 55c1af9fb12ed64284c5ab7723c22ccbd3087617 (patch) | |
tree | 01e2b45f1b8fe407e1433042680a7ce8079b724b | |
parent | 85740a02832c9c474833f929b4464eba06be66d3 (diff) | |
download | openttd-55c1af9fb12ed64284c5ab7723c22ccbd3087617.tar.xz |
(svn r20560) -Fix: AIs (still/again?) crashing for certain commands
-rw-r--r-- | src/ai/api/ai_object.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ai/api/ai_object.cpp b/src/ai/api/ai_object.cpp index ed36719c6..02f9e734b 100644 --- a/src/ai/api/ai_object.cpp +++ b/src/ai/api/ai_object.cpp @@ -209,6 +209,11 @@ bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const c /* 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); |