diff --git a/projects/mtg/include/AbilityParser.h b/projects/mtg/include/AbilityParser.h index 44c31a389..c109b6e87 100644 --- a/projects/mtg/include/AbilityParser.h +++ b/projects/mtg/include/AbilityParser.h @@ -12,15 +12,16 @@ private: string mName; string mResult; vector mParams; - void parse(string& s); - string process(string& s); + void parse(const string& s); + string process(const string& s); + static vector gAutoLineMacros; static map gAutoLineMacrosIndex; public: - AutoLineMacro(string& s); + AutoLineMacro(const string& s); static void Destroy(); - static bool AddMacro(string& s); - static string Process(string& s); + static bool AddMacro(const string& s); + static string Process(const string& s); }; #endif \ No newline at end of file diff --git a/projects/mtg/src/AbilityParser.cpp b/projects/mtg/src/AbilityParser.cpp index 03a638e7b..0a84f561a 100644 --- a/projects/mtg/src/AbilityParser.cpp +++ b/projects/mtg/src/AbilityParser.cpp @@ -10,13 +10,14 @@ using std::vector; vector AutoLineMacro::gAutoLineMacros; map AutoLineMacro::gAutoLineMacrosIndex; -AutoLineMacro::AutoLineMacro(string& s) +AutoLineMacro::AutoLineMacro(const string& s) { parse(s); } -void AutoLineMacro::parse(string& s) +void AutoLineMacro::parse(const string& stringMacro) { + string s = stringMacro; //we convert to lower, because the counterpart (auto strings) is converted to lower at parse time std::transform(s.begin(), s.end(), s.begin(), ::tolower); @@ -48,7 +49,7 @@ void AutoLineMacro::parse(string& s) boost::replace_all(mResult, "\\n", "\n"); } -string AutoLineMacro::process(string& s) +string AutoLineMacro::process(const string& s) { string temp = s; if (!mParams.size()) @@ -92,7 +93,7 @@ string AutoLineMacro::process(string& s) } -bool AutoLineMacro::AddMacro(string& s) +bool AutoLineMacro::AddMacro(const string& s) { AutoLineMacro * alm = NEW AutoLineMacro(s); if (gAutoLineMacrosIndex[alm->mName]) @@ -115,7 +116,7 @@ void AutoLineMacro::Destroy() } } -string AutoLineMacro::Process(string& s) +string AutoLineMacro::Process(const string& s) { string result = s; for (size_t i = 0; i < gAutoLineMacros.size(); ++i)