summaryrefslogtreecommitdiff
path: root/src/openvic2/GameManager.hpp
blob: 5e46e5829db7a6ef1c270a5d0cdf5340aa4ba694 (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
#pragma once

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

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

      Map map;
      BuildingManager building_manager;
      GoodManager good_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);

      return_t setup();

      Date const& get_today() const;
      return_t expand_building(index_t province_index, std::string const& building_type_identifier);
   };
}