diff options
author | rubidium <rubidium@openttd.org> | 2010-08-28 18:56:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-28 18:56:07 +0000 |
commit | fba19a41d5ffddb8c33a4e45016d90a8ae3283be (patch) | |
tree | 92b2a9eb8a69b98ce15505f273749786536b2a8f /src/object_cmd.cpp | |
parent | ca7fe458a26d6e23de93e8fbaaa82f1dbfa341f0 (diff) | |
download | openttd-fba19a41d5ffddb8c33a4e45016d90a8ae3283be.tar.xz |
(svn r20665) -Codechange: make clearing object tiles behave (more) like TTDPatch
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r-- | src/object_cmd.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 94b48a4d2..2cd8ddc82 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -326,6 +326,9 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) Object *o = Object::GetByTile(tile); TileArea ta = o->location; + CommandCost cost(EXPENSES_CONSTRUCTION, spec->GetClearCost() * ta.w * ta.h / 5); + if (spec->flags & OBJECT_FLAG_CLEAR_INCOME) cost.MultiplyCost(-1); // They get an income! + /* Water can remove everything! */ if (_current_company != OWNER_WATER) { if ((spec->flags & OBJECT_FLAG_AUTOREMOVE) == 0 && flags & DC_AUTO) { @@ -339,15 +342,15 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) } else if (CheckTileOwnership(tile).Failed()) { /* We don't own it!. */ return_cmd_error(STR_ERROR_OWNED_BY); - } else if ((spec->flags & OBJECT_FLAG_AUTOREMOVE) == 0 && !_cheats.magic_bulldozer.value) { + } else if ((spec->flags & OBJECT_FLAG_CANNOT_REMOVE) != 0 && (spec->flags & OBJECT_FLAG_AUTOREMOVE) == 0) { /* In the game editor or with cheats we can remove, otherwise we can't. */ - return CMD_ERROR; + if (!_cheats.magic_bulldozer.value) return CMD_ERROR; + + /* Removing with the cheat costs more in TTDPatch / the specs. */ + cost.MultiplyCost(25); } } - CommandCost cost(EXPENSES_CONSTRUCTION, spec->GetClearCost() * ta.w * ta.h); - if (spec->flags & OBJECT_FLAG_CLEAR_INCOME) cost.MultiplyCost(-1); // They get an income! - switch (type) { case OBJECT_HQ: { Company *c = Company::Get(GetTileOwner(tile)); |