CTweakMetadata::CTweakMetadata(IScriptTable *pTable) { // Default delta value m_fDelta = 1.0f; // Get the common elements of Tweaks m_sName = FetchStringValue(pTable, "NAME"); // Fetch any delta hint string sIncHint = FetchStringValue(pTable, "DELTA"); if (!sIncHint.empty()) { double fReadDelta = atof(sIncHint.c_str()); // Check the read value if (fReadDelta == 0.0) { m_sError = "Invalid delta value"; } else { m_fDelta = fReadDelta; } } }
CTweakMetadataCVAR::CTweakMetadataCVAR(IScriptTable *pTable) : CTweakMetadata(pTable) { // Already fetched by base classes: DELTA, NAME // Look for the essential elements of a Tweak m_bValid = true; // Fetch the variable name (we know this exists) m_sVariable = FetchStringValue(pTable, "CVAR"); // There's probably other checks that should be done, including looking for unrecognised elements // What type is the CVAR? m_CVarType = 0; if (GetCVar()) m_CVarType = GetCVar()->GetType(); }
CTweakMetadataLUA::CTweakMetadataLUA(IScriptTable *pTable) : CTweakMetadata(pTable) { // Already fetched by base classes: DELTA, NAME // Look for the essential elements of a Tweak m_bValid = true; // Fetch the variable name (we know this exists) m_sVariable = FetchStringValue(pTable, "LUA"); // Look for an incrementer function m_incrementer = FetchFunctionValue(pTable, "INCREMENTER"); // Look for an decrementer function m_decrementer = FetchFunctionValue(pTable, "DECREMENTER"); // There's probably other checks that should be done, including looking for unrecognised elements }