aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy/BuildingInstance.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-11-14 22:47:35 +0100
committer hop311 <hop3114@gmail.com>2023-11-16 20:38:34 +0100
commit886b8b8f396438fc2b7da7d2508f2064d14150a8 (patch)
treeeeed419a7d97ecb58adf63a17eb9184db3e5ed7a /src/openvic-simulation/economy/BuildingInstance.hpp
parent8271b1519e095ee3e7245cde2f0b54561c3ec619 (diff)
Misc changes
Diffstat (limited to 'src/openvic-simulation/economy/BuildingInstance.hpp')
-rw-r--r--src/openvic-simulation/economy/BuildingInstance.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/openvic-simulation/economy/BuildingInstance.hpp b/src/openvic-simulation/economy/BuildingInstance.hpp
new file mode 100644
index 0000000..9fc9df1
--- /dev/null
+++ b/src/openvic-simulation/economy/BuildingInstance.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "openvic-simulation/economy/BuildingType.hpp"
+
+namespace OpenVic {
+
+ struct BuildingInstance : HasIdentifier { // used in the actual game
+ using level_t = BuildingType::level_t;
+
+ enum class ExpansionState { CannotExpand, CanExpand, Preparing, Expanding };
+
+ private:
+ BuildingType const& PROPERTY(building_type);
+
+ level_t PROPERTY(level);
+ ExpansionState PROPERTY(expansion_state);
+ Date PROPERTY(start_date)
+ Date PROPERTY(end_date);
+ float PROPERTY(expansion_progress);
+
+ bool _can_expand() const;
+
+ public:
+ BuildingInstance(BuildingType const& new_building_type, level_t new_level = 0);
+ BuildingInstance(BuildingInstance&&) = default;
+
+ void set_level(level_t new_level);
+
+ bool expand();
+ void update_state(Date today);
+ void tick(Date today);
+ };
+}