From 7552ac635c39baae28de9b7c75cdc23d3547168e Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 5 Apr 2022 23:23:09 +0200 Subject: Fixed campaign saving Formatting was bad and resulted in crashes or malformed save files. Avoiding c-style cast is just an addition. --- StarsEx/CampaignSaveGame.cpp | 4 ++-- StarsEx/StarSystem.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'StarsEx') diff --git a/StarsEx/CampaignSaveGame.cpp b/StarsEx/CampaignSaveGame.cpp index f4b16ce..b225612 100644 --- a/StarsEx/CampaignSaveGame.cpp +++ b/StarsEx/CampaignSaveGame.cpp @@ -582,8 +582,8 @@ CampaignSaveGame::Save(const char* name) fprintf(f, "unit: \"%s\"\n", player_unit->Name().data()); fprintf(f, "status: %d\n", (int) campaign->GetStatus()); - fprintf(f, "basetime: %f\n", campaign->GetStartTime()); - fprintf(f, "time: %f // %s\n\n", + fprintf(f, "basetime: %Lf\n", campaign->GetStartTime()); + fprintf(f, "time: %Lf // %s\n\n", campaign->GetTime(), timestr); diff --git a/StarsEx/StarSystem.cpp b/StarsEx/StarSystem.cpp index 9d8e377..b31f577 100644 --- a/StarsEx/StarSystem.cpp +++ b/StarsEx/StarSystem.cpp @@ -70,7 +70,7 @@ void StarSystem::CalcStardate() base_time += epoch; } - long double gtime = (long double) Clock::GetInstance()->GameTime() / 1000.0; + long double gtime = Clock::GetInstance()->GameTime() / 1000.0; long double sdate = gtime + base_time + epoch; stardate = sdate; -- cgit v1.1