Integrate C++11 branch into 5_1-new
This commit is contained in:
+13
-14
@@ -6,7 +6,6 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageThreads.h"
|
||||
#include "Preference.h"
|
||||
#include "Foreach.h"
|
||||
#include "GameInput.h"
|
||||
#include "InputMapper.h"
|
||||
// for mouse stuff: -aj
|
||||
@@ -111,7 +110,7 @@ namespace
|
||||
* this won't cause timing problems, because the event timestamp is preserved. */
|
||||
static Preference<float> g_fInputDebounceTime( "InputDebounceTime", 0 );
|
||||
|
||||
InputFilter* INPUTFILTER = NULL; // global and accessible from anywhere in our program
|
||||
InputFilter* INPUTFILTER = nullptr; // global and accessible from anywhere in our program
|
||||
|
||||
static const float TIME_BEFORE_REPEATS = 0.375f;
|
||||
|
||||
@@ -233,9 +232,9 @@ void InputFilter::ResetDevice( InputDevice device )
|
||||
RageTimer now;
|
||||
|
||||
const ButtonStateMap ButtonStates( g_ButtonStates );
|
||||
FOREACHM_CONST( DeviceButtonPair, ButtonState, ButtonStates, b )
|
||||
for (std::pair<DeviceButtonPair const, ButtonState> const &b : ButtonStates)
|
||||
{
|
||||
const DeviceButtonPair &db = b->first;
|
||||
const DeviceButtonPair &db = b.first;
|
||||
if( db.device == device )
|
||||
ButtonPressed( DeviceInput(device, db.button, 0, now) );
|
||||
}
|
||||
@@ -326,7 +325,7 @@ void InputFilter::Update( float fDeltaTime )
|
||||
|
||||
vector<ButtonStateMap::iterator> ButtonsToErase;
|
||||
|
||||
FOREACHM( DeviceButtonPair, ButtonState, g_ButtonStates, b )
|
||||
for( map<DeviceButtonPair, ButtonState>::iterator b = g_ButtonStates.begin(); b != g_ButtonStates.end(); ++b )
|
||||
{
|
||||
di.device = b->first.device;
|
||||
di.button = b->first.button;
|
||||
@@ -379,8 +378,8 @@ void InputFilter::Update( float fDeltaTime )
|
||||
ReportButtonChange( di, IET_REPEAT );
|
||||
}
|
||||
|
||||
FOREACH( ButtonStateMap::iterator, ButtonsToErase, it )
|
||||
g_ButtonStates.erase( *it );
|
||||
for (ButtonStateMap::iterator &it : ButtonsToErase)
|
||||
g_ButtonStates.erase( it );
|
||||
}
|
||||
|
||||
template<typename T, typename IT>
|
||||
@@ -388,7 +387,7 @@ const T *FindItemBinarySearch( IT begin, IT end, const T &i )
|
||||
{
|
||||
IT it = lower_bound( begin, end, i );
|
||||
if( it == end || *it != i )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return &*it;
|
||||
}
|
||||
@@ -396,19 +395,19 @@ const T *FindItemBinarySearch( IT begin, IT end, const T &i )
|
||||
bool InputFilter::IsBeingPressed( const DeviceInput &di, const DeviceInputList *pButtonState ) const
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
if( pButtonState == NULL )
|
||||
if( pButtonState == nullptr )
|
||||
pButtonState = &g_CurrentState;
|
||||
const DeviceInput *pDI = FindItemBinarySearch( pButtonState->begin(), pButtonState->end(), di );
|
||||
return pDI != NULL && pDI->bDown;
|
||||
return pDI != nullptr && pDI->bDown;
|
||||
}
|
||||
|
||||
float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState ) const
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
if( pButtonState == NULL )
|
||||
if( pButtonState == nullptr )
|
||||
pButtonState = &g_CurrentState;
|
||||
const DeviceInput *pDI = FindItemBinarySearch( pButtonState->begin(), pButtonState->end(), di );
|
||||
if( pDI == NULL )
|
||||
if( pDI == nullptr )
|
||||
return 0;
|
||||
return pDI->ts.Ago();
|
||||
}
|
||||
@@ -416,10 +415,10 @@ float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pB
|
||||
float InputFilter::GetLevel( const DeviceInput &di, const DeviceInputList *pButtonState ) const
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
if( pButtonState == NULL )
|
||||
if( pButtonState == nullptr )
|
||||
pButtonState = &g_CurrentState;
|
||||
const DeviceInput *pDI = FindItemBinarySearch( pButtonState->begin(), pButtonState->end(), di );
|
||||
if( pDI == NULL )
|
||||
if( pDI == nullptr )
|
||||
return 0.0f;
|
||||
return pDI->level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user