Escape MyGUI markup codes in console output

This commit is contained in:
scrawl 2015-09-26 02:08:23 +02:00
parent 8e69c80bf6
commit 899e35591c
2 changed files with 7 additions and 8 deletions

View file

@ -170,25 +170,25 @@ namespace MWGui
mCommandLine->setFontName(fntName); mCommandLine->setFontName(fntName);
} }
void Console::print(const std::string &msg) void Console::print(const std::string &msg, const std::string& color)
{ {
mHistory->addText(msg); mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg));
} }
void Console::printOK(const std::string &msg) void Console::printOK(const std::string &msg)
{ {
print("#FF00FF" + msg + "\n"); print(msg + "\n", "#FF00FF");
} }
void Console::printError(const std::string &msg) void Console::printError(const std::string &msg)
{ {
print("#FF2222" + msg + "\n"); print(msg + "\n", "#FF2222");
} }
void Console::execute (const std::string& command) void Console::execute (const std::string& command)
{ {
// Log the command // Log the command
print("#FFFFFF> " + command + "\n"); print("> " + command + "\n");
Compiler::Locals locals; Compiler::Locals locals;
Compiler::Output output (locals); Compiler::Output output (locals);

View file

@ -48,9 +48,8 @@ namespace MWGui
void onResChange(int width, int height); void onResChange(int width, int height);
// Print a message to the console. Messages may contain color // Print a message to the console, in specified color.
// code, eg. "#FFFFFF this is white". void print(const std::string &msg, const std::string& color = "#FFFFFF");
void print(const std::string &msg);
// These are pre-colored versions that you should use. // These are pre-colored versions that you should use.