blob: 5a18723a39ae5bfbc5d9ea460c0afed70ecab28a (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#pragma once
#include <bitset>
#include <map>
#include <vector>
#include "openvic-simulation/country/Country.hpp"
#include "openvic-simulation/economy/Building.hpp"
#include "openvic-simulation/economy/Good.hpp"
#include "openvic-simulation/history/Bookmark.hpp"
#include "openvic-simulation/history/HistoryMap.hpp"
#include "openvic-simulation/map/Province.hpp"
#include "openvic-simulation/map/TerrainType.hpp"
namespace OpenVic {
struct ProvinceHistoryMap;
struct ProvinceHistoryEntry : HistoryEntry {
friend struct ProvinceHistoryMap;
using building_level_map_t = std::map<Building const*, Building::level_t>;
private:
Province const& PROPERTY(province);
std::optional<Country const*> PROPERTY(owner);
std::optional<Country const*> PROPERTY(controller);
std::optional<Province::colony_status_t> PROPERTY(colonial);
std::optional<bool> PROPERTY(slave);
std::vector<Country const*> PROPERTY(add_cores);
std::vector<Country const*> PROPERTY(remove_cores);
std::optional<Good const*> PROPERTY(rgo);
std::optional<Province::life_rating_t> PROPERTY(life_rating);
std::optional<TerrainType const*> PROPERTY(terrain_type);
building_level_map_t PROPERTY(buildings);
decimal_map_t<Ideology const*> PROPERTY(party_loyalties);
ProvinceHistoryEntry(Province const& new_province, Date new_date);
};
struct ProvinceHistoryManager;
struct ProvinceHistoryMap : HistoryMap<ProvinceHistoryEntry> {
friend struct ProvinceHistoryManager;
private:
Province const& PROPERTY(province);
protected:
ProvinceHistoryMap(Province const& new_province);
std::unique_ptr<ProvinceHistoryEntry> _make_entry(Date date) const override;
bool _load_history_entry(GameManager const& game_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root) override;
};
struct ProvinceHistoryManager {
private:
std::map<Province const*, ProvinceHistoryMap> PROPERTY(province_histories);
bool locked = false;
public:
ProvinceHistoryManager() = default;
void lock_province_histories(Map const& map, bool detailed_errors);
bool is_locked() const;
ProvinceHistoryMap const* get_province_history(Province const* province) const;
bool load_province_history_file(GameManager const& game_manager, Province const& province, ast::NodeCPtr root);
};
} // namespace OpenVic
|