(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 331b8dd7d4
commit f0b0691bfe
7 changed files with 88 additions and 115 deletions

View File

@@ -755,7 +755,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_SHIP);
if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings_game.vehicle.max_ships)
if (!Vehicle::CanAllocateItem() || unit_num > _settings_game.vehicle.max_ships)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {