1 #pragma once
2 #ifndef CATA_SRC_WEATHER_GEN_H
3 #define CATA_SRC_WEATHER_GEN_H
4 
5 #include <iosfwd>
6 #include <map>
7 #include <vector>
8 
9 #include "calendar.h"
10 #include "type_id.h"
11 
12 class JsonObject;
13 struct tripoint;
14 
15 struct w_point {
16     double temperature = 0;
17     double humidity = 0;
18     double pressure = 0;
19     double windpower = 0;
20     std::string wind_desc;
21     int winddirection = 0;
22     time_point time;
23 };
24 
25 class weather_generator
26 {
27     public:
28         // Average temperature
29         double base_temperature = 0;
30         // Average humidity
31         double base_humidity = 0;
32         // Average atmospheric pressure
33         double base_pressure = 0;
34         //Average yearly windspeed
35         double base_wind = 0;
36         //How much the wind peaks above average
37         int base_wind_distrib_peaks = 0;
38         int summer_temp_manual_mod = 0;
39         int spring_temp_manual_mod = 0;
40         int autumn_temp_manual_mod = 0;
41         int winter_temp_manual_mod = 0;
42         int spring_humidity_manual_mod = 0;
43         int summer_humidity_manual_mod = 0;
44         int autumn_humidity_manual_mod = 0;
45         int winter_humidity_manual_mod = 0;
46         //How much the wind folows seasonal variation ( lower means more change )
47         int base_wind_season_variation = 0;
48         static int current_winddir;
49         std::vector<std::string> weather_types;
50         weather_generator();
51 
52         /**
53          * Input should be an absolute position in the map square system (the one used
54          * by the @ref map). You can use @ref map::getabs to get an absolute position from a
55          * relative position (relative to the map you called getabs on).
56          */
57         w_point get_weather( const tripoint &, const time_point &, unsigned ) const;
58         weather_type_id get_weather_conditions( const tripoint &, const time_point &,
59                                                 unsigned seed, std::map<weather_type_id, time_point> &next_instance_allowed ) const;
60         weather_type_id get_weather_conditions( const w_point &,
61                                                 std::map<weather_type_id, time_point> &next_instance_allowed ) const;
62         int get_wind_direction( season_type ) const;
63         int convert_winddir( int ) const;
64         int get_water_temperature() const;
65         void test_weather( unsigned seed,
66                            std::map<weather_type_id, time_point> &next_instance_allowed ) const;
67 
68         double get_weather_temperature( const tripoint &, const time_point &, unsigned ) const;
69 
70         static weather_generator load( const JsonObject &jo );
71 };
72 
73 #endif // CATA_SRC_WEATHER_GEN_H
74