diff options
author | Aki <please@ignore.pl> | 2024-04-01 05:16:14 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-04-01 05:21:16 +0200 |
commit | 3be3bfaa17773550a696ed2b756136debfe79ae2 (patch) | |
tree | db55a420e43ddaa4a72140d2795892757c1672d3 /StarsEx/Stardate.h | |
parent | 0a3451f251f360267e2927d8320787d59148eadd (diff) | |
download | starshatter-3be3bfaa17773550a696ed2b756136debfe79ae2.zip starshatter-3be3bfaa17773550a696ed2b756136debfe79ae2.tar.gz starshatter-3be3bfaa17773550a696ed2b756136debfe79ae2.tar.bz2 |
Fixed date and time consistency across Campaigns and Missions
This fixes campaign mission generation mostly, but a full playthrough
will be needed. Missions now serialize and accept stardate setting a
bit better. Thanks to this, date is propagated over multiplayer, too.
This seems to break points system?
Code-wise, this does not workaround the problems from before namely
over-reliance on side-effects. Stardate class is at least one small
step into good direction. Now, it'd be nice to attach clocks to
simulation and campaign and whatever else that needs them.
Diffstat (limited to 'StarsEx/Stardate.h')
-rw-r--r-- | StarsEx/Stardate.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/StarsEx/Stardate.h b/StarsEx/Stardate.h new file mode 100644 index 0000000..cc696c8 --- /dev/null +++ b/StarsEx/Stardate.h @@ -0,0 +1,43 @@ +/* Starshatter: The Open Source Project + Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors + Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors + Copyright (c) 1997-2006, Destroyer Studios LLC. +*/ + +#pragma once + +#include <Text.h> + + +namespace starshatter +{ +namespace engine +{ + + +struct Stardate +{ + long double value = {}; + + Stardate(); + Stardate(long double value_); + + operator long double() const; + + Text Format(bool short_format=false) const; +}; + + +Stardate CurrentTime(); +Stardate OperationTime(); +Stardate MissionTime(); + +long double Epoch(); +long double OperationStart(); +long double MissionStart(); +void SetOperationStart(long double value={}, bool relative=false); +void SetMissionStart(long double value={}, bool relative=false); + + +} // namespace engine +} // namespace starshatter |