(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.

This commit is contained in:
rubidium
2008-04-23 20:56:08 +00:00
parent a204a3b70e
commit d56827a9a9
11 changed files with 60 additions and 79 deletions

View File

@@ -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);
}