Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2009, 2:11:48 PM (14 years ago)
Author:
scheusso
Message:

server may now pause/slow the game (also on clients) with commands setTimeFactor & pause

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc

    r5781 r6160  
    3737
    3838#include "core/CoreIncludes.h"
     39#include "core/GameMode.h"
     40#include "network/NetworkFunction.h"
    3941
    4042namespace orxonox
     
    4345    // TimeFactorListener
    4446    //----------------------------
     47    registerStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal );
     48   
    4549    float TimeFactorListener::timefactor_s = 1.0f;
    4650
     
    4852    {
    4953        RegisterRootObject(TimeFactorListener);
     54    }
     55
     56    /*static*/ void TimeFactorListener::setTimeFactor( float factor )
     57    {
     58        if ( !GameMode::isStandalone() )
     59            callStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal, CLIENTID_UNKNOWN, factor );
     60        TimeFactorListener::setTimeFactorInternal(factor);
     61    }
     62   
     63    /*static*/ void TimeFactorListener::setTimeFactorInternal( float factor )
     64    {
     65        float oldFactor = TimeFactorListener::timefactor_s;
     66        TimeFactorListener::timefactor_s = factor;
     67        for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it)
     68            it->changedTimeFactor(factor, oldFactor);
    5069    }
    5170
Note: See TracChangeset for help on using the changeset viewer.