Integrate C++11 branch into 5_1-new
This commit is contained in:
+17
-17
@@ -11,11 +11,11 @@
|
||||
#include "RageTimer.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "Foreach.h"
|
||||
#include "LuaBinding.h"
|
||||
#include "LuaManager.h"
|
||||
#include "ImageCache.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include <numeric>
|
||||
|
||||
REGISTER_ACTOR_CLASS( Sprite );
|
||||
|
||||
@@ -23,7 +23,7 @@ const float min_state_delay= 0.0001f;
|
||||
|
||||
Sprite::Sprite()
|
||||
{
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
m_iCurState = 0;
|
||||
m_fSecsIntoState = 0.0f;
|
||||
m_animation_length_seconds= 0.0f;
|
||||
@@ -80,10 +80,10 @@ Sprite::Sprite( const Sprite &cpy ):
|
||||
CPY(m_use_effect_clock_for_texcoords);
|
||||
#undef CPY
|
||||
|
||||
if( cpy.m_pTexture != NULL )
|
||||
if( cpy.m_pTexture != nullptr )
|
||||
m_pTexture = TEXTUREMAN->CopyTexture( cpy.m_pTexture );
|
||||
else
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
}
|
||||
|
||||
Sprite &Sprite::operator=( Sprite other )
|
||||
@@ -201,7 +201,7 @@ void Sprite::LoadFromNode( const XNode* pNode )
|
||||
vector<State> aStates;
|
||||
|
||||
const XNode *pFrames = pNode->GetChild( "Frames" );
|
||||
if( pFrames != NULL )
|
||||
if( pFrames != nullptr )
|
||||
{
|
||||
/* All attributes are optional. If Frame is omitted, use the previous state's
|
||||
* frame (or 0 if the first).
|
||||
@@ -213,7 +213,7 @@ void Sprite::LoadFromNode( const XNode* pNode )
|
||||
for( int i=0; true; i++ )
|
||||
{
|
||||
const XNode *pFrame = pFrames->GetChild( ssprintf("%i", i+1) ); // +1 for Lua's arrays
|
||||
if( pFrame == NULL )
|
||||
if( pFrame == nullptr )
|
||||
break;
|
||||
|
||||
State newState;
|
||||
@@ -231,7 +231,7 @@ void Sprite::LoadFromNode( const XNode* pNode )
|
||||
newState.rect = *m_pTexture->GetTextureCoordRect( iFrameIndex );
|
||||
|
||||
const XNode *pPoints[2] = { pFrame->GetChild( "1" ), pFrame->GetChild( "2" ) };
|
||||
if( pPoints[0] != NULL && pPoints[1] != NULL )
|
||||
if( pPoints[0] != nullptr && pPoints[1] != nullptr )
|
||||
{
|
||||
RectF r = newState.rect;
|
||||
|
||||
@@ -286,10 +286,10 @@ void Sprite::LoadFromNode( const XNode* pNode )
|
||||
|
||||
void Sprite::UnloadTexture()
|
||||
{
|
||||
if( m_pTexture != NULL ) // If there was a previous bitmap...
|
||||
if( m_pTexture != nullptr ) // If there was a previous bitmap...
|
||||
{
|
||||
TEXTUREMAN->UnloadTexture( m_pTexture ); // Unload it.
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
|
||||
/* Make sure we're reset to frame 0, so if we're reused, we aren't left
|
||||
* on a frame number that may be greater than the number of frames in
|
||||
@@ -327,7 +327,7 @@ void Sprite::EnableAnimation( bool bEnable )
|
||||
|
||||
void Sprite::SetTexture( RageTexture *pTexture )
|
||||
{
|
||||
ASSERT( pTexture != NULL );
|
||||
ASSERT( pTexture != nullptr );
|
||||
|
||||
if( m_pTexture != pTexture )
|
||||
{
|
||||
@@ -355,7 +355,7 @@ void Sprite::LoadFromTexture( RageTextureID ID )
|
||||
{
|
||||
// LOG->Trace( "Sprite::LoadFromTexture( %s )", ID.filename.c_str() );
|
||||
|
||||
RageTexture *pTexture = NULL;
|
||||
RageTexture *pTexture = nullptr;
|
||||
if( m_pTexture && m_pTexture->GetID() == ID )
|
||||
pTexture = m_pTexture;
|
||||
else
|
||||
@@ -390,7 +390,7 @@ void Sprite::LoadStatesFromTexture()
|
||||
// Assume the frames of this animation play in sequential order with 0.1 second delay.
|
||||
m_States.clear();
|
||||
|
||||
if( m_pTexture == NULL )
|
||||
if( m_pTexture == nullptr )
|
||||
{
|
||||
State newState;
|
||||
newState.fDelay = 0.1f;
|
||||
@@ -664,7 +664,7 @@ void Sprite::DrawTexture( const TweenState *state )
|
||||
|
||||
bool Sprite::EarlyAbortDraw() const
|
||||
{
|
||||
return m_pTexture == NULL;
|
||||
return m_pTexture == nullptr;
|
||||
}
|
||||
|
||||
void Sprite::DrawPrimitives()
|
||||
@@ -842,9 +842,9 @@ void Sprite::SetState( int iNewState )
|
||||
void Sprite::RecalcAnimationLengthSeconds()
|
||||
{
|
||||
m_animation_length_seconds = 0;
|
||||
FOREACH_CONST(State, m_States, s)
|
||||
for (State const &s : m_States)
|
||||
{
|
||||
m_animation_length_seconds += s->fDelay;
|
||||
m_animation_length_seconds += s.fDelay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ void Sprite::SetSecondsIntoAnimation( float fSeconds )
|
||||
|
||||
RString Sprite::GetTexturePath() const
|
||||
{
|
||||
if( m_pTexture==NULL )
|
||||
if( m_pTexture == nullptr )
|
||||
return RString();
|
||||
|
||||
return m_pTexture->GetID().filename;
|
||||
@@ -1275,7 +1275,7 @@ public:
|
||||
static int GetTexture( T* p, lua_State *L )
|
||||
{
|
||||
RageTexture *pTexture = p->GetTexture();
|
||||
if( pTexture != NULL )
|
||||
if( pTexture != nullptr )
|
||||
pTexture->PushSelf(L);
|
||||
else
|
||||
lua_pushnil( L );
|
||||
|
||||
Reference in New Issue
Block a user