From 1a0fe0e8c63f99f912edfa7d39234cc71df41db9 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 9 Jan 2012 22:21:45 +0000 Subject: (svn r23783) -Cleanup: remove ancient but not needed command flag --- src/command.cpp | 62 ++++++++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 38 deletions(-) (limited to 'src/command.cpp') 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); -- cgit v1.2.3-54-g00ecf