Bug lastTrainsetConfiguration incorrectly reset during initialization

In unrestricted aftercore (after a grey you run), I configured my trainset at 623, ran 34 combats so that
Code:
trainsetPosition
was at 657, then my script aborted, I killed Java and then restarted mafia. Upon initialization of the session, mafia unhelpfully set
Code:
lastTrainsetConfiguration
from 623 to 617, making my script think that it could reconfigure, but reconfiguration was not available.

Did mafia look at the workshed while refreshing and incorrectly decide that its own tracking was off, and that the trainset was in fact ready to reconfigure or something?
 

fronobulax

Developer
Staff member
I may be too literal but "killed Java" concerns me. Is it possible that you corrupted a preference file and it was reloaded from a backup or killing Java somehow prevented the disk file from being updated?
 
I don't think so. I have a script that kills Java many hours after my script runs. But it's possible that this is a part of the problem.

But I feel like I regularly see this kind of behaviour, where KoLmafia changes the lastTrainsetPosition preference to 40 less than trainsetPosition when it is not yet available. My script checks if reconfiguration is available every adventure, but it only seems to get out of sync when a refresh is done.
 

Crowther

Active member
I automatically kill KoLmafia with a script before rollover. I use "kill -HUP" instead of just "kill" and that lets mafia save its preference file before quitting.
 

Irrat

Member
As the author of the trainset code, I feel like this is intentional.

Unfortunately I am on my phone and apparently I wasn't speaking plain English in the description.

Perhaps if you can prove that a test is wrong? It might just be that there's some weird behavior with trainset that wasn't known at the time. Or kol changed something.

To be clear, I am not saying that this isn't a bug. I think I might have noticed this myself. I just can't remember if it was known at the time and why it would be doing this. That a junit test would be ideal.
 

Irrat

Member
Alright, looked into this briefly and I think its because a free fight can move the trainset, but its free which we didn't take into account.

In my head, it goes
1. You reconfigure, mafia tracks that
2. You do a free fight, trainset moves. Mafia tracks that.
3. You visit the workshed, trainset can be configured.. Mafia tracks th- Mafia blinks. It shouldn't be configurable. It doesn't know how to track that.

I think I have the following questions
1. Is the configuration locked when we move the trainset position, or when we spend a turn
2. If we move the position without locking the configuration, does it contribute to the cooldown or do we need to spend a turn first
3. This should be true, but does free fights change any of the expected behavior after configuration is locked in
 
Top