diff --git a/vehicle/simvehicle.cc b/vehicle/simvehicle.cc index 1feca64..042e612 100644 --- a/vehicle/simvehicle.cc +++ b/vehicle/simvehicle.cc @@ -1,4 +1,4 @@ -#/* +/* * Copyright (c) 1997 - 2001 Hj. Malthaner * * This file is part of the Simutrans project under the artistic license. @@ -7066,7 +7066,8 @@ bool air_vehicle_t::calc_route_internal( flying_height = 3*TILE_HEIGHT_STEP; } takeoff = 0; - target_height = ((sint16)start.z+3)*TILE_HEIGHT_STEP; + // target_height = ((sint16)start.z+3)*TILE_HEIGHT_STEP; + target_height = ((sint16)start.z+SET_FLIGHT_HEIGHT)*TILE_HEIGHT_STEP; } //DBG_MESSAGE("air_vehicle_t::calc_route()","take off ok"); @@ -7081,7 +7082,7 @@ bool air_vehicle_t::calc_route_internal( // add the start const grund_t *gr; int endi = 1; - int over = 3; + int over = SET_LANDING_OFFSET; // now add all runway + 3 ... do { if(!welt->is_within_limits(search_end.get_2d()+(end_dir*endi)) ) { @@ -7385,7 +7386,7 @@ bool air_vehicle_t::can_enter_tile(const grund_t *gr, sint32 &restart_speed, uin // check for another circle ... if( route_index == touchdown - HOLDING_PATTERN_OFFSET ) { - const int runway_state = block_reserver( touchdown, search_for_stop+1, true ); + const int runway_state = block_reserver( touchdown + SET_LANDING_OFFSET - HOLDING_PATTERN_OFFSET, search_for_stop+1, true ); if( runway_state != 1 ) { @@ -7413,7 +7414,8 @@ bool air_vehicle_t::can_enter_tile(const grund_t *gr, sint32 &restart_speed, uin if( route_index == touchdown - HOLDING_PATTERN_LENGTH - HOLDING_PATTERN_OFFSET && state != circling ) { // just check, if the end of runway is free; we will wait there - const int runway_state = block_reserver( touchdown, search_for_stop+1, true ); + // const int runway_state = block_reserver( touchdown, search_for_stop+1, true ); // + const int runway_state = block_reserver( touchdown + SET_LANDING_OFFSET - HOLDING_PATTERN_OFFSET, search_for_stop+1, true ); // LOOKS OKAY! if(runway_state == 1) { route_index += HOLDING_PATTERN_LENGTH; @@ -7707,7 +7709,7 @@ void air_vehicle_t::hop(grund_t* gr) new_friction = 1; block_reserver( takeoff, takeoff+100, false ); flying_height = h_cur - h_next; - target_height = h_cur+TILE_HEIGHT_STEP*3; + target_height = h_cur+TILE_HEIGHT_STEP*SET_FLIGHT_HEIGHT;//modified } break; } @@ -7730,11 +7732,11 @@ void air_vehicle_t::hop(grund_t* gr) } flying_height -= h_next; // did we have to change our flight height? - if( target_height-h_next > TILE_HEIGHT_STEP*5 ) { + if( target_height-h_next > TILE_HEIGHT_STEP*(SET_FLIGHT_HEIGHT+2) ) { // Move down target_height -= TILE_HEIGHT_STEP*2; } - else if( target_height-h_next < TILE_HEIGHT_STEP*2 ) { + else if( target_height-h_next < TILE_HEIGHT_STEP*(SET_FLIGHT_HEIGHT-1) ) { // Move up target_height += TILE_HEIGHT_STEP*2; } @@ -7751,7 +7753,7 @@ void air_vehicle_t::hop(grund_t* gr) flying_height = (flying_height-TILE_HEIGHT_STEP); } - if (route_index >= touchdown) { + if (route_index >= touchdown - SET_LANDING_OFFSET) { //modified. "too short" // come down, now! target_height = h_next; diff --git a/vehicle/simvehicle.h b/vehicle/simvehicle.h index 1ede89c..28f141e 100644 --- a/vehicle/simvehicle.h +++ b/vehicle/simvehicle.h @@ -40,7 +40,8 @@ class schiene_t; #define HOLDING_PATTERN_LENGTH 16 // offset of end tile of the holding pattern before touchdown tile. #define HOLDING_PATTERN_OFFSET 3 - +#define SET_FLIGHT_HEIGHT 20 +#define SET_LANDING_OFFSET SET_FLIGHT_HEIGHT-1 /*----------------------- Movables ------------------------------------*/ /**