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.
surface.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
24namespace cqsp::core::components {
29 std::vector<entt::entity> settlements;
30 std::vector<entt::entity> provinces;
31};
32
33struct City {
34 entt::entity province;
35};
36
38 // Identifier for the mouse to identify which province the person has clicked on
39 std::string province_map;
41 std::string adjacencies;
42};
43
47struct Settlement {
48 std::vector<entt::entity> population;
49 std::vector<std::pair<entt::entity, double>> job_demands;
50 // Infrastructure and other things
51 // we might need air supply and other things like that
52};
53
54struct TimeZone {
55 double time_diff = 0;
56};
57
59 entt::entity time_zone = entt::null;
60};
61
63 uint32_t allocated;
64 uint32_t filled;
65};
66
67struct Province {
68 entt::entity country = entt::null;
69 entt::entity planet = entt::null;
70 std::vector<entt::entity> cities;
71 std::vector<entt::entity> neighbors;
72 std::vector<std::pair<entt::entity, ZoningAllocation>> zoning;
73};
74
76 int r;
77 int g;
78 int b;
79 ProvinceColor() = default;
80 ProvinceColor(int r, int g, int b) : r(r), g(g), b(b) {}
81
82 bool operator==(const ProvinceColor& other) const { return (other.r == r && other.g == g && other.b == b); }
83
84 operator int() const { return toInt(r, g, b); }
85
86 static int toInt(int r, int g, int b) {
87 int rgb = r;
88 rgb = (rgb << 8) + g;
89 rgb = (rgb << 8) + b;
90 return rgb;
91 }
92
93 static ProvinceColor fromInt(int color) {
94 int r = (color & 0xFF0000) >> 16;
95 int g = (color & 0x00FF00) >> 8;
96 int b = (color & 0x0000FF);
97
98 return ProvinceColor(r, g, b);
99 }
100};
101
102// Capital city
103struct CapitalCity {};
104
106 std::vector<entt::entity> docked_ships;
107};
108
112};
113} // namespace cqsp::core::components
Definition: area.h:27
Definition: surface.h:103
Definition: surface.h:33
entt::entity province
Definition: surface.h:34
Definition: surface.h:58
entt::entity time_zone
Definition: surface.h:59
Definition: surface.h:105
std::vector< entt::entity > docked_ships
Definition: surface.h:106
static int toInt(int r, int g, int b)
Definition: surface.h:86
ProvinceColor(int r, int g, int b)
Definition: surface.h:80
bool operator==(const ProvinceColor &other) const
Definition: surface.h:82
int r
Definition: surface.h:76
int g
Definition: surface.h:77
static ProvinceColor fromInt(int color)
Definition: surface.h:93
int b
Definition: surface.h:78
Definition: surface.h:67
std::vector< entt::entity > neighbors
Definition: surface.h:71
entt::entity country
Definition: surface.h:68
std::vector< std::pair< entt::entity, ZoningAllocation > > zoning
Definition: surface.h:72
std::vector< entt::entity > cities
Definition: surface.h:70
entt::entity planet
Definition: surface.h:69
std::string province_definitions
Definition: surface.h:40
std::string province_map
Definition: surface.h:39
std::string adjacencies
Definition: surface.h:41
int resources
Definition: surface.h:111
int science
Definition: surface.h:110
A settlement is a place where a population can live in, such as a city or a space station
Definition: surface.h:47
std::vector< std::pair< entt::entity, double > > job_demands
Definition: surface.h:49
std::vector< entt::entity > population
Definition: surface.h:48
The list of cities and settlements that are on a city
Definition: surface.h:28
std::vector< entt::entity > settlements
Definition: surface.h:29
std::vector< entt::entity > provinces
Definition: surface.h:30
Definition: surface.h:54
double time_diff
Definition: surface.h:55
uint32_t allocated
Definition: surface.h:63
uint32_t filled
Definition: surface.h:64