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:
9 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gametypes/Asteroids.cc

    r7655 r8858  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/Host.h"
     32#include "chat/ChatManager.h"
    3333#include "worldentities/pawns/Pawn.h"
    3434
     
    7474
    7575        std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
    76         COUT(0) << message << std::endl;
    77         Host::Broadcast(message);
     76        ChatManager::message(message);
    7877
    7978    }
     
    8483
    8584        std::string message("The match has ended.");
    86         COUT(0) << message << std::endl;
    87         Host::Broadcast(message);
     85        ChatManager::message(message);
    8886    }
    8987}
  • code/trunk/src/orxonox/gametypes/Deathmatch.cc

    r6417 r8858  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/Host.h"
     32#include "chat/ChatManager.h"
    3333#include "infos/PlayerInfo.h"
    3434#include "worldentities/pawns/Pawn.h"
     
    4848
    4949        std::string message("The match has started!");
    50         COUT(0) << message << std::endl;
    51         Host::Broadcast(message);
     50        ChatManager::message(message);
    5251    }
    5352
     
    5756
    5857        std::string message("The match has ended.");
    59         COUT(0) << message << std::endl;
    60         Host::Broadcast(message);
     58        ChatManager::message(message);
    6159    }
    6260
     
    6664
    6765        const std::string& message = player->getName() + " entered the game";
    68         COUT(0) << message << std::endl;
    69         Host::Broadcast(message);
     66        ChatManager::message(message);
    7067    }
    7168
     
    7774        {
    7875            const std::string& message = player->getName() + " left the game";
    79             COUT(0) << message << std::endl;
    80             Host::Broadcast(message);
     76            ChatManager::message(message);
    8177        }
    8278
     
    9187        {
    9288            const std::string& message = player->getOldName() + " changed name to " + player->getName();
    93             COUT(0) << message << std::endl;
    94             Host::Broadcast(message);
     89            ChatManager::message(message);
    9590        }
    9691
     
    113108                message = victim->getPlayer()->getName() + " died";
    114109
    115             COUT(0) << message << std::endl;
    116             Host::Broadcast(message);
     110            ChatManager::message(message);
    117111        }
    118112
     
    127121        {
    128122            const std::string& message = player->getName() + " scores!";
    129             COUT(0) << message << std::endl;
    130             Host::Broadcast(message);
     123            ChatManager::message(message);
    131124        }
    132125    }
  • code/trunk/src/orxonox/gametypes/Dynamicmatch.cc

    r8729 r8858  
    4949#include "core/CoreIncludes.h"
    5050#include "core/command/Executor.h"
    51 #include "network/Host.h"
     51#include "chat/ChatManager.h"
    5252#include "infos/PlayerInfo.h"
    5353#include "worldentities/pawns/Pawn.h"
     
    342342        numberOf[chaser]++;
    343343        Gametype::playerEntered(player);
    344         const std::string& message6 = player->getName() + " entered the game";
    345         COUT(0) << message6 << std::endl;
    346         Host::Broadcast(message6);
     344        const std::string& message = player->getName() + " entered the game";
     345        ChatManager::message(message);
    347346    }
    348347
     
    359358            }
    360359            const std::string& message = player->getName() + " left the game";
    361             COUT(0) << message << std::endl;
    362             Host::Broadcast(message);
     360            ChatManager::message(message);
    363361            //remove player from map
    364362            playerParty_.erase (player);
     
    617615        {
    618616            const std::string& message = player->getOldName() + " changed name to " + player->getName();
    619             COUT(0) << message << std::endl;
    620             Host::Broadcast(message);
     617            ChatManager::message(message);
    621618        }
    622619
     
    630627        {
    631628            std::string message("Dynamicmatch started!");
    632             COUT(0) << message << std::endl;
    633             Host::Broadcast(message);
     629            ChatManager::message(message);
    634630        }
    635631        else if(tutorial) // Announce selectionphase
     
    647643    {
    648644        std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!");
    649         COUT(0) << message << std::endl;
    650         Host::Broadcast(message);
     645        ChatManager::message(message);
    651646        callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this)));
    652647    }
     
    655650    {
    656651        std::string message("After 3 Minutes the game is over.");
    657         COUT(0) << message << std::endl;
    658         Host::Broadcast(message);
     652        ChatManager::message(message);
    659653    }*/
    660654    void Dynamicmatch::end()
     
    663657
    664658        std::string message("Time out. Press F2 to see the points you scored.");
    665         COUT(0) << message << std::endl;
    666         Host::Broadcast(message);
     659        ChatManager::message(message);
    667660    }
    668661    SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const
  • code/trunk/src/orxonox/gametypes/Gametype.cc

    r8706 r8858  
    297297            }
    298298            else
    299                 COUT(2) << "Warning: Killed Pawn was not in the playerlist" << std::endl;
     299                orxout(internal_warning) << "Killed Pawn was not in the playerlist" << endl;
    300300        }
    301301    }
     
    344344            }
    345345
    346             COUT(2) << "Warning: Fallback SpawnPoint was used, because there were no active SpawnPoints." << endl;
     346            orxout(internal_warning) << "Fallback SpawnPoint was used because there were no active SpawnPoints." << endl;
    347347            return fallbackSpawnPoint;
    348348        }
     
    444444        else
    445445        {
    446             COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
     446            orxout(user_error) << "No SpawnPoints in current Gametype" << endl;
    447447            abort();
    448448        }
     
    461461        else
    462462        {
    463             COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
     463            orxout(user_error) << "No SpawnPoints in current Gametype" << endl;
    464464            abort();
    465465        }
  • code/trunk/src/orxonox/gametypes/LastManStanding.cc

    r8327 r8858  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/Host.h"
     32#include "chat/ChatManager.h"
    3333#include "infos/PlayerInfo.h"
    3434#include "worldentities/pawns/Pawn.h"
     
    9090                const std::string& message = ""; // resets Camper-Warning-message
    9191                this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    92             }   
     92            }
    9393        }
    9494        return true;
     
    105105            this->playersAlive--;
    106106            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
    107             COUT(0) << message << std::endl;
    108             Host::Broadcast(message);
     107            ChatManager::message(message);
    109108        }
    110109
     
    128127    {
    129128        Gametype::end();
    130        
     129
    131130        for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    132131        {
     
    148147            return 0;
    149148    }
    150    
     149
    151150    int LastManStanding::getNumPlayersAlive() const
    152151    {
     
    190189        this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
    191190        this->playerDelayTime_[player]=respawnDelay;
    192        
     191
    193192        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
    194193        if (it != this->players_.end())
     
    198197            const std::string& message = ""; // resets Camper-Warning-message
    199198            this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    200         } 
     199        }
    201200    }
    202201
     
    239238            }
    240239            for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    241             {   
     240            {
    242241                if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
    243                     continue;     
     242                    continue;
    244243                it->second-=dt;//Decreases punishment time.
    245                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 
     244                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    246245                {
    247246                    playerDelayTime_[it->first]-=dt;
  • code/trunk/src/orxonox/gametypes/LastTeamStanding.cc

    r8706 r8858  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/NetworkPrereqs.h"
    33 #include "network/Host.h"
     32#include "chat/ChatManager.h"
    3433#include "infos/PlayerInfo.h"
    3534#include "worldentities/pawns/Pawn.h"
     
    119118                this->teamsAlive--;
    120119            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
    121             COUT(0) << message << std::endl;
    122             Host::Broadcast(message);
     120            ChatManager::message(message);
    123121        }
    124122        return allow;
  • code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc

    r8327 r8858  
    141141            return;
    142142
    143         COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl;
    144         if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) COUT(0) << "Team 1 is near victory!" << std::endl;
    145         if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) COUT(0) << "Team 2 is near victory!" << std::endl;
     143        orxout(message) << "Points standing:" << '\n' << "Team 1: "<< pointsTeam1_ << '\n' << "Team 2: " << pointsTeam2_ << endl;
     144        if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) orxout(message) << "Team 1 is near victory!" << endl;
     145        if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) orxout(message) << "Team 2 is near victory!" << endl;
    146146    }
    147147
     
    179179            if (this->pointsTeam1_ > this->pointsTeam2_)
    180180            {
    181                 COUT(0) << "Team 1 has won the match" << std::endl;
     181                orxout(message) << "Team 1 has won the match" << endl;
    182182                winningteam = 0;
    183183            }
    184184            else
    185185            {
    186                 COUT(0) << "Team 2 has won the match" << std::endl;
     186                orxout(message) << "Team 2 has won the match" << endl;
    187187                winningteam = 1;
    188188            }
  • code/trunk/src/orxonox/gametypes/UnderAttack.cc

    r8327 r8858  
    3232#include "core/CoreIncludes.h"
    3333#include "core/ConfigValueIncludes.h"
    34 #include "network/Host.h"
     34#include "chat/ChatManager.h"
    3535#include "worldentities/pawns/Destroyer.h"
    3636#include "infos/PlayerInfo.h"
     
    7070        this->end(); //end gametype
    7171        std::string message("Ship destroyed! Team 0 has won!");
    72         COUT(0) << message << std::endl;
    73         Host::Broadcast(message);
     72        ChatManager::message(message);
    7473        this->gameEnded_ = true;
    7574
     
    153152                this->end();
    154153                std::string message("Time is up! Team 1 has won!");
    155                 COUT(0) << message << std::endl;
    156                 Host::Broadcast(message);
     154                ChatManager::message(message);
    157155
    158156                for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
     
    173171                const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
    174172/*
    175                 COUT(0) << message << std::endl;
    176                 Host::Broadcast(message);
     173                ChatManager::message(message);
    177174*/
    178175                this->gtinfo_->sendAnnounceMessage(message);
Note: See TracChangeset for help on using the changeset viewer.