aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/GameManager.hpp
blob: af2ec4f02a4ac0ecfefb3906ae9d50e645e316d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "openvic/GameAdvancementHook.hpp"
#include "openvic/economy/Good.hpp"
#include "openvic/map/Map.hpp"

namespace OpenVic {
   struct GameManager {
      using state_updated_func_t = std::function<void()>;

      Map map;
      BuildingManager building_manager;
      GoodManager good_manager;
      PopManager pop_manager;
      GameAdvancementHook clock;

   private:
      time_t session_start; /* SS-54, as well as allowing time-tracking */
      Date today;
      state_updated_func_t state_updated;
      bool needs_update;

      void set_needs_update();
      void update_state();
      void tick();

   public:
      GameManager(state_updated_func_t state_updated_callback);

      bool setup();

      Date const& get_today() const;
      bool expand_building(Province::index_t province_index, const std::string_view building_type_identifier);

      /* Hardcoded data for defining things for which parsing from files has
       * not been implemented, currently mapmodes and building types.
       */
      bool load_hardcoded_defines();
   };
}