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.
universe.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 <map>
20#include <memory>
21#include <string>
22#include <vector>
23
24#include <entt/entt.hpp>
25
26#include "common/stardate.h"
29
30namespace cqsp {
31namespace common {
32class Universe : public entt::registry {
33 public:
34 explicit Universe(std::string uuid);
35 Universe();
36
38
39 std::map<std::string, entt::entity> goods;
40 std::vector<entt::entity> consumergoods;
41 std::map<std::string, entt::entity> recipes;
42 std::map<std::string, entt::entity> terrain_data;
43 std::map<std::string, systems::names::NameGenerator> name_generators;
44 std::map<std::string, entt::entity> fields;
45 std::map<std::string, entt::entity> technologies;
46 std::map<std::string, entt::entity> planets;
47 std::map<std::string, entt::entity> time_zones;
48 std::map<std::string, entt::entity> countries;
49 std::map<std::string, entt::entity> provinces;
50 std::map<std::string, entt::entity> cities;
51 std::map<int, entt::entity> province_colors;
52 std::map<entt::entity, int> colors_province;
53 entt::entity sun;
54
55 void EnableTick() { to_tick = true; }
56 void DisableTick() { to_tick = false; }
57 bool ToTick() { return to_tick; }
58 void ToggleTick() { to_tick = !to_tick; }
59
60 int GetDate() { return date.GetDate(); }
61 std::unique_ptr<cqsp::common::util::IRandom> random;
62 std::string uuid;
63
67 double tick_fraction = 0;
68
69 private:
70 bool to_tick = false;
71};
72} // namespace common
73} // namespace cqsp
Definition: universe.h:32
void DisableTick()
Definition: universe.h:56
std::unique_ptr< cqsp::common::util::IRandom > random
Definition: universe.h:61
std::map< std::string, entt::entity > recipes
Definition: universe.h:41
std::vector< entt::entity > consumergoods
Definition: universe.h:40
int GetDate()
Definition: universe.h:60
std::map< std::string, entt::entity > planets
Definition: universe.h:46
std::map< std::string, entt::entity > terrain_data
Definition: universe.h:42
std::map< int, entt::entity > province_colors
Definition: universe.h:51
std::map< std::string, entt::entity > goods
Definition: universe.h:39
std::map< std::string, entt::entity > cities
Definition: universe.h:50
std::map< std::string, entt::entity > countries
Definition: universe.h:48
components::StarDate date
Definition: universe.h:37
void ToggleTick()
Definition: universe.h:58
Universe()
Definition: universe.cpp:25
bool ToTick()
Definition: universe.h:57
std::map< std::string, entt::entity > fields
Definition: universe.h:44
double tick_fraction
What is the current fraction of the wait of the tick we are processing
Definition: universe.h:67
std::map< std::string, systems::names::NameGenerator > name_generators
Definition: universe.h:43
std::map< entt::entity, int > colors_province
Definition: universe.h:52
std::map< std::string, entt::entity > provinces
Definition: universe.h:49
std::map< std::string, entt::entity > time_zones
Definition: universe.h:47
std::map< std::string, entt::entity > technologies
Definition: universe.h:45
entt::entity sun
Definition: universe.h:53
void EnableTick()
Definition: universe.h:55
bool to_tick
Definition: universe.h:70
std::string uuid
Definition: universe.h:62
Holds and calculates the tick that is on going. Date is the number of hours that has been ongoing sin...
Definition: stardate.h:45
int GetDate()
Definition: stardate.h:56
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21