diff options
author | rubidium <rubidium@openttd.org> | 2008-04-23 20:56:08 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-23 20:56:08 +0000 |
commit | 6939569362a8c3e2c1b5174962309d0d73152845 (patch) | |
tree | a6906b106143841dcbc6aea392d11baa75492e05 /src/road_cmd.cpp | |
parent | 1ba6e3deebf4c26896491842df51dc26f29a1c5d (diff) | |
download | openttd-6939569362a8c3e2c1b5174962309d0d73152845.tar.xz |
(svn r12855) -Codechange: do not use autoptr's for testing whether certain objects can be build, but check it directly in the pool so we do not have to call destructors in the testing phase. Stations still use the autoptr though.
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index a2a32d023..c95506a72 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -23,7 +23,6 @@ #include "newgrf.h" #include "station_map.h" #include "tunnel_map.h" -#include "misc/autoptr.hpp" #include "variables.h" #include "autoslope.h" #include "transparency.h" @@ -817,16 +816,14 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); - Depot *dep = new Depot(tile); - if (dep == NULL) return CMD_ERROR; - AutoPtrT<Depot> d_auto_delete = dep; + if (!Depot::CanAllocateItem()) return CMD_ERROR; if (flags & DC_EXEC) { + Depot *dep = new Depot(tile); dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index; MakeRoadDepot(tile, _current_player, dir, rt); MarkTileDirtyByTile(tile); - d_auto_delete.Detach(); } return cost.AddCost(_price.build_road_depot); } |