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-2023 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 std::string province_texture;
40 std::string province_map;
41};
42
46struct Settlement {
47 std::vector<entt::entity> population;
48};
49
50struct TimeZone {
51 double time_diff;
52};
53
55 entt::entity time_zone;
56};
57
58struct Province {
59 entt::entity country;
60 std::vector<entt::entity> cities;
61};
62
64 int r;
65 int g;
66 int b;
67 ProvinceColor() = default;
68 ProvinceColor(int r, int g, int b) : r(r), g(g), b(b) {}
69
70 bool operator==(const ProvinceColor& other) const { return (other.r == r && other.g == g && other.b == b); }
71
72 operator int() const { return toInt(r, g, b); }
73
74 static int toInt(int r, int g, int b) {
75 int rgb = r;
76 rgb = (rgb << 8) + g;
77 rgb = (rgb << 8) + b;
78 return rgb;
79 }
80
81 static ProvinceColor fromInt(int color) {
82 int r = (color & 0xFF0000) >> 16;
83 int g = (color & 0x00FF00) >> 8;
84 int b = (color & 0x0000FF);
85
86 return ProvinceColor(r, g, b);
87 }
88};
89
90// Capital city
91struct CapitalCity {};
92} // namespace components
93} // namespace common
94} // namespace cqsp
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21
entt::entity time_zone
Definition: surface.h:55
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:68
static int toInt(int r, int g, int b)
Definition: surface.h:74
int r
Definition: surface.h:64
static ProvinceColor fromInt(int color)
Definition: surface.h:81
int g
Definition: surface.h:65
int b
Definition: surface.h:66
bool operator==(const ProvinceColor &other) const
Definition: surface.h:70
Definition: surface.h:58
std::vector< entt::entity > cities
Definition: surface.h:60
entt::entity country
Definition: surface.h:59
std::string province_map
Definition: surface.h:40
std::string province_texture
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:46
std::vector< entt::entity > population
Definition: surface.h:47
Definition: surface.h:27
int64_t seed
Definition: surface.h:28
Definition: surface.h:50
double time_diff
Definition: surface.h:51