Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7172 for code/trunk


Ignore:
Timestamp:
Aug 17, 2010, 8:25:21 PM (14 years ago)
Author:
landauf
Message:

removed network as dependency of tools. these libraries can build in parallel again now.
moved network synchronization of setTimeFactor from TimeFactorListener to GSRoot (GSRoot inherits from TimeFactorListener now)

Location:
code/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/tools/CMakeLists.txt

    r7163 r7172  
    2222  LINK_LIBRARIES
    2323    core
    24     network
    2524  SOURCE_FILES ${TOOLS_SRC_FILES}
    2625)
  • code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h

    r6417 r7172  
    4141            virtual ~TimeFactorListener() {}
    4242
    43             static void setTimeFactor( float factor );
    44             static void setTimeFactorInternal( float factor );
    45             static inline float getTimeFactor(){ return TimeFactorListener::timefactor_s; }
     43            static void setTimeFactor(float factor);
     44            static inline float getTimeFactor()
     45                { return TimeFactorListener::timefactor_s; }
    4646
    4747        protected:
  • code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc

    r6417 r7172  
    3838#include "core/CoreIncludes.h"
    3939#include "core/GameMode.h"
    40 #include "network/NetworkFunction.h"
    4140
    4241namespace orxonox
     
    4544    // TimeFactorListener
    4645    //----------------------------
    47     registerStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal );
    48 
    4946    float TimeFactorListener::timefactor_s = 1.0f;
    5047
     
    5451    }
    5552
    56     /*static*/ void TimeFactorListener::setTimeFactor( float factor )
     53    /*static*/ void TimeFactorListener::setTimeFactor(float factor)
    5754    {
    58         if ( !GameMode::isStandalone() )
    59             callStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal, CLIENTID_UNKNOWN, factor );
    60         TimeFactorListener::setTimeFactorInternal(factor);
    61     }
     55        if (factor == TimeFactorListener::timefactor_s)
     56            return;
    6257
    63     /*static*/ void TimeFactorListener::setTimeFactorInternal( float factor )
    64     {
    6558        float oldFactor = TimeFactorListener::timefactor_s;
    6659        TimeFactorListener::timefactor_s = factor;
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r6417 r7172  
    3636#include "network/NetworkFunction.h"
    3737#include "tools/Timer.h"
    38 #include "tools/interfaces/TimeFactorListener.h"
    3938#include "tools/interfaces/Tickable.h"
    4039
     
    4342    DeclareGameState(GSRoot, "root", false, false);
    4443    SetConsoleCommandShortcut(GSRoot, printObjects);
     44
     45    registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor);
    4546
    4647    GSRoot::GSRoot(const GameStateInfo& info)
     
    153154    }
    154155
    155     float GSRoot::getTimeFactor()
     156    void GSRoot::changedTimeFactor(float factor_new, float factor_old)
    156157    {
    157         return TimeFactorListener::getTimeFactor();
     158        if (!GameMode::isStandalone())
     159            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new);
    158160    }
    159161}
  • code/trunk/src/orxonox/gamestates/GSRoot.h

    r6417 r7172  
    3232#include "OrxonoxPrereqs.h"
    3333#include "core/GameState.h"
     34#include "tools/interfaces/TimeFactorListener.h"
    3435
    3536namespace orxonox
    3637{
    37     class _OrxonoxExport GSRoot : public GameState
     38    class _OrxonoxExport GSRoot : public GameState, public TimeFactorListener
    3839    {
    3940    public:
     
    5152        void setTimeFactor(float factor);
    5253        void pause();
    53         float getTimeFactor();
     54
     55    protected:
     56        virtual void changedTimeFactor(float factor_new, float factor_old);
    5457
    5558    private:
Note: See TracChangeset for help on using the changeset viewer.