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;
109};
110
112 double revenue;
113 // How much it paid in materials to produce goods
115 // How much cash it took to maintain the factory
117 // How much it paid to people
118 double wages;
119 double profit;
120 // How much it paid in transport fees
121 double transport;
122
123 void Reset() {
124 revenue = 0;
125 materialcosts = 0;
126 maintenance = 0;
127 wages = 0;
128 profit = 0;
129 transport = 0;
130 }
131};
132
133// TODO(AGM): Remove
135 float interval;
137};
138
141
143
145 // Ledgers later to show how much
146};
147
149
151
153 std::map<entt::entity, double> dist;
154};
155} // 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:33
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:111
double materialcosts
Definition: resource.h:114
double maintenance
Definition: resource.h:116
double profit
Definition: resource.h:119
void Reset()
Definition: resource.h:123
double wages
Definition: resource.h:118
double revenue
Definition: resource.h:112
double transport
Definition: resource.h:121
Definition: resource.h:39
types::joule energy
Definition: resource.h:41
Definition: resource.h:134
float interval
Definition: resource.h:135
float time_left
Definition: resource.h:136
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
bool shortage
Definition: resource.h:107
double utilization
Definition: resource.h:102
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:153
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