Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 30, 2011, 9:31:05 PM (13 years ago)
Author:
landauf
Message:

fixed bug with multiple lines in shell.
adjusted colors in IOConsole and InGameConsole a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/core/command/Shell.cc

    r8799 r8801  
    3333
    3434#include "Shell.h"
     35
     36#include <boost/preprocessor/stringize.hpp>
    3537
    3638#include "util/Math.h"
     
    4850namespace orxonox
    4951{
     52#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: add commands again, inspect tcl support (and remove boost include)")
    5053//    SetConsoleCommand("log",     OutputHandler::log    );
    5154//    SetConsoleCommand("error",   OutputHandler::error  ).hide();
     
    251254
    252255    /**
    253         @brief Sends output to the internal output buffer.
     256        @brief Adds multiple lines to the internal output buffer.
    254257    */
    255258    void Shell::addOutput(const std::string& text, LineType type)
    256259    {
     260        std::vector<std::string> lines;
     261        vectorize(text, '\n', &lines);
     262
     263        for (size_t i = 0; i < lines.size(); ++i)
     264            this->addLine(lines[i], type);
     265    }
     266
     267    /**
     268        @brief Adds a line to the internal output buffer.
     269    */
     270    void Shell::addLine(const std::string& line, LineType type)
     271    {
    257272        // yes it was - push the new line to the list
    258         this->outputLines_.push_front(std::make_pair(text, static_cast<LineType>(type)));
     273        this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));
    259274
    260275        // adjust the scroll position if needed
     
    286301    void Shell::printLine(const std::string& line, OutputLevel level)
    287302    {
    288         this->addOutput(line, static_cast<LineType>(level));
     303        this->addLine(line, static_cast<LineType>(level));
    289304    }
    290305
Note: See TracChangeset for help on using the changeset viewer.