(svn r8549) -Fix

Do not check whether the end of the depot array has been reached when building an aircraft. This cannot happen, just assert it really does not happen
pull/155/head
tron 18 years ago
parent fc4a53bff0
commit e2ad9abbca

@ -338,24 +338,17 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
_new_vehicle_id = v->index; _new_vehicle_id = v->index;
v->u.air.pos = MAX_ELEMENTS;
/* When we click on hangar we know the tile it is on. By that we know /* When we click on hangar we know the tile it is on. By that we know
* its position in the array of depots the airport has.....we can search * its position in the array of depots the airport has.....we can search
* layout for #th position of depot. Since layout must start with a listing * layout for #th position of depot. Since layout must start with a listing
* of all depots, it is simple */ * of all depots, it is simple */
{ for (uint i = 0;; i++) {
uint i; assert(i != apc->nof_depots);
if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) {
for (i = 0; i < apc->nof_depots; i++) { assert(apc->layout[i].heading == HANGAR);
if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) { v->u.air.pos = apc->layout[i].position;
assert(apc->layout[i].heading == HANGAR); break;
v->u.air.pos = apc->layout[i].position;
break;
}
} }
// to ensure v->u.air.pos has been given a value
assert(v->u.air.pos != MAX_ELEMENTS);
} }
v->u.air.state = HANGAR; v->u.air.state = HANGAR;

Loading…
Cancel
Save