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.
resource.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 <iostream>
20#include <map>
21#include <string>
22#include <vector>
23
24#include <entt/entt.hpp>
25
29
30namespace cqsp::core::components {
34struct Matter {
37};
38
39struct Energy {
40 // Energy per unit
42};
43
47struct Unit {
48 std::string unit_name;
49};
50
51struct Good {};
52
67};
68
69struct Mineral {};
70// Good is for capital goods
71struct CapitalGood {};
72
75 double amount;
76 ResourceMap operator*(const double value) const;
78};
79
80struct Recipe {
84 float interval;
85 // The actual factory worker amount is workers * productivity
86 double workers;
87
89};
90
91struct RecipeCost {
94};
95
96// Factory size
98 // The size of the factory.
99 // the maximum output of the factory is
100 double size;
101 // The utilization of the factory.
103 double diff;
105
107 bool shortage = false;
108 double wages = 25;
111};
112
114 double revenue;
115 // How much it paid in materials to produce goods
117 // How much cash it took to maintain the factory
119 // How much it paid to people
120 double wages;
121 double profit;
122 // How much it paid in transport fees
123 double transport;
124
125 double amount_sold = 0;
126
127 void Reset() {
128 revenue = 0;
129 material_costs = 0;
130 maintenance = 0;
131 wages = 0;
132 profit = 0;
133 amount_sold = 0;
134 transport = 0;
135 }
136};
137
138// TODO(AGM): Remove
140 float interval;
142};
143
146
148
150 // Ledgers later to show how much
151};
152
154
156
158 std::map<entt::entity, double> dist;
159};
160} // namespace cqsp::core::components
Definition: resourceledger.h:34
double meter_cube
Definition: units.h:38
double kilogram
Definition: units.h:39
double joule
Definition: units.h:41
Definition: area.h:23
ProductionType
Definition: area.h:34
GoodEntity
Definition: resourceledger.h:28
Definition: resource.h:71
See SysPopulationConsumption for an explanation of these values
Definition: resource.h:56
double marginal_propensity
Definition: resource.h:66
double autonomous_consumption
Definition: resource.h:61
Definition: resource.h:113
double amount_sold
Definition: resource.h:125
double maintenance
Definition: resource.h:118
double profit
Definition: resource.h:121
void Reset()
Definition: resource.h:127
double wages
Definition: resource.h:120
double revenue
Definition: resource.h:114
double material_costs
Definition: resource.h:116
double transport
Definition: resource.h:123
Definition: resource.h:39
types::joule energy
Definition: resource.h:41
Definition: resource.h:139
float interval
Definition: resource.h:140
float time_left
Definition: resource.h:141
Definition: resource.h:51
Definition: resource.h:97
int workers
Definition: resource.h:106
double diff_delta
Definition: resource.h:104
double size
Definition: resource.h:100
double diff
Definition: resource.h:103
int continuous_gains
Definition: resource.h:110
bool shortage
Definition: resource.h:107
double utilization
Definition: resource.h:102
int continuous_losses
Definition: resource.h:109
double wages
Definition: resource.h:108
Something that has a mass.
Definition: resource.h:34
types::kilogram mass
Definition: resource.h:36
types::meter_cube volume
Definition: resource.h:35
Definition: resource.h:69
Definition: resource.h:91
ResourceMap scaling
Definition: resource.h:93
ResourceMap fixed
Definition: resource.h:92
Definition: resource.h:80
ResourceMap capitalcost
Definition: resource.h:88
RecipeOutput output
Definition: resource.h:82
ProductionType type
Definition: resource.h:83
double workers
Definition: resource.h:86
float interval
Definition: resource.h:84
ResourceMap input
Definition: resource.h:81
Definition: resource.h:73
ResourceMap operator*(const double value) const
Definition: resource.cpp:20
GoodEntity entity
Definition: resource.h:74
double amount
Definition: resource.h:75
std::map< entt::entity, double > dist
Definition: resource.h:158
The unit name of the good. If it doesn't have it, then it's a quantity.
Definition: resource.h:47
std::string unit_name
Definition: resource.h:48