Results 1 to 9 of 9

Thread: [PATCH] Track dieting pill and apply fullness calculations to food

  1. #1
    Developer
    Join Date
    Jan 2007
    Posts
    95

    Default [PATCH] Track dieting pill and apply fullness calculations to food

    This tracks dieting pills and temporarily updates the fullness of consumables to double when appropriate. It's quite a complicated bit of code to touch, but I've tested everything I wrote and it seems to work well.
    Attached Files

  2. #2

    Default

    I think this will incorrectly double adventures from variable items like astral hot dogs (and s'mores, for an easier to test option)? That seems complicated to avoid.

    It also looks like it would decrement dietingPillsUsed to negative values if you multi-eat 4 of something but have only used 2 dieting pills (an easy fix).

  3. #3
    Developer
    Join Date
    Jan 2007
    Posts
    95

    Default

    I think this will incorrectly double adventures from variable items like astral hot dogs (and s'mores, for an easier to test option)? That seems complicated to avoid.
    Good point, this occurred to me as well today. I'll look into it.


    It also looks like it would decrement dietingPillsUsed to negative values if you multi-eat 4 of something but have only used 2 dieting pills (an easy fix).
    Ah I thought that decrement without specifying a minimum defaults to 0. I'll fix that!

  4. #4
    Developer
    Join Date
    Jan 2007
    Posts
    95

    Default

    Yeah as far as I can see, decrement with only the pref name will not go lower than 0

    Code:
    	public static final int decrement( final String name )
    	{
    		return Preferences.decrement( name, 1 );
    	}
    
    	public static final int decrement( final String name, final int delta )
    	{
    		return Preferences.decrement( name, delta, 0 );
    	}
    
    	public static final int decrement( final String name, final int delta, final int min )
    	{
    		int current = Preferences.getInteger( name );
    		if ( delta != 0 )
    		{
    			current -= delta;
    
    			if ( current < min )
    			{
    				current = min;
    			}
    
    			Preferences.setInteger( name, current );
    		}
    		return current;
    	}
    I wrote an "isVariable" function for handling the rest, although when trying to populate it I realised I don't know what happens if you eat a steel lasagne with dieting pill active.
    Attached Files

  5. #5
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,188

    Default

    Bumping a thread with a supplied patch.
    I have no idea what a dieting pill is, so can't really review it welll...

  6. #6
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,500

    Default

    I wrote an "isVariable" function for handling the rest, although when trying to populate it I realised I don't know what happens if you eat a steel lasagne with dieting pill active.
    Originally Posted by gausie View Post
    Patch failed for me. Probably need to regenerate it. Also is the concern about steel lasagna important enough to defer until it is understood?
    Well, thank you.
    Originally Posted by Veracity View Post

  7. #7
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,188

    Default

    Bumping yet again since I got burned by a dieting pill in a TCRS run.

  8. #8
    Developer
    Join Date
    Jan 2007
    Posts
    95

    Default

    Sadly I just haven't got the time to make this work right now

  9. #9
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,188

    Default

    Since I have new motivation to look at this, so I'll take a look at it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •