forked from mirror/OpenTTD
(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:
@@ -24,7 +24,6 @@
|
||||
#include "industry_map.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_canal.h"
|
||||
#include "misc/autoptr.hpp"
|
||||
#include "transparency.h"
|
||||
#include "strings_func.h"
|
||||
#include "functions.h"
|
||||
@@ -201,18 +200,16 @@ CommandCost CmdBuildShipDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
|
||||
ret = DoCommand(tile2, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
if (CmdFailed(ret)) return CMD_ERROR;
|
||||
|
||||
Depot *depot = new Depot(tile);
|
||||
if (depot == NULL) return CMD_ERROR;
|
||||
AutoPtrT<Depot> d_auto_delete = depot;
|
||||
if (!Depot::CanAllocateItem()) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Depot *depot = new Depot(tile);
|
||||
depot->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
|
||||
|
||||
MakeShipDepot(tile, _current_player, DEPOT_NORTH, axis, wc1);
|
||||
MakeShipDepot(tile2, _current_player, DEPOT_SOUTH, axis, wc2);
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkTileDirtyByTile(tile2);
|
||||
d_auto_delete.Detach();
|
||||
}
|
||||
|
||||
return CommandCost(EXPENSES_CONSTRUCTION, _price.build_ship_depot);
|
||||
|
Reference in New Issue
Block a user