summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-09 22:21:45 +0000
committerrubidium <rubidium@openttd.org>2012-01-09 22:21:45 +0000
commit1a0fe0e8c63f99f912edfa7d39234cc71df41db9 (patch)
tree76f9c779f44fd2ecba4e151c7fe0ebd0afb9122b /src/command.cpp
parentf33f9b39208142c8b5e876dafe60a99ca3ea9b7a (diff)
downloadopenttd-1a0fe0e8c63f99f912edfa7d39234cc71df41db9.tar.xz
(svn r23783) -Cleanup: remove ancient but not needed command flag
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp62
1 files changed, 24 insertions, 38 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 713774491..5fd62b745 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -633,40 +633,26 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
if (exec_as_spectator) cur_company.Change(COMPANY_SPECTATOR);
bool test_and_exec_can_differ = (cmd_flags & CMD_NO_TEST) != 0;
- bool skip_test = _networking && (cmd & CMD_NO_TEST_IF_IN_NETWORK) != 0;
-
- /* Do we need to do a test run?
- * Basically we need to always do this, except when
- * the no-test-in-network flag is giving and we're
- * in a network game (e.g. restoring orders would
- * fail this test because the first order does not
- * exist yet when inserting the second, giving that
- * a wrong insert location and ignoring the command
- * and thus breaking restoring). However, when we
- * just want to do cost estimation we don't care
- * because it's only done once anyway. */
- CommandCost res;
- if (estimate_only || !skip_test) {
- /* Test the command. */
- _cleared_object_areas.Clear();
- SetTownRatingTestMode(true);
- ClearStorageChanges(false);
- res = proc(tile, flags, p1, p2, text);
- SetTownRatingTestMode(false);
-
- /* Make sure we're not messing things up here. */
- assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify());
- /* If the command fails, we're doing an estimate
- * or the player does not have enough money
- * (unless it's a command where the test and
- * execution phase might return different costs)
- * we bail out here. */
- if (res.Failed() || estimate_only ||
- (!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) {
- cur_company.Restore();
- return_dcpi(res, false);
- }
+ /* Test the command. */
+ _cleared_object_areas.Clear();
+ SetTownRatingTestMode(true);
+ ClearStorageChanges(false);
+ CommandCost res = proc(tile, flags, p1, p2, text);
+ SetTownRatingTestMode(false);
+
+ /* Make sure we're not messing things up here. */
+ assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify());
+
+ /* If the command fails, we're doing an estimate
+ * or the player does not have enough money
+ * (unless it's a command where the test and
+ * execution phase might return different costs)
+ * we bail out here. */
+ if (res.Failed() || estimate_only ||
+ (!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) {
+ cur_company.Restore();
+ return_dcpi(res, false);
}
#ifdef ENABLE_NETWORK
@@ -705,11 +691,11 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
cur_company.Restore();
}
- /* If the test and execution can differ, or we skipped the test
- * we have to check the return of the command. Otherwise we can
- * check whether the test and execution have yielded the same
- * result, i.e. cost and error state are the same. */
- if (!test_and_exec_can_differ && !skip_test) {
+ /* If the test and execution can differ we have to check the
+ * return of the command. Otherwise we can check whether the
+ * test and execution have yielded the same result,
+ * i.e. cost and error state are the same. */
+ if (!test_and_exec_can_differ) {
assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check
} else if (res2.Failed()) {
return_dcpi(res2, false);