Bug - Fixed "drink" doesn't equip previous pants after equipping Travoltan trousers to buy ingredients

Ryo_Sangnoir

Developer
Staff member
Triggered by an ash command: drink(1, $item[elemental caipiroska]);

Mafia works out that the cheapest option is to buy fermenting powder and a bowl of rye sprouts. It equips the Travoltan trousers to make buying cheaper, but doesn't restore the previous pants.

Commands like "acquire" successfully restore the previous pants.
 

Veracity

Developer
Staff member
Code:
        String limitmode = KoLCharacter.getLimitmode();

       try ( Checkpoint checkpoint = new Checkpoint( KoLCharacter.getLimitmode() == limitmode ) )
        {
            UseItemCommand.use( command, parameters );
        }
Did somebody break outfit checkpoints? Actually, it looks that Checkpoint is always created with "true" - which means "don't restore".

I seem to recall a change where all uses of Checkpoints were changed to use try-with-resources. Looks like a bug was introduced.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Huh, I'll look at what I changed it from and fix it
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I actually can't work out what this used to do

I assume it always resolved to false - it seems to have always been this way. The only thing I can think of is that the limit mode can change mid-item use? In any case, I've fixed it by letting Checkpoint defer that check. Hooray for Java 8! r20718
 
Top