Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 23, 2011, 12:45:53 AM (13 years ago)
Author:
landauf
Message:

merged output branch back to trunk.

Changes:

  • you have to include util/Output.h instead of util/Debug.h
  • COUT(x) is now called orxout(level)
  • output levels are now defined by an enum instead of numbers. see util/Output.h for the definition
  • it's possible to use output contexts with orxout(level, context). see util/Output.h for some common contexts. you can define more contexts
  • you must use 'endl' at the end of an output message, '\n' does not flush the message

Output levels:

  • instead of COUT(0) use orxout()
  • instead of COUT(1) use orxout(user_error) or orxout(internal_error)
  • instead of COUT(2) use orxout(user_warning) or orxout(internal_warning)
  • instead of COUT(3) use orxout(user_status/user_info) or orxout(internal_status/internal_info)
  • instead of COUT(4) use orxout(verbose)
  • instead of COUT(5) use orxout(verbose_more)
  • instead of COUT(6) use orxout(verbose_ultra)

Guidelines:

  • user_* levels are for the user, visible in the console and the log-file
  • internal_* levels are for developers, visible in the log-file
  • verbose_* levels are for debugging, only visible if the context of the output is activated

Usage in C++:

  • orxout() << "message" << endl;
  • orxout(level) << "message" << endl;
  • orxout(level, context) << "message" << endl;

Usage in Lua:

  • orxout("message")
  • orxout(orxonox.level.levelname, "message")
  • orxout(orxonox.level.levelname, "context", "message")

Usage in Tcl (and in the in-game-console):

  • orxout levelname message
  • orxout_context levelname context message
  • shortcuts: log message, error message, warning message, status message, info message, debug message
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/gametypes/SpaceRace.cc

    r8767 r8858  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/Host.h"
     32#include "chat/ChatManager.h"
    3333#include "util/Convert.h"
    3434#include "util/Math.h"
     
    5454            this->clock_.capture();
    5555            int s = this->clock_.getSeconds();
    56             int ms = this->clock_.getMilliseconds()-1000*s;
     56            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
    5757            const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
    5858                        + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
    5959                        + " before the time limit. You lose!";
    60             COUT(3) << message;
    6160            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     61            ChatManager::message(message);
    6262        }
    6363        else
     
    6565            this->clock_.capture();
    6666            int s = this->clock_.getSeconds();
    67             int ms = this->clock_.getMilliseconds()-1000*s;
     67            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
    6868            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
    6969                        + "." + multi_cast<std::string>(ms) + " seconds.";
    70             COUT(3) << message << std::endl;
    7170            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     71            ChatManager::message(message);
     72/*
    7273            float time = this->clock_.getSecondsPrecise();
    7374            this->scores_.insert(time);
    7475            std::set<float>::iterator it;
    7576            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
    76             COUT(3) <<  multi_cast<std::string>(*it) << std::endl;
     77                orxout(level::message) << multi_cast<std::string>(*it) << endl;
     78*/
    7779        }
    7880    }
     
    8385
    8486        std::string message("The match has started! Reach the check points as quickly as possible!");
    85         COUT(3) << message << std::endl;
    8687        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     88        ChatManager::message(message);
    8789    }
    8890
     
    9294        this->clock_.capture();
    9395        int s = this->clock_.getSeconds();
    94         int ms = this->clock_.getMilliseconds()-1000*s;
     96        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
    9597        const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
    9698                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
    97                         + " seconds.\n";
    98         COUT(3) << message;
     99                        + " seconds.";
    99100        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     101        ChatManager::message(message);
    100102    }
    101103
Note: See TracChangeset for help on using the changeset viewer.