Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2008, 6:01:13 PM (16 years ago)
Author:
landauf
Message:

Merged objecthierarchy2 into presentation branch

Couln't merge 2 lines in Gamestate.cc and a whole block of code in GSDedicated.cc (it seems like oli implemented in both branches something like a network-tick-limiter but with different approaches)

Not yet tested in network mode and with bots
The SpaceShips movement is also not yet fully adopted to the new physics (see Engine class)

Location:
code/branches/presentation
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/util

  • code/branches/presentation/src/util/Convert.h

    r2171 r2485  
    460460            else
    461461              *output = "false";
    462             return false;
     462            return true;
    463463        }
    464464    };
  • code/branches/presentation/src/util/Exception.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/presentation/src/util/Exception.h

  • code/branches/presentation/src/util/OutputHandler.cc

    r2171 r2485  
    100100        @param buffer The OutputBuffer
    101101    */
    102     void OutputHandler::setOutputBuffer(OutputBuffer& buffer)
    103     {
    104         buffer.getStream() >> this->outputBuffer_->getStream().rdbuf();
    105         this->outputBuffer_ = &buffer;
     102    void OutputHandler::setOutputBuffer(OutputBuffer* buffer)
     103    {
     104        if (buffer == NULL)
     105            this->outputBuffer_ = &this->fallbackBuffer_;
     106        else
     107        {
     108            buffer->getStream() >> this->outputBuffer_->getStream().rdbuf();
     109            this->outputBuffer_ = buffer;
     110        }
    106111    }
    107112
  • code/branches/presentation/src/util/OutputHandler.h

    r2171 r2485  
    101101            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
    102102
    103             void setOutputBuffer(OutputBuffer& buffer);
     103            void setOutputBuffer(OutputBuffer* buffer);
    104104
    105105            template <class T>
  • code/branches/presentation/src/util/SignalHandler.cc

    r2459 r2485  
    3535#include "Debug.h"
    3636
    37 #include <cassert>
    3837#include <iostream>
    3938#include <cstdlib>
     
    4241namespace orxonox
    4342{
    44     SignalHandler * SignalHandler::singletonRef = NULL;
     43    SignalHandler* SignalHandler::singletonRef_s = NULL;
    4544}
    4645
     
    5554{
    5655    bool SignalHandler::bXAutoKeyRepeatOn_ = false;
    57 
    58     SignalHandler::SignalHandler()
    59     {
    60     }
    6156
    6257    /**
     
    133128    void SignalHandler::sigHandler( int sig )
    134129    {
    135       for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
     130      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
    136131      {
    137132        (*(it->cb))( it->someData );
     
    184179      if ( sigPid == 0 )
    185180      {
    186         getInstance()->dontCatch();
     181        getInstance().dontCatch();
    187182        // wait for message from parent when it has attached gdb
    188183        int someData;
     
    237232
    238233      char cmd[256];
    239       snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
     234      snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance().appName.c_str(), sigPid );
    240235      write( gdbIn[1], cmd, strlen(cmd) );
    241236
     
    331326      bt.insert(0, timeString);
    332327
    333       FILE * f = fopen( getInstance()->filename.c_str(), "a" );
     328      FILE * f = fopen( getInstance().filename.c_str(), "a" );
    334329
    335330      if ( !f )
    336331      {
    337         perror( ( std::string( "could not append to " ) + getInstance()->filename ).c_str() );
     332        perror( ( std::string( "could not append to " ) + getInstance().filename ).c_str() );
    338333        exit(EXIT_FAILURE);
    339334      }
     
    341336      if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
    342337      {
    343         COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->filename << std::endl;
     338        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;
    344339        exit(EXIT_FAILURE);
    345340      }
  • code/branches/presentation/src/util/SignalHandler.h

    r2459 r2485  
    3737#include "UtilPrereqs.h"
    3838
     39#include <cassert>
    3940#include <list>
    4041#include <string>
     
    6869    class SignalHandler
    6970    {
    70     private:
    71         SignalHandler();
    7271    public:
    73         inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
    74         ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
     72        SignalHandler()  { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; }
     73        ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = NULL; }
     74        inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; }
    7575
    7676        void registerCallback( SignalCallback cb, void * someData );
     
    8787        SignalCallbackList callbackList;
    8888
    89         static SignalHandler * singletonRef;
     89        static SignalHandler* singletonRef_s;
    9090
    9191        std::string appName;
     
    104104    {
    105105    public:
    106         inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
    107         void doCatch( const std::string & appName, const std::string & filename ) {};
    108         void dontCatch() {};
    109         void registerCallback( SignalCallback cb, void * someData ) {};
     106        SignalHandler()  { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; }
     107        ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = 0; }
     108        inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; }
     109        void doCatch( const std::string & appName, const std::string & filename ) {}
     110        void dontCatch() {}
     111        void registerCallback( SignalCallback cb, void * someData ) {}
    110112
    111113    private:
    112         static SignalHandler * singletonRef;
     114        static SignalHandler* singletonRef_s;
    113115    };
    114116}
Note: See TracChangeset for help on using the changeset viewer.