This patch changes aircraft (normal and disaster) behaviour to adjust their flying altitude according to the terrain below during flight.
I took two patches from the MHL patch and rewrote them for plain trunk while splitting them up further.
Credits for the code go to ic111 and myself but ic111 wrote most of it.
Attached is a series of patches to be applied succesfully.
Commit messages are as follows and should speak for themselves:
10.diff Codechange: Rename base_altitude to offset
20.diff Codechange: Rename GetAircraftFlyingAltitude() to GetAircraftFlyingAltitudeOffset()
30.diff Codechange: Rename PLANE_HOLDING_ALTITUDE to PLANE_HOLD_MAX_FLYING_ALTITUDE and HELI_FLIGHT_ALTITUDE to HELICOPTER_HOLD_MAX_FLYING_ALTITUDE
40.diff Codechange: Prepare the code to let aircraft change altitude according to the terrain below afterwards
Besides a savegamebump and some enums we need the tile height below the aircraft's shadow.
50.diff Feature: Aircraft change altitude according to terrain below
60.diff Codechange: Prepare the code to let disaster aircraft change altitude according to terrain below afterwards
70.diff Feature: Disaster aircraft change altitude according to terrain below
Reduced the flightpatch heights of aircraft for easier testing if everything goes allright.
Increased the frequency of disaster vehicles appearing.
The test.diff should not be commited to trunk as is!
The part that changes aircraft.h is to make aircraft fly lower so that they change altitude more often with "only" 15 heightlevels (This could be applied to trunk, minus the outcommented values, but I fear collision with high buildings).
The part that changes disaster_cmd.cpp is to have disaster vehicles appear more often and all at once instead of during certain periods in time. (this part should not be commited at all IHMO)
Notes / questions:
- In patch 40 I assume a height of level 7, something in the middle of heighest an lowest possible heightlevel, when an aircraft is outside the map and freeformedges is on; this is because the height of void tiles can not be querried. (In the MHL patch tiles outside the map do have a heightlevel and this situation is handled differently there).
Is there a way to get the height of the closest border tile when an aircraft is above a void tile?
- There are two savegamebumps needed one in in patch 40 and one in patch 60. I only increased the value once; ?if/when commiting this patch to trunk as a patchbomb this will not cause an issue with savegames?
Testing, bugreporting and suggestions for code improvements much apreciated.