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/Player.cpp | |
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/Player.cpp')
-rw-r--r-- | StarsEx/Player.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/StarsEx/Player.cpp b/StarsEx/Player.cpp index fffa9a6..091c808 100644 --- a/StarsEx/Player.cpp +++ b/StarsEx/Player.cpp @@ -635,19 +635,17 @@ Player::CommandRankRequired(int ship_class) // +-------------------------------------------------------------------+ int -Player::GetMissionPoints(ShipStats* s, std::uint32_t start_time) +Player::GetMissionPoints(ShipStats* s, std::int_fast32_t flight_time_) { int result = 0; if (s) { result = s->GetPoints(); - int flight_time = (Clock::GetInstance()->GameTime() - start_time) / 1000; - // if player survived mission, award one experience point // for each minute of action, in ten point blocks: if (!s->GetDeaths() && !s->GetColls()) { - int minutes = flight_time / 60; + int minutes = flight_time_ / 60; minutes /= 10; minutes *= 10; result += minutes; @@ -669,12 +667,12 @@ Player::GetMissionPoints(ShipStats* s, std::uint32_t start_time) // +-------------------------------------------------------------------+ void -Player::ProcessStats(ShipStats* s, std::uint32_t start_time) +Player::ProcessStats(ShipStats* s, std::int_fast32_t flight_time_) { if (!s) return; int old_rank = Rank(); - int pts = GetMissionPoints(s, start_time); + int pts = GetMissionPoints(s, flight_time_); AddPoints(pts); AddPoints(s->GetCommandPoints()); @@ -683,7 +681,7 @@ Player::ProcessStats(ShipStats* s, std::uint32_t start_time) AddLosses(s->GetDeaths()); AddLosses(s->GetColls()); AddMissions(1); - AddFlightTime((Clock::GetInstance()->GameTime() - start_time) / 1000); + AddFlightTime(flight_time_); int rank = Rank(); |