From fd325d49f9103408f7d2fc10cc99dae7fab9a0a1 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Tue, 24 Dec 2013 15:05:23 +0700 Subject: ZVISION: Add splitter function into controls class. --- engines/zvision/control.cpp | 24 ++++++++++++++++++++++++ engines/zvision/control.h | 2 ++ 2 files changed, 26 insertions(+) (limited to 'engines') diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 0346228681..ef2e90f8ce 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -103,4 +103,28 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } +void Control::getParams(Common::String &input_str, Common::String ¶meter, Common::String &values) { + const char *chrs = input_str.c_str(); + uint lbr; + + for (lbr = 0; lbr < input_str.size(); lbr++) + if (chrs[lbr] == '(') + break; + + if (lbr >= input_str.size()) + return; + + uint rbr; + + for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + if (chrs[rbr] == ')') + break; + + if (rbr >= input_str.size()) + return; + + parameter = Common::String(chrs, chrs + lbr); + values = Common::String(chrs + lbr + 1, chrs + rbr); +} + } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 65d76da5c4..93ad5f5df1 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -24,6 +24,7 @@ #define ZVISION_CONTROL_H #include "common/keyboard.h" +#include "common/str.h" namespace Common { @@ -102,6 +103,7 @@ protected: ZVision *_engine; uint32 _key; + void getParams(Common::String &input_str, Common::String ¶meter, Common::String &values); // Static member functions public: static void parseFlatControl(ZVision *engine); -- cgit v1.2.3