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
34 // Identifier of the texture for opengl to decide what to render
35 std::string province_texture;
36 // Identifier for the mouse to identify which province the person has clicked on
37 std::string province_map;
39 std::string adjacencies;
40};
41
45struct Settlement {
46 std::vector<entt::entity> population;
47 // Infrastructure and other things
48 // we might need air supply and other things like that
49};
50
51struct TimeZone {
52 double time_diff = 0;
53};
54
56 entt::entity time_zone = entt::null;
57};
58
59struct Province {
60 entt::entity country = entt::null;
61 std::vector<entt::entity> cities;
62 std::vector<entt::entity> neighbors;
63};
64
66 int r;
67 int g;
68 int b;
69 ProvinceColor() = default;
70 ProvinceColor(int r, int g, int b) : r(r), g(g), b(b) {}
71
72 bool operator==(const ProvinceColor& other) const { return (other.r == r && other.g == g && other.b == b); }
73
74 operator int() const { return toInt(r, g, b); }
75
76 static int toInt(int r, int g, int b) {
77 int rgb = r;
78 rgb = (rgb << 8) + g;
79 rgb = (rgb << 8) + b;
80 return rgb;
81 }
82
83 static ProvinceColor fromInt(int color) {
84 int r = (color & 0xFF0000) >> 16;
85 int g = (color & 0x00FF00) >> 8;
86 int b = (color & 0x0000FF);
87
88 return ProvinceColor(r, g, b);
89 }
90};
91
92// Capital city
93struct CapitalCity {};
94
96 std::vector<entt::entity> docked_ships;
97};
98} // namespace cqsp::core::components
Definition: area.h:23
Definition: surface.h:93
Definition: surface.h:55
entt::entity time_zone
Definition: surface.h:56
Definition: surface.h:95
std::vector< entt::entity > docked_ships
Definition: surface.h:96
static int toInt(int r, int g, int b)
Definition: surface.h:76
ProvinceColor(int r, int g, int b)
Definition: surface.h:70
bool operator==(const ProvinceColor &other) const
Definition: surface.h:72
int r
Definition: surface.h:66
int g
Definition: surface.h:67
static ProvinceColor fromInt(int color)
Definition: surface.h:83
int b
Definition: surface.h:68
Definition: surface.h:59
std::vector< entt::entity > neighbors
Definition: surface.h:62
entt::entity country
Definition: surface.h:60
std::vector< entt::entity > cities
Definition: surface.h:61
std::string province_definitions
Definition: surface.h:38
std::string province_map
Definition: surface.h:37
std::string province_texture
Definition: surface.h:35
std::string adjacencies
Definition: surface.h:39
A settlement is a place where a population can live in, such as a city or a space station
Definition: surface.h:45
std::vector< entt::entity > population
Definition: surface.h:46
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:51
double time_diff
Definition: surface.h:52