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
25struct Surface {
26 int64_t seed;
27};
28
32struct Habitation {
33 std::vector<entt::entity> settlements;
34};
35
37 // Identifier of the texture for opengl to decide what to render
38 std::string province_texture;
39 // Identifier for the mouse to identify which province the person has clicked on
40 std::string province_map;
42 std::string adjacencies;
43};
44
48struct Settlement {
49 std::vector<entt::entity> population;
50};
51
52struct TimeZone {
53 double time_diff;
54};
55
57 entt::entity time_zone;
58};
59
60struct Province {
61 entt::entity country;
62 std::vector<entt::entity> cities;
63 std::vector<entt::entity> neighbors;
64};
65
67 int r;
68 int g;
69 int b;
70 ProvinceColor() = default;
71 ProvinceColor(int r, int g, int b) : r(r), g(g), b(b) {}
72
73 bool operator==(const ProvinceColor& other) const { return (other.r == r && other.g == g && other.b == b); }
74
75 operator int() const { return toInt(r, g, b); }
76
77 static int toInt(int r, int g, int b) {
78 int rgb = r;
79 rgb = (rgb << 8) + g;
80 rgb = (rgb << 8) + b;
81 return rgb;
82 }
83
84 static ProvinceColor fromInt(int color) {
85 int r = (color & 0xFF0000) >> 16;
86 int g = (color & 0x00FF00) >> 8;
87 int b = (color & 0x0000FF);
88
89 return ProvinceColor(r, g, b);
90 }
91};
92
93// Capital city
94struct CapitalCity {};
95
97 std::vector<entt::entity> docked_ships;
98};
99} // namespace cqsp::common::components
Definition: area.h:23
entt::entity time_zone
Definition: surface.h:57
std::vector< entt::entity > docked_ships
Definition: surface.h:97
If people are living on a planet or not
Definition: surface.h:32
std::vector< entt::entity > settlements
Definition: surface.h:33
ProvinceColor(int r, int g, int b)
Definition: surface.h:71
static int toInt(int r, int g, int b)
Definition: surface.h:77
int r
Definition: surface.h:67
static ProvinceColor fromInt(int color)
Definition: surface.h:84
int g
Definition: surface.h:68
int b
Definition: surface.h:69
bool operator==(const ProvinceColor &other) const
Definition: surface.h:73
Definition: surface.h:60
std::vector< entt::entity > cities
Definition: surface.h:62
std::vector< entt::entity > neighbors
Definition: surface.h:63
entt::entity country
Definition: surface.h:61
std::string province_map
Definition: surface.h:40
std::string province_texture
Definition: surface.h:38
std::string province_definitions
Definition: surface.h:41
std::string adjacencies
Definition: surface.h:42
A settlement is a place where a population can live in, such as a city or a space station
Definition: surface.h:48
std::vector< entt::entity > population
Definition: surface.h:49
Definition: surface.h:25
int64_t seed
Definition: surface.h:26
Definition: surface.h:52
double time_diff
Definition: surface.h:53