@@ -106,10 +106,10 @@ bool CClientVariables::Get(const std::string& strVariable, CColor& val)
106
106
try
107
107
{
108
108
ss >> iR >> iG >> iB >> iA;
109
- val.R = iR ;
110
- val.G = iG ;
111
- val.B = iB ;
112
- val.A = iA ;
109
+ val.R = static_cast < unsigned char >(iR) ;
110
+ val.G = static_cast < unsigned char >(iG) ;
111
+ val.B = static_cast < unsigned char >(iB) ;
112
+ val.A = static_cast < unsigned char >(iA) ;
113
113
}
114
114
catch (...)
115
115
{
@@ -234,7 +234,15 @@ void CClientVariables::ValidateValues()
234
234
235
235
ClampValue (" console_pos" , CVector2D (0 , 0 ), CVector2D (uiViewportWidth - 32 , uiViewportHeight - 32 ));
236
236
ClampValue (" console_size" , CVector2D (50 , 50 ), CVector2D (uiViewportWidth - 32 , uiViewportHeight - 32 ));
237
- ClampValue (" fps_limit" , 0 , std::numeric_limits<short >::max ());
237
+
238
+ // CVars need a better API for this (Issue #4427)
239
+ int temp;
240
+ CVARS_GET (" fps_limit" , temp);
241
+ std::uint16_t fps = static_cast <std::uint16_t >(temp);
242
+ FPSLimits::IsValidAndSetValid (fps, fps);
243
+ CVARS_SET (" fps_limit" , fps);
244
+
245
+
238
246
ClampValue (" chat_font" , 0 , 3 );
239
247
ClampValue (" chat_lines" , 3 , 62 );
240
248
ClampValue (" chat_color" , CColor (0 , 0 , 0 , 0 ), CColor (255 , 255 , 255 , 255 ));
@@ -261,9 +269,10 @@ void CClientVariables::ValidateValues()
261
269
262
270
void CClientVariables::LoadDefaults ()
263
271
{
264
- #define DEFAULT (__x,__y ) if (!Exists(__x)) \
265
- Set (__x,__y)
266
- #define _S (__x ) std::string(__x)
272
+ #define DEFAULT (__x, __y ) \
273
+ if (!Exists (__x)) \
274
+ Set (__x, __y)
275
+ #define _S (__x ) std::string(__x)
267
276
268
277
if (!Exists (" nick" ))
269
278
{
@@ -279,6 +288,7 @@ void CClientVariables::LoadDefaults()
279
288
DEFAULT (" console_size" , CVector2D (200 , 200 )); // console size
280
289
DEFAULT (" serverbrowser_size" , CVector2D (720 .0f , 495 .0f )); // serverbrowser size
281
290
DEFAULT (" fps_limit" , 100 ); // frame limiter
291
+ DEFAULT (" vsync" , true ); // vsync
282
292
DEFAULT (" chat_font" , 2 ); // chatbox font type
283
293
DEFAULT (" chat_lines" , 10 ); // chatbox lines
284
294
DEFAULT (" chat_color" , CColor (0 , 0 , 0 , 0 )); // chatbox background color
@@ -379,4 +389,8 @@ void CClientVariables::LoadDefaults()
379
389
#if 0
380
390
DEFAULT ( "streaming_memory", 50 ); // Streaming memory
381
391
#endif
392
+
393
+ #undef DEFAULT
394
+ #undef _S
395
+
382
396
}
0 commit comments