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 <utility>
23#include <vector>
24
25#include <entt/entt.hpp>
26
30
31namespace cqsp::core::components {
32struct Energy {
33 // Energy per unit
35};
36
40struct Unit {
41 std::string unit_name;
42};
43
44struct Good {
47};
48
63};
64
65struct Mineral {};
66struct RawGood {};
67struct LaborGood {};
68struct FluidGood {};
70// Good is for capital goods
71struct CapitalGood {};
72
75 double amount;
76 ResourceMap operator*(const double value) const;
78};
79
81 std::vector<std::pair<entt::entity, uint32_t>> workers;
82 uint32_t GetSum() {
83 uint32_t sum = 0;
84 for (const auto& w : workers) {
85 sum += w.second;
86 }
87 return sum;
88 }
89};
90
91struct Recipe {
93 double power_cost = 0.0;
96 // The actual factory worker amount is workers * productivity
98 // double workers;
99
101};
102
107 /* Per tick cost */
109 int time;
110 // You just need to fulfill any of these zoning requirements I guess?
111 std::vector<std::pair<entt::entity, int>> zoning;
112};
113
117};
118
121
123} // namespace cqsp::core::components
Try to avoid using this unless you really need it since this is extremely slow.
Definition: resourceledger.h:38
This is a vector meant for fast iteration
Definition: resourceledger.h:223
double meter_cube
Definition: units.h:39
double kilogram
Definition: units.h:40
double joule
Definition: units.h:42
Definition: area.h:27
ProductionType
Definition: area.h:42
GoodEntity
Definition: resourceledger.h:28
Definition: resource.h:71
std::vector< std::pair< entt::entity, int > > zoning
Definition: resource.h:111
ResourceVector cost
Definition: resource.h:108
int time
Definition: resource.h:109
See SysPopulationConsumption for an explanation of these values
Definition: resource.h:52
double marginal_propensity
Definition: resource.h:62
double autonomous_consumption
Definition: resource.h:57
Definition: resource.h:32
types::joule energy
Definition: resource.h:34
Definition: resource.h:68
Definition: resource.h:44
types::meter_cube volume
Definition: resource.h:45
types::kilogram mass
Definition: resource.h:46
Definition: resource.h:67
Definition: resource.h:65
Definition: resource.h:66
Definition: resource.h:114
ResourceVector scaling
Definition: resource.h:116
ResourceVector fixed
Definition: resource.h:115
Definition: resource.h:91
ResourceVector capitalcost
Definition: resource.h:100
RecipeOutput output
Definition: resource.h:94
ResourceVector input
Definition: resource.h:92
ProductionType type
Definition: resource.h:95
double power_cost
Definition: resource.h:93
RecipeWorkers workers
Definition: resource.h:97
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
Definition: resource.h:80
std::vector< std::pair< entt::entity, uint32_t > > workers
Definition: resource.h:81
uint32_t GetSum()
Definition: resource.h:82
The unit name of the good. If it doesn't have it, then it's a quantity.
Definition: resource.h:40
std::string unit_name
Definition: resource.h:41