Fix "The Longest Journey" achievement progress not increasing at large values.

The counter is now an int that increases per kilometer traveled, rather than
accruing even the tiniest increase in map units, as after a while, these
increments would become insignificant even for a double precision number.
This commit is contained in:
Mari the Deer 2025-03-18 22:44:26 +01:00
commit 5133d077f7
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1206 \cu(mar 18 mar 2025 22:44:17 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1206 \cu(2025-03-18 22:44:17)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1207 \cu(mar 18 mar 2025 22:44:26 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1207 \cu(2025-03-18 22:44:26)\c-";

View file

@ -308,8 +308,13 @@ extend Class Demolitionist
SWWMHandler.CancelOneliner("falling");
airscreamtime = 0;
cairtime = 0;
// only increase counter for achievement by kilometers alone, as an integer
// (previously this used a double, but it broke with large values)
let oldgroundkm = int(mystats.grounddist/32000.);
mystats.grounddist += traveldist;
SWWMUtility.AchievementProgressIncDouble("travel",traveldist/32000.,player);
let newgroundkm = int(mystats.grounddist/32000.);
if ( newgroundkm > oldgroundkm )
SWWMUtility.AchievementProgressInc("travel",newgroundkm-oldgroundkm,player);
}
// spawn bubbles while underwater
if ( (waterlevel > 1) && !Random[ExploS](0,5) )