From e0f9f411056c235947b809cb21c477aa5acca1b4 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 3 Apr 2024 01:31:01 +0200 Subject: Fixed mission points reward calculation --- StarsEx/Player.cpp | 71 ++++++++++++++---------------------------------------- 1 file changed, 18 insertions(+), 53 deletions(-) (limited to 'StarsEx/Player.cpp') diff --git a/StarsEx/Player.cpp b/StarsEx/Player.cpp index 091c808..f299079 100644 --- a/StarsEx/Player.cpp +++ b/StarsEx/Player.cpp @@ -13,25 +13,25 @@ #include "Player.h" +#include #include -#include "NetLobbyServer.h" -#include "NetLayer.h" -#include "Ship.h" -#include "SimEvent.h" +#include "Bitmap.h" #include "Campaign.h" #include "CampaignSaveGame.h" -#include "Random.h" -#include "HUDView.h" -#include "Mfd.h" - +#include "Clock.h" +#include "ContentBundle.h" #include "DataLoader.h" #include "Encrypt.h" -#include "ParseUtil.h" #include "FormatUtil.h" -#include "Bitmap.h" -#include "Clock.h" -#include "ContentBundle.h" +#include "HUDView.h" +#include "Mfd.h" +#include "NetLayer.h" +#include "NetLobbyServer.h" +#include "ParseUtil.h" +#include "Random.h" +#include "Ship.h" +#include "SimEvent.h" // +-------------------------------------------------------------------+ @@ -634,54 +634,19 @@ Player::CommandRankRequired(int ship_class) // +-------------------------------------------------------------------+ -int -Player::GetMissionPoints(ShipStats* s, std::int_fast32_t flight_time_) -{ - int result = 0; - - if (s) { - result = s->GetPoints(); - - // 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; - minutes /= 10; - minutes *= 10; - result += minutes; - - if (s->HasEvent(SimEvent::DOCK)) - result += 100; - } - else { - result -= (int) (2.5 * Ship::Value(s->GetShipClass())); - } - - if (result < 0) - result = 0; - } - - return result; -} - -// +-------------------------------------------------------------------+ - void -Player::ProcessStats(ShipStats* s, std::int_fast32_t flight_time_) +Player::ProcessStats(ShipStats* s) { - if (!s) return; - + if (!s) + return; int old_rank = Rank(); - int pts = GetMissionPoints(s, flight_time_); - - AddPoints(pts); - AddPoints(s->GetCommandPoints()); + AddMissions(1); + AddPoints(s->EffectivePoints()); AddKills(s->GetGunKills()); AddKills(s->GetMissileKills()); AddLosses(s->GetDeaths()); AddLosses(s->GetColls()); - AddMissions(1); - AddFlightTime(flight_time_); + AddFlightTime(s->FlightTime()); int rank = Rank(); -- cgit v1.1