(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.

This commit is contained in:
rubidium
2009-01-09 14:59:02 +00:00
parent de9413454e
commit d197060137
7 changed files with 88 additions and 115 deletions

View File

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