Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2011, 5:15:13 PM (13 years ago)
Author:
landauf
Message:

Replaced COUT with orxout in core. Tried to set levels and contexts in a more or less useful way, but not really optimized.

File:
1 edited

Legend:

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

    r8788 r8806  
    6060    SetConsoleCommand("exit", &stop_game);
    6161    static void printFPS()
    62         { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
     62        { orxout(message) << Game::getInstance().getAvgFPS() << endl; }
    6363    SetConsoleCommand("Stats", "printFPS", &printFPS);
    6464    static void printTickTime()
    65         { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
     65        { orxout(message) << Game::getInstance().getAvgTickTime() << endl; }
    6666    SetConsoleCommand("Stats", "printTickTime", &printTickTime);
    6767
     
    163163    {
    164164        if (this->requestedStateNodes_.empty())
    165             COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
     165            orxout(user_error) << "Starting game without requesting GameState. This automatically terminates the program." << endl;
    166166
    167167        // START GAME
     
    189189            catch (...)
    190190            {
    191                 COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl;
    192                 COUT(0) << "This should really never happen! Closing the program." << std::endl;
     191                orxout(user_error) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << endl;
     192                orxout(user_error) << "This should really never happen! Closing the program." << endl;
    193193                this->stop();
    194194                break;
     
    203203            catch (...)
    204204            {
    205                 COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
    206                 COUT(0) << "This should really never happen! Closing the program." << std::endl;
     205                orxout(user_error) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << endl;
     206                orxout(user_error) << "This should really never happen! Closing the program." << endl;
    207207                this->stop();
    208208                break;
     
    241241                catch (...)
    242242                {
    243                     COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl;
     243                    orxout(user_error) << "Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << endl;
    244244                    // All scheduled operations have now been rendered inert --> flush them and issue a warning
    245245                    if (this->requestedStateNodes_.size() > 1)
    246                         COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
     246                        orxout(internal_info) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << endl;
    247247                    this->requestedStateNodes_.clear();
    248248                    break;
     
    272272            catch (...)
    273273            {
    274                 COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl;
    275                 COUT(1) << "This should really never happen!" << std::endl;
    276                 COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
     274                orxout(user_error) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << endl;
     275                orxout(user_error) << "This should really never happen!" << endl;
     276                orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl;
    277277                shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
    278278                while (current->name_ != (*it)->getName() && current)
     
    355355        if (!this->checkState(name))
    356356        {
    357             COUT(2) << "Warning: GameState named '" << name << "' doesn't exist!" << std::endl;
     357            orxout(user_warning) << "GameState named '" << name << "' doesn't exist!" << endl;
    358358            return;
    359359        }
     
    361361        if (this->bChangingState_)
    362362        {
    363             COUT(2) << "Warning: Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << std::endl;
     363            orxout(user_warning) << "Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << endl;
    364364            return;
    365365        }
     
    372372        if (name == lastRequestedNode->name_)
    373373        {
    374             COUT(2) << "Warning: Requesting the currently active state! Ignoring." << std::endl;
     374            orxout(user_warning) << "Requesting the currently active state! Ignoring." << endl;
    375375            return;
    376376        }
     
    403403
    404404        if (requestedNodes.empty())
    405             COUT(1) << "Error: Requested GameState transition is not allowed. Ignoring." << std::endl;
     405            orxout(user_error) << "Requested GameState transition is not allowed. Ignoring." << endl;
    406406        else
    407407            this->requestedStateNodes_.insert(requestedStateNodes_.end(), requestedNodes.begin(), requestedNodes.end());
     
    425425            this->requestState(lastRequestedNode->parent_.lock()->name_);
    426426        else
    427             COUT(2) << "Warning: Can't pop the internal dummy root GameState" << std::endl;
     427            orxout(internal_warning) << "Can't pop the internal dummy root GameState" << endl;
    428428    }
    429429
     
    437437            std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
    438438            if (it != gameStateDeclarations_s.end())
    439                 COUT(1) << "Error: GameState '" << name << "' has not yet been loaded." << std::endl;
     439                orxout(internal_error) << "GameState '" << name << "' has not yet been loaded." << endl;
    440440            else
    441                 COUT(1) << "Error: Could not find GameState '" << name << "'." << std::endl;
     441                orxout(internal_error) << "Could not find GameState '" << name << "'." << endl;
    442442            return shared_ptr<GameState>();
    443443        }
     
    589589        catch (...)
    590590        {
    591             COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl;
    592             COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
     591            orxout(internal_warning) << "Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << endl;
     592            orxout(internal_warning) << "There might be potential resource leaks involved! To avoid this, improve exception-safety." << endl;
    593593        }
    594594        // Check if graphics is still required
Note: See TracChangeset for help on using the changeset viewer.