@@ -38,7 +38,9 @@ bool CClientVariables::Load ( void )
38
38
39
39
// Load the cvars
40
40
m_pStorage = pRoot->FindSubNode ( CONFIG_NODE_CVARS );
41
- if ( !m_pStorage ) {
41
+
42
+ if ( !m_pStorage )
43
+ {
42
44
// Non-existant, create a new node
43
45
m_pStorage = pRoot->CreateSubNode ( CONFIG_NODE_CVARS );
44
46
}
@@ -59,9 +61,12 @@ bool CClientVariables::Get ( const std::string& strVariable, CVector &val )
59
61
strVal = Node ( strVariable )->GetTagContent ();
60
62
ss.str ( strVal );
61
63
62
- try {
64
+ try
65
+ {
63
66
ss >> val.fX >> val.fY >> val.fZ ;
64
- } catch (...) {
67
+ }
68
+ catch (...)
69
+ {
65
70
return false ;
66
71
}
67
72
@@ -78,9 +83,12 @@ bool CClientVariables::Get ( const std::string& strVariable, CVector2D &val )
78
83
strVal = Node ( strVariable )->GetTagContent ();
79
84
ss.str ( strVal );
80
85
81
- try {
86
+ try
87
+ {
82
88
ss >> val.fX >> val.fY ;
83
- } catch (...) {
89
+ }
90
+ catch (...)
91
+ {
84
92
return false ;
85
93
}
86
94
@@ -98,13 +106,16 @@ bool CClientVariables::Get ( const std::string& strVariable, CColor &val )
98
106
strVal = Node ( strVariable )->GetTagContent ();
99
107
ss.str ( strVal );
100
108
101
- try {
109
+ try
110
+ {
102
111
ss >> iR >> iG >> iB >> iA;
103
112
val.R = iR;
104
113
val.G = iG;
105
114
val.B = iB;
106
115
val.A = iA;
107
- } catch (...) {
116
+ }
117
+ catch (...)
118
+ {
108
119
return false ;
109
120
}
110
121
@@ -161,7 +172,9 @@ CXMLNode* CClientVariables::Node ( const std::string& strVariable )
161
172
162
173
// Try and grab the sub node
163
174
pNode = m_pStorage->FindSubNode ( strVariable.c_str () );
164
- if ( !pNode ) {
175
+
176
+ if ( !pNode )
177
+ {
165
178
// Non-existant, create a new sub node
166
179
pNode = m_pStorage->CreateSubNode ( strVariable.c_str () );
167
180
}
@@ -227,29 +240,29 @@ void CClientVariables::ValidateValues ( void )
227
240
uint uiViewportWidth = CCore::GetSingleton ().GetGraphics ()->GetViewportWidth ();
228
241
uint uiViewportHeight = CCore::GetSingleton ().GetGraphics ()->GetViewportHeight ();
229
242
230
- ClampValue ( " console_pos" , CVector2D ( 0 , 0 ), CVector2D ( uiViewportWidth - 32 , uiViewportHeight - 32 ) );
231
- ClampValue ( " console_size" , CVector2D ( 50 , 50 ), CVector2D ( uiViewportWidth - 32 , uiViewportHeight - 32 ) );
232
- ClampValue ( " fps_limit" , 0 , 100 );
233
- ClampValue ( " chat_font" , 0 , 3 );
234
- ClampValue ( " chat_lines" , 3 , 62 );
235
- ClampValue ( " chat_color" , CColor (0 ,0 ,0 ,0 ), CColor (255 ,255 ,255 ,255 ) );
236
- ClampValue ( " chat_text_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
237
- ClampValue ( " chat_input_color" , CColor (0 ,0 ,0 ,0 ), CColor (255 ,255 ,255 ,255 ) );
238
- ClampValue ( " chat_input_prefix_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
239
- ClampValue ( " chat_input_text_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
240
- ClampValue ( " chat_scale" , CVector2D ( 0 .5f , 0 .5f ), CVector2D ( 3 , 3 ) );
241
- ClampValue ( " chat_width" , 0 .5f , 4 .f );
242
- ClampValue ( " chat_line_life" , 1000 , 120000000 );
243
- ClampValue ( " chat_line_fade_out" , 1000 , 30000000 );
244
- ClampValue ( " chat_position_offset_x" , -1 .0f , 1 .0f );
245
- ClampValue ( " chat_position_offset_y" , -1 .0f , 1 .0f );
246
- ClampValue ( " chat_position_horizontal" ,Chat::Position::Horizontal::LEFT, Chat::Position::Horizontal::RIGHT );
247
- ClampValue ( " chat_position_vertical" , Chat::Position::Vertical::TOP, Chat::Position::Vertical::BOTTOM );
248
- ClampValue ( " chat_text_alignment" , Chat::Text::Align::LEFT, Chat::Text::Align::RIGHT );
249
- ClampValue ( " text_scale" , 0 .8f , 3 .0f );
250
- ClampValue ( " mtavolume" , 0 .0f , 1 .0f );
251
- ClampValue ( " voicevolume" , 0 .0f , 1 .0f );
252
- ClampValue ( " mapalpha" , 0 , 255 );
243
+ ClampValue ( " console_pos" , CVector2D ( 0 , 0 ), CVector2D ( uiViewportWidth - 32 , uiViewportHeight - 32 ) );
244
+ ClampValue ( " console_size" , CVector2D ( 50 , 50 ), CVector2D ( uiViewportWidth - 32 , uiViewportHeight - 32 ) );
245
+ ClampValue ( " fps_limit" , 0 , 100 );
246
+ ClampValue ( " chat_font" , 0 , 3 );
247
+ ClampValue ( " chat_lines" , 3 , 62 );
248
+ ClampValue ( " chat_color" , CColor (0 ,0 ,0 ,0 ), CColor (255 ,255 ,255 ,255 ) );
249
+ ClampValue ( " chat_text_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
250
+ ClampValue ( " chat_input_color" , CColor (0 ,0 ,0 ,0 ), CColor (255 ,255 ,255 ,255 ) );
251
+ ClampValue ( " chat_input_prefix_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
252
+ ClampValue ( " chat_input_text_color" , CColor (0 ,0 ,0 ,128 ), CColor (255 ,255 ,255 ,255 ) );
253
+ ClampValue ( " chat_scale" , CVector2D ( 0 .5f , 0 .5f ), CVector2D ( 3 , 3 ) );
254
+ ClampValue ( " chat_width" , 0 .5f , 4 .f );
255
+ ClampValue ( " chat_line_life" , 1000 , 120000000 );
256
+ ClampValue ( " chat_line_fade_out" , 1000 , 30000000 );
257
+ ClampValue ( " chat_position_offset_x" , -1 .0f , 1 .0f );
258
+ ClampValue ( " chat_position_offset_y" , -1 .0f , 1 .0f );
259
+ ClampValue ( " chat_position_horizontal" , Chat::Position::Horizontal::LEFT, Chat::Position::Horizontal::RIGHT );
260
+ ClampValue ( " chat_position_vertical" , Chat::Position::Vertical::TOP, Chat::Position::Vertical::BOTTOM );
261
+ ClampValue ( " chat_text_alignment" , Chat::Text::Align::LEFT, Chat::Text::Align::RIGHT );
262
+ ClampValue ( " text_scale" , 0 .8f , 3 .0f );
263
+ ClampValue ( " mtavolume" , 0 .0f , 1 .0f );
264
+ ClampValue ( " voicevolume" , 0 .0f , 1 .0f );
265
+ ClampValue ( " mapalpha" , 0 , 255 );
253
266
}
254
267
255
268
@@ -259,9 +272,9 @@ void CClientVariables::LoadDefaults ( void )
259
272
Set (__x,__y)
260
273
#define _S (__x ) std::string(__x)
261
274
262
- if (!Exists (" nick" ))
275
+ if (!Exists (" nick" ))
263
276
{
264
- DEFAULT ( " nick" , _S (CNickGen::GetRandomNickname ()) ); // nickname
277
+ DEFAULT ( " nick" , _S (CNickGen::GetRandomNickname ()) ); // nickname
265
278
CCore::GetSingleton ().RequestNewNickOnStart (); // Request the user to set a new nickname
266
279
}
267
280
0 commit comments