Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-29 16:04:03 +0000
committerStijn Buys <ingar@osirion.org>2010-11-29 16:04:03 +0000
commit8774e65cc503318005f34c133cbaee21b18fc144 (patch)
tree907c120079597398abfda5d4791ce58573009e7c /src/core
parent2c7d185fdb03d17475deb9af1edaa82ffa51d4b6 (diff)
Parse command line options after engine initialization.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/application.cc9
-rw-r--r--src/core/commandbuffer.cc10
-rw-r--r--src/core/commandbuffer.h1
-rw-r--r--src/core/gameserver.cc4
4 files changed, 12 insertions, 12 deletions
diff --git a/src/core/application.cc b/src/core/application.cc
index f21dcad..15179c9 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -371,11 +371,8 @@ void Application::load_config()
char line[MAXCMDSIZE];
while (ifs.getline(line, MAXCMDSIZE - 1)) {
if (line[0] && line[0] != '#' && line[0] != ';')
- cmd() << line << '\n';
+ CommandBuffer::exec(line);
}
-
- // execute commands in the buffer
- CommandBuffer::exec();
}
void Application::load_autoexec()
@@ -409,10 +406,8 @@ void Application::load_autoexec()
char line[MAXCMDSIZE];
while (ifs.getline(line, MAXCMDSIZE - 1)) {
if (line[0] && line[0] != '#' && line[0] != ';')
- cmd() << line << '\n';
+ CommandBuffer::exec(line);
}
-
- CommandBuffer::exec();
}
}
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 40971cc..58fe6be 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -316,7 +316,15 @@ void CommandBuffer::exec(std::string const &cmdline)
if (!cmdline.size())
return;
- std::istringstream cmdstream(cmdline);
+ std::string cleaned;
+
+ for (size_t i = 0; i < cmdline.size(); i++) {
+ if (cmdline[i] != '"') {
+ cleaned += cmdline[i];
+ }
+ }
+
+ std::istringstream cmdstream(cleaned);
std::string command;
if (!(cmdstream >> command))
diff --git a/src/core/commandbuffer.h b/src/core/commandbuffer.h
index c8024ba..5ecfeee 100644
--- a/src/core/commandbuffer.h
+++ b/src/core/commandbuffer.h
@@ -43,7 +43,6 @@ public:
/// the global command buffer
static std::stringstream cmdbuf;
-private:
static void exec(std::string const & cmdline);
};
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index e07774d..cb1e66d 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -684,11 +684,9 @@ void GameServer::load_config()
char line[MAXCMDSIZE];
while (ifs.getline(line, MAXCMDSIZE - 1)) {
if (line[0] && line[0] != '#' && line[0] != ';')
- cmd() << line << '\n';
+ CommandBuffer::exec(line);
}
- // execute commands in the buffer
- CommandBuffer::exec();
}
}