diff options
author | rubidium <rubidium@openttd.org> | 2009-01-09 14:59:02 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-09 14:59:02 +0000 |
commit | f0b0691bfe603e362cd5760240582cec410876ff (patch) | |
tree | c50b9279882186f1767a0a6d05f3b4df148a5c93 /src/station_cmd.cpp | |
parent | 331b8dd7d4c95266aae579171064879d847ea8aa (diff) | |
download | openttd-f0b0691bfe603e362cd5760240582cec410876ff.tar.xz |
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index fa623ab7f..12eca14d2 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3070,13 +3070,12 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount) void BuildOilRig(TileIndex tile) { - Station *st = new Station(tile); - - if (st == NULL) { + if (!Station::CanAllocateItem()) { DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile); return; } + Station *st = new Station(tile); st->town = ClosestTownFromTile(tile, UINT_MAX); st->sign.width_1 = 0; |