Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
area.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2025 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <string>
20#include <vector>
21
22#include <entt/entt.hpp>
23
26
29 std::vector<entt::entity> industries;
30};
31
33 std::vector<entt::entity> power_plants;
34};
35
39 int levels;
40};
41
43
44struct Factory {};
45
46struct Mine {};
47
48struct Service {};
49
50struct Farm {
51 // Farms have a harvest period?
52 // Farms can fluctuate between how much they generate per tick.
53 // Also add food good
54};
55
57
58enum struct IndustryState {
67};
68
69inline std::string IndustryStateToString(IndustryState state) {
70 switch (state) {
72 return "Steady State";
74 return "Maximum Production";
76 return "Minimum Production";
78 return "Construction";
80 return "Demolishing";
82 return "Shrinking";
84 return "Expanding";
86 return "Shortage";
87 }
88}
89
90// Factory size
92 // The size of the factory.
93 // the maximum output of the factory is
94 double size;
95 // The utilization of the factory.
96 double utilization = 0;
97 double diff = 0;
98
100 bool shortage = false;
101 double cumulative_pr = 0;
103 int stability = 0;
104 double expertise = 1;
105
108 double throughput = 1.;
109
110 // Zoning requirements...
111 std::pair<entt::entity, int> consumption;
112
114 entt::entity recipe;
115
117
118 double revenue;
119 // How much it paid in materials to produce goods
121 // How much cash it took to maintain the factory
124 // How much it paid to people
125 double wage_cost;
126 double tax_cost;
128 double profit;
129 // How much it paid in transport fees
130 double transport;
131 // How much in (percent) subsidies you are adding to the output
132 double output_subsidy = 0.0;
134
135 double amount_sold = 0;
136
137 void Reset() {
138 revenue = 0;
139 material_costs = 0;
140 maintenance = 0;
141 wage_cost = 0;
142 profit = 0;
143 amount_sold = 0;
144 transport = 0;
145 }
146
153 double ProfitMargin() { return profit / (revenue + 0.0001); }
154};
155
156struct ZoningType {};
157} // namespace cqsp::core::components
This is a vector meant for fast iteration
Definition: resourceledger.h:223
Definition: area.h:27
ProductionType
Definition: area.h:42
std::string IndustryStateToString(IndustryState state)
Definition: area.h:69
IndustryState
Definition: area.h:58
int progress
Definition: area.h:37
int levels
Definition: area.h:39
int maximum
Definition: area.h:38
Definition: area.h:44
Definition: area.h:50
std::vector< entt::entity > industries
Definition: area.h:29
Definition: area.h:46
std::vector< entt::entity > power_plants
Definition: area.h:33
bool shortage
Definition: area.h:100
double tax_cost
Definition: area.h:126
IndustryState state
Definition: area.h:116
double wage_cost
Definition: area.h:125
ResourceVector workers
Definition: area.h:99
double size
Definition: area.h:94
double maintenance
Definition: area.h:122
double utilization
Definition: area.h:96
void Reset()
Definition: area.h:137
double amount_sold
Definition: area.h:135
entt::entity recipe
Definition: area.h:114
double diff
Definition: area.h:97
double ProfitMargin()
Definition: area.h:153
double profit
Definition: area.h:128
AdditiveModifier max_expertise
Definition: area.h:107
double expertise
Definition: area.h:104
double output_subsidy_amount
Definition: area.h:133
int stability
Definition: area.h:103
double material_costs
Definition: area.h:120
double transport
Definition: area.h:130
double cumulative_pr
Definition: area.h:101
double throughput
Definition: area.h:108
MultiplicativeModifier expertise_gain
Definition: area.h:106
double output_subsidy
Definition: area.h:132
ProductionType type
Definition: area.h:113
std::pair< entt::entity, int > consumption
Definition: area.h:111
double revenue
Definition: area.h:118
double power_consumption
Definition: area.h:123
int continuous_gains
Definition: area.h:102
double construction_cost
Definition: area.h:127
Definition: area.h:48