336 v->reliability_spd_dec = e->reliability_spd_dec; |
336 v->reliability_spd_dec = e->reliability_spd_dec; |
337 v->max_age = e->lifelength * 366; |
337 v->max_age = e->lifelength * 366; |
338 |
338 |
339 _new_vehicle_id = v->index; |
339 _new_vehicle_id = v->index; |
340 |
340 |
341 v->u.air.pos = MAX_ELEMENTS; |
|
342 |
|
343 /* When we click on hangar we know the tile it is on. By that we know |
341 /* When we click on hangar we know the tile it is on. By that we know |
344 * its position in the array of depots the airport has.....we can search |
342 * its position in the array of depots the airport has.....we can search |
345 * layout for #th position of depot. Since layout must start with a listing |
343 * layout for #th position of depot. Since layout must start with a listing |
346 * of all depots, it is simple */ |
344 * of all depots, it is simple */ |
347 { |
345 for (uint i = 0;; i++) { |
348 uint i; |
346 assert(i != apc->nof_depots); |
349 |
347 if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) { |
350 for (i = 0; i < apc->nof_depots; i++) { |
348 assert(apc->layout[i].heading == HANGAR); |
351 if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) { |
349 v->u.air.pos = apc->layout[i].position; |
352 assert(apc->layout[i].heading == HANGAR); |
350 break; |
353 v->u.air.pos = apc->layout[i].position; |
|
354 break; |
|
355 } |
|
356 } |
351 } |
357 // to ensure v->u.air.pos has been given a value |
|
358 assert(v->u.air.pos != MAX_ELEMENTS); |
|
359 } |
352 } |
360 |
353 |
361 v->u.air.state = HANGAR; |
354 v->u.air.state = HANGAR; |
362 v->u.air.previous_pos = v->u.air.pos; |
355 v->u.air.previous_pos = v->u.air.pos; |
363 v->u.air.targetairport = GetStationIndex(tile); |
356 v->u.air.targetairport = GetStationIndex(tile); |