aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-12-08 23:14:43 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-12-08 23:14:43 -0300
commit3485791000c76fe0e8788759d033a1ce26294488 (patch)
tree216a26d60c2179f63596205f3269e10d07543dd2
parent5aa288ad7e457a4303f799fad803ba1e5845c6ce (diff)
downloadgame-3485791000c76fe0e8788759d033a1ce26294488.tar.gz
game-3485791000c76fe0e8788759d033a1ce26294488.zip
fix a problem with sector refreshing delays at startup
I misread the original initial values for `RefreshX` and `RefreshY` from the binary which caused the behavior, and a confused comment from me. Thanks to Gustinos from OTLand for catching that. I actualy done a small back of the envelope calculation and it seems that, using a config similar to the one from the leaked files, it would have taken ~100 hours for it to start refreshing sectors, meaning this feature has NEVER actually been tested. I'd expect unexpected bugs to emerge from this change.
-rw-r--r--src/operate.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/operate.cc b/src/operate.cc
index 68bf61c..6419051 100644
--- a/src/operate.cc
+++ b/src/operate.cc
@@ -2953,17 +2953,9 @@ void RefreshMap(void){
void RefreshCylinders(void){
// TODO(fusion): `RefreshedCylinders` is the number of cylinders we attempt to
// refresh in this function, which is called every minute or so by `AdvanceGame`.
- // We should probably rename it to something more clear.
-
- // TODO(fusion): This might be on purpose but `RefreshX` and `RefreshY` will be
- // way below `SectorXMin` and `SectorYMin` the first N times this function is
- // called and depending on the value of `RefreshedCylinders`, could take a few
- // hours before we even start refreshing the map.
- // If the intent is to delay refreshing cylinders until some time after startup,
- // we should change how this function is called by `AdvanceGame` instead.
-
- static int RefreshX = -1;
- static int RefreshY = -1;
+ // We should probably rename it to something clearer.
+ static int RefreshX = INT_MAX;
+ static int RefreshY = INT_MAX;
for(int i = 0; i < RefreshedCylinders; i += 1){
if(RefreshX < SectorXMax){
RefreshX += 1;