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.
stardate.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
45class StarDate {
46 public:
47 // How many seconds a tick is
48 static const int TIME_INCREMENT = 60;
49
50 static const int HOUR = 1;
51 static const int DAY = 24 * HOUR;
52 static const int WEEK = DAY * 7;
53
54 void IncrementDate() { date++; }
55
56 int GetDate() { return date; }
57
58 double ToSecond() { return date * TIME_INCREMENT; }
59 double ToDay() { return date / (float)1440.; }
60
61 std::string ToString();
62 std::string ToString(double offset);
63
64 int GetYear();
65 int GetMonth();
66 int GetDay();
67 int GetHour();
68 int GetMinute();
69
70 void SetDate(unsigned int _date) { date = _date; }
71
72 private:
73 // The date is in minutes
74 unsigned int date = -1;
75
76 static const int start_date = 2000;
77};
78} // namespace cqsp::common::components
Holds and calculates the tick that is on going. Date is the number of hours that has been ongoing sin...
Definition: stardate.h:45
double ToSecond()
Definition: stardate.h:58
unsigned int date
Definition: stardate.h:74
std::string ToString()
Definition: stardate.cpp:33
static const int HOUR
Definition: stardate.h:50
int GetMonth()
Definition: stardate.cpp:58
int GetYear()
Definition: stardate.cpp:53
int GetHour()
Definition: stardate.cpp:68
int GetMinute()
Definition: stardate.cpp:69
void SetDate(unsigned int _date)
Definition: stardate.h:70
int GetDate()
Definition: stardate.h:56
void IncrementDate()
Definition: stardate.h:54
int GetDay()
Definition: stardate.cpp:63
double ToDay()
Definition: stardate.h:59
static const int start_date
Definition: stardate.h:76
static const int TIME_INCREMENT
Definition: stardate.h:48
static const int DAY
Definition: stardate.h:51
static const int WEEK
Definition: stardate.h:52
Definition: area.h:25
glm::vec3 offset
Definition: starsystemview.cpp:72