FlightGear next
AIStorm.hxx
Go to the documentation of this file.
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 - davidculp2@comcast.net
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
17class FGAIStorm : public FGAIBase
18{
19public:
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
34private:
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};
FGAIBase(object_type ot, bool enableHot)
Definition AIBase.cxx:146
double getHeight() const
Definition AIStorm.hxx:32
void setStrengthNorm(double s)
Definition AIStorm.hxx:27
double getStrengthNorm() const
Definition AIStorm.hxx:30
void update(double dt) override
Definition AIStorm.cxx:69
virtual ~FGAIStorm()=default
void setHeight(double h)
Definition AIStorm.hxx:29
double getDiameter() const
Definition AIStorm.hxx:31
std::string_view getTypeString(void) const override
Definition AIStorm.hxx:23
void readFromScenario(SGPropertyNode *scFileNode) override
Definition AIStorm.cxx:58
void setDiameter(double d)
Definition AIStorm.hxx:28