src/settings_gui.cpp
changeset 5601 d58f82901b2f
parent 5587 167d9a91ef02
child 5609 dc6a58930ba4
equal deleted inserted replaced
5600:19cb92f7ccf2 5601:d58f82901b2f
   435 		switch (e->we.click.widget) {
   435 		switch (e->we.click.widget) {
   436 		case 8: { /* Difficulty settings widget, decode click */
   436 		case 8: { /* Difficulty settings widget, decode click */
   437 			const GameSettingData *info;
   437 			const GameSettingData *info;
   438 			int x, y;
   438 			int x, y;
   439 			uint btn, dis;
   439 			uint btn, dis;
   440 			int val;
   440 			int16 val;
   441 
   441 
   442 			// Don't allow clients to make any changes
   442 			// Don't allow clients to make any changes
   443 			if  (_networking && !_network_server)
   443 			if  (_networking && !_network_server)
   444 				return;
   444 				return;
   445 
   445 
   471 				// Increase button clicked
   471 				// Increase button clicked
   472 				val = min(val + info->step, info->max);
   472 				val = min(val + info->step, info->max);
   473 				SETBIT(_difficulty_click_b, btn);
   473 				SETBIT(_difficulty_click_b, btn);
   474 			} else {
   474 			} else {
   475 				// Decrease button clicked
   475 				// Decrease button clicked
   476 				val = max(val - info->step, info->min);
   476 				val -= info->step;
       
   477 				val = max(val,  info->min);
   477 				SETBIT(_difficulty_click_a, btn);
   478 				SETBIT(_difficulty_click_a, btn);
   478 			}
   479 			}
   479 
   480 
   480 			// save value in temporary variable
   481 			// save value in temporary variable
   481 			((int*)&_opt_mod_temp.diff)[btn] = val;
   482 			((int*)&_opt_mod_temp.diff)[btn] = val;