summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Player.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-04-03 01:31:01 +0200
committerAki <please@ignore.pl>2024-04-03 01:31:01 +0200
commite0f9f411056c235947b809cb21c477aa5acca1b4 (patch)
tree1371e376659d66ec0c881032b6001630aa4f964b /StarsEx/Player.cpp
parent7f1e5f578ec184ebcbbdcd9f7725619ea426d5e4 (diff)
downloadstarshatter-e0f9f411056c235947b809cb21c477aa5acca1b4.zip
starshatter-e0f9f411056c235947b809cb21c477aa5acca1b4.tar.gz
starshatter-e0f9f411056c235947b809cb21c477aa5acca1b4.tar.bz2
Fixed mission points reward calculation
Diffstat (limited to 'StarsEx/Player.cpp')
-rw-r--r--StarsEx/Player.cpp71
1 files changed, 18 insertions, 53 deletions
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 <algorithm>
#include <cstdint>
-#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();