News:

Want to praise Simutrans?
Your feedback is important for us ;D.

[solved]r2157 - Problem of "Minimum load" of schedule window

Started by z9999, December 07, 2008, 04:43:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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.

prissi

The problem was somewhere else, all minus numbers were converted to unsigned char ...

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

prissi


Dwachs

Parsley, sage, rosemary, and maggikraut.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

prissi

When we are working on that: clamp is useless here too ... Thanks!