]> git.stg.codes - stg.git/blobdiff - projects/stargazer/settings_impl.cpp
Merge branch 'naffanya-dev'
[stg.git] / projects / stargazer / settings_impl.cpp
index d197efc40c32877bf1852982b2f34a8df7a15d93..92670cb5082a345768582a2173ce06803fa0d43f 100644 (file)
@@ -138,71 +138,6 @@ SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval)
 {
 }
 //-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseYesNo(const string & value, bool * val)
-{
-if (0 == strcasecmp(value.c_str(), "yes"))
-    {
-    *val = true;
-    return 0;
-    }
-if (0 == strcasecmp(value.c_str(), "no"))
-    {
-    *val = false;
-    return 0;
-    }
-
-strError = "Incorrect value \'" + value + "\'.";
-return -1;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseInt(const string & value, int * val)
-{
-if (str2x<int>(value, *val))
-    {
-    strError = "Cannot convert \'" + value + "\' to integer.";
-    return -1;
-    }
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseUnsigned(const string & value, unsigned * val)
-{
-if (str2x<unsigned>(value, *val))
-    {
-    strError = "Cannot convert \'" + value + "\' to unsigned integer.";
-    return -1;
-    }
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseIntInRange(const string & value, int min, int max, int * val)
-{
-if (ParseInt(value, val) != 0)
-    return -1;
-
-if (*val < min || *val > max)
-    {
-    strError = "Value \'" + value + "\' out of range.";
-    return -1;
-    }
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseUnsignedInRange(const string & value, unsigned min, unsigned max, unsigned * val)
-{
-if (ParseUnsigned(value, val) != 0)
-    return -1;
-
-if (*val < min || *val > max)
-    {
-    strError = "Value \'" + value + "\' out of range.";
-    return -1;
-    }
-
-return 0;
-}
-//-----------------------------------------------------------------------------
 int SETTINGS_IMPL::ParseModuleSettings(const DOTCONFDocumentNode * node, vector<PARAM_VALUE> * params)
 {
 const DOTCONFDocumentNode * childNode;
@@ -440,7 +375,7 @@ while (node)
 
     if (strcasecmp(node->getName(), "FeeChargeType") == 0)
         {
-        if (ParseUnsignedInRange(node->getValue(0), 0, 2, &feeChargeType) != 0)
+        if (ParseUnsignedInRange(node->getValue(0), 0, 3, &feeChargeType) != 0)
             {
             strError = "Incorrect FeeChargeType value: \'" + string(node->getValue(0)) + "\'";
             return -1;
@@ -522,6 +457,13 @@ while (node)
             }
         }
 
+    if (strcasecmp(node->getName(), "ScriptParams") == 0)
+        {
+        for (int i = 0; node->getValue(i) != NULL; ++i)
+            {
+            scriptParams.push_back(node->getValue(i));
+            }
+        }
     node = node->getNextNode();
     }
 
@@ -553,4 +495,4 @@ else if (detailStatPeriodStr == "1/6")
 
 return -1;
 }
-//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
\ No newline at end of file