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.
simulation.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 <memory>
20#include <vector>
21
22#include "common/game.h"
24
36 public:
37 explicit Simulation(cqsp::common::Game &game);
38
42 void tick();
43 void Init();
44
45 template <class T>
46 void AddSystem() {
47 static_assert(std::is_base_of<cqsp::common::systems::ISimulationSystem, T>::value);
48 system_list.push_back(std::make_unique<T>(m_game));
49 }
50
51 private:
56 std::vector<std::unique_ptr<cqsp::common::systems::ISimulationSystem>> system_list;
58};
59} // namespace cqsp::common::systems::simulation
Wrapper class for all the components of the game, so that all the game stuff can be initialized in on...
Definition: game.h:27
Definition: universe.h:33
Main simulation of game. /summary> To add a simulation in the game, add a class extending from cqsp::...
Definition: simulation.h:35
void Init()
Definition: simulation.cpp:73
cqsp::common::Universe & m_universe
Definition: simulation.h:57
Simulation(cqsp::common::Game &game)
Definition: simulation.cpp:52
void tick()
1 game tick, runs every single system that is added.
Definition: simulation.cpp:82
cqsp::common::Game & m_game
Definition: simulation.h:52
void AddSystem()
Definition: simulation.h:46
std::vector< std::unique_ptr< cqsp::common::systems::ISimulationSystem > > system_list
Holds all the systems.
Definition: simulation.h:56
Definition: simulation.h:25