@@ -145,30 +145,42 @@ bool CCommands::Execute ( const char* szCommand, const char* szParametersIn, boo
145
145
}
146
146
}
147
147
148
+ // Recompose the original command text
149
+ std::string val = std::string (szCommand) + " " + std::string (szParameters ? szParameters : " " );
150
+
148
151
// Is it a cvar? (syntax: cvar[ = value])
149
- std::string val = std::string ( szCommand ) + " " + std::string ( szParameters ? szParameters : " " );
150
- unsigned int nOpIndex = val.find ( ' =' );
151
- std::string key = val.substr ( 0 , nOpIndex );
152
- if (val.find (" = " ) != std::string::npos) {
153
- key = val.substr ( 0 , nOpIndex-1 );
154
- }
155
- if ( CClientVariables::GetSingleton ().Exists ( key ) && !bIsScriptedBind ) {
156
- std::stringstream ss;
157
-
158
- // Determine whether this is an atomic get or set query
159
- if ( nOpIndex != std::string::npos ) {
160
- // (set) some_cvar=value
161
- val = val.substr ( nOpIndex + 1 );
162
- TrimWhiteSpace ( val );
163
- CVARS_SET ( key, val );
164
- } else {
165
- // (get) some_cvar
166
- CVARS_GET ( key, val );
152
+ {
153
+ // Check to see if '=' exists
154
+ unsigned int nOpIndex = val.find (' =' );
155
+ std::string key = val.substr (0 , nOpIndex);
156
+
157
+ // Check to see if ' =' exists
158
+ if (val.find (" =" ) != std::string::npos) {
159
+ key = val.substr (0 , nOpIndex - 1 );
160
+ }
161
+
162
+ TrimWhiteSpace (key);
163
+
164
+ // Handle the cvar if it exists
165
+ if (CClientVariables::GetSingleton ().Exists (key) && !bIsScriptedBind) {
166
+ std::stringstream ss;
167
+
168
+ // Determine whether this is an atomic get or set query
169
+ if (nOpIndex != std::string::npos) {
170
+ // (set) some_cvar=value
171
+ val = val.substr (nOpIndex + 1 );
172
+ TrimWhiteSpace (val);
173
+ CVARS_SET (key, val);
174
+ }
175
+ else {
176
+ // (get) some_cvar
177
+ CVARS_GET (key, val);
178
+ }
179
+ ss << key << " = " << val;
180
+ val = ss.str ();
181
+ CCore::GetSingleton ().GetConsole ()->Print (val.c_str ());
182
+ return true ;
167
183
}
168
- ss << key << " = " << val;
169
- val = ss.str ();
170
- CCore::GetSingleton ().GetConsole ()->Print ( val.c_str () );
171
- return true ;
172
184
}
173
185
174
186
// HACK: if its a 'nick' command, save it here
0 commit comments