simutrans r2157 GDI
With "Minimum load" of schedule window, when I press arrow or scroll mouse wheel, valuse of minimum load toggles only 0 and 100.
I can't select other value without inputting the value from keyboard.
Maybe, gui_numberinput_t::PROGRESS isn't working well as intended.
The problem was somewhere else, all minus numbers were converted to unsigned char ...
while you are at it: this line should fix the positioning of the number-input element in fahrplan_gui:
numimp_load.setze_groesse( koord( 60, BUTTON_HEIGHT ) );
(to be inserted in the constructor line 263.
Also done before reading this ...
so we were simultaneously fixing the same bugs :)
another small patch for numberinput:
Index: gui_numberinput.cc
===================================================================
--- gui_numberinput.cc (revision 2159)
+++ gui_numberinput.cc (working copy)
@@ -151,8 +151,8 @@
{
sint64 diff = max_value-min_value;
for( int i=0; i<7; i++ ) {
- if( value<((diff*(sint64)percent[i])/100l) ) {
- return clamp( (sint32)((diff*percent[i])/100l), min_value, max_value );
+ if( value-min_value<((diff*(sint64)percent[i])/100l) ) {
+ return clamp(min_value + (sint32)((diff*percent[i])/100l), min_value, max_value );
}
}
return max_value;
@@ -192,8 +192,8 @@
{
sint64 diff = max_value-min_value;
for( int i=6; i>=0; i-- ) {
- if( value>((diff*percent[i])/100l) ) {
- return clamp( (sint32)((diff*percent[i])/100l), min_value, max_value );
+ if( value-min_value>((diff*percent[i])/100l) ) {
+ return clamp( min_value+(sint32)((diff*percent[i])/100l), min_value, max_value );
}
}
return min_value;
min_value was not recognized here, false behaviour would be visible for min_value !=0.
When we are working on that: clamp is useless here too ... Thanks!