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