From b765821552acd7918ad16e92e70b4a8b44974b0f Mon Sep 17 00:00:00 2001 From: FinnHornhoover Date: Tue, 19 Dec 2023 20:35:29 +0300 Subject: [PATCH] added option to disable score capping --- config.ini | 3 +++ src/Racing.cpp | 5 +++-- src/settings.cpp | 4 ++++ src/settings.hpp | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config.ini b/config.ini index fb7977d..f6ac838 100644 --- a/config.ini +++ b/config.ini @@ -66,6 +66,9 @@ motd=Welcome to OpenFusion! # location of the database #dbpath=database.db +# should there be a score cap for infected zone races? +#izracescorecapped=true + # should tutorial flags be disabled off the bat? disablefirstuseflag=true diff --git a/src/Racing.cpp b/src/Racing.cpp index 2b49f4b..2d6c4c0 100644 --- a/src/Racing.cpp +++ b/src/Racing.cpp @@ -106,10 +106,11 @@ static void racingEnd(CNSocket* sock, CNPacketData* data) { int timeDiff = now - epRace.startTime; int podsCollected = epRace.collectedRings.size(); - int score = std::min(epInfo.maxScore, (int)std::exp( + int score = std::exp( (epInfo.podFactor * podsCollected) / epInfo.maxPods - (epInfo.timeFactor * timeDiff) / epInfo.maxTime - + epInfo.scaleFactor)); + + epInfo.scaleFactor); + score = (settings::IZRACESCORECAPPED && score > epInfo.maxScore) ? epInfo.maxScore : score; int fm = (1.0 + std::exp(epInfo.scaleFactor - 1.0) * epInfo.podFactor * podsCollected) / epInfo.maxPods; // we submit the ranking first... diff --git a/src/settings.cpp b/src/settings.cpp index 45d2cfc..5949f52 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -67,6 +67,9 @@ int settings::MONITORINTERVAL = 5000; // event mode settings int settings::EVENTMODE = 0; +// race settings +bool settings::IZRACESCORECAPPED = true; + void settings::init() { INIReader reader("config.ini"); @@ -111,6 +114,7 @@ void settings::init() { EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE); DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG); ANTICHEAT = reader.GetBoolean("shard", "anticheat", ANTICHEAT); + IZRACESCORECAPPED = reader.GetBoolean("shard", "izracescorecapped", IZRACESCORECAPPED); MONITORENABLED = reader.GetBoolean("monitor", "enabled", MONITORENABLED); MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT); MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL); diff --git a/src/settings.hpp b/src/settings.hpp index 097a1cd..85fad68 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -38,6 +38,7 @@ namespace settings { extern int MONITORPORT; extern int MONITORINTERVAL; extern bool DISABLEFIRSTUSEFLAG; + extern bool IZRACESCORECAPPED; void init(); }