Jump to content
Eternal Lands Official Forums
Sign in to follow this  
ttlanhil

spinners in ELConfig don't go to min/max

Recommended Posts

as in the title. if an option has a min setting of 0, you won't be able to set it to 0 (same with 0.0)

 

the fix for this bug is part of berlios patch #624 (iffn we're still not sure about the rest of the patch, fine, can just use the bugfix part for now)

Share this post


Link to post
Share on other sites

whoops, I was checking the wrong spinner. okay, int spinners work, float ones have the bug described above

 

I'm unable to reproduce this. Are you sure it's a bug? And which part of that patch fixes it?

 

go to elconfig -> audio and try to adjust the volume for either down to 0.0

when using clean-cvs, lowest it will go for me is 0.10

using my modified client, it will go down to 0.00

 

the patch has been up a while, so the line numbers are off, but other than that it should still be good. the relevant part:

@@ -1979,15 +1979,16 @@
				case SPIN_FLOAT:
					switch (action) {
						case 'i':
-							//if(*(float *)button->data + button->interval <= button->max+0.000001) { //+0.000001 to avoid issues with floating point values
-							if(*(float *)button->data + button->interval <= button->max) { // NOTE: Can't do that, values > max may cause crashes. Change the max value intead.
+							if(*(float *)button->data + button->interval >= button->max+0.000001) //+0.000001 to avoid issues with floating point values
+								*(float *)button->data = button->max-0.000001f;//because of this, we won't have a value>max
+							else
								*(float *)button->data += button->interval;
-							}
						break;
						case 'd':
-							if(*(float *)button->data - button->interval >= button->min) {
+							if(*(float *)button->data - button->interval < button->min-0.00000f)
+								*(float *)button->data = button->min+0.00000f;
+							else
								*(float *)button->data -= button->interval;
-							}
						break;
					}
					snprintf(button->input_buffer, 255, "%.2f", *(float *)button->data);

going to max on a float does work with clean-cvs... sicne the problem is with floating value inprecision, I guess the problem might only show up on some computers

short version: if the increase/decrease would put it over/under the max/min, then set it to just inside the max/min instead

 

 

 

Try setting the minimum to -0.0000001 instead.

for all float options? they already have a min of 0.0, which should be correct (okay, some float configs will have a different min, but y'know what I mean)

it's the widget that has the error, and the change above fixes it safely.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×