diff options
author | rubidium <rubidium@openttd.org> | 2007-11-03 06:20:25 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-11-03 06:20:25 +0000 |
commit | c393a2802824754d492781d451337e693d28604b (patch) | |
tree | c0ef014ba15f6ddb05bc1cb38d4c75b51e0867a0 /src | |
parent | 71ba45cdfb05a21c22fd0c184386a4faed8b46d7 (diff) | |
download | openttd-c393a2802824754d492781d451337e693d28604b.tar.xz |
(svn r11370) -Fix [FS1384]: manually replacing a vehicle with shared orders makes it lose it's order index and service interval. Patch by jthill.
Diffstat (limited to 'src')
-rw-r--r-- | src/order_cmd.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index e9ed59545..ab8bef202 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -984,16 +984,17 @@ void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *bak) /* If we had shared orders, recover that */ if (bak->clone != INVALID_VEHICLE) { DoCommandP(0, v->index | (bak->clone << 16), 0, NULL, CMD_CLONE_ORDER); - return; - } + } else { - /* CMD_NO_TEST_IF_IN_NETWORK is used here, because CMD_INSERT_ORDER checks if the - * order number is one more than the current amount of orders, and because - * in network the commands are queued before send, the second insert always - * fails in test mode. By bypassing the test-mode, that no longer is a problem. */ - for (uint i = 0; bak->order[i].IsValid(); i++) { - if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK)) - break; + /* CMD_NO_TEST_IF_IN_NETWORK is used here, because CMD_INSERT_ORDER checks if the + * order number is one more than the current amount of orders, and because + * in network the commands are queued before send, the second insert always + * fails in test mode. By bypassing the test-mode, that no longer is a problem. */ + for (uint i = 0; bak->order[i].IsValid(); i++) { + if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, + CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK)) + break; + } } /* Restore vehicle order-index and service interval */ |