Debian Codegraph @

src/AIModel/AIStorm.hxx

raw symbols SCIP
1 /*
2 * SPDX-FileName: AIStorm.hxx
3 * SPDX-FileComment: AIBase derived class creates an AI thunderstorm
4 * SPDX-FileCopyrightText: Copyright (C) 2004 David P. Culp - [email protected]
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #pragma once
9
10 #include <string>
11 #include <string_view>
12
13 #include "AIBase.hxx"
14 #include "AIManager.hxx"
15
16
17 class FGAIStorm : public FGAIBase
18 {
19 public:
20 FGAIStorm();
21 virtual ~FGAIStorm() = default;
22
23 std::string_view getTypeString(void) const override { return "thunderstorm"; }
24 void readFromScenario(SGPropertyNode* scFileNode) override;
25 void update(double dt) override;
26
27 inline void setStrengthNorm(double s) { strength_norm = s; };
28 inline void setDiameter(double d) { diameter = d; };
29 inline void setHeight(double h) { height = h; };
30 inline double getStrengthNorm() const { return strength_norm; };
31 inline double getDiameter() const { return diameter; };
32 inline double getHeight() const { return height; };
33
34 private:
35 double diameter = 0.0; // diameter of turbulence zone, in nm
36 double height = 0.0; // top of turbulence zone, in feet MSL
37 double strength_norm = 0.0; // strength of turbulence
38
39 void Run(double dt);
40
41 // lightning stuff
42 double delay; // average time (sec) between lightning flashes
43 int subflashes; // number of subflashes per flash
44 double random_delay; // delay +/- random number
45 double timer;
46 SGPropertyNode_ptr flash_node;
47 int flashed; // number of subflashes already done this flash
48 bool flashing; // true if currently flashing;
49 int subflash_array[8];
50 int subflash_index;
51
52 // turbulence stuff
53 SGPropertyNode_ptr turb_mag_node;
54 SGPropertyNode_ptr turb_rate_node;
55 };