diff options
author | erihel <erihel@gmail.com> | 2014-02-02 01:51:14 +0100 |
---|---|---|
committer | erihel <erihel@gmail.com> | 2014-02-02 01:51:14 +0100 |
commit | 93582536ded303f4c9c358ef9967deb07d638e54 (patch) | |
tree | 2ba781604f31af20b20fc43fa647491d4c82de32 /src/script | |
parent | d84d38280b3ed706ff2371fc88e43a2a7245d3dd (diff) | |
parent | 70b18cc4c05398cd06558f4634937a70c2436546 (diff) | |
download | colobot-93582536ded303f4c9c358ef9967deb07d638e54.tar.gz colobot-93582536ded303f4c9c358ef9967deb07d638e54.tar.bz2 colobot-93582536ded303f4c9c358ef9967deb07d638e54.zip |
Merge branch 'dev' of github:colobot/colobot into dev
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/cmdtoken.cpp | 10 | ||||
-rw-r--r-- | src/script/cmdtoken.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/script/cmdtoken.cpp b/src/script/cmdtoken.cpp index da4a886..6393505 100644 --- a/src/script/cmdtoken.cpp +++ b/src/script/cmdtoken.cpp @@ -35,6 +35,16 @@ char* SkipSpace(char *line) return line; } +std::string GetCmd(char* line) +{ + line = SkipSpace(line); + + int len = 0; + for(char* x = line; *x != 0 && *x != ' ' && *x != '\t' && *x != '\n'; x++, len++); + + return std::string(line, len); +} + // Checks if a line contains a command. bool Cmd(char *line, const char *token) diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h index 24b592f..8a423c5 100644 --- a/src/script/cmdtoken.h +++ b/src/script/cmdtoken.h @@ -30,6 +30,7 @@ // Procedures. +extern std::string GetCmd(char* line); extern bool Cmd(char *line, const char *token); extern char* SearchOp(char *line, const char *op); |