MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / parseCVars

Function parseCVars

TheForceEngine/TFE_Settings/settings.cpp:1260–1288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1258 }
1259
1260 void parseCVars(const char* key, const char* _value)
1261 {
1262 // Split the value into <type value>
1263 char tmp[256];
1264 strcpy(tmp, _value);
1265
1266 char* type = strtok(tmp, " ");
1267 char* value = strtok(nullptr, " ");
1268 if (!type || !value) { return; }
1269
1270 if (strcasecmp(type, "int") == 0)
1271 {
1272 TFE_Console::addSerializedCVarInt(key, parseInt(value));
1273 }
1274 else if (strcasecmp(type, "float") == 0)
1275 {
1276 TFE_Console::addSerializedCVarFloat(key, parseFloat(value));
1277 }
1278 else if (strcasecmp(type, "bool") == 0)
1279 {
1280 TFE_Console::addSerializedCVarBool(key, parseBool(value));
1281 }
1282 else if (strcasecmp(type, "string") == 0)
1283 {
1284 value = &value[1];
1285 value[strlen(value) - 1] = 0;
1286 TFE_Console::addSerializedCVarString(key, value);
1287 }
1288 }
1289
1290 bool validatePath(const char* path, const char* sentinel)
1291 {

Callers 1

parseIniFileFunction · 0.85

Calls 7

addSerializedCVarIntFunction · 0.85
addSerializedCVarFloatFunction · 0.85
addSerializedCVarBoolFunction · 0.85
parseBoolFunction · 0.85
addSerializedCVarStringFunction · 0.85
parseIntFunction · 0.50
parseFloatFunction · 0.50

Tested by

no test coverage detected