summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-02-03 08:30:22 +0000
committertron <tron@openttd.org>2007-02-03 08:30:22 +0000
commite2ad9abbcae8dc14f699cdf3775a4bcbb1da8a5a (patch)
treea99c595281e4f538ed12690c634de5a9cebcc7d1 /src
parentfc4a53bff00e9cfdfc6b7cf465cbce5850484722 (diff)
downloadopenttd-e2ad9abbcae8dc14f699cdf3775a4bcbb1da8a5a.tar.xz
(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
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 3788efca8..ea5e255b8 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -338,24 +338,17 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
_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
* 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
* of all depots, it is simple */
- {
- uint i;
-
- for (i = 0; i < apc->nof_depots; i++) {
- if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) {
- assert(apc->layout[i].heading == HANGAR);
- v->u.air.pos = apc->layout[i].position;
- break;
- }
+ for (uint i = 0;; i++) {
+ assert(i != apc->nof_depots);
+ if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) {
+ assert(apc->layout[i].heading == HANGAR);
+ 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;