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.
maneuver.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 <deque>
20#include <utility>
21
23
25// Datatype returned by a command
26// impulse vector and time in seconds of the maneuver
27typedef std::pair<glm::dvec3, double> Maneuver_t;
28typedef std::pair<Maneuver_t, Maneuver_t> HohmannPair_t;
29
32struct Maneuver {
40 const glm::dvec3 delta_v;
41 const double time;
42 Maneuver() = delete;
43 explicit Maneuver(const std::pair<glm::dvec3, double>& maneuver) : delta_v(maneuver.first), time(maneuver.second) {}
44 /*
45 * @param maneuver maneuver pair
46 * @param offset seconds to offset how far in the future or in the past to put this maneuver
47 */
48 explicit Maneuver(const std::pair<glm::dvec3, double>& maneuver, double current_time)
49 : delta_v(maneuver.first), time(maneuver.second + current_time) {}
50};
51
53 std::deque<Maneuver> maneuvers;
54 std::deque<entt::entity> commands;
55 CommandQueue() = default;
56
57 auto begin() { return maneuvers.begin(); }
58 auto end() { return maneuvers.end(); }
59 bool empty() { return maneuvers.empty(); }
60 entt::entity& front() { return commands.front(); }
61};
62} // namespace cqsp::common::components
double second
Definition: units.h:42
Definition: area.h:23
std::pair< glm::dvec3, double > Maneuver_t
Definition: maneuver.h:27
std::pair< Maneuver_t, Maneuver_t > HohmannPair_t
Definition: maneuver.h:28
std::deque< entt::entity > commands
Definition: maneuver.h:54
auto begin()
Definition: maneuver.h:57
auto end()
Definition: maneuver.h:58
bool empty()
Definition: maneuver.h:59
entt::entity & front()
Definition: maneuver.h:60
std::deque< Maneuver > maneuvers
Definition: maneuver.h:53
Definition: maneuver.h:32
Maneuver(const std::pair< glm::dvec3, double > &maneuver, double current_time)
Definition: maneuver.h:48
Maneuver(const std::pair< glm::dvec3, double > &maneuver)
Definition: maneuver.h:43
const glm::dvec3 delta_v
Delta v applied with respect to the orbital vector positive y is prograde, negative y is retrograde I...
Definition: maneuver.h:40
const double time
Definition: maneuver.h:41