1#include "../Rendering/ClientMath.h"
2#include <iostream>
3
4
5
7{
10} busStorage;
11Bus* bus = &busStorage;
12struct Game {
Bus* bus = &busStorage; } game;
13struct Gui { Game* game; } guiStorage{&game};
14Gui*
gui = &guiStorage;
15struct Grid {
bool dataReady =
true; }
grid;
16struct Camera { RiseMath::Vector3 position; } camera;
17struct Ship
18{
19 float mslKm = 0, bound = .001f;
20 bool groundvehicle = false;
21 double precisionx = 0, precisiony = 0, precisionz = 0;
22 RiseMath::Vector3 position;
23 RiseMath::Matrix matrixWorld;
25struct Cockpit
26{
27 float strutsrettoCGKm = .002f, landingGearLengthKm = .001f;
28 float suspensionRideHeightKm = .0005f;
30struct City {
float elevation = 0; }
citystuff;
34{
40 float result = -1;
41 int queries = 0;
42 float CalculateAGLd(RiseMath::Vector3,
double,
double,
double,
43 double, double, double, RiseMath::Vector3, bool)
44 { ++queries; return result; }
45} view;
47
48#include "RepositionAltitude.generated.h"
49
50static int failures = 0, checks = 0;
51static void Check(bool pass, const char* message)
52{
53 ++checks;
54 if (!pass) { ++failures; std::cerr << "FAIL: " << message << '\n'; }
55}
56
58{
59
60
61 for (auto reset : {ResetD0, ResetO0})
62 {
63 for (float staleResult : {-1.f, .003f})
64 {
69 reset();
70 Check(
f_AGL >= .442f,
"reposition retained the old ground AGL");
71 Check(!GroundMarkerVisible(), "reposition did not hide the ground marker");
74 view.result = staleResult;
75 view.queries = 0;
76 SampleTerrain();
77 Check(view.queries == 0, "old terrain queried before above-cloud flag caught up");
79 "old terrain overwrote the reposition clearance");
80 Check(!GroundMarkerVisible(), "false ground marker returned after reposition");
81 SampleContainedTerrain();
82 Check(view.queries == 0, "contained vehicle queried stale terrain in orbit");
84 SampleTerrain();
85 Check(!GroundMarkerVisible(), "false ground marker persisted in orbit");
86 }
87 }
88
89
92 view.result = .003f;
93 view.queries = 0;
94 SampleTerrain();
96 "landing did not restore near-zero radio altitude");
97 Check(GroundMarkerVisible(), "normal ground marker suppressed after return");
98 SampleContainedTerrain();
99 Check(view.queries == 2, "contained surface vehicle no longer refreshes its terrain position");
100 view.result = .5f;
101 SampleTerrain();
102 Check(!GroundMarkerVisible(), "ground marker did not clear during normal climb");
103
104 for (int invalid = 0; invalid < 3; ++invalid)
105 {
109 view.queries = 0;
110 SampleTerrain();
111 Check(view.queries == 0, "unavailable terrain was sampled");
112 }
113 std::cout << checks << " checks, " << failures << " failures\n";
114 return failures ? 1 : 0;
115}
float StaticAirPressureMb
std::unique_ptr< grid > ptrGrid
float CalculateAGLd(RiseMath::Vector3 terpos, double terprecisionx, double terprecisiony, double terprecisionz, double proposedx, double proposedy, double proposedz, RiseMath::Vector3 proposed, bool makeleveler)
s_network_objects playerships[MAX_SCAN]
@ Game
Use the game audio system.