Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements

Fix whitespace changes
This commit is contained in:
Michael Sundqvist
2022-07-31 22:14:38 +02:00
committed by Martin Natano
parent f0680a29fc
commit 0cba3579de
534 changed files with 3456 additions and 3488 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ void ActiveAttackList::Refresh()
{ {
const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks; const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks;
vector<RString> vsThemedMods; std::vector<RString> vsThemedMods;
for( unsigned i=0; i<attacks.size(); i++ ) for( unsigned i=0; i<attacks.size(); i++ )
{ {
const Attack& attack = attacks[i]; const Attack& attack = attacks[i];
+4 -4
View File
@@ -34,8 +34,8 @@ REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor );
float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat;
float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0; float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0;
vector<float> Actor::g_vfCurrentBGMBeatPlayer(NUM_PlayerNumber, 0); std::vector<float> Actor::g_vfCurrentBGMBeatPlayer(NUM_PlayerNumber, 0);
vector<float> Actor::g_vfCurrentBGMBeatPlayerNoOffset(NUM_PlayerNumber, 0); std::vector<float> Actor::g_vfCurrentBGMBeatPlayerNoOffset(NUM_PlayerNumber, 0);
Actor *Actor::Copy() const { return new Actor(*this); } Actor *Actor::Copy() const { return new Actor(*this); }
@@ -822,7 +822,7 @@ void Actor::UpdateTweening( float fDeltaTime )
bool bBeginning = TI.m_fTimeLeftInTween == TI.m_fTweenTime; bool bBeginning = TI.m_fTimeLeftInTween == TI.m_fTweenTime;
float fSecsToSubtract = min( TI.m_fTimeLeftInTween, fDeltaTime ); float fSecsToSubtract = std::min( TI.m_fTimeLeftInTween, fDeltaTime );
TI.m_fTimeLeftInTween -= fSecsToSubtract; TI.m_fTimeLeftInTween -= fSecsToSubtract;
fDeltaTime -= fSecsToSubtract; fDeltaTime -= fSecsToSubtract;
@@ -1537,7 +1537,7 @@ bool Actor::HasCommand( const RString &sCmdName ) const
const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const
{ {
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName ); std::map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
if( it == m_mapNameToCommands.end() ) if( it == m_mapNameToCommands.end() )
return nullptr; return nullptr;
return &it->second; return &it->second;
+6 -6
View File
@@ -632,7 +632,7 @@ protected:
Actor* m_FakeParent; Actor* m_FakeParent;
// WrapperStates provides a way to wrap the actor inside ActorFrames, // WrapperStates provides a way to wrap the actor inside ActorFrames,
// applicable to any actor, not just ones the theme creates. // applicable to any actor, not just ones the theme creates.
vector<Actor*> m_WrapperStates; std::vector<Actor*> m_WrapperStates;
/** @brief Some general information about the Tween. */ /** @brief Some general information about the Tween. */
struct TweenInfo struct TweenInfo
@@ -667,7 +667,7 @@ protected:
TweenState state; TweenState state;
TweenInfo info; TweenInfo info;
}; };
vector<TweenStateAndInfo *> m_Tweens; std::vector<TweenStateAndInfo *> m_Tweens;
/** @brief Temporary variables that are filled just before drawing */ /** @brief Temporary variables that are filled just before drawing */
TweenState *m_pTempState; TweenState *m_pTempState;
@@ -686,7 +686,7 @@ protected:
// Stuff for effects // Stuff for effects
#if defined(SSC_FUTURES) // be able to stack effects #if defined(SSC_FUTURES) // be able to stack effects
vector<Effect> m_Effects; std::vector<Effect> m_Effects;
#else // compatibility #else // compatibility
Effect m_Effect; Effect m_Effect;
#endif #endif
@@ -746,12 +746,12 @@ protected:
// global state // global state
static float g_fCurrentBGMTime, g_fCurrentBGMBeat; static float g_fCurrentBGMTime, g_fCurrentBGMBeat;
static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset; static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset;
static vector<float> g_vfCurrentBGMBeatPlayer; static std::vector<float> g_vfCurrentBGMBeatPlayer;
static vector<float> g_vfCurrentBGMBeatPlayerNoOffset; static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
private: private:
// commands // commands
map<RString, apActorCommands> m_mapNameToCommands; std::map<RString, apActorCommands> m_mapNameToCommands;
}; };
#endif #endif
+8 -8
View File
@@ -140,7 +140,7 @@ void ActorFrame::AddChild( Actor *pActor )
{ {
#ifdef DEBUG #ifdef DEBUG
// check that this Actor isn't already added. // check that this Actor isn't already added.
vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); std::vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor );
if( iter != m_SubActors.end() ) if( iter != m_SubActors.end() )
Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) ); Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) );
#endif #endif
@@ -154,7 +154,7 @@ void ActorFrame::AddChild( Actor *pActor )
void ActorFrame::RemoveChild( Actor *pActor ) void ActorFrame::RemoveChild( Actor *pActor )
{ {
vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); std::vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor );
if( iter != m_SubActors.end() ) if( iter != m_SubActors.end() )
m_SubActors.erase( iter ); m_SubActors.erase( iter );
} }
@@ -182,7 +182,7 @@ void ActorFrame::RemoveAllChildren()
void ActorFrame::MoveToTail( Actor* pActor ) void ActorFrame::MoveToTail( Actor* pActor )
{ {
vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); std::vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor );
if( iter == m_SubActors.end() ) // didn't find if( iter == m_SubActors.end() ) // didn't find
FAIL_M("Nonexistent actor"); FAIL_M("Nonexistent actor");
@@ -192,7 +192,7 @@ void ActorFrame::MoveToTail( Actor* pActor )
void ActorFrame::MoveToHead( Actor* pActor ) void ActorFrame::MoveToHead( Actor* pActor )
{ {
vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); std::vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor );
if( iter == m_SubActors.end() ) // didn't find if( iter == m_SubActors.end() ) // didn't find
FAIL_M("Nonexistent actor"); FAIL_M("Nonexistent actor");
@@ -259,7 +259,7 @@ void ActorFrame::DrawPrimitives()
// draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space
if( m_bDrawByZPosition ) if( m_bDrawByZPosition )
{ {
vector<Actor*> subs = m_SubActors; std::vector<Actor*> subs = m_SubActors;
ActorUtil::SortByZPosition( subs ); ActorUtil::SortByZPosition( subs );
for( unsigned i=0; i<subs.size(); i++ ) for( unsigned i=0; i<subs.size(); i++ )
{ {
@@ -474,7 +474,7 @@ void ActorFrame::UpdateInternal( float fDeltaTime )
Actor::UpdateInternal( fDeltaTime ); Actor::UpdateInternal( fDeltaTime );
// update all sub-Actors // update all sub-Actors
for( vector<Actor*>::iterator it=m_SubActors.begin(); it!=m_SubActors.end(); it++ ) for( std::vector<Actor*>::iterator it=m_SubActors.begin(); it!=m_SubActors.end(); it++ )
{ {
Actor *pActor = *it; Actor *pActor = *it;
pActor->Update(fDeltaTime); pActor->Update(fDeltaTime);
@@ -531,7 +531,7 @@ float ActorFrame::GetTweenTimeLeft() const
for( unsigned i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
{ {
const Actor* pActor = m_SubActors[i]; const Actor* pActor = m_SubActors[i];
m = max(m, m_fHibernateSecondsLeft + pActor->GetTweenTimeLeft()); m = std::max(m, m_fHibernateSecondsLeft + pActor->GetTweenTimeLeft());
} }
return m; return m;
@@ -702,7 +702,7 @@ public:
{ {
luaL_checktype( L, 1, LUA_TTABLE ); luaL_checktype( L, 1, LUA_TTABLE );
lua_pushvalue( L, 1 ); lua_pushvalue( L, 1 );
vector<float> coords; std::vector<float> coords;
LuaHelpers::ReadArrayFromTable( coords, L ); LuaHelpers::ReadArrayFromTable( coords, L );
lua_pop( L, 1 ); lua_pop( L, 1 );
if( coords.size() !=3 ) if( coords.size() !=3 )
+2 -2
View File
@@ -26,7 +26,7 @@ public:
virtual void RemoveChild( Actor *pActor ); virtual void RemoveChild( Actor *pActor );
void TransferChildren( ActorFrame *pTo ); void TransferChildren( ActorFrame *pTo );
Actor* GetChild( const RString &sName ); Actor* GetChild( const RString &sName );
vector<Actor*> GetChildren() { return m_SubActors; } std::vector<Actor*> GetChildren() { return m_SubActors; }
int GetNumChildren() const { return m_SubActors.size(); } int GetNumChildren() const { return m_SubActors.size(); }
/** @brief Remove all of the children from the frame. */ /** @brief Remove all of the children from the frame. */
@@ -99,7 +99,7 @@ protected:
void LoadChildrenFromNode( const XNode* pNode ); void LoadChildrenFromNode( const XNode* pNode );
/** @brief The children Actors used by the ActorFrame. */ /** @brief The children Actors used by the ActorFrame. */
vector<Actor*> m_SubActors; std::vector<Actor*> m_SubActors;
bool m_bPropagateCommands; bool m_bPropagateCommands;
bool m_bDeleteChildren; bool m_bDeleteChildren;
bool m_bDrawByZPosition; bool m_bDrawByZPosition;
+1 -1
View File
@@ -39,7 +39,7 @@ private:
RageTexture *m_pTexture; RageTexture *m_pTexture;
TextureMode m_TextureMode; TextureMode m_TextureMode;
}; };
vector<TextureUnitState> m_aTextureUnits; std::vector<TextureUnitState> m_aTextureUnits;
RectF m_Rect; RectF m_Rect;
}; };
+7 -7
View File
@@ -345,10 +345,10 @@ bool ActorMultiVertex::EarlyAbortDraw() const
void ActorMultiVertex::SetVertsFromSplinesInternal(size_t num_splines, size_t offset) void ActorMultiVertex::SetVertsFromSplinesInternal(size_t num_splines, size_t offset)
{ {
vector<RageSpriteVertex>& verts= AMV_DestTweenState().vertices; std::vector<RageSpriteVertex>& verts= AMV_DestTweenState().vertices;
size_t first= AMV_DestTweenState().FirstToDraw + offset; size_t first= AMV_DestTweenState().FirstToDraw + offset;
size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset; size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset;
vector<float> tper(num_splines, 0.0f); std::vector<float> tper(num_splines, 0.0f);
float num_parts= (static_cast<float>(num_verts) / float num_parts= (static_cast<float>(num_verts) /
static_cast<float>(num_splines)) - 1.0f; static_cast<float>(num_splines)) - 1.0f;
for(size_t i= 0; i < num_splines; ++i) for(size_t i= 0; i < num_splines; ++i)
@@ -357,7 +357,7 @@ void ActorMultiVertex::SetVertsFromSplinesInternal(size_t num_splines, size_t of
} }
for(size_t v= 0; v < num_verts; ++v) for(size_t v= 0; v < num_verts; ++v)
{ {
vector<float> pos; std::vector<float> pos;
const int spi= v%num_splines; const int spi= v%num_splines;
float part= static_cast<float>(v/num_splines); float part= static_cast<float>(v/num_splines);
_splines[spi].evaluate(part * tper[spi], pos); _splines[spi].evaluate(part * tper[spi], pos);
@@ -438,8 +438,8 @@ void ActorMultiVertex::SetSecondsIntoAnimation(float seconds)
void ActorMultiVertex::UpdateAnimationState(bool force_update) void ActorMultiVertex::UpdateAnimationState(bool force_update)
{ {
AMV_TweenState& dest= AMV_DestTweenState(); AMV_TweenState& dest= AMV_DestTweenState();
vector<RageSpriteVertex>& verts= dest.vertices; std::vector<RageSpriteVertex>& verts= dest.vertices;
vector<size_t>& qs= dest.quad_states; std::vector<size_t>& qs= dest.quad_states;
if(!_use_animation_state || _states.empty() || if(!_use_animation_state || _states.empty() ||
dest._DrawMode == DrawMode_LineStrip || qs.empty()) dest._DrawMode == DrawMode_LineStrip || qs.empty())
{ return; } { return; }
@@ -590,7 +590,7 @@ void ActorMultiVertex::Update(float fDelta)
UpdateAnimationState(); UpdateAnimationState();
if(!skip_this_movie_update && _decode_movie) if(!skip_this_movie_update && _decode_movie)
{ {
_Texture->DecodeSeconds(max(0, time_passed)); _Texture->DecodeSeconds(std::max(0.0f, time_passed));
} }
} }
@@ -1068,7 +1068,7 @@ public:
{ {
luaL_error(L, "The texture must be set before adding states."); luaL_error(L, "The texture must be set before adding states.");
} }
vector<ActorMultiVertex::State> new_states; std::vector<ActorMultiVertex::State> new_states;
size_t num_states= lua_objlen(L, 1); size_t num_states= lua_objlen(L, 1);
new_states.resize(num_states); new_states.resize(num_states);
for(size_t i= 0; i < num_states; ++i) for(size_t i= 0; i < num_states; ++i)
+7 -7
View File
@@ -48,8 +48,8 @@ public:
void SetDrawState( DrawMode dm, int first, int num ); void SetDrawState( DrawMode dm, int first, int num );
int GetSafeNumToDraw( DrawMode dm, int num ) const; int GetSafeNumToDraw( DrawMode dm, int num ) const;
vector<RageSpriteVertex> vertices; std::vector<RageSpriteVertex> vertices;
vector<size_t> quad_states; std::vector<size_t> quad_states;
DrawMode _DrawMode; DrawMode _DrawMode;
int FirstToDraw; int FirstToDraw;
@@ -128,7 +128,7 @@ public:
{ ASSERT(i < _states.size()); return _states[i]; } { ASSERT(i < _states.size()); return _states[i]; }
void SetStateData(size_t i, const State& s) void SetStateData(size_t i, const State& s)
{ ASSERT(i < _states.size()); _states[i]= s; } { ASSERT(i < _states.size()); _states[i]= s; }
void SetStateProperties(const vector<State>& new_states) void SetStateProperties(const std::vector<State>& new_states)
{ _states= new_states; SetState(0); } { _states= new_states; SetState(0); }
void SetState(size_t i); void SetState(size_t i);
void SetAllStateDelays(float delay); void SetAllStateDelays(float delay);
@@ -153,8 +153,8 @@ public:
private: private:
RageTexture* _Texture; RageTexture* _Texture;
vector<RageSpriteVertex> _Vertices; std::vector<RageSpriteVertex> _Vertices;
vector<AMV_TweenState> AMV_Tweens; std::vector<AMV_TweenState> AMV_Tweens;
AMV_TweenState AMV_current; AMV_TweenState AMV_current;
AMV_TweenState AMV_start; AMV_TweenState AMV_start;
@@ -166,12 +166,12 @@ private:
// Four splines for controlling vert positions, because quads drawmode // Four splines for controlling vert positions, because quads drawmode
// requires four. -Kyz // requires four. -Kyz
vector<CubicSplineN> _splines; std::vector<CubicSplineN> _splines;
bool _skip_next_update; bool _skip_next_update;
float _secs_into_state; float _secs_into_state;
size_t _cur_state; size_t _cur_state;
vector<State> _states; std::vector<State> _states;
}; };
/** /**
+1 -1
View File
@@ -269,7 +269,7 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives )
iLastItemToDraw = clamp( iLastItemToDraw, 0, m_iNumItems ); iLastItemToDraw = clamp( iLastItemToDraw, 0, m_iNumItems );
} }
vector<Actor*> subs; std::vector<Actor*> subs;
{ {
// Shift m_SubActors so iFirstItemToDraw is at the beginning. // Shift m_SubActors so iFirstItemToDraw is at the beginning.
+13 -13
View File
@@ -18,7 +18,7 @@
// Actor registration // Actor registration
static map<RString,CreateActorFn> *g_pmapRegistrees = nullptr; static std::map<RString,CreateActorFn> *g_pmapRegistrees = nullptr;
static bool IsRegistered( const RString& sClassName ) static bool IsRegistered( const RString& sClassName )
{ {
@@ -28,9 +28,9 @@ static bool IsRegistered( const RString& sClassName )
void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn ) void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn )
{ {
if( g_pmapRegistrees == nullptr ) if( g_pmapRegistrees == nullptr )
g_pmapRegistrees = new map<RString,CreateActorFn>; g_pmapRegistrees = new std::map<RString,CreateActorFn>;
map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName ); std::map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName );
ASSERT_M( iter == g_pmapRegistrees->end(), ssprintf("Actor class '%s' already registered.", sClassName.c_str()) ); ASSERT_M( iter == g_pmapRegistrees->end(), ssprintf("Actor class '%s' already registered.", sClassName.c_str()) );
(*g_pmapRegistrees)[sClassName] = pfn; (*g_pmapRegistrees)[sClassName] = pfn;
@@ -48,7 +48,7 @@ bool ActorUtil::ResolvePath( RString &sPath, const RString &sName, bool optional
RageFileManager::FileType ft = FILEMAN->GetFileType( sPath ); RageFileManager::FileType ft = FILEMAN->GetFileType( sPath );
if( ft != RageFileManager::TYPE_FILE && ft != RageFileManager::TYPE_DIR ) if( ft != RageFileManager::TYPE_FILE && ft != RageFileManager::TYPE_DIR )
{ {
vector<RString> asPaths; std::vector<RString> asPaths;
GetDirListing( sPath + "*", asPaths, false, true ); // return path too GetDirListing( sPath + "*", asPaths, false, true ); // return path too
if( asPaths.empty() ) if( asPaths.empty() )
@@ -193,7 +193,7 @@ Actor *ActorUtil::LoadFromNode( const XNode* _pNode, Actor *pParentActor )
if( !bHasClass && bLegacy ) if( !bHasClass && bLegacy )
sClass = GetLegacyActorClass( &node ); sClass = GetLegacyActorClass( &node );
map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClass ); std::map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClass );
if( iter == g_pmapRegistrees->end() ) if( iter == g_pmapRegistrees->end() )
{ {
RString sFile; RString sFile;
@@ -305,7 +305,7 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor )
{ {
case FT_Lua: case FT_Lua:
{ {
unique_ptr<XNode> pNode( LoadXNodeFromLuaShowErrors(sPath) ); std::unique_ptr<XNode> pNode( LoadXNodeFromLuaShowErrors(sPath) );
if( pNode.get() == nullptr ) if( pNode.get() == nullptr )
{ {
// XNode will warn about the error // XNode will warn about the error
@@ -471,7 +471,7 @@ void ActorUtil::LoadAllCommands( Actor& actor, const RString &sMetricsGroup )
void ActorUtil::LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName ) void ActorUtil::LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName )
{ {
set<RString> vsValueNames; std::set<RString> vsValueNames;
THEME->GetMetricsThatBeginWith( sMetricsGroup, sName, vsValueNames ); THEME->GetMetricsThatBeginWith( sMetricsGroup, sName, vsValueNames );
for (RString const & sv : vsValueNames) for (RString const & sv : vsValueNames)
@@ -490,7 +490,7 @@ static bool CompareActorsByZPosition(const Actor *p1, const Actor *p2)
return p1->GetZ() < p2->GetZ(); return p1->GetZ() < p2->GetZ();
} }
void ActorUtil::SortByZPosition( vector<Actor*> &vActors ) void ActorUtil::SortByZPosition( std::vector<Actor*> &vActors )
{ {
// Preserve ordering of Actors with equal Z positions. // Preserve ordering of Actors with equal Z positions.
stable_sort( vActors.begin(), vActors.end(), CompareActorsByZPosition ); stable_sort( vActors.begin(), vActors.end(), CompareActorsByZPosition );
@@ -511,8 +511,8 @@ XToString( FileType );
LuaXType( FileType ); LuaXType( FileType );
// convenience so the for-loop lines can be shorter. // convenience so the for-loop lines can be shorter.
typedef map<RString, FileType> etft_cont_t; typedef std::map<RString, FileType> etft_cont_t;
typedef map<FileType, vector<RString> > fttel_cont_t; typedef std::map<FileType, std::vector<RString> > fttel_cont_t;
etft_cont_t ExtensionToFileType; etft_cont_t ExtensionToFileType;
fttel_cont_t FileTypeToExtensionList; fttel_cont_t FileTypeToExtensionList;
@@ -569,18 +569,18 @@ void ActorUtil::InitFileTypeLists()
} }
} }
vector<RString> const& ActorUtil::GetTypeExtensionList(FileType ft) std::vector<RString> const& ActorUtil::GetTypeExtensionList(FileType ft)
{ {
return FileTypeToExtensionList[ft]; return FileTypeToExtensionList[ft];
} }
void ActorUtil::AddTypeExtensionsToList(FileType ft, vector<RString>& add_to) void ActorUtil::AddTypeExtensionsToList(FileType ft, std::vector<RString>& add_to)
{ {
fttel_cont_t::iterator ext_list= FileTypeToExtensionList.find(ft); fttel_cont_t::iterator ext_list= FileTypeToExtensionList.find(ft);
if(ext_list != FileTypeToExtensionList.end()) if(ext_list != FileTypeToExtensionList.end())
{ {
add_to.reserve(add_to.size() + ext_list->second.size()); add_to.reserve(add_to.size() + ext_list->second.size());
for(vector<RString>::iterator curr= ext_list->second.begin(); for(std::vector<RString>::iterator curr= ext_list->second.begin();
curr != ext_list->second.end(); ++curr) curr != ext_list->second.end(); ++curr)
{ {
add_to.push_back(*curr); add_to.push_back(*curr);
+3 -3
View File
@@ -48,8 +48,8 @@ const RString& FileTypeToString( FileType ft );
namespace ActorUtil namespace ActorUtil
{ {
void InitFileTypeLists(); void InitFileTypeLists();
vector<RString> const& GetTypeExtensionList(FileType ft); std::vector<RString> const& GetTypeExtensionList(FileType ft);
void AddTypeExtensionsToList(FileType ft, vector<RString>& add_to); void AddTypeExtensionsToList(FileType ft, std::vector<RString>& add_to);
// Every screen should register its class at program initialization. // Every screen should register its class at program initialization.
void Register( const RString& sClassName, CreateActorFn pfn ); void Register( const RString& sClassName, CreateActorFn pfn );
@@ -124,7 +124,7 @@ namespace ActorUtil
bool ResolvePath( RString &sPath, const RString &sName, bool optional= false ); bool ResolvePath( RString &sPath, const RString &sName, bool optional= false );
void SortByZPosition( vector<Actor*> &vActors ); void SortByZPosition( std::vector<Actor*> &vActors );
FileType GetFileType( const RString &sPath ); FileType GetFileType( const RString &sPath );
}; };
+18 -18
View File
@@ -43,12 +43,12 @@
#include "ScreenManager.h" #include "ScreenManager.h"
vector<TimingData> AdjustSync::s_vpTimingDataOriginal; std::vector<TimingData> AdjustSync::s_vpTimingDataOriginal;
float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0.0f; float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0.0f;
int AdjustSync::s_iAutosyncOffsetSample = 0; int AdjustSync::s_iAutosyncOffsetSample = 0;
float AdjustSync::s_fAutosyncOffset[AdjustSync::OFFSET_SAMPLE_COUNT]; float AdjustSync::s_fAutosyncOffset[AdjustSync::OFFSET_SAMPLE_COUNT];
float AdjustSync::s_fStandardDeviation = 0.0f; float AdjustSync::s_fStandardDeviation = 0.0f;
vector< pair<float, float> > AdjustSync::s_vAutosyncTempoData; std::vector<std::pair<float, float>> AdjustSync::s_vAutosyncTempoData;
float AdjustSync::s_fAverageError = 0.0f; float AdjustSync::s_fAverageError = 0.0f;
const float AdjustSync::ERROR_TOO_HIGH = 0.025f; const float AdjustSync::ERROR_TOO_HIGH = 0.025f;
int AdjustSync::s_iStepsFiltered = 0; int AdjustSync::s_iStepsFiltered = 0;
@@ -60,7 +60,7 @@ void AdjustSync::ResetOriginalSyncData()
if( GAMESTATE->m_pCurSong ) if( GAMESTATE->m_pCurSong )
{ {
s_vpTimingDataOriginal.push_back(GAMESTATE->m_pCurSong->m_SongTiming); s_vpTimingDataOriginal.push_back(GAMESTATE->m_pCurSong->m_SongTiming);
const vector<Steps *>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps(); const std::vector<Steps*>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps();
for (Steps const *s : vpSteps) for (Steps const *s : vpSteps)
{ {
s_vpTimingDataOriginal.push_back(s->m_Timing); s_vpTimingDataOriginal.push_back(s->m_Timing);
@@ -86,7 +86,7 @@ bool AdjustSync::IsSyncDataChanged()
// Can't sync in course modes // Can't sync in course modes
if( GAMESTATE->IsCourseMode() ) if( GAMESTATE->IsCourseMode() )
return false; return false;
vector<RString> vs; std::vector<RString> vs;
AdjustSync::GetSyncChangeTextGlobal( vs ); AdjustSync::GetSyncChangeTextGlobal( vs );
AdjustSync::GetSyncChangeTextSong( vs ); AdjustSync::GetSyncChangeTextSong( vs );
return !vs.empty(); return !vs.empty();
@@ -127,7 +127,7 @@ void AdjustSync::RevertSyncChanges()
GAMESTATE->m_pCurSong->m_SongTiming = s_vpTimingDataOriginal[0]; GAMESTATE->m_pCurSong->m_SongTiming = s_vpTimingDataOriginal[0];
unsigned location = 1; unsigned location = 1;
const vector<Steps *>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps(); const std::vector<Steps*>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps();
for (Steps *s : vpSteps) for (Steps *s : vpSteps)
{ {
s->m_Timing = s_vpTimingDataOriginal[location]; s->m_Timing = s_vpTimingDataOriginal[location];
@@ -152,7 +152,7 @@ void AdjustSync::HandleAutosync( float fNoteOffBySeconds, float fStepTime )
case AutosyncType_Tempo: case AutosyncType_Tempo:
{ {
// We collect all of the data and process it at the end // We collect all of the data and process it at the end
s_vAutosyncTempoData.push_back( make_pair(fStepTime, fNoteOffBySeconds) ); s_vAutosyncTempoData.push_back( std::make_pair(fStepTime, fNoteOffBySeconds) );
break; break;
} }
case AutosyncType_Machine: case AutosyncType_Machine:
@@ -198,7 +198,7 @@ void AdjustSync::AutosyncOffset()
case AutosyncType_Song: case AutosyncType_Song:
{ {
GAMESTATE->m_pCurSong->m_SongTiming.m_fBeat0OffsetInSeconds += mean; GAMESTATE->m_pCurSong->m_SongTiming.m_fBeat0OffsetInSeconds += mean;
const vector<Steps *>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps(); const std::vector<Steps*>& vpSteps = GAMESTATE->m_pCurSong->GetAllSteps();
for (Steps *s : vpSteps) for (Steps *s : vpSteps)
{ {
// Empty TimingData means it's inherited // Empty TimingData means it's inherited
@@ -257,7 +257,7 @@ void AdjustSync::AutosyncTempo()
const float fScaleBPM = 1.0f/(1.0f - fSlope); const float fScaleBPM = 1.0f/(1.0f - fSlope);
TimingData &timing = GAMESTATE->m_pCurSong->m_SongTiming; TimingData &timing = GAMESTATE->m_pCurSong->m_SongTiming;
const vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM); const std::vector<TimingSegment*> &bpms = timing.GetTimingSegments(SEGMENT_BPM);
for (unsigned i = 0; i < bpms.size(); i++) for (unsigned i = 0; i < bpms.size(); i++)
{ {
const BPMSegment *b = ToBPM( bpms[i] ); const BPMSegment *b = ToBPM( bpms[i] );
@@ -267,14 +267,14 @@ void AdjustSync::AutosyncTempo()
/* We assume that the stops were measured as a number of beats. /* We assume that the stops were measured as a number of beats.
* Therefore, if we change the bpms, we need to make a similar * Therefore, if we change the bpms, we need to make a similar
* change to the stops. */ * change to the stops. */
const vector<TimingSegment *> &stops = timing.GetTimingSegments(SEGMENT_STOP); const std::vector<TimingSegment*> &stops = timing.GetTimingSegments(SEGMENT_STOP);
for (unsigned i = 0; i < stops.size(); i++) for (unsigned i = 0; i < stops.size(); i++)
{ {
const StopSegment *s = ToStop( stops[i] ); const StopSegment *s = ToStop( stops[i] );
timing.AddSegment( StopSegment(s->GetRow(), s->GetPause() * (1.0f - fSlope)) ); timing.AddSegment( StopSegment(s->GetRow(), s->GetPause() * (1.0f - fSlope)) );
} }
// Do the same for delays. // Do the same for delays.
const vector<TimingSegment *> &delays = timing.GetTimingSegments(SEGMENT_DELAY); const std::vector<TimingSegment*> &delays = timing.GetTimingSegments(SEGMENT_DELAY);
for (unsigned i = 0; i < delays.size(); i++) for (unsigned i = 0; i < delays.size(); i++)
{ {
const DelaySegment *s = ToDelay( delays[i] ); const DelaySegment *s = ToDelay( delays[i] );
@@ -307,7 +307,7 @@ static LocalizedString ERROR ("AdjustSync", "Average Error %.5fs");
static LocalizedString ETC ("AdjustSync", "Etc."); static LocalizedString ETC ("AdjustSync", "Etc.");
static LocalizedString TAPS_IGNORED ("AdjustSync", "%d taps ignored."); static LocalizedString TAPS_IGNORED ("AdjustSync", "%d taps ignored.");
void AdjustSync::GetSyncChangeTextGlobal( vector<RString> &vsAddTo ) void AdjustSync::GetSyncChangeTextGlobal( std::vector<RString> &vsAddTo )
{ {
{ {
float fOld = Quantize( AdjustSync::s_fGlobalOffsetSecondsOriginal, 0.001f ); float fOld = Quantize( AdjustSync::s_fGlobalOffsetSecondsOriginal, 0.001f );
@@ -325,7 +325,7 @@ void AdjustSync::GetSyncChangeTextGlobal( vector<RString> &vsAddTo )
} }
// XXX: needs cleanup still -- vyhd // XXX: needs cleanup still -- vyhd
void AdjustSync::GetSyncChangeTextSong( vector<RString> &vsAddTo ) void AdjustSync::GetSyncChangeTextSong( std::vector<RString> &vsAddTo )
{ {
if( GAMESTATE->m_pCurSong.Get() ) if( GAMESTATE->m_pCurSong.Get() )
{ {
@@ -354,8 +354,8 @@ void AdjustSync::GetSyncChangeTextSong( vector<RString> &vsAddTo )
} }
} }
const vector<TimingSegment *> &bpmTest = testing.GetTimingSegments(SEGMENT_BPM); const std::vector<TimingSegment*> &bpmTest = testing.GetTimingSegments(SEGMENT_BPM);
const vector<TimingSegment *> &bpmOrig = original.GetTimingSegments(SEGMENT_BPM); const std::vector<TimingSegment*> &bpmOrig = original.GetTimingSegments(SEGMENT_BPM);
SEGMENTS_MISMATCH_MESSAGE(bpmOrig, bpmTest, bpm); SEGMENTS_MISMATCH_MESSAGE(bpmOrig, bpmTest, bpm);
for(size_t i= 0; i < bpmTest.size() && i < bpmOrig.size(); i++) for(size_t i= 0; i < bpmTest.size() && i < bpmOrig.size(); i++)
{ {
@@ -377,8 +377,8 @@ void AdjustSync::GetSyncChangeTextSong( vector<RString> &vsAddTo )
vsAddTo.push_back( s ); vsAddTo.push_back( s );
} }
const vector<TimingSegment *> &stopTest = testing.GetTimingSegments(SEGMENT_STOP); const std::vector<TimingSegment*> &stopTest = testing.GetTimingSegments(SEGMENT_STOP);
const vector<TimingSegment *> &stopOrig = original.GetTimingSegments(SEGMENT_STOP); const std::vector<TimingSegment*> &stopOrig = original.GetTimingSegments(SEGMENT_STOP);
SEGMENTS_MISMATCH_MESSAGE(stopOrig, stopTest, stop); SEGMENTS_MISMATCH_MESSAGE(stopOrig, stopTest, stop);
for(size_t i= 0; i < stopTest.size() && i < stopOrig.size(); i++) for(size_t i= 0; i < stopTest.size() && i < stopOrig.size(); i++)
@@ -400,8 +400,8 @@ void AdjustSync::GetSyncChangeTextSong( vector<RString> &vsAddTo )
vsAddTo.push_back( s ); vsAddTo.push_back( s );
} }
const vector<TimingSegment *> &delyTest = testing.GetTimingSegments(SEGMENT_DELAY); const std::vector<TimingSegment*> &delyTest = testing.GetTimingSegments(SEGMENT_DELAY);
const vector<TimingSegment *> &delyOrig = original.GetTimingSegments(SEGMENT_DELAY); const std::vector<TimingSegment*> &delyOrig = original.GetTimingSegments(SEGMENT_DELAY);
SEGMENTS_MISMATCH_MESSAGE(delyOrig, delyTest, delay); SEGMENTS_MISMATCH_MESSAGE(delyOrig, delyTest, delay);
for(size_t i= 0; i < delyTest.size() && i < delyOrig.size(); i++) for(size_t i= 0; i < delyTest.size() && i < delyOrig.size(); i++)
+4 -4
View File
@@ -17,7 +17,7 @@ public:
* @brief The original TimingData before adjustments were made. * @brief The original TimingData before adjustments were made.
* *
* This is designed to work with Split Timing. */ * This is designed to work with Split Timing. */
static vector<TimingData> s_vpTimingDataOriginal; static std::vector<TimingData> s_vpTimingDataOriginal;
static float s_fGlobalOffsetSecondsOriginal; static float s_fGlobalOffsetSecondsOriginal;
/* We only want to call the Reset methods before a song, not immediately after /* We only want to call the Reset methods before a song, not immediately after
@@ -35,8 +35,8 @@ public:
static void HandleSongEnd(); static void HandleSongEnd();
static void AutosyncOffset(); static void AutosyncOffset();
static void AutosyncTempo(); static void AutosyncTempo();
static void GetSyncChangeTextGlobal( vector<RString> &vsAddTo ); static void GetSyncChangeTextGlobal( std::vector<RString> &vsAddTo );
static void GetSyncChangeTextSong( vector<RString> &vsAddTo ); static void GetSyncChangeTextSong( std::vector<RString> &vsAddTo );
/** @brief The minimum number of steps to hit for syncing purposes. */ /** @brief The minimum number of steps to hit for syncing purposes. */
static const int OFFSET_SAMPLE_COUNT = 24; static const int OFFSET_SAMPLE_COUNT = 24;
@@ -49,7 +49,7 @@ public:
// reject the recorded data for the Least Squares Regression. // reject the recorded data for the Least Squares Regression.
static const float ERROR_TOO_HIGH; static const float ERROR_TOO_HIGH;
static vector< pair<float, float> > s_vAutosyncTempoData; static std::vector<std::pair<float, float>> s_vAutosyncTempoData;
static float s_fAverageError; static float s_fAverageError;
static int s_iStepsFiltered; static int s_iStepsFiltered;
}; };
+4 -4
View File
@@ -29,7 +29,7 @@ AnnouncerManager::~AnnouncerManager()
LUA->UnsetGlobal( "ANNOUNCER" ); LUA->UnsetGlobal( "ANNOUNCER" );
} }
void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo ) void AnnouncerManager::GetAnnouncerNames( std::vector<RString>& AddTo )
{ {
GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true ); GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
@@ -47,7 +47,7 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
if( sAnnouncerName == "" ) if( sAnnouncerName == "" )
return true; return true;
vector<RString> asAnnouncerNames; std::vector<RString> asAnnouncerNames;
GetAnnouncerNames( asAnnouncerNames ); GetAnnouncerNames( asAnnouncerNames );
for( unsigned i=0; i<asAnnouncerNames.size(); i++ ) for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
if( 0==strcasecmp(sAnnouncerName, asAnnouncerNames[i]) ) if( 0==strcasecmp(sAnnouncerName, asAnnouncerNames[i]) )
@@ -154,7 +154,7 @@ bool AnnouncerManager::HasSoundsFor( RString sFolderName )
void AnnouncerManager::NextAnnouncer() void AnnouncerManager::NextAnnouncer()
{ {
vector<RString> as; std::vector<RString> as;
GetAnnouncerNames( as ); GetAnnouncerNames( as );
if( as.size()==0 ) if( as.size()==0 )
return; return;
@@ -186,7 +186,7 @@ public:
static int DoesAnnouncerExist( T* p, lua_State *L ) { lua_pushboolean(L, p->DoesAnnouncerExist( SArg(1) )); return 1; } static int DoesAnnouncerExist( T* p, lua_State *L ) { lua_pushboolean(L, p->DoesAnnouncerExist( SArg(1) )); return 1; }
static int GetAnnouncerNames( T* p, lua_State *L ) static int GetAnnouncerNames( T* p, lua_State *L )
{ {
vector<RString> vAnnouncers; std::vector<RString> vAnnouncers;
p->GetAnnouncerNames( vAnnouncers ); p->GetAnnouncerNames( vAnnouncers );
LuaHelpers::CreateTableFromArray(vAnnouncers, L); LuaHelpers::CreateTableFromArray(vAnnouncers, L);
return 1; return 1;
+1 -1
View File
@@ -12,7 +12,7 @@ public:
/** /**
* @brief Retrieve the announcer names. * @brief Retrieve the announcer names.
* @param AddTo the list of announcer names. */ * @param AddTo the list of announcer names. */
void GetAnnouncerNames( vector<RString>& AddTo ); void GetAnnouncerNames( std::vector<RString>& AddTo );
/** /**
* @brief Determine if the specified announcer exists. * @brief Determine if the specified announcer exists.
* @param sAnnouncerName the announcer we're checking for. * @param sAnnouncerName the announcer we're checking for.
+5 -5
View File
@@ -295,8 +295,8 @@ void ArrowEffects::Init(PlayerNumber pn)
// Using the x offset when the dimension might be y or z feels so // Using the x offset when the dimension might be y or z feels so
// wrong, but it provides min and max values when otherwise the // wrong, but it provides min and max values when otherwise the
// limits would just be zero, which would make it do nothing. -Kyz // limits would just be zero, which would make it do nothing. -Kyz
data.m_MinTornado[dimension][col_id] = min(pCols[i].fXOffset, data.m_MinTornado[dimension][col_id]); data.m_MinTornado[dimension][col_id] = std::min(pCols[i].fXOffset, data.m_MinTornado[dimension][col_id]);
data.m_MaxTornado[dimension][col_id] = max(pCols[i].fXOffset, data.m_MaxTornado[dimension][col_id]); data.m_MaxTornado[dimension][col_id] = std::max(pCols[i].fXOffset, data.m_MaxTornado[dimension][col_id]);
} }
} }
@@ -433,7 +433,7 @@ void ArrowEffects::SetCurrentOptions(const PlayerOptions* options)
static float GetDisplayedBeat( const PlayerState* pPlayerState, float beat ) static float GetDisplayedBeat( const PlayerState* pPlayerState, float beat )
{ {
// do a binary search here // do a binary search here
const vector<CacheDisplayedBeat> &data = pPlayerState->m_CacheDisplayedBeat; const std::vector<CacheDisplayedBeat> &data = pPlayerState->m_CacheDisplayedBeat;
int max = data.size() - 1; int max = data.size() - 1;
int l = 0, r = max; int l = 0, r = max;
while( l <= r ) while( l <= r )
@@ -856,7 +856,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
{ {
// Allow Tiny to pull tracks together, but not to push them apart. // Allow Tiny to pull tracks together, but not to push them apart.
float fTinyPercent = fEffects[PlayerOptions::EFFECT_TINY]; float fTinyPercent = fEffects[PlayerOptions::EFFECT_TINY];
fTinyPercent = min( powf(TINY_PERCENT_BASE, fTinyPercent), (float)TINY_PERCENT_GATE ); fTinyPercent = std::min( powf(TINY_PERCENT_BASE, fTinyPercent), (float)TINY_PERCENT_GATE );
fPixelOffsetFromCenter *= fTinyPercent; fPixelOffsetFromCenter *= fTinyPercent;
} }
@@ -1120,7 +1120,7 @@ float ArrowGetPercentVisible(float fYPosWithoutReverse, int iCol, float fYOffset
* fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]; * fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH];
} }
return clamp( 1+fVisibleAdjust, 0, 1 ); return clamp(1 + fVisibleAdjust, 0.0f, 1.0f);
} }
float ArrowEffects::GetAlpha( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar) float ArrowEffects::GetAlpha( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar)
+4 -4
View File
@@ -33,7 +33,7 @@ void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlay
ASSERT( pPlayerState != nullptr ); ASSERT( pPlayerState != nullptr );
/* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */ /* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */
fStartBeat = min( GAMESTATE->m_Position.m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat ); fStartBeat = std::min( GAMESTATE->m_Position.m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat );
fStartBeat = truncf(fStartBeat)+1; fStartBeat = truncf(fStartBeat)+1;
const TimingData &timing = pSong->m_SongTiming; const TimingData &timing = pSong->m_SongTiming;
@@ -84,7 +84,7 @@ RString Attack::GetTextDescription() const
int Attack::GetNumAttacks() const int Attack::GetNumAttacks() const
{ {
vector<RString> tmp; std::vector<RString> tmp;
split(this->sModifiers, ",", tmp); split(this->sModifiers, ",", tmp);
return tmp.size(); return tmp.size();
} }
@@ -94,9 +94,9 @@ bool AttackArray::ContainsTransformOrTurn() const
return std::any_of((*this).begin(), (*this).end(), [](Attack const &a) { return a.ContainsTransformOrTurn(); }); return std::any_of((*this).begin(), (*this).end(), [](Attack const &a) { return a.ContainsTransformOrTurn(); });
} }
vector<RString> AttackArray::ToVectorString() const std::vector<RString> AttackArray::ToVectorString() const
{ {
vector<RString> ret; std::vector<RString> ret;
for (Attack const &a : *this) for (Attack const &a : *this)
{ {
ret.push_back(ssprintf("TIME=%f:LEN=%f:MODS=%s", ret.push_back(ssprintf("TIME=%f:LEN=%f:MODS=%s",
+2 -2
View File
@@ -69,7 +69,7 @@ struct Attack
int GetNumAttacks() const; int GetNumAttacks() const;
}; };
struct AttackArray : public vector<Attack> struct AttackArray : public std::vector<Attack>
{ {
/** /**
* @brief Determine if the list of attacks contains a transform or turn mod. * @brief Determine if the list of attacks contains a transform or turn mod.
@@ -79,7 +79,7 @@ struct AttackArray : public vector<Attack>
/** /**
* @brief Return a string representation used for simfiles. * @brief Return a string representation used for simfiles.
* @return the string representation. */ * @return the string representation. */
vector<RString> ToVectorString() const; std::vector<RString> ToVectorString() const;
/** /**
* @brief Adjust the starting time of all attacks. * @brief Adjust the starting time of all attacks.
+2 -2
View File
@@ -42,7 +42,7 @@ void AttackDisplay::Init( const PlayerState* pPlayerState )
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
return; return;
set<RString> attacks; std::set<RString> attacks;
for( int al=0; al<NUM_ATTACK_LEVELS; al++ ) for( int al=0; al<NUM_ATTACK_LEVELS; al++ )
{ {
const Character *ch = GAMESTATE->m_pCurCharacters[pn]; const Character *ch = GAMESTATE->m_pCurCharacters[pn];
@@ -52,7 +52,7 @@ void AttackDisplay::Init( const PlayerState* pPlayerState )
attacks.insert( asAttacks[att] ); attacks.insert( asAttacks[att] );
} }
for( set<RString>::const_iterator it = attacks.begin(); it != attacks.end(); ++it ) for( std::set<RString>::const_iterator it = attacks.begin(); it != attacks.end(); ++it )
{ {
const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true ); const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true );
if( path == "" ) if( path == "" )
+6 -6
View File
@@ -67,7 +67,7 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
* This leads to failure later on. * This leads to failure later on.
* We need a better way to prevent this. */ * We need a better way to prevent this. */
if( m_ndAutoKeysoundsOnly[pn].GetNextTapNoteRowForTrack( t, iNextRowForPlayer ) ) if( m_ndAutoKeysoundsOnly[pn].GetNextTapNoteRowForTrack( t, iNextRowForPlayer ) )
iNextRow = min( iNextRow, iNextRowForPlayer ); iNextRow = std::min( iNextRow, iNextRowForPlayer );
} }
if( iNextRow == INT_MAX ) if( iNextRow == INT_MAX )
@@ -111,7 +111,7 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
pPlayer2 = nullptr; pPlayer2 = nullptr;
pShared = nullptr; pShared = nullptr;
vector<RString> vsMusicFile; std::vector<RString> vsMusicFile;
const RString sMusicPath = GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()]->GetMusicPath(); const RString sMusicPath = GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()]->GetMusicPath();
if( !sMusicPath.empty() ) if( !sMusicPath.empty() )
@@ -126,7 +126,7 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
} }
vector<RageSoundReader *> vpSounds; std::vector<RageSoundReader *> vpSounds;
for (RString const &s : vsMusicFile) for (RString const &s : vsMusicFile)
{ {
RString sError; RString sError;
@@ -239,7 +239,7 @@ void AutoKeysounds::FinishLoading()
Song* pSong = GAMESTATE->m_pCurSong; Song* pSong = GAMESTATE->m_pCurSong;
vector<RageSoundReader *> apSounds; std::vector<RageSoundReader *> apSounds;
LoadTracks( pSong, m_pSharedSound, m_pPlayerSounds[0], m_pPlayerSounds[1] ); LoadTracks( pSong, m_pSharedSound, m_pPlayerSounds[0], m_pPlayerSounds[1] );
// Load autoplay sounds, if any. // Load autoplay sounds, if any.
@@ -287,7 +287,7 @@ void AutoKeysounds::FinishLoading()
} }
if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->GetMasterPlayerNumber() == PLAYER_2 ) if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->GetMasterPlayerNumber() == PLAYER_2 )
swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] ); std::swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] );
if( apSounds.size() > 1 ) if( apSounds.size() > 1 )
{ {
@@ -319,7 +319,7 @@ void AutoKeysounds::Update( float fDelta )
float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ); float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds );
int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
iRowNow = max( 0, iRowNow ); iRowNow = std::max( 0, iRowNow );
static int iRowLastCrossed = 0; static int iRowLastCrossed = 0;
float fBeatLast = roundf(NoteRowToBeat(iRowLastCrossed)); float fBeatLast = roundf(NoteRowToBeat(iRowLastCrossed));
+1 -1
View File
@@ -25,7 +25,7 @@ protected:
static void LoadTracks( const Song *pSong, RageSoundReader *&pGlobal, RageSoundReader *&pPlayer1, RageSoundReader *&pPlayer2 ); static void LoadTracks( const Song *pSong, RageSoundReader *&pGlobal, RageSoundReader *&pPlayer1, RageSoundReader *&pPlayer2 );
NoteData m_ndAutoKeysoundsOnly[NUM_PLAYERS]; NoteData m_ndAutoKeysoundsOnly[NUM_PLAYERS];
vector<RageSound> m_vKeysounds; std::vector<RageSound> m_vKeysounds;
RageSound m_sSound; RageSound m_sSound;
RageSoundReader *m_pChain; // owned by m_sSound RageSoundReader *m_pChain; // owned by m_sSound
RageSoundReader *m_pPlayerSounds[NUM_PLAYERS]; // owned by m_sSound RageSoundReader *m_pPlayerSounds[NUM_PLAYERS]; // owned by m_sSound
+2 -2
View File
@@ -36,7 +36,7 @@ void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNo
const RString& sAniDir = _sAniDir; const RString& sAniDir = _sAniDir;
{ {
vector<RString> vsLayerNames; std::vector<RString> vsLayerNames;
FOREACH_CONST_Child( pNode, pLayer ) FOREACH_CONST_Child( pNode, pLayer )
{ {
if( strncmp(pLayer->GetName(), "Layer", 5) == 0 ) if( strncmp(pLayer->GetName(), "Layer", 5) == 0 )
@@ -129,7 +129,7 @@ void BGAnimation::LoadFromAniDir( const RString &_sAniDir )
// This is an 3.0 and before-style BGAnimation (not using .ini) // This is an 3.0 and before-style BGAnimation (not using .ini)
// loading a directory of layers // loading a directory of layers
vector<RString> asImagePaths; std::vector<RString> asImagePaths;
ASSERT( sAniDir != "" ); ASSERT( sAniDir != "" );
GetDirListing( sAniDir+"*.png", asImagePaths, false, true ); GetDirListing( sAniDir+"*.png", asImagePaths, false, true );
+4 -4
View File
@@ -155,7 +155,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath )
Effect effect = EFFECT_CENTER; Effect effect = EFFECT_CENTER;
for( int i=0; i<NUM_EFFECTS; i++ ) for( int i=0; i<NUM_EFFECTS; i++ )
if( lcPath.find(EFFECT_STRING[i]) != string::npos ) if( lcPath.find(EFFECT_STRING[i]) != std::string::npos )
effect = (Effect)i; effect = (Effect)i;
switch( effect ) switch( effect )
@@ -227,7 +227,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath )
int iSpriteArea = int( s.GetUnzoomedWidth()*s.GetUnzoomedHeight() ); int iSpriteArea = int( s.GetUnzoomedWidth()*s.GetUnzoomedHeight() );
const int iMaxArea = int(SCREEN_WIDTH*SCREEN_HEIGHT); const int iMaxArea = int(SCREEN_WIDTH*SCREEN_HEIGHT);
int iNumParticles = iMaxArea / iSpriteArea; int iNumParticles = iMaxArea / iSpriteArea;
iNumParticles = min( iNumParticles, MAX_SPRITES ); iNumParticles = std::min( iNumParticles, MAX_SPRITES );
for( int i=0; i<iNumParticles; i++ ) for( int i=0; i<iNumParticles; i++ )
{ {
@@ -292,9 +292,9 @@ void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath )
Sprite s; Sprite s;
s.Load( ID ); s.Load( ID );
m_iNumTilesWide = 2+int(SCREEN_WIDTH /s.GetUnzoomedWidth()); m_iNumTilesWide = 2+int(SCREEN_WIDTH /s.GetUnzoomedWidth());
m_iNumTilesWide = min( m_iNumTilesWide, MAX_TILES_WIDE ); m_iNumTilesWide = std::min( m_iNumTilesWide, MAX_TILES_WIDE );
m_iNumTilesHigh = 2+int(SCREEN_HEIGHT/s.GetUnzoomedHeight()); m_iNumTilesHigh = 2+int(SCREEN_HEIGHT/s.GetUnzoomedHeight());
m_iNumTilesHigh = min( m_iNumTilesHigh, MAX_TILES_HIGH ); m_iNumTilesHigh = std::min( m_iNumTilesHigh, MAX_TILES_HIGH );
m_fTilesStartX = s.GetUnzoomedWidth() / 2; m_fTilesStartX = s.GetUnzoomedWidth() / 2;
m_fTilesStartY = s.GetUnzoomedHeight() / 2; m_fTilesStartY = s.GetUnzoomedHeight() / 2;
m_fTilesSpacingX = s.GetUnzoomedWidth(); m_fTilesSpacingX = s.GetUnzoomedWidth();
+1 -1
View File
@@ -22,7 +22,7 @@ public:
float GetMaxTweenTimeLeft() const; float GetMaxTweenTimeLeft() const;
protected: protected:
vector<RageVector3> m_vParticleVelocity; std::vector<RageVector3> m_vParticleVelocity;
enum Type enum Type
{ {
+4 -4
View File
@@ -102,7 +102,7 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
m_BPMS.clear(); m_BPMS.clear();
const vector<float> &BPMS = bpms.vfBpms; const std::vector<float> &BPMS = bpms.vfBpms;
bool AllIdentical = true; bool AllIdentical = true;
for( unsigned i = 0; i < BPMS.size(); ++i ) for( unsigned i = 0; i < BPMS.size(); ++i )
@@ -117,8 +117,8 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
int MaxBPM = INT_MIN; int MaxBPM = INT_MIN;
for( unsigned i = 0; i < BPMS.size(); ++i ) for( unsigned i = 0; i < BPMS.size(); ++i )
{ {
MinBPM = min( MinBPM, (int)lrintf(BPMS[i]) ); MinBPM = std::min( MinBPM, (int) lrintf(BPMS[i]) );
MaxBPM = max( MaxBPM, (int)lrintf(BPMS[i]) ); MaxBPM = std::max( MaxBPM, (int) lrintf(BPMS[i]) );
} }
if( MinBPM == MaxBPM ) if( MinBPM == MaxBPM )
{ {
@@ -141,7 +141,7 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
m_BPMS.push_back(BPMS[i]); // hold m_BPMS.push_back(BPMS[i]); // hold
} }
m_iCurrentBPM = min(1u, m_BPMS.size()); // start on the first hold m_iCurrentBPM = std::min(1, static_cast<int>(m_BPMS.size())); // start on the first hold
m_fBPMFrom = BPMS[0]; m_fBPMFrom = BPMS[0];
m_fBPMTo = BPMS[0]; m_fBPMTo = BPMS[0];
m_fPercentInState = 1; m_fPercentInState = 1;
+1 -1
View File
@@ -109,7 +109,7 @@ protected:
/** @brief The current BPM index used. */ /** @brief The current BPM index used. */
int m_iCurrentBPM; int m_iCurrentBPM;
/** @brief The list of BPMs. */ /** @brief The list of BPMs. */
vector<float> m_BPMS; std::vector<float> m_BPMS;
float m_fPercentInState; float m_fPercentInState;
/** @brief How long it takes to cycle the various BPMs. */ /** @brief How long it takes to cycle the various BPMs. */
float m_fCycleTime; float m_fCycleTime;
+27 -27
View File
@@ -86,14 +86,14 @@ public:
DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; };
void GetLoadedBackgroundChanges( vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] ); void GetLoadedBackgroundChanges( std::vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] );
protected: protected:
bool m_bInitted; bool m_bInitted;
DancingCharacters* m_pDancingCharacters; DancingCharacters* m_pDancingCharacters;
const Song *m_pSong; const Song *m_pSong;
map<RString,BackgroundTransition> m_mapNameToTransition; std::map<RString,BackgroundTransition> m_mapNameToTransition;
deque<BackgroundDef> m_RandomBGAnimations; // random background to choose from. These may or may not be loaded into m_BGAnimations. std::deque<BackgroundDef> m_RandomBGAnimations; // random background to choose from. These may or may not be loaded into m_BGAnimations.
void LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change ); void LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change );
bool IsDangerAllVisible(); bool IsDangerAllVisible();
@@ -107,13 +107,13 @@ protected:
// return true if created and added to m_BGAnimations // return true if created and added to m_BGAnimations
bool CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent ); bool CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent );
// return def of the background that was created and added to m_BGAnimations. calls CreateBackground // return def of the background that was created and added to m_BGAnimations. calls CreateBackground
BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations, Actor *pParent ); BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, std::deque<BackgroundDef> &RandomBGAnimations, Actor *pParent );
int FindBGSegmentForBeat( float fBeat ) const; int FindBGSegmentForBeat( float fBeat ) const;
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition ); void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const std::map<RString,BackgroundTransition> &mapNameToTransition );
map<BackgroundDef,Actor*> m_BGAnimations; std::map<BackgroundDef,Actor*> m_BGAnimations;
vector<BackgroundChange> m_aBGChanges; std::vector<BackgroundChange> m_aBGChanges;
int m_iCurBGChangeIndex; int m_iCurBGChangeIndex;
Actor *m_pCurrentBGA; Actor *m_pCurrentBGA;
Actor *m_pFadingBGA; Actor *m_pFadingBGA;
@@ -179,7 +179,7 @@ void BackgroundImpl::Init()
// load transitions // load transitions
{ {
ASSERT( m_mapNameToTransition.empty() ); ASSERT( m_mapNameToTransition.empty() );
vector<RString> vsPaths, vsNames; std::vector<RString> vsPaths, vsNames;
BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames ); BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames );
for( unsigned i=0; i<vsPaths.size(); i++ ) for( unsigned i=0; i<vsPaths.size(); i++ )
{ {
@@ -268,13 +268,13 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() ); ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() );
// Resolve the background names // Resolve the background names
vector<RString> vsToResolve; std::vector<RString> vsToResolve;
vsToResolve.push_back( bd.m_sFile1 ); vsToResolve.push_back( bd.m_sFile1 );
vsToResolve.push_back( bd.m_sFile2 ); vsToResolve.push_back( bd.m_sFile2 );
vector<RString> vsResolved; std::vector<RString> vsResolved;
vsResolved.resize( vsToResolve.size() ); vsResolved.resize( vsToResolve.size() );
vector<LuaThreadVariable *> vsResolvedRef; std::vector<LuaThreadVariable *> vsResolvedRef;
vsResolvedRef.resize( vsToResolve.size() ); vsResolvedRef.resize( vsToResolve.size() );
for( unsigned i=0; i<vsToResolve.size(); i++ ) for( unsigned i=0; i<vsToResolve.size(); i++ )
@@ -294,7 +294,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
* RandomMovies dir * RandomMovies dir
* BGAnimations dir. * BGAnimations dir.
*/ */
vector<RString> vsPaths, vsThrowAway; std::vector<RString> vsPaths, vsThrowAway;
// Look for BGAnims in the song dir // Look for BGAnims in the song dir
if( sToResolve == SONG_BACKGROUND_FILE ) if( sToResolve == SONG_BACKGROUND_FILE )
@@ -364,7 +364,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
RString sEffectFile; RString sEffectFile;
for( int i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
vector<RString> vsPaths, vsThrowAway; std::vector<RString> vsPaths, vsThrowAway;
BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway ); BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway );
if( vsPaths.empty() ) if( vsPaths.empty() )
{ {
@@ -396,7 +396,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
return true; return true;
} }
BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations, Actor *pParent ) BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const RString &sEffect, std::deque<BackgroundDef> &RandomBGAnimations, Actor *pParent )
{ {
if( g_RandomBackgroundMode == BGMODE_OFF ) if( g_RandomBackgroundMode == BGMODE_OFF )
return BackgroundDef(); return BackgroundDef();
@@ -417,7 +417,7 @@ BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const R
if( !sEffect.empty() ) if( !sEffect.empty() )
bd.m_sEffect = sEffect; bd.m_sEffect = sEffect;
map<BackgroundDef,Actor*>::const_iterator iter = m_BGAnimations.find( bd ); std::map<BackgroundDef,Actor*>::const_iterator iter = m_BGAnimations.find( bd );
// create the background if it's not already created // create the background if it's not already created
if( iter == m_BGAnimations.end() ) if( iter == m_BGAnimations.end() )
@@ -436,7 +436,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
const TimingData &timing = m_pSong->m_SongTiming; const TimingData &timing = m_pSong->m_SongTiming;
// change BG every time signature change or 4 measures // change BG every time signature change or 4 measures
const vector<TimingSegment *> &tSigs = timing.GetTimingSegments(SEGMENT_TIME_SIG); const std::vector<TimingSegment *> &tSigs = timing.GetTimingSegments(SEGMENT_TIME_SIG);
for (unsigned i = 0; i < tSigs.size(); i++) for (unsigned i = 0; i < tSigs.size(); i++)
{ {
@@ -444,9 +444,9 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
int iSegmentEndRow = (i + 1 == tSigs.size()) ? iEndRow : tSigs[i+1]->GetRow(); int iSegmentEndRow = (i + 1 == tSigs.size()) ? iEndRow : tSigs[i+1]->GetRow();
int time_signature_start= max(ts->GetRow(),iStartRow); int time_signature_start= std::max(ts->GetRow(),iStartRow);
for(int j= time_signature_start; for(int j= time_signature_start;
j<min(iEndRow,iSegmentEndRow); j<std::min(iEndRow,iSegmentEndRow);
j+= int(RAND_BG_CHANGE_MEASURES * ts->GetNoteRowsPerMeasure())) j+= int(RAND_BG_CHANGE_MEASURES * ts->GetNoteRowsPerMeasure()))
{ {
// Don't fade. It causes frame rate dip, especially on slower machines. // Don't fade. It causes frame rate dip, especially on slower machines.
@@ -473,7 +473,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
if(RAND_BG_CHANGES_WHEN_BPM_CHANGES) if(RAND_BG_CHANGES_WHEN_BPM_CHANGES)
{ {
// change BG every BPM change that is at the beginning of a measure // change BG every BPM change that is at the beginning of a measure
const vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM); const std::vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM);
for( unsigned i=0; i<bpms.size(); i++ ) for( unsigned i=0; i<bpms.size(); i++ )
{ {
bool bAtBeginningOfMeasure = false; bool bAtBeginningOfMeasure = false;
@@ -520,7 +520,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
// Choose a bunch of backgrounds that we'll use for the random file marker // Choose a bunch of backgrounds that we'll use for the random file marker
{ {
vector<RString> vsThrowAway, vsNames; std::vector<RString> vsThrowAway, vsNames;
switch( g_RandomBackgroundMode ) switch( g_RandomBackgroundMode )
{ {
default: default:
@@ -539,7 +539,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
// Pick the same random items every time the song is played. // Pick the same random items every time the song is played.
RandomGen rnd( GetHashForString(pSong->GetSongDir()) ); RandomGen rnd( GetHashForString(pSong->GetSongDir()) );
random_shuffle( vsNames.begin(), vsNames.end(), rnd ); random_shuffle( vsNames.begin(), vsNames.end(), rnd );
int iSize = min( (int)g_iNumBackgrounds, (int)vsNames.size() ); int iSize = std::min( (int)g_iNumBackgrounds, (int)vsNames.size() );
vsNames.resize( iSize ); vsNames.resize( iSize );
for (RString const &s : vsNames) for (RString const &s : vsNames)
@@ -718,7 +718,7 @@ int BackgroundImpl::Layer::FindBGSegmentForBeat( float fBeat ) const
} }
/* If the BG segment has changed, move focus to it. Send Update() calls. */ /* If the BG segment has changed, move focus to it. Send Update() calls. */
void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition ) void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const std::map<RString, BackgroundTransition> &mapNameToTransition )
{ {
ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID ); ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID );
@@ -750,7 +750,7 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
m_pFadingBGA = m_pCurrentBGA; m_pFadingBGA = m_pCurrentBGA;
map<BackgroundDef,Actor*>::const_iterator iter = m_BGAnimations.find( change.m_def ); std::map<BackgroundDef, Actor*>::const_iterator iter = m_BGAnimations.find( change.m_def );
if( iter == m_BGAnimations.end() ) if( iter == m_BGAnimations.end() )
{ {
XNode *pNode = change.m_def.CreateNode(); XNode *pNode = change.m_def.CreateNode();
@@ -776,7 +776,7 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
if( !change.m_sTransition.empty() ) if( !change.m_sTransition.empty() )
{ {
map<RString,BackgroundTransition>::const_iterator lIter = mapNameToTransition.find( change.m_sTransition ); std::map<RString, BackgroundTransition>::const_iterator lIter = mapNameToTransition.find( change.m_sTransition );
if(lIter == mapNameToTransition.end()) if(lIter == mapNameToTransition.end())
{ {
LuaHelpers::ReportScriptErrorFmt("'%s' is not the name of a BackgroundTransition file.", change.m_sTransition.c_str()); LuaHelpers::ReportScriptErrorFmt("'%s' is not the name of a BackgroundTransition file.", change.m_sTransition.c_str());
@@ -811,7 +811,7 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
} }
/* This is unaffected by the music rate. */ /* This is unaffected by the music rate. */
float fDeltaTimeNoMusicRate = max( fDeltaTime / fRate, 0 ); float fDeltaTimeNoMusicRate = std::max( fDeltaTime / fRate, 0.0f );
if( m_pCurrentBGA ) if( m_pCurrentBGA )
m_pCurrentBGA->Update( fDeltaTimeNoMusicRate ); m_pCurrentBGA->Update( fDeltaTimeNoMusicRate );
@@ -876,7 +876,7 @@ void BackgroundImpl::DrawPrimitives()
ActorFrame::DrawPrimitives(); ActorFrame::DrawPrimitives();
} }
void BackgroundImpl::GetLoadedBackgroundChanges( vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] ) void BackgroundImpl::GetLoadedBackgroundChanges( std::vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] )
{ {
FOREACH_BackgroundLayer( i ) FOREACH_BackgroundLayer( i )
*pBackgroundChangesOut[i] = m_Layer[i].m_aBGChanges; *pBackgroundChangesOut[i] = m_Layer[i].m_aBGChanges;
@@ -988,7 +988,7 @@ void Background::Unload() { m_pImpl->Unload(); }
void Background::FadeToActualBrightness() { m_pImpl->FadeToActualBrightness(); } void Background::FadeToActualBrightness() { m_pImpl->FadeToActualBrightness(); }
void Background::SetBrightness( float fBrightness ) { m_pImpl->SetBrightness(fBrightness); } void Background::SetBrightness( float fBrightness ) { m_pImpl->SetBrightness(fBrightness); }
DancingCharacters* Background::GetDancingCharacters() { return m_pImpl->GetDancingCharacters(); } DancingCharacters* Background::GetDancingCharacters() { return m_pImpl->GetDancingCharacters(); }
void Background::GetLoadedBackgroundChanges( vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] ) { m_pImpl->GetLoadedBackgroundChanges(pBackgroundChangesOut); } void Background::GetLoadedBackgroundChanges( std::vector<BackgroundChange> *pBackgroundChangesOut[NUM_BackgroundLayer] ) { m_pImpl->GetLoadedBackgroundChanges(pBackgroundChangesOut); }
/* /*
* (c) 2001-2004 Chris Danford, Ben Nordstrom * (c) 2001-2004 Chris Danford, Ben Nordstrom
+1 -1
View File
@@ -35,7 +35,7 @@ public:
* @return the dancing characters. */ * @return the dancing characters. */
DancingCharacters* GetDancingCharacters(); DancingCharacters* GetDancingCharacters();
void GetLoadedBackgroundChanges( vector<BackgroundChange> **pBackgroundChangesOut ); void GetLoadedBackgroundChanges( std::vector<BackgroundChange> **pBackgroundChangesOut );
protected: protected:
BackgroundImpl *m_pImpl; BackgroundImpl *m_pImpl;
+19 -19
View File
@@ -54,7 +54,7 @@ XNode *BackgroundDef::CreateNode() const
RString BackgroundChange::GetTextDescription() const RString BackgroundChange::GetTextDescription() const
{ {
vector<RString> vsParts; std::vector<RString> vsParts;
if( !m_def.m_sFile1.empty() ) vsParts.push_back( m_def.m_sFile1 ); if( !m_def.m_sFile1.empty() ) vsParts.push_back( m_def.m_sFile1 );
if( !m_def.m_sFile2.empty() ) vsParts.push_back( m_def.m_sFile2 ); if( !m_def.m_sFile2.empty() ) vsParts.push_back( m_def.m_sFile2 );
if( m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) ); if( m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) );
@@ -108,7 +108,7 @@ const RString SBE_StretchNoLoop = "StretchNoLoop";
const RString SBE_StretchRewind = "StretchRewind"; const RString SBE_StretchRewind = "StretchRewind";
const RString SBT_CrossFade = "CrossFade"; const RString SBT_CrossFade = "CrossFade";
static void StripCvsAndSvn( vector<RString> &vsPathsToStrip, vector<RString> &vsNamesToStrip ) static void StripCvsAndSvn( std::vector<RString> &vsPathsToStrip, std::vector<RString> &vsNamesToStrip )
{ {
ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() ); ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() );
for( unsigned i=0; i<vsNamesToStrip.size(); i++ ) for( unsigned i=0; i<vsNamesToStrip.size(); i++ )
@@ -126,19 +126,19 @@ int CompareBackgroundChanges(const BackgroundChange &seg1, const BackgroundChang
return seg1.m_fStartBeat < seg2.m_fStartBeat; return seg1.m_fStartBeat < seg2.m_fStartBeat;
} }
void BackgroundUtil::SortBackgroundChangesArray( vector<BackgroundChange> &vBackgroundChanges ) void BackgroundUtil::SortBackgroundChangesArray( std::vector<BackgroundChange> &vBackgroundChanges )
{ {
sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges ); sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges );
} }
void BackgroundUtil::AddBackgroundChange( vector<BackgroundChange> &vBackgroundChanges, BackgroundChange seg ) void BackgroundUtil::AddBackgroundChange( std::vector<BackgroundChange> &vBackgroundChanges, BackgroundChange seg )
{ {
vector<BackgroundChange>::iterator it; std::vector<BackgroundChange>::iterator it;
it = upper_bound( vBackgroundChanges.begin(), vBackgroundChanges.end(), seg, CompareBackgroundChanges ); it = upper_bound( vBackgroundChanges.begin(), vBackgroundChanges.end(), seg, CompareBackgroundChanges );
vBackgroundChanges.insert( it, seg ); vBackgroundChanges.insert( it, seg );
} }
void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetBackgroundEffects( const RString &_sName, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
RString sName = _sName; RString sName = _sName;
if( sName == "" ) if( sName == "" )
@@ -154,7 +154,7 @@ void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector<RString
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
RString sName = _sName; RString sName = _sName;
if( sName == "" ) if( sName == "" )
@@ -172,7 +172,7 @@ void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector<RSt
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
vsPathsOut.clear(); vsPathsOut.clear();
if( sMatch.empty() ) if( sMatch.empty() )
@@ -191,7 +191,7 @@ void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMat
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
vsPathsOut.clear(); vsPathsOut.clear();
if( sMatch.empty() ) if( sMatch.empty() )
@@ -211,7 +211,7 @@ void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, ve
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
vsPathsOut.clear(); vsPathsOut.clear();
if( sMatch.empty() ) if( sMatch.empty() )
@@ -231,7 +231,7 @@ void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, v
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set<RString> &vsPossibleFileNamesOut ) static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, std::set<RString> &vsPossibleFileNamesOut )
{ {
vsPossibleFileNamesOut.clear(); vsPossibleFileNamesOut.clear();
@@ -262,7 +262,7 @@ static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set
vsPossibleFileNamesOut.insert( p->first ); vsPossibleFileNamesOut.insert( p->first );
} }
void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ) void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut )
{ {
vsPathsOut.clear(); vsPathsOut.clear();
GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true ); GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true );
@@ -283,7 +283,7 @@ namespace {
void GetGlobalRandomMoviePaths( void GetGlobalRandomMoviePaths(
const Song *pSong, const Song *pSong,
const RString &sMatch, const RString &sMatch,
vector<RString> &vsPathsOut, std::vector<RString> &vsPathsOut,
bool bTryInsideOfSongGroupAndGenreFirst, bool bTryInsideOfSongGroupAndGenreFirst,
bool bTryInsideOfSongGroupFirst ) bool bTryInsideOfSongGroupFirst )
{ {
@@ -301,11 +301,11 @@ namespace {
} }
// Search for the most appropriate background // Search for the most appropriate background
set<RString> ssFileNameWhitelist; std::set<RString> ssFileNameWhitelist;
if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() ) if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() )
GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist ); GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist );
vector<RString> vsDirsToTry; std::vector<RString> vsDirsToTry;
if( bTryInsideOfSongGroupFirst && pSong ) if( bTryInsideOfSongGroupFirst && pSong )
{ {
ASSERT( !pSong->m_sGroupName.empty() ); ASSERT( !pSong->m_sGroupName.empty() );
@@ -322,7 +322,7 @@ namespace {
if( !ssFileNameWhitelist.empty() ) if( !ssFileNameWhitelist.empty() )
{ {
vector<RString> vsMatches; std::vector<RString> vsMatches;
for (RString const &s : vsPathsOut) for (RString const &s : vsPathsOut)
{ {
RString sBasename = Basename( s ); RString sBasename = Basename( s );
@@ -349,8 +349,8 @@ namespace {
void BackgroundUtil::GetGlobalRandomMovies( void BackgroundUtil::GetGlobalRandomMovies(
const Song *pSong, const Song *pSong,
const RString &sMatch, const RString &sMatch,
vector<RString> &vsPathsOut, std::vector<RString> &vsPathsOut,
vector<RString> &vsNamesOut, std::vector<RString> &vsNamesOut,
bool bTryInsideOfSongGroupAndGenreFirst, bool bTryInsideOfSongGroupAndGenreFirst,
bool bTryInsideOfSongGroupFirst ) bool bTryInsideOfSongGroupFirst )
{ {
@@ -371,7 +371,7 @@ void BackgroundUtil::BakeAllBackgroundChanges( Song *pSong )
{ {
Background bg; Background bg;
bg.LoadFromSong( pSong ); bg.LoadFromSong( pSong );
vector<BackgroundChange> *vBGChanges[NUM_BackgroundLayer]; std::vector<BackgroundChange> *vBGChanges[NUM_BackgroundLayer];
FOREACH_BackgroundLayer( i ) FOREACH_BackgroundLayer( i )
vBGChanges[i] = &pSong->GetBackgroundChanges(i); vBGChanges[i] = &pSong->GetBackgroundChanges(i);
bg.GetLoadedBackgroundChanges( vBGChanges ); bg.GetLoadedBackgroundChanges( vBGChanges );
+9 -9
View File
@@ -73,17 +73,17 @@ struct BackgroundChange
/** @brief Shared background-related routines. */ /** @brief Shared background-related routines. */
namespace BackgroundUtil namespace BackgroundUtil
{ {
void AddBackgroundChange( vector<BackgroundChange> &vBackgroundChanges, BackgroundChange seg ); void AddBackgroundChange( std::vector<BackgroundChange> &vBackgroundChanges, BackgroundChange seg );
void SortBackgroundChangesArray( vector<BackgroundChange> &vBackgroundChanges ); void SortBackgroundChangesArray( std::vector<BackgroundChange> &vBackgroundChanges );
void GetBackgroundEffects( const RString &sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetBackgroundEffects( const RString &sName, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetBackgroundTransitions( const RString &sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetBackgroundTransitions( const RString &sName, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetSongBGAnimations( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetSongMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetSongMovies( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetSongBitmaps( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetSongBitmaps( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut ); void GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut );
void GetGlobalRandomMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true ); void GetGlobalRandomMovies( const Song *pSong, const RString &sMatch, std::vector<RString> &vsPathsOut, std::vector<RString> &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true );
void BakeAllBackgroundChanges( Song *pSong ); void BakeAllBackgroundChanges( Song *pSong );
}; };
+16 -16
View File
@@ -27,7 +27,7 @@ REGISTER_ACTOR_CLASS( BitmapText );
#define NUM_RAINBOW_COLORS THEME->GetMetricI("BitmapText","NumRainbowColors") #define NUM_RAINBOW_COLORS THEME->GetMetricI("BitmapText","NumRainbowColors")
#define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1)) #define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1))
static vector<RageColor> RAINBOW_COLORS; static std::vector<RageColor> RAINBOW_COLORS;
BitmapText::BitmapText() BitmapText::BitmapText()
{ {
@@ -254,7 +254,7 @@ void BitmapText::BuildChars()
for( unsigned l=0; l<m_wTextLines.size(); l++ ) // for each line for( unsigned l=0; l<m_wTextLines.size(); l++ ) // for each line
{ {
m_iLineWidths.push_back(m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] )); m_iLineWidths.push_back(m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] ));
m_size.x = max( m_size.x, m_iLineWidths.back() ); m_size.x = std::max( m_size.x, (float) m_iLineWidths.back() );
} }
/* Ensure that the width is always even. This maintains pixel alignment; /* Ensure that the width is always even. This maintains pixel alignment;
@@ -283,7 +283,7 @@ void BitmapText::BuildChars()
{ {
iY += m_pFont->GetHeight(); iY += m_pFont->GetHeight();
wstring sLine = m_wTextLines[i]; std::wstring sLine = m_wTextLines[i];
if( m_pFont->IsRightToLeft() ) if( m_pFont->IsRightToLeft() )
reverse( sLine.begin(), sLine.end() ); reverse( sLine.begin(), sLine.end() );
const int iLineWidth = m_iLineWidths[i]; const int iLineWidth = m_iLineWidths[i];
@@ -494,12 +494,12 @@ void BitmapText::SetTextInternal()
/* "...I can add Japanese wrapping, at least. We could handle hyphens /* "...I can add Japanese wrapping, at least. We could handle hyphens
* and soft hyphens and pretty easily, too." -glenn */ * and soft hyphens and pretty easily, too." -glenn */
// TODO: Move this wrapping logic into Font. // TODO: Move this wrapping logic into Font.
vector<RString> asLines; std::vector<RString> asLines;
split( m_sText, "\n", asLines, false ); split( m_sText, "\n", asLines, false );
for( unsigned line = 0; line < asLines.size(); ++line ) for( unsigned line = 0; line < asLines.size(); ++line )
{ {
vector<RString> asWords; std::vector<RString> asWords;
split( asLines[line], " ", asWords ); split( asLines[line], " ", asWords );
RString sCurLine; RString sCurLine;
@@ -612,7 +612,7 @@ void BitmapText::UpdateBaseZoom()
} \ } \
if(dimension != 0) \ if(dimension != 0) \
{ \ { \
const float zoom= min(1, dimension_max / dimension); \ const float zoom= fmin(1, dimension_max / dimension); \
base_zoom_set(zoom); \ base_zoom_set(zoom); \
} \ } \
} }
@@ -646,7 +646,7 @@ void BitmapText::CropLineToWidth(size_t l, int width)
if(l < m_wTextLines.size()) if(l < m_wTextLines.size())
{ {
int used_width= width; int used_width= width;
wstring& line= m_wTextLines[l]; std::wstring& line= m_wTextLines[l];
int fit= m_pFont->GetGlyphsThatFit(line, &used_width); int fit= m_pFont->GetGlyphsThatFit(line, &used_width);
if(fit < line.size()) if(fit < line.size())
{ {
@@ -720,12 +720,12 @@ void BitmapText::DrawPrimitives()
else else
{ {
size_t i = 0; size_t i = 0;
map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin(); std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
while( i < m_aVertices.size() ) while( i < m_aVertices.size() )
{ {
// Set the colors up to the next attribute. // Set the colors up to the next attribute.
size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
iEnd = min( iEnd, m_aVertices.size() ); iEnd = std::min( iEnd, m_aVertices.size() );
for( ; i < iEnd; i += 4 ) for( ; i < iEnd; i += 4 )
{ {
m_aVertices[i+0].c = m_pTempState->diffuse[0]; // top left m_aVertices[i+0].c = m_pTempState->diffuse[0]; // top left
@@ -742,8 +742,8 @@ void BitmapText::DrawPrimitives()
iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
else else
iEnd = i + attr.length*4; iEnd = i + attr.length*4;
iEnd = min( iEnd, m_aVertices.size() ); iEnd = std::min( iEnd, m_aVertices.size() );
vector<RageColor> temp_attr_diffuse(NUM_DIFFUSE_COLORS, m_internalDiffuse); std::vector<RageColor> temp_attr_diffuse(NUM_DIFFUSE_COLORS, m_internalDiffuse);
for(size_t c= 0; c < NUM_DIFFUSE_COLORS; ++c) for(size_t c= 0; c < NUM_DIFFUSE_COLORS; ++c)
{ {
temp_attr_diffuse[c]*= attr.diffuse[c]; temp_attr_diffuse[c]*= attr.diffuse[c];
@@ -763,7 +763,7 @@ void BitmapText::DrawPrimitives()
} }
// apply jitter to verts // apply jitter to verts
vector<RageVector3> vGlyphJitter; std::vector<RageVector3> vGlyphJitter;
if( m_bJitter ) if( m_bJitter )
{ {
int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 ); int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 );
@@ -805,12 +805,12 @@ void BitmapText::DrawPrimitives()
DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow ); DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow );
size_t i = 0; size_t i = 0;
map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin(); std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
while( i < m_aVertices.size() ) while( i < m_aVertices.size() )
{ {
// Set the glow up to the next attribute. // Set the glow up to the next attribute.
size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
iEnd = min( iEnd, m_aVertices.size() ); iEnd = std::min( iEnd, m_aVertices.size() );
for( ; i < iEnd; ++i ) for( ; i < iEnd; ++i )
m_aVertices[i].c = m_pTempState->glow; m_aVertices[i].c = m_pTempState->glow;
if( iter == m_mAttributes.end() ) if( iter == m_mAttributes.end() )
@@ -822,7 +822,7 @@ void BitmapText::DrawPrimitives()
iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
else else
iEnd = i + attr.length*4; iEnd = i + attr.length*4;
iEnd = min( iEnd, m_aVertices.size() ); iEnd = std::min( iEnd, m_aVertices.size() );
for( ; i < iEnd; ++i ) for( ; i < iEnd; ++i )
{ {
if( m_internalGlow.a > 0 ) if( m_internalGlow.a > 0 )
@@ -878,7 +878,7 @@ void BitmapText::AddAttribute( size_t iPos, const Attribute &attr )
int iLines = 0; int iLines = 0;
size_t iAdjustedPos = iPos; size_t iAdjustedPos = iPos;
for (wstring const & line : m_wTextLines) for (std::wstring const & line : m_wTextLines)
{ {
size_t length = line.length(); size_t length = line.length();
if( length >= iAdjustedPos ) if( length >= iAdjustedPos )
+8 -8
View File
@@ -85,8 +85,8 @@ public:
void SetTextGlowMode( TextGlowMode tgm ) { m_TextGlowMode = tgm; } void SetTextGlowMode( TextGlowMode tgm ) { m_TextGlowMode = tgm; }
void GetLines( vector<wstring> &wTextLines ) const { wTextLines = m_wTextLines; } void GetLines( std::vector<std::wstring> &wTextLines ) const { wTextLines = m_wTextLines; }
const vector<wstring> &GetLines() const { return m_wTextLines; } const std::vector<std::wstring> &GetLines() const { return m_wTextLines; }
RString GetText() const { return m_sText; } RString GetText() const { return m_sText; }
// Return true if the string 's' will use an alternate string, if available. // Return true if the string 's' will use an alternate string, if available.
@@ -113,8 +113,8 @@ protected:
Font *m_pFont; Font *m_pFont;
bool m_bUppercase; bool m_bUppercase;
RString m_sText; RString m_sText;
vector<wstring> m_wTextLines; std::vector<std::wstring> m_wTextLines;
vector<int> m_iLineWidths; // in source pixels std::vector<int> m_iLineWidths; // in source pixels
int m_iWrapWidthPixels; // -1 = no wrap int m_iWrapWidthPixels; // -1 = no wrap
float m_fMaxWidth; // 0 = no max float m_fMaxWidth; // 0 = no max
float m_fMaxHeight; // 0 = no max float m_fMaxHeight; // 0 = no max
@@ -126,10 +126,10 @@ protected:
float m_fDistortion; float m_fDistortion;
int m_iVertSpacing; int m_iVertSpacing;
vector<RageSpriteVertex> m_aVertices; std::vector<RageSpriteVertex> m_aVertices;
vector<FontPageTextures*> m_vpFontPageTextures; std::vector<FontPageTextures*> m_vpFontPageTextures;
map<size_t, Attribute> m_mAttributes; std::map<size_t, Attribute> m_mAttributes;
bool m_bHasGlowAttribute; bool m_bHasGlowAttribute;
TextGlowMode m_TextGlowMode; TextGlowMode m_TextGlowMode;
@@ -141,7 +141,7 @@ protected:
private: private:
void SetTextInternal(); void SetTextInternal();
vector<BMT_TweenState> BMT_Tweens; std::vector<BMT_TweenState> BMT_Tweens;
BMT_TweenState BMT_current; BMT_TweenState BMT_current;
BMT_TweenState BMT_start; BMT_TweenState BMT_start;
}; };
+4 -4
View File
@@ -98,7 +98,7 @@ XNode* Bookkeeper::CreateNode() const
{ {
XNode* pData = xml->AppendChild("Data"); XNode* pData = xml->AppendChild("Data");
for( map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) for( std::map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it )
{ {
int iCoins = it->second; int iCoins = it->second;
XNode *pDay = pData->AppendChild( "Coins", iCoins ); XNode *pDay = pData->AppendChild( "Coins", iCoins );
@@ -173,7 +173,7 @@ void Bookkeeper::ReadCoinsFile( int &coins )
} }
// Return the number of coins between [beginning,ending). // Return the number of coins between [beginning,ending).
int Bookkeeper::GetNumCoinsInRange( map<Date,int>::const_iterator begin, map<Date,int>::const_iterator end ) const int Bookkeeper::GetNumCoinsInRange( std::map<Date,int>::const_iterator begin, std::map<Date,int>::const_iterator end ) const
{ {
int iCoins = 0; int iCoins = 0;
@@ -237,7 +237,7 @@ void Bookkeeper::GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] ) const
for( int i=0; i<DAYS_IN_WEEK; i++ ) for( int i=0; i<DAYS_IN_WEEK; i++ )
coins[i] = 0; coins[i] = 0;
for( map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) for( std::map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it )
{ {
const Date &d = it->first; const Date &d = it->first;
int iDayOfWeek = GetDayInYearAndYear( d.m_iDayOfYear, d.m_iYear ).tm_wday; int iDayOfWeek = GetDayInYearAndYear( d.m_iDayOfYear, d.m_iYear ).tm_wday;
@@ -248,7 +248,7 @@ void Bookkeeper::GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] ) const
void Bookkeeper::GetCoinsByHour( int coins[HOURS_IN_DAY] ) const void Bookkeeper::GetCoinsByHour( int coins[HOURS_IN_DAY] ) const
{ {
memset( coins, 0, sizeof(int) * HOURS_IN_DAY ); memset( coins, 0, sizeof(int) * HOURS_IN_DAY );
for( map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) for( std::map<Date,int>::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it )
{ {
const Date &d = it->first; const Date &d = it->first;
+2 -2
View File
@@ -58,10 +58,10 @@ private:
bool operator<( const Date &rhs ) const; bool operator<( const Date &rhs ) const;
}; };
int GetNumCoins( Date beginning, Date ending ) const; int GetNumCoins( Date beginning, Date ending ) const;
int GetNumCoinsInRange( map<Date,int>::const_iterator begin, map<Date,int>::const_iterator end ) const; int GetNumCoinsInRange( std::map<Date,int>::const_iterator begin, std::map<Date,int>::const_iterator end ) const;
int m_iLastSeenTime; int m_iLastSeenTime;
map<Date,int> m_mapCoinsForHour; std::map<Date,int> m_mapCoinsForHour;
}; };
extern Bookkeeper* BOOKKEEPER; // global and accessible from anywhere in our program extern Bookkeeper* BOOKKEEPER; // global and accessible from anywhere in our program
+7 -7
View File
@@ -20,13 +20,13 @@ bool Character::Load( RString sCharDir )
// save ID // save ID
{ {
vector<RString> as; std::vector<RString> as;
split( sCharDir, "/", as ); split( sCharDir, "/", as );
m_sCharacterID = as.back(); m_sCharacterID = as.back();
} }
{ {
vector<RString> as; std::vector<RString> as;
GetDirListing( m_sCharDir+"card.png", as, false, true ); GetDirListing( m_sCharDir+"card.png", as, false, true );
GetDirListing( m_sCharDir+"card.jpg", as, false, true ); GetDirListing( m_sCharDir+"card.jpg", as, false, true );
GetDirListing( m_sCharDir+"card.jpeg", as, false, true ); GetDirListing( m_sCharDir+"card.jpeg", as, false, true );
@@ -39,7 +39,7 @@ bool Character::Load( RString sCharDir )
} }
{ {
vector<RString> as; std::vector<RString> as;
GetDirListing( m_sCharDir+"icon.png", as, false, true ); GetDirListing( m_sCharDir+"icon.png", as, false, true );
GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); GetDirListing( m_sCharDir+"icon.jpg", as, false, true );
GetDirListing( m_sCharDir+"icon.jpeg", as, false, true ); GetDirListing( m_sCharDir+"icon.jpeg", as, false, true );
@@ -74,7 +74,7 @@ bool Character::Load( RString sCharDir )
RString GetRandomFileInDir( RString sDir ) RString GetRandomFileInDir( RString sDir )
{ {
vector<RString> asFiles; std::vector<RString> asFiles;
GetDirListing( sDir, asFiles, false, true ); GetDirListing( sDir, asFiles, false, true );
if( asFiles.empty() ) if( asFiles.empty() )
return RString(); return RString();
@@ -96,7 +96,7 @@ RString Character::GetWarmUpAnimationPath() const { return DerefRedir(GetRandomF
RString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); } RString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); }
RString Character::GetTakingABreakPath() const RString Character::GetTakingABreakPath() const
{ {
vector<RString> as; std::vector<RString> as;
GetDirListing( m_sCharDir+"break.png", as, false, true ); GetDirListing( m_sCharDir+"break.png", as, false, true );
GetDirListing( m_sCharDir+"break.jpg", as, false, true ); GetDirListing( m_sCharDir+"break.jpg", as, false, true );
GetDirListing( m_sCharDir+"break.jpeg", as, false, true ); GetDirListing( m_sCharDir+"break.jpeg", as, false, true );
@@ -110,7 +110,7 @@ RString Character::GetTakingABreakPath() const
RString Character::GetSongSelectIconPath() const RString Character::GetSongSelectIconPath() const
{ {
vector<RString> as; std::vector<RString> as;
// first try and find an icon specific to the select music screen // first try and find an icon specific to the select music screen
// so you can have different icons for music select / char select // so you can have different icons for music select / char select
GetDirListing( m_sCharDir+"selectmusicicon.png", as, false, true ); GetDirListing( m_sCharDir+"selectmusicicon.png", as, false, true );
@@ -138,7 +138,7 @@ RString Character::GetSongSelectIconPath() const
RString Character::GetStageIconPath() const RString Character::GetStageIconPath() const
{ {
vector<RString> as; std::vector<RString> as;
// first try and find an icon specific to the select music screen // first try and find an icon specific to the select music screen
// so you can have different icons for music select / char select // so you can have different icons for music select / char select
GetDirListing( m_sCharDir+"stageicon.png", as, false, true ); GetDirListing( m_sCharDir+"stageicon.png", as, false, true );
+5 -5
View File
@@ -24,7 +24,7 @@ CharacterManager::CharacterManager()
SAFE_DELETE( m_pCharacters[i] ); SAFE_DELETE( m_pCharacters[i] );
m_pCharacters.clear(); m_pCharacters.clear();
vector<RString> as; std::vector<RString> as;
GetDirListing( CHARACTERS_DIR "*", as, true, true ); GetDirListing( CHARACTERS_DIR "*", as, true, true );
StripCvsAndSvn( as ); StripCvsAndSvn( as );
StripMacResourceForks( as ); StripMacResourceForks( as );
@@ -63,7 +63,7 @@ CharacterManager::~CharacterManager()
LUA->UnsetGlobal( "CHARMAN" ); LUA->UnsetGlobal( "CHARMAN" );
} }
void CharacterManager::GetCharacters( vector<Character*> &apCharactersOut ) void CharacterManager::GetCharacters( std::vector<Character*> &apCharactersOut )
{ {
for( unsigned i=0; i<m_pCharacters.size(); i++ ) for( unsigned i=0; i<m_pCharacters.size(); i++ )
if( !m_pCharacters[i]->IsDefaultCharacter() ) if( !m_pCharacters[i]->IsDefaultCharacter() )
@@ -72,7 +72,7 @@ void CharacterManager::GetCharacters( vector<Character*> &apCharactersOut )
Character* CharacterManager::GetRandomCharacter() Character* CharacterManager::GetRandomCharacter()
{ {
vector<Character*> apCharacters; std::vector<Character*> apCharacters;
GetCharacters( apCharacters ); GetCharacters( apCharacters );
if( apCharacters.size() ) if( apCharacters.size() )
return apCharacters[RandomInt(apCharacters.size())]; return apCharacters[RandomInt(apCharacters.size())];
@@ -146,7 +146,7 @@ public:
} }
static int GetAllCharacters( T* p, lua_State *L ) static int GetAllCharacters( T* p, lua_State *L )
{ {
vector<Character*> vChars; std::vector<Character*> vChars;
p->GetCharacters(vChars); p->GetCharacters(vChars);
LuaHelpers::CreateTableFromArray(vChars, L); LuaHelpers::CreateTableFromArray(vChars, L);
@@ -154,7 +154,7 @@ public:
} }
static int GetCharacterCount(T* p, lua_State *L) static int GetCharacterCount(T* p, lua_State *L)
{ {
vector<Character*> chars; std::vector<Character*> chars;
p->GetCharacters(chars); p->GetCharacters(chars);
lua_pushnumber(L, chars.size()); lua_pushnumber(L, chars.size());
return 1; return 1;
+2 -2
View File
@@ -13,7 +13,7 @@ public:
/** @brief Destroy the character manager. */ /** @brief Destroy the character manager. */
~CharacterManager(); ~CharacterManager();
void GetCharacters( vector<Character*> &vpCharactersOut ); void GetCharacters( std::vector<Character*> &vpCharactersOut );
/** @brief Get one installed character at random. /** @brief Get one installed character at random.
* @return The random character. */ * @return The random character. */
Character* GetRandomCharacter(); Character* GetRandomCharacter();
@@ -29,7 +29,7 @@ public:
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
private: private:
vector<Character*> m_pCharacters; std::vector<Character*> m_pCharacters;
}; };
+2 -2
View File
@@ -167,13 +167,13 @@ void CodeDetector::ChangeScrollSpeed( GameController controller, bool bIncrement
RString sTitleOut; RString sTitleOut;
ScreenOptionsMaster::SetList( row, hand, "Speed", sTitleOut ); ScreenOptionsMaster::SetList( row, hand, "Speed", sTitleOut );
vector<ModeChoice>& entries = hand.ListEntries; std::vector<ModeChoice>& entries = hand.ListEntries;
RString sScrollSpeed = po.GetScrollSpeedAsString(); RString sScrollSpeed = po.GetScrollSpeedAsString();
if (sScrollSpeed.empty()) if (sScrollSpeed.empty())
sScrollSpeed = "1x"; sScrollSpeed = "1x";
for ( vector<ModeChoice>::iterator it = entries.begin(); it != entries.end(); ++it ) for ( std::vector<ModeChoice>::iterator it = entries.begin(); it != entries.end(); ++it )
{ {
ModeChoice& modeChoice = *it; ModeChoice& modeChoice = *it;
if ( modeChoice.m_sModifiers == sScrollSpeed ) { if ( modeChoice.m_sModifiers == sScrollSpeed ) {
+1 -1
View File
@@ -15,7 +15,7 @@ void InputQueueCodeSet::Load( const RString &sType )
for( unsigned c=0; c<m_asCodeNames.size(); c++ ) for( unsigned c=0; c<m_asCodeNames.size(); c++ )
{ {
vector<RString> asBits; std::vector<RString> asBits;
split( m_asCodeNames[c], "=", asBits, true ); split( m_asCodeNames[c], "=", asBits, true );
RString sCodeName = asBits[0]; RString sCodeName = asBits[0];
if( asBits.size() > 1 ) if( asBits.size() > 1 )
+2 -2
View File
@@ -12,8 +12,8 @@ public:
bool InputMessage( const InputEventPlus &input, Message &msg ) const; bool InputMessage( const InputEventPlus &input, Message &msg ) const;
private: private:
vector<InputQueueCode> m_aCodes; std::vector<InputQueueCode> m_aCodes;
vector<RString> m_asCodeNames; std::vector<RString> m_asCodeNames;
}; };
#endif #endif
+1 -1
View File
@@ -73,7 +73,7 @@ void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
// Find the largest combo. // Find the largest combo.
int iMaxComboSize = 0; int iMaxComboSize = 0;
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
iMaxComboSize = max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() ); iMaxComboSize = std::max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() );
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
{ {
+3 -3
View File
@@ -34,7 +34,7 @@ RString Command::GetOriginalCommandString() const
return join( ",", m_vsArgs ); return join( ",", m_vsArgs );
} }
static void SplitWithQuotes( const RString sSource, const char Delimitor, vector<RString> &asOut, const bool bIgnoreEmpty ) static void SplitWithQuotes( const RString sSource, const char Delimitor, std::vector<RString> &asOut, const bool bIgnoreEmpty )
{ {
/* Short-circuit if the source is empty; we want to return an empty vector if /* Short-circuit if the source is empty; we want to return an empty vector if
* the string is empty, even if bIgnoreEmpty is true. */ * the string is empty, even if bIgnoreEmpty is true. */
@@ -53,7 +53,7 @@ static void SplitWithQuotes( const RString sSource, const char Delimitor, vector
{ {
/* We've found a quote. Search for the close. */ /* We've found a quote. Search for the close. */
pos = sSource.find( sSource[pos], pos+1 ); pos = sSource.find( sSource[pos], pos+1 );
if( pos == string::npos ) if( pos == std::string::npos )
pos = sSource.size(); pos = sSource.size();
else else
++pos; ++pos;
@@ -86,7 +86,7 @@ RString Commands::GetOriginalCommandString() const
void ParseCommands( const RString &sCommands, Commands &vCommandsOut, bool bLegacy ) void ParseCommands( const RString &sCommands, Commands &vCommandsOut, bool bLegacy )
{ {
vector<RString> vsCommands; std::vector<RString> vsCommands;
if( bLegacy ) if( bLegacy )
split( sCommands, ";", vsCommands, true ); split( sCommands, ";", vsCommands, true );
else else
+2 -2
View File
@@ -20,7 +20,7 @@ public:
}; };
Arg GetArg( unsigned index ) const; Arg GetArg( unsigned index ) const;
vector<RString> m_vsArgs; std::vector<RString> m_vsArgs;
Command(): m_vsArgs() {} Command(): m_vsArgs() {}
}; };
@@ -28,7 +28,7 @@ public:
class Commands class Commands
{ {
public: public:
vector<Command> v; std::vector<Command> v;
RString GetOriginalCommandString() const; // used when reporting an error in number of args RString GetOriginalCommandString() const; // used when reporting an error in number of args
}; };
+3 -3
View File
@@ -24,7 +24,7 @@
#include <conio.h> #include <conio.h>
#endif #endif
vector<CommandLineActions::CommandLineArgs> CommandLineActions::ToProcess; std::vector<CommandLineActions::CommandLineArgs> CommandLineActions::ToProcess;
static void LuaInformation() static void LuaInformation()
{ {
@@ -33,7 +33,7 @@ static void LuaInformation()
pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd"); pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd");
pNode->AppendChild("Version", string(PRODUCT_FAMILY) + product_version); pNode->AppendChild("Version", std::string(PRODUCT_FAMILY) + product_version);
pNode->AppendChild("Date", DateTime::GetNowDate().GetString()); pNode->AppendChild("Date", DateTime::GetNowDate().GetString());
XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl"); XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl");
@@ -50,7 +50,7 @@ static void LuaInformation()
static void Version() static void Version()
{ {
#if defined(WIN32) #if defined(WIN32)
RString sProductID = ssprintf("%s", (string(PRODUCT_FAMILY) + product_version).c_str() ); RString sProductID = ssprintf("%s", (std::string(PRODUCT_FAMILY) + product_version).c_str() );
RString sVersion = ssprintf("build %s\nCompile Date: %s @ %s", ::sm_version_git_hash, version_date, version_time); RString sVersion = ssprintf("build %s\nCompile Date: %s @ %s", ::sm_version_git_hash, version_date, version_time);
AllocConsole(); AllocConsole();
+2 -2
View File
@@ -16,13 +16,13 @@ namespace CommandLineActions
{ {
public: public:
/** @brief the arguments in question. */ /** @brief the arguments in question. */
vector<RString> argv; std::vector<RString> argv;
}; };
/** /**
* @brief A list of command line arguemnts to process while the game is running. * @brief A list of command line arguemnts to process while the game is running.
* These args could have come from this process or passed to this process * These args could have come from this process or passed to this process
* from another process. */ * from another process. */
extern vector<CommandLineArgs> ToProcess; extern std::vector<CommandLineArgs> ToProcess;
} }
#endif #endif
+8 -8
View File
@@ -37,7 +37,7 @@ void ThemeMetricDifficultiesToShow::Read()
m_v.clear(); m_v.clear();
vector<RString> v; std::vector<RString> v;
split( ThemeMetric<RString>::GetValue(), ",", v ); split( ThemeMetric<RString>::GetValue(), ",", v );
if(v.empty()) if(v.empty())
{ {
@@ -58,7 +58,7 @@ void ThemeMetricDifficultiesToShow::Read()
} }
} }
} }
const vector<Difficulty>& ThemeMetricDifficultiesToShow::GetValue() const { return m_v; } const std::vector<Difficulty>& ThemeMetricDifficultiesToShow::GetValue() const { return m_v; }
ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ) : ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ) :
@@ -76,7 +76,7 @@ void ThemeMetricCourseDifficultiesToShow::Read()
m_v.clear(); m_v.clear();
vector<RString> v; std::vector<RString> v;
split( ThemeMetric<RString>::GetValue(), ",", v ); split( ThemeMetric<RString>::GetValue(), ",", v );
if(v.empty()) if(v.empty())
{ {
@@ -97,11 +97,11 @@ void ThemeMetricCourseDifficultiesToShow::Read()
} }
} }
} }
const vector<CourseDifficulty>& ThemeMetricCourseDifficultiesToShow::GetValue() const { return m_v; } const std::vector<CourseDifficulty>& ThemeMetricCourseDifficultiesToShow::GetValue() const { return m_v; }
static void RemoveStepsTypes( vector<StepsType>& inout, RString sStepsTypesToRemove ) static void RemoveStepsTypes( std::vector<StepsType>& inout, RString sStepsTypesToRemove )
{ {
vector<RString> v; std::vector<RString> v;
split( sStepsTypesToRemove, ",", v ); split( sStepsTypesToRemove, ",", v );
if( v.size() == 0 ) return; // Nothing to do! if( v.size() == 0 ) return; // Nothing to do!
@@ -115,7 +115,7 @@ static void RemoveStepsTypes( vector<StepsType>& inout, RString sStepsTypesToRem
continue; continue;
} }
const vector<StepsType>::iterator iter = find( inout.begin(), inout.end(), st ); const std::vector<StepsType>::iterator iter = find( inout.begin(), inout.end(), st );
if( iter != inout.end() ) if( iter != inout.end() )
inout.erase( iter ); inout.erase( iter );
} }
@@ -138,7 +138,7 @@ void ThemeMetricStepsTypesToShow::Read()
RemoveStepsTypes( m_v, ThemeMetric<RString>::GetValue() ); RemoveStepsTypes( m_v, ThemeMetric<RString>::GetValue() );
} }
const vector<StepsType>& ThemeMetricStepsTypesToShow::GetValue() const { return m_v; } const std::vector<StepsType>& ThemeMetricStepsTypesToShow::GetValue() const { return m_v; }
RString CommonMetrics::LocalizeOptionItem( const RString &s, bool bOptional ) RString CommonMetrics::LocalizeOptionItem( const RString &s, bool bOptional )
+6 -6
View File
@@ -14,9 +14,9 @@ public:
ThemeMetricDifficultiesToShow(): m_v() { } ThemeMetricDifficultiesToShow(): m_v() { }
ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ); ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName );
void Read(); void Read();
const vector<Difficulty> &GetValue() const; const std::vector<Difficulty> &GetValue() const;
private: private:
vector<Difficulty> m_v; std::vector<Difficulty> m_v;
}; };
class ThemeMetricCourseDifficultiesToShow : public ThemeMetric<RString> class ThemeMetricCourseDifficultiesToShow : public ThemeMetric<RString>
{ {
@@ -24,9 +24,9 @@ public:
ThemeMetricCourseDifficultiesToShow(): m_v() { } ThemeMetricCourseDifficultiesToShow(): m_v() { }
ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ); ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName );
void Read(); void Read();
const vector<CourseDifficulty> &GetValue() const; const std::vector<CourseDifficulty> &GetValue() const;
private: private:
vector<CourseDifficulty> m_v; std::vector<CourseDifficulty> m_v;
}; };
class ThemeMetricStepsTypesToShow : public ThemeMetric<RString> class ThemeMetricStepsTypesToShow : public ThemeMetric<RString>
{ {
@@ -34,9 +34,9 @@ public:
ThemeMetricStepsTypesToShow(): m_v() { } ThemeMetricStepsTypesToShow(): m_v() { }
ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ); ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName );
void Read(); void Read();
const vector<StepsType> &GetValue() const; const std::vector<StepsType> &GetValue() const;
private: private:
vector<StepsType> m_v; std::vector<StepsType> m_v;
}; };
+29 -29
View File
@@ -46,7 +46,7 @@ const int MAX_BOTTOM_RANGE = 10;
RString CourseEntry::GetTextDescription() const RString CourseEntry::GetTextDescription() const
{ {
vector<RString> vsEntryDescription; std::vector<RString> vsEntryDescription;
Song *pSong = songID.ToSong(); Song *pSong = songID.ToSong();
if( pSong ) if( pSong )
vsEntryDescription.push_back( pSong->GetTranslitFullTitle() ); vsEntryDescription.push_back( pSong->GetTranslitFullTitle() );
@@ -342,7 +342,7 @@ bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) c
ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(), ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(),
ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) ); ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) );
vector<SortTrailEntry> entries; std::vector<SortTrailEntry> entries;
for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) for( unsigned i = 0; i < trail.m_vEntries.size(); ++i )
{ {
SortTrailEntry ste; SortTrailEntry ste;
@@ -362,7 +362,7 @@ bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) c
} }
// TODO: Move Course initialization after PROFILEMAN is created // TODO: Move Course initialization after PROFILEMAN is created
static void CourseSortSongs( SongSort sort, vector<Song*> &vpPossibleSongs, RandomGen &rnd ) static void CourseSortSongs( SongSort sort, std::vector<Song*> &vpPossibleSongs, RandomGen &rnd )
{ {
switch( sort ) switch( sort )
{ {
@@ -421,7 +421,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
// Different seed for each course, but the same for the whole round: // Different seed for each course, but the same for the whole round:
RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) ); RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) );
vector<CourseEntry> tmp_entries; std::vector<CourseEntry> tmp_entries;
if( m_bShuffle ) if( m_bShuffle )
{ {
/* Always randomize the same way per round. Otherwise, the displayed course /* Always randomize the same way per round. Otherwise, the displayed course
@@ -431,11 +431,11 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd ); random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd );
} }
const vector<CourseEntry> &entries = m_bShuffle ? tmp_entries:m_vEntries; const std::vector<CourseEntry> &entries = m_bShuffle ? tmp_entries:m_vEntries;
// This can take some time, so don't fill it out unless we need it. // This can take some time, so don't fill it out unless we need it.
vector<Song*> vSongsByMostPlayed; std::vector<Song*> vSongsByMostPlayed;
vector<Song*> AllSongsShuffled; std::vector<Song*> AllSongsShuffled;
trail.m_StepsType = st; trail.m_StepsType = st;
trail.m_CourseType = GetCourseType(); trail.m_CourseType = GetCourseType();
@@ -454,7 +454,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
} }
else else
{ {
vector<SongAndSteps> vSongAndSteps; std::vector<SongAndSteps> vSongAndSteps;
for (auto e = entries.begin(); e != entries.end(); ++e) for (auto e = entries.begin(); e != entries.end(); ++e)
{ {
SongAndSteps resolved; // fill this in SongAndSteps resolved; // fill this in
@@ -502,9 +502,9 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
if( vSongAndSteps.empty() ) if( vSongAndSteps.empty() )
continue; continue;
vector<Song*> vpSongs; std::vector<Song*> vpSongs;
typedef vector<Steps*> StepsVector; typedef std::vector<Steps*> StepsVector;
map<Song*, StepsVector> mapSongToSteps; std::map<Song*, StepsVector> mapSongToSteps;
for (std::vector<SongAndSteps>::const_iterator sas = vSongAndSteps.begin(); sas != vSongAndSteps.end(); ++sas) for (std::vector<SongAndSteps>::const_iterator sas = vSongAndSteps.begin(); sas != vSongAndSteps.end(); ++sas)
{ {
StepsVector &v = mapSongToSteps[ sas->pSong ]; StepsVector &v = mapSongToSteps[ sas->pSong ];
@@ -520,7 +520,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
if( e->iChooseIndex < int( vSongAndSteps.size() ) ) if( e->iChooseIndex < int( vSongAndSteps.size() ) )
{ {
resolved.pSong = vpSongs[ e->iChooseIndex ]; resolved.pSong = vpSongs[ e->iChooseIndex ];
const vector<Steps*> &mappedSongs = mapSongToSteps[ resolved.pSong ]; const std::vector<Steps*> &mappedSongs = mapSongToSteps[ resolved.pSong ];
resolved.pSteps = mappedSongs[ RandomInt( mappedSongs.size() ) ]; resolved.pSteps = mappedSongs[ RandomInt( mappedSongs.size() ) ];
} }
else else
@@ -583,8 +583,8 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
/* Clamp the possible adjustments to try to avoid going under 1 or over /* Clamp the possible adjustments to try to avoid going under 1 or over
* MAX_BOTTOM_RANGE. */ * MAX_BOTTOM_RANGE. */
iMinDist = min( max( iMinDist, -iLowMeter + 1 ), iMaxDist ); iMinDist = std::min( std::max( iMinDist, -iLowMeter + 1 ), iMaxDist );
iMaxDist = max( min( iMaxDist, MAX_BOTTOM_RANGE - iHighMeter ), iMinDist ); iMaxDist = std::max( std::min( iMaxDist, MAX_BOTTOM_RANGE - iHighMeter ), iMinDist );
int iAdd; int iAdd;
if( iMaxDist == iMinDist ) if( iMaxDist == iMinDist )
@@ -649,14 +649,14 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
return bCourseDifficultyIsSignificant && trail.m_vEntries.size() > 0; return bCourseDifficultyIsSignificant && trail.m_vEntries.size() > 0;
} }
void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail &trail, StepsType &st, void Course::GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, Trail &trail, StepsType &st,
CourseDifficulty &cd, RandomGen &rnd, bool &bCourseDifficultyIsSignificant ) const CourseDifficulty &cd, RandomGen &rnd, bool &bCourseDifficultyIsSignificant ) const
{ {
typedef vector<Steps*> StepsVector; typedef std::vector<Steps*> StepsVector;
std::set<Song*> alreadySelected; std::set<Song*> alreadySelected;
Song* lastSongSelected; Song* lastSongSelected;
vector<SongAndSteps> vSongAndSteps; std::vector<SongAndSteps> vSongAndSteps;
for (auto e = entries.begin(); e != entries.end(); ++e) for (auto e = entries.begin(); e != entries.end(); ++e)
{ {
@@ -749,7 +749,7 @@ void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail
// Otherwise, pick random steps corresponding to the selected song // Otherwise, pick random steps corresponding to the selected song
CourseSortSongs(e->songSort, vpSongs, rnd); CourseSortSongs(e->songSort, vpSongs, rnd);
resolved.pSong = vpSongs[e->iChooseIndex]; resolved.pSong = vpSongs[e->iChooseIndex];
const vector<Steps*>& songSteps = songStepMap[resolved.pSong]; const std::vector<Steps*>& songSteps = songStepMap[resolved.pSong];
resolved.pSteps = songSteps[RandomInt(songSteps.size())]; resolved.pSteps = songSteps[RandomInt(songSteps.size())];
lastSongSelected = resolved.pSong; lastSongSelected = resolved.pSong;
@@ -814,8 +814,8 @@ void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail
/* Clamp the possible adjustments to try to avoid going under 1 or over /* Clamp the possible adjustments to try to avoid going under 1 or over
* MAX_BOTTOM_RANGE. */ * MAX_BOTTOM_RANGE. */
iMinDist = min( max( iMinDist, -iLowMeter + 1 ), iMaxDist ); iMinDist = std::min( std::max( iMinDist, -iLowMeter + 1 ), iMaxDist );
iMaxDist = max( min( iMaxDist, MAX_BOTTOM_RANGE - iHighMeter ), iMinDist ); iMaxDist = std::max( std::min( iMaxDist, MAX_BOTTOM_RANGE - iHighMeter ), iMinDist );
int iAdd; int iAdd;
if( iMaxDist == iMinDist ) if( iMaxDist == iMinDist )
@@ -860,7 +860,7 @@ void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail
} }
} }
void Course::GetTrails( vector<Trail*> &AddTo, StepsType st ) const void Course::GetTrails( std::vector<Trail*> &AddTo, StepsType st ) const
{ {
FOREACH_ShownCourseDifficulty( cd ) FOREACH_ShownCourseDifficulty( cd )
{ {
@@ -871,9 +871,9 @@ void Course::GetTrails( vector<Trail*> &AddTo, StepsType st ) const
} }
} }
void Course::GetAllTrails( vector<Trail*> &AddTo ) const void Course::GetAllTrails( std::vector<Trail*> &AddTo ) const
{ {
vector<StepsType> vStepsTypesToShow; std::vector<StepsType> vStepsTypesToShow;
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vStepsTypesToShow ); GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vStepsTypesToShow );
for (StepsType const &st : vStepsTypesToShow) for (StepsType const &st : vStepsTypesToShow)
{ {
@@ -923,7 +923,7 @@ bool Course::AllSongsAreFixed() const
const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const
{ {
vector<const Style*> vpStyles; std::vector<const Style*> vpStyles;
GAMEMAN->GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); GAMEMAN->GetCompatibleStyles( pGame, iNumPlayers, vpStyles );
for (Style const *pStyle : vpStyles) for (Style const *pStyle : vpStyles)
@@ -1127,7 +1127,7 @@ void Course::UpdateCourseStats( StepsType st )
bool Course::IsRanking() const bool Course::IsRanking() const
{ {
vector<RString> rankingsongs; std::vector<RString> rankingsongs;
split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs); split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs);
@@ -1150,7 +1150,7 @@ const CourseEntry *Course::FindFixedSong( const Song *pSong ) const
return nullptr; return nullptr;
} }
void Course::GetAllCachedTrails( vector<Trail *> &out ) void Course::GetAllCachedTrails( std::vector<Trail *> &out )
{ {
TrailCache_t::iterator it; TrailCache_t::iterator it;
for( it = m_TrailCache.begin(); it != m_TrailCache.end(); ++it ) for( it = m_TrailCache.begin(); it != m_TrailCache.end(); ++it )
@@ -1201,7 +1201,7 @@ bool Course::Matches( RString sGroup, RString sCourse ) const
if( !sFile.empty() ) if( !sFile.empty() )
{ {
sFile.Replace("\\","/"); sFile.Replace("\\","/");
vector<RString> bits; std::vector<RString> bits;
split( sFile, "/", bits ); split( sFile, "/", bits );
const RString &sLastBit = bits[bits.size()-1]; const RString &sLastBit = bits[bits.size()-1];
if( sCourse.EqualsNoCase(sLastBit) ) if( sCourse.EqualsNoCase(sLastBit) )
@@ -1281,7 +1281,7 @@ public:
} }
static int GetCourseEntries( T* p, lua_State *L ) static int GetCourseEntries( T* p, lua_State *L )
{ {
vector<CourseEntry*> v; std::vector<CourseEntry*> v;
for( unsigned i = 0; i < p->m_vEntries.size(); ++i ) for( unsigned i = 0; i < p->m_vEntries.size(); ++i )
{ {
v.push_back(&p->m_vEntries[i]); v.push_back(&p->m_vEntries[i]);
@@ -1296,7 +1296,7 @@ public:
} }
static int GetAllTrails( T* p, lua_State *L ) static int GetAllTrails( T* p, lua_State *L )
{ {
vector<Trail*> v; std::vector<Trail*> v;
p->GetAllTrails( v ); p->GetAllTrails( v );
LuaHelpers::CreateTableFromArray<Trail*>( v, L ); LuaHelpers::CreateTableFromArray<Trail*>( v, L );
return 1; return 1;
+9 -9
View File
@@ -95,8 +95,8 @@ public:
// Dereferences course_entries and returns only the playable Songs and Steps // Dereferences course_entries and returns only the playable Songs and Steps
Trail* GetTrail( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; Trail* GetTrail( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const;
Trail* GetTrailForceRegenCache( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; Trail* GetTrailForceRegenCache( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const;
void GetTrails( vector<Trail*> &AddTo, StepsType st ) const; void GetTrails( std::vector<Trail*> &AddTo, StepsType st ) const;
void GetAllTrails( vector<Trail*> &AddTo ) const; void GetAllTrails( std::vector<Trail*> &AddTo ) const;
int GetMeter( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; int GetMeter( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const;
bool HasMods() const; bool HasMods() const;
bool HasTimedMods() const; bool HasTimedMods() const;
@@ -133,7 +133,7 @@ public:
// Call when a Song or its Steps are deleted/changed. // Call when a Song or its Steps are deleted/changed.
void Invalidate( const Song *pStaleSong ); void Invalidate( const Song *pStaleSong );
void GetAllCachedTrails( vector<Trail *> &out ); void GetAllCachedTrails( std::vector<Trail *> &out );
RString GetCacheFilePath() const; RString GetCacheFilePath() const;
const CourseEntry *FindFixedSong( const Song *pSong ) const; const CourseEntry *FindFixedSong( const Song *pSong ) const;
@@ -149,7 +149,7 @@ public:
void CalculateRadarValues(); void CalculateRadarValues();
bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
void GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail &trail, StepsType &st, void GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, Trail &trail, StepsType &st,
CourseDifficulty &cd, RandomGen &rnd, bool &bCourseDifficultyIsSignificant ) const; CourseDifficulty &cd, RandomGen &rnd, bool &bCourseDifficultyIsSignificant ) const;
bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
@@ -178,7 +178,7 @@ public:
bool m_bIncomplete; bool m_bIncomplete;
vector<CourseEntry> m_vEntries; std::vector<CourseEntry> m_vEntries;
// sorting values // sorting values
int m_SortOrder_TotalDifficulty; int m_SortOrder_TotalDifficulty;
@@ -186,7 +186,7 @@ public:
ProfileSlot m_LoadedFromProfile; // ProfileSlot_Invalid if wasn't loaded from a profile ProfileSlot m_LoadedFromProfile; // ProfileSlot_Invalid if wasn't loaded from a profile
typedef pair<StepsType,Difficulty> CacheEntry; typedef std::pair<StepsType,Difficulty> CacheEntry;
struct CacheData struct CacheData
{ {
Trail trail; Trail trail;
@@ -194,15 +194,15 @@ public:
CacheData(): trail(), null(false) {} CacheData(): trail(), null(false) {}
}; };
typedef map<CacheEntry, CacheData> TrailCache_t; typedef std::map<CacheEntry, CacheData> TrailCache_t;
mutable TrailCache_t m_TrailCache; mutable TrailCache_t m_TrailCache;
mutable int m_iTrailCacheSeed; mutable int m_iTrailCacheSeed;
typedef map<CacheEntry, RadarValues> RadarCache_t; typedef std::map<CacheEntry, RadarValues> RadarCache_t;
RadarCache_t m_RadarCache; RadarCache_t m_RadarCache;
// Preferred styles: // Preferred styles:
set<RString> m_setStyles; std::set<RString> m_setStyles;
}; };
#endif #endif
+1 -1
View File
@@ -20,7 +20,7 @@ public:
protected: protected:
void SetItemFromGameState( Actor *pActor, int iCourseEntryIndex ); void SetItemFromGameState( Actor *pActor, int iCourseEntryIndex );
vector<Actor *> m_vpDisplay; std::vector<Actor *> m_vpDisplay;
}; };
#endif #endif
+14 -14
View File
@@ -73,7 +73,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
{ {
RString str = sParams[1]; RString str = sParams[1];
str.MakeLower(); str.MakeLower();
if( str.find("yes") != string::npos ) if( str.find("yes") != std::string::npos )
out.m_bRepeat = true; out.m_bRepeat = true;
} }
@@ -87,7 +87,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
} }
else if( sValueName.EqualsNoCase("LIVES") ) else if( sValueName.EqualsNoCase("LIVES") )
{ {
out.m_iLives = max( StringToInt(sParams[1]), 0 ); out.m_iLives = std::max( StringToInt(sParams[1]), 0 );
} }
else if( sValueName.EqualsNoCase("GAINSECONDS") ) else if( sValueName.EqualsNoCase("GAINSECONDS") )
{ {
@@ -97,7 +97,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
{ {
if( sParams.params.size() == 2 ) if( sParams.params.size() == 2 )
{ {
out.m_iCustomMeter[Difficulty_Medium] = max( StringToInt(sParams[1]), 0 ); /* compat */ out.m_iCustomMeter[Difficulty_Medium] = std::max( StringToInt(sParams[1]), 0 ); /* compat */
} }
else if( sParams.params.size() == 3 ) else if( sParams.params.size() == 3 )
{ {
@@ -107,7 +107,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
LOG->UserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() ); LOG->UserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() );
continue; continue;
} }
out.m_iCustomMeter[cd] = max( StringToInt(sParams[2]), 0 ); out.m_iCustomMeter[cd] = std::max( StringToInt(sParams[2]), 0 );
} }
} }
@@ -117,14 +117,14 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
float end = -9999; float end = -9999;
for( unsigned j = 1; j < sParams.params.size(); ++j ) for( unsigned j = 1; j < sParams.params.size(); ++j )
{ {
vector<RString> sBits; std::vector<RString> sBits;
split( sParams[j], "=", sBits, false ); split( sParams[j], "=", sBits, false );
if( sBits.size() < 2 ) if( sBits.size() < 2 )
continue; continue;
Trim( sBits[0] ); Trim( sBits[0] );
if( !sBits[0].CompareNoCase("TIME") ) if( !sBits[0].CompareNoCase("TIME") )
attack.fStartSecond = max( StringToFloat(sBits[1]), 0.0f ); attack.fStartSecond = std::max( StringToFloat(sBits[1]), 0.0f );
else if( !sBits[0].CompareNoCase("LEN") ) else if( !sBits[0].CompareNoCase("LEN") )
attack.fSecsRemaining = StringToFloat( sBits[1] ); attack.fSecsRemaining = StringToFloat( sBits[1] );
else if( !sBits[0].CompareNoCase("END") ) else if( !sBits[0].CompareNoCase("END") )
@@ -223,7 +223,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
//new_entry.bSecret = true; //new_entry.bSecret = true;
RString sSong = sParams[1]; RString sSong = sParams[1];
sSong.Replace( "\\", "/" ); sSong.Replace( "\\", "/" );
vector<RString> bits; std::vector<RString> bits;
split( sSong, "/", bits ); split( sSong, "/", bits );
if( bits.size() == 2 ) if( bits.size() == 2 )
{ {
@@ -247,7 +247,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
{ {
RString sSong = sParams[1]; RString sSong = sParams[1];
sSong.Replace( "\\", "/" ); sSong.Replace( "\\", "/" );
vector<RString> bits; std::vector<RString> bits;
split( sSong, "/", bits ); split( sSong, "/", bits );
Song *pSong = nullptr; Song *pSong = nullptr;
@@ -287,14 +287,14 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
new_entry.stepsCriteria.m_iLowMeter = 3; new_entry.stepsCriteria.m_iLowMeter = 3;
new_entry.stepsCriteria.m_iHighMeter = 6; new_entry.stepsCriteria.m_iHighMeter = 6;
} }
new_entry.stepsCriteria.m_iLowMeter = max( new_entry.stepsCriteria.m_iLowMeter, 1 ); new_entry.stepsCriteria.m_iLowMeter = std::max( new_entry.stepsCriteria.m_iLowMeter, 1 );
new_entry.stepsCriteria.m_iHighMeter = max( new_entry.stepsCriteria.m_iHighMeter, new_entry.stepsCriteria.m_iLowMeter ); new_entry.stepsCriteria.m_iHighMeter = std::max( new_entry.stepsCriteria.m_iHighMeter, new_entry.stepsCriteria.m_iLowMeter );
} }
{ {
// If "showcourse" or "noshowcourse" is in the list, force // If "showcourse" or "noshowcourse" is in the list, force
// new_entry.secret on or off. // new_entry.secret on or off.
vector<RString> mods; std::vector<RString> mods;
split( sParams[3], ",", mods, true ); split( sParams[3], ",", mods, true );
for( int j = (int) mods.size()-1; j >= 0 ; --j ) for( int j = (int) mods.size()-1; j >= 0 ; --j )
{ {
@@ -340,7 +340,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
else if( sValueName.EqualsNoCase("STYLE") ) else if( sValueName.EqualsNoCase("STYLE") )
{ {
RString sStyles = sParams[1]; RString sStyles = sParams[1];
vector<RString> asStyles; std::vector<RString> asStyles;
split( sStyles, ",", asStyles ); split( sStyles, ",", asStyles );
for (RString const &s : asStyles) for (RString const &s : asStyles)
out.m_setStyles.insert( s ); out.m_setStyles.insert( s );
@@ -356,7 +356,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
{ {
const RString sFName = SetExtension( out.m_sPath, "" ); const RString sFName = SetExtension( out.m_sPath, "" );
vector<RString> arrayPossibleBanners; std::vector<RString> arrayPossibleBanners;
GetDirListing( sFName + "*.png", arrayPossibleBanners, false, false ); GetDirListing( sFName + "*.png", arrayPossibleBanners, false, false );
GetDirListing( sFName + "*.jpg", arrayPossibleBanners, false, false ); GetDirListing( sFName + "*.jpg", arrayPossibleBanners, false, false );
GetDirListing( sFName + "*.jpeg", arrayPossibleBanners, false, false ); GetDirListing( sFName + "*.jpeg", arrayPossibleBanners, false, false );
@@ -400,7 +400,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out )
// save group name // save group name
{ {
vector<RString> parts; std::vector<RString> parts;
split( sPath, "/", parts, false ); split( sPath, "/", parts, false );
if( parts.size() >= 4 ) // e.g. "/Courses/blah/fun.crs" if( parts.size() >= 4 ) // e.g. "/Courses/blah/fun.crs"
out.m_sGroupName = parts[parts.size()-2]; out.m_sGroupName = parts[parts.size()-2];
+19 -19
View File
@@ -87,19 +87,19 @@ static bool CompareCoursePointersByRanking( const Course* pCourse1, const Course
return iNum1 < iNum2; return iNum1 < iNum2;
} }
void CourseUtil::SortCoursePointerArrayByDifficulty( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByDifficulty( std::vector<Course*> &vpCoursesInOut )
{ {
sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByDifficulty ); sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByDifficulty );
} }
void CourseUtil::SortCoursePointerArrayByRanking( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByRanking( std::vector<Course*> &vpCoursesInOut )
{ {
for( unsigned i=0; i<vpCoursesInOut.size(); i++ ) for( unsigned i=0; i<vpCoursesInOut.size(); i++ )
vpCoursesInOut[i]->UpdateCourseStats( GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType ); vpCoursesInOut[i]->UpdateCourseStats( GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType );
sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByRanking ); sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByRanking );
} }
void CourseUtil::SortCoursePointerArrayByTotalDifficulty( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByTotalDifficulty( std::vector<Course*> &vpCoursesInOut )
{ {
for( unsigned i=0; i<vpCoursesInOut.size(); i++ ) for( unsigned i=0; i<vpCoursesInOut.size(); i++ )
vpCoursesInOut[i]->UpdateCourseStats( GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType ); vpCoursesInOut[i]->UpdateCourseStats( GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType );
@@ -115,7 +115,7 @@ RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so )
// more code here // more code here
} }
void SortCoursePointerArrayBySectionName( vector<Course*> &vpCoursesInOut, SortOrder so ) void SortCoursePointerArrayBySectionName( std::vector<Course*> &vpCoursesInOut, SortOrder so )
{ {
RString sOther = SORT_OTHER.GetValue(); RString sOther = SORT_OTHER.GetValue();
for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) for(unsigned i = 0; i < vpCoursesInOut.size(); ++i)
@@ -138,17 +138,17 @@ static bool CompareCoursePointersByType( const Course* pCourse1, const Course* p
return pCourse1->GetPlayMode() < pCourse2->GetPlayMode(); return pCourse1->GetPlayMode() < pCourse2->GetPlayMode();
} }
void CourseUtil::SortCoursePointerArrayByType( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByType( std::vector<Course*> &vpCoursesInOut )
{ {
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByType ); stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByType );
} }
void CourseUtil::MoveRandomToEnd( vector<Course*> &vpCoursesInOut ) void CourseUtil::MoveRandomToEnd( std::vector<Course*> &vpCoursesInOut )
{ {
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareRandom ); stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareRandom );
} }
static map<const Course*, RString> course_sort_val; static std::map<const Course*, RString> course_sort_val;
bool CompareCoursePointersBySortValueAscending( const Course *pSong1, const Course *pSong2 ) bool CompareCoursePointersBySortValueAscending( const Course *pSong1, const Course *pSong2 )
{ {
@@ -165,12 +165,12 @@ bool CompareCoursePointersByTitle( const Course *pCourse1, const Course *pCourse
return CompareCoursePointersByName( pCourse1, pCourse2 ); return CompareCoursePointersByName( pCourse1, pCourse2 );
} }
void CourseUtil::SortCoursePointerArrayByTitle( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByTitle( std::vector<Course*> &vpCoursesInOut )
{ {
sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle ); sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle );
} }
void CourseUtil::SortCoursePointerArrayByAvgDifficulty( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortCoursePointerArrayByAvgDifficulty( std::vector<Course*> &vpCoursesInOut )
{ {
RageTimer foo; RageTimer foo;
course_sort_val.clear(); course_sort_val.clear();
@@ -185,7 +185,7 @@ void CourseUtil::SortCoursePointerArrayByAvgDifficulty( vector<Course*> &vpCours
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), MovePlayersBestToEnd ); stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), MovePlayersBestToEnd );
} }
void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, ProfileSlot slot, bool bDescending ) void CourseUtil::SortCoursePointerArrayByNumPlays( std::vector<Course*> &vpCoursesInOut, ProfileSlot slot, bool bDescending )
{ {
if( !PROFILEMAN->IsPersistentProfile(slot) ) if( !PROFILEMAN->IsPersistentProfile(slot) )
return; // nothing to do since we don't have data return; // nothing to do since we don't have data
@@ -193,7 +193,7 @@ void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInO
SortCoursePointerArrayByNumPlays( vpCoursesInOut, pProfile, bDescending ); SortCoursePointerArrayByNumPlays( vpCoursesInOut, pProfile, bDescending );
} }
void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending ) void CourseUtil::SortCoursePointerArrayByNumPlays( std::vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending )
{ {
ASSERT( pProfile != nullptr ); ASSERT( pProfile != nullptr );
for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) for(unsigned i = 0; i < vpCoursesInOut.size(); ++i)
@@ -202,7 +202,7 @@ void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInO
course_sort_val.clear(); course_sort_val.clear();
} }
void CourseUtil::SortByMostRecentlyPlayedForMachine( vector<Course*> &vpCoursesInOut ) void CourseUtil::SortByMostRecentlyPlayedForMachine( std::vector<Course*> &vpCoursesInOut )
{ {
Profile *pProfile = PROFILEMAN->GetMachineProfile(); Profile *pProfile = PROFILEMAN->GetMachineProfile();
@@ -275,7 +275,7 @@ void CourseUtil::AutogenNonstopFromGroup( const RString &sGroupName, Difficulty
out.m_vEntries.pop_back(); out.m_vEntries.pop_back();
} }
void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc, Course &out ) void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, std::vector<Song*> aSongs, Difficulty dc, Course &out )
{ {
out.m_bIsAutogen = true; out.m_bIsAutogen = true;
out.m_bRepeat = false; out.m_bRepeat = false;
@@ -325,7 +325,7 @@ void CourseUtil::WarnOnInvalidMods( RString sMods )
{ {
PlayerOptions po; PlayerOptions po;
SongOptions so; SongOptions so;
vector<RString> vs; std::vector<RString> vs;
split( sMods, ",", vs, true ); split( sMods, ",", vs, true );
for (RString const &s : vs) for (RString const &s : vs)
{ {
@@ -429,7 +429,7 @@ bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sE
} }
// Check for name conflicts // Check for name conflicts
vector<Course*> vpCourses; std::vector<Course*> vpCourses;
EditCourseUtil::GetAllEditCourses( vpCourses ); EditCourseUtil::GetAllEditCourses( vpCourses );
for (Course const *p : vpCourses) for (Course const *p : vpCourses)
{ {
@@ -467,9 +467,9 @@ void EditCourseUtil::PrepareForPlay()
PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = static_cast<int>(pCourse->m_fGoalSeconds); PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = static_cast<int>(pCourse->m_fGoalSeconds);
} }
void EditCourseUtil::GetAllEditCourses( vector<Course*> &vpCoursesOut ) void EditCourseUtil::GetAllEditCourses( std::vector<Course*> &vpCoursesOut )
{ {
vector<Course*> vpCoursesTemp; std::vector<Course*> vpCoursesTemp;
SONGMAN->GetAllCourses( vpCoursesTemp, false ); SONGMAN->GetAllCourses( vpCoursesTemp, false );
for (Course *c : vpCoursesTemp) for (Course *c : vpCoursesTemp)
{ {
@@ -490,14 +490,14 @@ void EditCourseUtil::LoadDefaults( Course &out )
{ {
out.m_sMainTitle = ssprintf("Workout %d", i+1); out.m_sMainTitle = ssprintf("Workout %d", i+1);
vector<Course*> vpCourses; std::vector<Course*> vpCourses;
EditCourseUtil::GetAllEditCourses( vpCourses ); EditCourseUtil::GetAllEditCourses( vpCourses );
if (std::any_of(vpCourses.begin(), vpCourses.end(), [&](Course const *p) { return out.m_sMainTitle == p->m_sMainTitle; })) if (std::any_of(vpCourses.begin(), vpCourses.end(), [&](Course const *p) { return out.m_sMainTitle == p->m_sMainTitle; }))
break; break;
} }
vector<Song*> vpSongs; std::vector<Song*> vpSongs;
SONGMAN->GetPreferredSortSongs( vpSongs ); SONGMAN->GetPreferredSortSongs( vpSongs );
for( int i=0; i<(int)vpSongs.size() && i<6; i++ ) for( int i=0; i<(int)vpSongs.size() && i<6; i++ )
{ {
+13 -13
View File
@@ -17,25 +17,25 @@ bool CompareCoursePointersByTitle( const Course *pCourse1, const Course *pCourse
/** @brief Utility functions that deal with Courses. */ /** @brief Utility functions that deal with Courses. */
namespace CourseUtil namespace CourseUtil
{ {
void SortCoursePointerArrayByDifficulty( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByDifficulty( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByType( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByType( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByTitle( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByTitle( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByAvgDifficulty( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByTotalDifficulty( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByRanking( vector<Course*> &vpCoursesInOut ); void SortCoursePointerArrayByRanking( std::vector<Course*> &vpCoursesInOut );
void SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, ProfileSlot slot, bool bDescending ); void SortCoursePointerArrayByNumPlays( std::vector<Course*> &vpCoursesInOut, ProfileSlot slot, bool bDescending );
void SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending ); void SortCoursePointerArrayByNumPlays( std::vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending );
void SortByMostRecentlyPlayedForMachine( vector<Course*> &vpCoursesInOut ); void SortByMostRecentlyPlayedForMachine( std::vector<Course*> &vpCoursesInOut );
// sm-ssc sort additions: // sm-ssc sort additions:
//void SortCoursePointerArrayBySectionName( vector<Course*> &vpCoursesInOut, SortOrder so ); //void SortCoursePointerArrayBySectionName( std::vector<Course*> &vpCoursesInOut, SortOrder so );
void MoveRandomToEnd( vector<Course*> &vpCoursesInOut ); void MoveRandomToEnd( std::vector<Course*> &vpCoursesInOut );
void MakeDefaultEditCourseEntry( CourseEntry &out ); void MakeDefaultEditCourseEntry( CourseEntry &out );
void AutogenEndlessFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); void AutogenEndlessFromGroup( const RString &sGroupName, Difficulty dc, Course &out );
void AutogenNonstopFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); void AutogenNonstopFromGroup( const RString &sGroupName, Difficulty dc, Course &out );
void AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc, Course &out ); void AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, std::vector<Song*> aSongs, Difficulty dc, Course &out );
bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut );
@@ -53,7 +53,7 @@ namespace EditCourseUtil
void LoadDefaults( Course &out ); void LoadDefaults( Course &out );
bool RemoveAndDeleteFile( Course *pCourse ); bool RemoveAndDeleteFile( Course *pCourse );
bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut );
void GetAllEditCourses( vector<Course*> &vpCoursesOut ); void GetAllEditCourses( std::vector<Course*> &vpCoursesOut );
bool Save( Course *pCourse ); bool Save( Course *pCourse );
bool RenameAndSave( Course *pCourse, RString sName ); bool RenameAndSave( Course *pCourse, RString sName );
+2 -2
View File
@@ -59,7 +59,7 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
if( !course.m_setStyles.empty() ) if( !course.m_setStyles.empty() )
{ {
vector<RString> asStyles; std::vector<RString> asStyles;
asStyles.insert( asStyles.begin(), course.m_setStyles.begin(), course.m_setStyles.end() ); asStyles.insert( asStyles.begin(), course.m_setStyles.begin(), course.m_setStyles.end() );
f.PutLine( ssprintf("#STYLE:%s;", join( ",", asStyles ).c_str()) ); f.PutLine( ssprintf("#STYLE:%s;", join( ",", asStyles ).c_str()) );
} }
@@ -83,7 +83,7 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
StepsType st = entry.first; StepsType st = entry.first;
CourseDifficulty cd = entry.second; CourseDifficulty cd = entry.second;
vector<RString> asRadarValues; std::vector<RString> asRadarValues;
const RadarValues &rv = it->second; const RadarValues &rv = it->second;
for( int r=0; r < NUM_RadarCategory; r++ ) for( int r=0; r < NUM_RadarCategory; r++ )
asRadarValues.push_back( ssprintf("%.3f", rv[r]) ); asRadarValues.push_back( ssprintf("%.3f", rv[r]) );
+1 -1
View File
@@ -274,7 +274,7 @@ bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile )
if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) ) if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) )
return true; return true;
vector<RString> asKeys; std::vector<RString> asKeys;
GetDirListing( ALTERNATE_PUBLIC_KEY_DIR, asKeys, false, true ); GetDirListing( ALTERNATE_PUBLIC_KEY_DIR, asKeys, false, true );
for( unsigned i = 0; i < asKeys.size(); ++i ) for( unsigned i = 0; i < asKeys.size(); ++i )
{ {
+1 -1
View File
@@ -44,7 +44,7 @@ bool CsvFile::ReadFile( RageFileBasic &f )
utf8_remove_bom( line ); utf8_remove_bom( line );
vector<RString> vs; std::vector<RString> vs;
while( !line.empty() ) while( !line.empty() )
{ {
+2 -2
View File
@@ -15,8 +15,8 @@ public:
bool WriteFile( const RString &sPath ) const; bool WriteFile( const RString &sPath ) const;
bool WriteFile( RageFileBasic &sFile ) const; bool WriteFile( RageFileBasic &sFile ) const;
typedef vector<RString> StringVector; typedef std::vector<RString> StringVector;
vector<StringVector> m_vvs; std::vector<StringVector> m_vvs;
private: private:
RString m_sPath; RString m_sPath;
+37 -38
View File
@@ -3,7 +3,6 @@
#include "RageLog.h" #include "RageLog.h"
#include "RageUtil.h" #include "RageUtil.h"
#include <list> #include <list>
using std::list;
// Spline solving optimization: // Spline solving optimization:
// The tridiagonal part of the system of equations for a spline of size n is // The tridiagonal part of the system of equations for a spline of size n is
@@ -22,25 +21,25 @@ struct SplineSolutionCache
{ {
struct Entry struct Entry
{ {
vector<float> diagonals; std::vector<float> diagonals;
vector<float> multiples; std::vector<float> multiples;
}; };
void solve_diagonals_straight(vector<float>& diagonals, vector<float>& multiples); void solve_diagonals_straight(std::vector<float>& diagonals, std::vector<float>& multiples);
void solve_diagonals_looped(vector<float>& diagonals, vector<float>& multiples); void solve_diagonals_looped(std::vector<float>& diagonals, std::vector<float>& multiples);
private: private:
void prep_inner(size_t last, vector<float>& out); void prep_inner(size_t last, std::vector<float>& out);
bool find_in_cache(list<Entry>& cache, vector<float>& outd, vector<float>& outm); bool find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
void add_to_cache(list<Entry>& cache, vector<float>& outd, vector<float>& outm); void add_to_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
list<Entry> straight_diagonals; std::list<Entry> straight_diagonals;
list<Entry> looped_diagonals; std::list<Entry> looped_diagonals;
}; };
const size_t solution_cache_limit= 16; const size_t solution_cache_limit= 16;
bool SplineSolutionCache::find_in_cache(list<Entry>& cache, vector<float>& outd, vector<float>& outm) bool SplineSolutionCache::find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm)
{ {
size_t out_size= outd.size(); size_t out_size= outd.size();
for(list<Entry>::iterator entry= cache.begin(); for(std::list<Entry>::iterator entry= cache.begin();
entry != cache.end(); ++entry) entry != cache.end(); ++entry)
{ {
if(out_size == entry->diagonals.size()) if(out_size == entry->diagonals.size())
@@ -60,7 +59,7 @@ bool SplineSolutionCache::find_in_cache(list<Entry>& cache, vector<float>& outd,
return false; return false;
} }
void SplineSolutionCache::add_to_cache(list<Entry>& cache, vector<float>& outd, vector<float>& outm) void SplineSolutionCache::add_to_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm)
{ {
if(cache.size() >= solution_cache_limit) if(cache.size() >= solution_cache_limit)
{ {
@@ -71,7 +70,7 @@ void SplineSolutionCache::add_to_cache(list<Entry>& cache, vector<float>& outd,
cache.front().multiples= outm; cache.front().multiples= outm;
} }
void SplineSolutionCache::prep_inner(size_t last, vector<float>& out) void SplineSolutionCache::prep_inner(size_t last, std::vector<float>& out)
{ {
for(size_t i= 1; i < last; ++i) for(size_t i= 1; i < last; ++i)
{ {
@@ -79,7 +78,7 @@ void SplineSolutionCache::prep_inner(size_t last, vector<float>& out)
} }
} }
void SplineSolutionCache::solve_diagonals_straight(vector<float>& diagonals, vector<float>& multiples) void SplineSolutionCache::solve_diagonals_straight(std::vector<float>& diagonals, std::vector<float>& multiples)
{ {
if(find_in_cache(straight_diagonals, diagonals, multiples)) if(find_in_cache(straight_diagonals, diagonals, multiples))
{ {
@@ -125,7 +124,7 @@ void SplineSolutionCache::solve_diagonals_straight(vector<float>& diagonals, vec
add_to_cache(straight_diagonals, diagonals, multiples); add_to_cache(straight_diagonals, diagonals, multiples);
} }
void SplineSolutionCache::solve_diagonals_looped(vector<float>& diagonals, vector<float>& multiples) void SplineSolutionCache::solve_diagonals_looped(std::vector<float>& diagonals, std::vector<float>& multiples)
{ {
if(find_in_cache(looped_diagonals, diagonals, multiples)) if(find_in_cache(looped_diagonals, diagonals, multiples))
{ {
@@ -165,7 +164,7 @@ void SplineSolutionCache::solve_diagonals_looped(vector<float>& diagonals, vecto
diagonals[0]= 4.0f; diagonals[0]= 4.0f;
prep_inner(last, diagonals); prep_inner(last, diagonals);
// right_column is sized to not store the diagonal . // right_column is sized to not store the diagonal .
vector<float> right_column(diagonals.size()-1, 0.0f); std::vector<float> right_column(diagonals.size()-1, 0.0f);
right_column[0]= 1.0f; right_column[0]= 1.0f;
right_column[last-2]= 1.0f; right_column[last-2]= 1.0f;
@@ -253,9 +252,9 @@ void CubicSpline::solve_looped()
{ {
if(check_minimum_size()) { return; } if(check_minimum_size()) { return; }
size_t last= m_points.size(); size_t last= m_points.size();
vector<float> results(m_points.size()); std::vector<float> results(m_points.size());
vector<float> diagonals(m_points.size()); std::vector<float> diagonals(m_points.size());
vector<float> multiples; std::vector<float> multiples;
solution_cache.solve_diagonals_looped(diagonals, multiples); solution_cache.solve_diagonals_looped(diagonals, multiples);
results[0]= 3 * loop_space_difference( results[0]= 3 * loop_space_difference(
m_points[1].a, m_points[last-1].a, m_spatial_extent); m_points[1].a, m_points[last-1].a, m_spatial_extent);
@@ -302,9 +301,9 @@ void CubicSpline::solve_straight()
{ {
if(check_minimum_size()) { return; } if(check_minimum_size()) { return; }
size_t last= m_points.size(); size_t last= m_points.size();
vector<float> results(m_points.size()); std::vector<float> results(m_points.size());
vector<float> diagonals(m_points.size()); std::vector<float> diagonals(m_points.size());
vector<float> multiples; std::vector<float> multiples;
solution_cache.solve_diagonals_straight(diagonals, multiples); solution_cache.solve_diagonals_straight(diagonals, multiples);
results[0]= 3 * (m_points[1].a - m_points[0].a); results[0]= 3 * (m_points[1].a - m_points[0].a);
prep_inner(last, results); prep_inner(last, results);
@@ -373,7 +372,7 @@ bool CubicSpline::check_minimum_size()
return all_points_identical; return all_points_identical;
} }
void CubicSpline::prep_inner(size_t last, vector<float>& results) void CubicSpline::prep_inner(size_t last, std::vector<float>& results)
{ {
for(size_t i= 1; i < last - 1; ++i) for(size_t i= 1; i < last - 1; ++i)
{ {
@@ -382,7 +381,7 @@ void CubicSpline::prep_inner(size_t last, vector<float>& results)
} }
} }
void CubicSpline::set_results(size_t last, vector<float>& diagonals, vector<float>& results) void CubicSpline::set_results(size_t last, std::vector<float>& diagonals, std::vector<float>& results)
{ {
// No more operations left, everything not a diagonal should be zero now. // No more operations left, everything not a diagonal should be zero now.
for(size_t i= 0; i < last; ++i) for(size_t i= 0; i < last; ++i)
@@ -650,7 +649,7 @@ void CubicSplineN::solve()
} }
#define CSN_EVAL_SOMETHING(something) \ #define CSN_EVAL_SOMETHING(something) \
void CubicSplineN::something(float t, vector<float>& v) const \ void CubicSplineN::something(float t, std::vector<float>& v) const \
{ \ { \
for(spline_cont_t::const_iterator spline= m_splines.begin(); \ for(spline_cont_t::const_iterator spline= m_splines.begin(); \
spline != m_splines.end(); ++spline) \ spline != m_splines.end(); ++spline) \
@@ -680,7 +679,7 @@ CSN_EVAL_RV_SOMETHING(evaluate_derivative);
#undef CSN_EVAL_RV_SOMETHING #undef CSN_EVAL_RV_SOMETHING
void CubicSplineN::set_point(size_t i, const vector<float>& v) void CubicSplineN::set_point(size_t i, const std::vector<float>& v)
{ {
ASSERT_M(v.size() == m_splines.size(), "CubicSplineN::set_point requires the passed point to be the same dimension as the spline."); ASSERT_M(v.size() == m_splines.size(), "CubicSplineN::set_point requires the passed point to be the same dimension as the spline.");
for(size_t n= 0; n < m_splines.size(); ++n) for(size_t n= 0; n < m_splines.size(); ++n)
@@ -690,8 +689,8 @@ void CubicSplineN::set_point(size_t i, const vector<float>& v)
m_dirty= true; m_dirty= true;
} }
void CubicSplineN::set_coefficients(size_t i, const vector<float>& b, void CubicSplineN::set_coefficients(size_t i, const std::vector<float>& b,
const vector<float>& c, const vector<float>& d) const std::vector<float>& c, const std::vector<float>& d)
{ {
ASSERT_M(b.size() == c.size() && c.size() == d.size() && ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be " d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
@@ -703,8 +702,8 @@ void CubicSplineN::set_coefficients(size_t i, const vector<float>& b,
m_dirty= true; m_dirty= true;
} }
void CubicSplineN::get_coefficients(size_t i, vector<float>& b, void CubicSplineN::get_coefficients(size_t i, std::vector<float>& b,
vector<float>& c, vector<float>& d) std::vector<float>& c, std::vector<float>& d)
{ {
ASSERT_M(b.size() == c.size() && c.size() == d.size() && ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be " d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
@@ -814,7 +813,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
#define LCSN_EVAL_SOMETHING(something) \ #define LCSN_EVAL_SOMETHING(something) \
static int something(T* p, lua_State* L) \ static int something(T* p, lua_State* L) \
{ \ { \
vector<float> pos; \ std::vector<float> pos; \
p->something(FArg(1), pos); \ p->something(FArg(1), pos); \
lua_createtable(L, pos.size(), 0); \ lua_createtable(L, pos.size(), 0); \
for(size_t i= 0; i < pos.size(); ++i) \ for(size_t i= 0; i < pos.size(); ++i) \
@@ -831,7 +830,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
#undef LCSN_EVAL_SOMETHING #undef LCSN_EVAL_SOMETHING
static void get_element_table_from_stack(T* p, lua_State* L, int s, static void get_element_table_from_stack(T* p, lua_State* L, int s,
size_t limit, vector<float>& ret) size_t limit, std::vector<float>& ret)
{ {
size_t elements= lua_objlen(L, s); size_t elements= lua_objlen(L, s);
// Too many elements is not an error because allowing it allows the user // Too many elements is not an error because allowing it allows the user
@@ -854,7 +853,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
{ {
luaL_error(L, "Spline point must be a table."); luaL_error(L, "Spline point must be a table.");
} }
vector<float> pos; std::vector<float> pos;
get_element_table_from_stack(p, L, s, p->dimension(), pos); get_element_table_from_stack(p, L, s, p->dimension(), pos);
p->set_point(i, pos); p->set_point(i, pos);
} }
@@ -871,9 +870,9 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
luaL_error(L, "Spline coefficient args must be three tables."); luaL_error(L, "Spline coefficient args must be three tables.");
} }
size_t limit= p->dimension(); size_t limit= p->dimension();
vector<float> b; get_element_table_from_stack(p, L, s, limit, b); std::vector<float> b; get_element_table_from_stack(p, L, s, limit, b);
vector<float> c; get_element_table_from_stack(p, L, s+1, limit, c); std::vector<float> c; get_element_table_from_stack(p, L, s+1, limit, c);
vector<float> d; get_element_table_from_stack(p, L, s+2, limit, d); std::vector<float> d; get_element_table_from_stack(p, L, s+2, limit, d);
p->set_coefficients(i, b, c, d); p->set_coefficients(i, b, c, d);
} }
static int set_coefficients(T* p, lua_State* L) static int set_coefficients(T* p, lua_State* L)
@@ -886,7 +885,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
{ {
size_t i= point_index(p, L, 1); size_t i= point_index(p, L, 1);
size_t limit= p->dimension(); size_t limit= p->dimension();
vector<vector<float> > coeff(3); std::vector<std::vector<float> > coeff(3);
coeff[0].resize(limit); coeff[0].resize(limit);
coeff[1].resize(limit); coeff[1].resize(limit);
coeff[2].resize(limit); coeff[2].resize(limit);
+13 -14
View File
@@ -2,7 +2,6 @@
#define CUBIC_SPLINE_H #define CUBIC_SPLINE_H
#include <vector> #include <vector>
using std::vector;
#include "RageTypes.h" #include "RageTypes.h"
struct lua_State; struct lua_State;
@@ -28,14 +27,14 @@ CubicSpline() :m_spatial_extent(0.0f) {}
float m_spatial_extent; float m_spatial_extent;
private: private:
bool check_minimum_size(); bool check_minimum_size();
void prep_inner(size_t last, vector<float>& results); void prep_inner(size_t last, std::vector<float>& results);
void set_results(size_t last, vector<float>& diagonals, vector<float>& results); void set_results(size_t last, std::vector<float>& diagonals, std::vector<float>& results);
struct SplinePoint struct SplinePoint
{ {
float a, b, c, d; float a, b, c, d;
}; };
vector<SplinePoint> m_points; std::vector<SplinePoint> m_points;
}; };
struct CubicSplineN struct CubicSplineN
@@ -46,17 +45,17 @@ struct CubicSplineN
static void weighted_average(CubicSplineN& out, const CubicSplineN& from, static void weighted_average(CubicSplineN& out, const CubicSplineN& from,
const CubicSplineN& to, float between); const CubicSplineN& to, float between);
void solve(); void solve();
void evaluate(float t, vector<float>& v) const; void evaluate(float t, std::vector<float>& v) const;
void evaluate_derivative(float t, vector<float>& v) const; void evaluate_derivative(float t, std::vector<float>& v) const;
void evaluate_second_derivative(float t, vector<float>& v) const; void evaluate_second_derivative(float t, std::vector<float>& v) const;
void evaluate_third_derivative(float t, vector<float>& v) const; void evaluate_third_derivative(float t, std::vector<float>& v) const;
void evaluate(float t, RageVector3& v) const; void evaluate(float t, RageVector3& v) const;
void evaluate_derivative(float t, RageVector3& v) const; void evaluate_derivative(float t, RageVector3& v) const;
void set_point(size_t i, const vector<float>& v); void set_point(size_t i, const std::vector<float>& v);
void set_coefficients(size_t i, const vector<float>& b, void set_coefficients(size_t i, const std::vector<float>& b,
const vector<float>& c, const vector<float>& d); const std::vector<float>& c, const std::vector<float>& d);
void get_coefficients(size_t i, vector<float>& b, void get_coefficients(size_t i, std::vector<float>& b,
vector<float>& c, vector<float>& d); std::vector<float>& c, std::vector<float>& d);
void set_spatial_extent(size_t i, float extent); void set_spatial_extent(size_t i, float extent);
float get_spatial_extent(size_t i); float get_spatial_extent(size_t i);
void resize(size_t s); void resize(size_t s);
@@ -68,7 +67,7 @@ struct CubicSplineN
if(m_loop) { return static_cast<float>(size()); } if(m_loop) { return static_cast<float>(size()); }
else { return static_cast<float>(size()-1); } else { return static_cast<float>(size()-1); }
} }
typedef vector<CubicSpline> spline_cont_t; typedef std::vector<CubicSpline> spline_cont_t;
void set_loop(bool l); void set_loop(bool l);
bool get_loop() const; bool get_loop() const;
void set_polygonal(bool p); void set_polygonal(bool p);
+3 -3
View File
@@ -23,12 +23,12 @@ LuaXType( Difficulty );
const RString &CourseDifficultyToLocalizedString( CourseDifficulty x ) const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
{ {
static unique_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty]; static std::unique_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
if( g_CourseDifficultyName[0].get() == nullptr ) if( g_CourseDifficultyName[0].get() == nullptr )
{ {
FOREACH_ENUM( Difficulty,i) FOREACH_ENUM( Difficulty,i)
{ {
unique_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) ); std::unique_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) );
g_CourseDifficultyName[i] = move(ap); g_CourseDifficultyName[i] = move(ap);
} }
} }
@@ -112,7 +112,7 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
return "Edit"; return "Edit";
} }
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
vector<RString> vsNames; std::vector<RString> vsNames;
split( NAMES, ",", vsNames ); split( NAMES, ",", vsNames );
for (RString const &sName: vsNames) for (RString const &sName: vsNames)
{ {
+1 -1
View File
@@ -24,7 +24,7 @@ bool DifficultyIcon::Load( RString sPath )
Sprite::Load( sPath ); Sprite::Load( sPath );
int iStates = GetNumStates(); int iStates = GetNumStates();
bool bWarn = iStates != NUM_Difficulty && iStates != NUM_Difficulty*2; bool bWarn = iStates != NUM_Difficulty && iStates != NUM_Difficulty*2;
if( sPath.find("_blank") != string::npos ) if( sPath.find("_blank") != std::string::npos )
bWarn = false; bWarn = false;
if( bWarn ) if( bWarn )
{ {
+11 -11
View File
@@ -133,36 +133,36 @@ void StepsDisplayList::UpdatePositions()
int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: 0; int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: 0;
int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: 0; int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: 0;
vector<Row> &Rows = m_Rows; std::vector<Row> &Rows = m_Rows;
const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1) && GAMESTATE->IsHumanPlayer(PLAYER_2); const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1) && GAMESTATE->IsHumanPlayer(PLAYER_2);
if( !BothPlayersActivated ) if( !BothPlayersActivated )
{ {
// Simply center the cursor. // Simply center the cursor.
first_start = max( P1Choice - halfsize, 0 ); first_start = std::max( P1Choice - halfsize, 0 );
first_end = first_start + total; first_end = first_start + total;
second_start = second_end = first_end; second_start = second_end = first_end;
} }
else else
{ {
// First half: // First half:
const int earliest = min( P1Choice, P2Choice ); const int earliest = std::min( P1Choice, P2Choice );
first_start = max( earliest - halfsize/2, 0 ); first_start = std::max( earliest - halfsize/2, 0 );
first_end = first_start + halfsize; first_end = first_start + halfsize;
// Second half: // Second half:
const int latest = max( P1Choice, P2Choice ); const int latest = std::max( P1Choice, P2Choice );
second_start = max( latest - halfsize/2, 0 ); second_start = std::max( latest - halfsize/2, 0 );
// Don't overlap. // Don't overlap.
second_start = max( second_start, first_end ); second_start = std::max( second_start, first_end );
second_end = second_start + halfsize; second_end = second_start + halfsize;
} }
first_end = min( first_end, (int) Rows.size() ); first_end = std::min( first_end, (int) Rows.size() );
second_end = min( second_end, (int) Rows.size() ); second_end = std::min( second_end, (int) Rows.size() );
/* If less than total (and Rows.size()) are displayed, fill in the empty /* If less than total (and Rows.size()) are displayed, fill in the empty
* space intelligently. */ * space intelligently. */
@@ -272,7 +272,7 @@ void StepsDisplayList::SetFromGameState()
// FIXME: This clamps to between the min and the max difficulty, but // FIXME: This clamps to between the min and the max difficulty, but
// it really should round to the nearest difficulty that's in // it really should round to the nearest difficulty that's in
// DIFFICULTIES_TO_SHOW. // DIFFICULTIES_TO_SHOW.
const vector<Difficulty>& difficulties = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); const std::vector<Difficulty>& difficulties = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue();
m_Rows.resize( difficulties.size() ); m_Rows.resize( difficulties.size() );
for (Difficulty const &d : difficulties) for (Difficulty const &d : difficulties)
{ {
@@ -283,7 +283,7 @@ void StepsDisplayList::SetFromGameState()
} }
else else
{ {
vector<Steps*> vpSteps; std::vector<Steps*> vpSteps;
SongUtil::GetPlayableSteps( pSong, vpSteps ); SongUtil::GetPlayableSteps( pSong, vpSteps );
// Should match the sort in ScreenSelectMusic::AfterMusicChange. // Should match the sort in ScreenSelectMusic::AfterMusicChange.
+2 -2
View File
@@ -47,7 +47,7 @@ private:
{ {
StepsDisplay m_Meter; StepsDisplay m_Meter;
}; };
vector<Line> m_Lines; std::vector<Line> m_Lines;
const Song *m_CurSong; const Song *m_CurSong;
bool m_bShown; bool m_bShown;
@@ -68,7 +68,7 @@ private:
bool m_bHidden; // currently off screen bool m_bHidden; // currently off screen
}; };
vector<Row> m_Rows; std::vector<Row> m_Rows;
}; };
+1 -1
View File
@@ -29,7 +29,7 @@ public:
} }
}; };
/** @brief The collection of DisplayResolutions available within the program. */ /** @brief The collection of DisplayResolutions available within the program. */
typedef set<DisplayResolution> DisplayResolutions; typedef std::set<DisplayResolution> DisplayResolutions;
#endif #endif
+8 -8
View File
@@ -40,7 +40,7 @@ StringToX( EditMenuAction );
static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); } static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); } static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); }
void EditMenu::StripLockedStepsAndDifficulty( vector<StepsAndDifficulty> &v ) void EditMenu::StripLockedStepsAndDifficulty( std::vector<StepsAndDifficulty> &v )
{ {
const Song *pSong = GetSelectedSong(); const Song *pSong = GetSelectedSong();
for( int i=(int)v.size()-1; i>=0; i-- ) for( int i=(int)v.size()-1; i>=0; i-- )
@@ -50,7 +50,7 @@ void EditMenu::StripLockedStepsAndDifficulty( vector<StepsAndDifficulty> &v )
} }
} }
void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector<Song*> &vpSongsOut ) void EditMenu::GetSongsToShowForGroup( const RString &sGroup, std::vector<Song*> &vpSongsOut )
{ {
if(sGroup == "") if(sGroup == "")
{ {
@@ -79,7 +79,7 @@ void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector<Song*> &vpS
SongUtil::SortSongPointerArrayByTitle( vpSongsOut ); SongUtil::SortSongPointerArrayByTitle( vpSongsOut );
} }
void EditMenu::GetGroupsToShow( vector<RString> &vsGroupsOut ) void EditMenu::GetGroupsToShow( std::vector<RString> &vsGroupsOut )
{ {
vsGroupsOut.clear(); vsGroupsOut.clear();
if( !SHOW_GROUPS.GetValue() ) if( !SHOW_GROUPS.GetValue() )
@@ -89,7 +89,7 @@ void EditMenu::GetGroupsToShow( vector<RString> &vsGroupsOut )
for( int i = vsGroupsOut.size()-1; i>=0; i-- ) for( int i = vsGroupsOut.size()-1; i>=0; i-- )
{ {
const RString &sGroup = vsGroupsOut[i]; const RString &sGroup = vsGroupsOut[i];
vector<Song*> vpSongs; std::vector<Song*> vpSongs;
GetSongsToShowForGroup( sGroup, vpSongs ); GetSongsToShowForGroup( sGroup, vpSongs );
// strip groups that have no unlocked songs // strip groups that have no unlocked songs
if( vpSongs.empty() ) if( vpSongs.empty() )
@@ -408,7 +408,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
} }
if( mode == EditMode_Practice ) if( mode == EditMode_Practice )
{ {
vector<Song*> vtSongs; std::vector<Song*> vtSongs;
GetSongsToShowForGroup(GetSelectedGroup(), vtSongs); GetSongsToShowForGroup(GetSelectedGroup(), vtSongs);
// Filter out songs that aren't playable. // Filter out songs that aren't playable.
for (Song *s :vtSongs) for (Song *s :vtSongs)
@@ -461,7 +461,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
m_StepsTypes.clear(); m_StepsTypes.clear();
// Only show StepsTypes for which we have valid Steps. // Only show StepsTypes for which we have valid Steps.
vector<StepsType> vSts = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); std::vector<StepsType> vSts = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
for (StepsType &st : vSts) for (StepsType &st : vSts)
{ {
if(SongUtil::GetStepsByDifficulty( GetSelectedSong(), st, Difficulty_Invalid, false) != nullptr) if(SongUtil::GetStepsByDifficulty( GetSelectedSong(), st, Difficulty_Invalid, false) != nullptr)
@@ -503,7 +503,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
case EditMode_CourseMods: case EditMode_CourseMods:
case EditMode_Practice: case EditMode_Practice:
{ {
vector<Steps*> v; std::vector<Steps*> v;
SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedStepsType(), Difficulty_Edit ); SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedStepsType(), Difficulty_Edit );
StepsUtil::SortStepsByDescription( v ); StepsUtil::SortStepsByDescription( v );
for (Steps *p : v) for (Steps *p : v)
@@ -616,7 +616,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
} }
else else
{ {
vector<Steps*> v; std::vector<Steps*> v;
SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedSourceStepsType(), dc ); SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedSourceStepsType(), dc );
StepsUtil::SortStepsByDescription( v ); StepsUtil::SortStepsByDescription( v );
for (Steps *pSteps : v) for (Steps *pSteps : v)
+9 -9
View File
@@ -190,9 +190,9 @@ public:
private: private:
struct StepsAndDifficulty; struct StepsAndDifficulty;
void StripLockedStepsAndDifficulty( vector<StepsAndDifficulty> &v ); void StripLockedStepsAndDifficulty( std::vector<StepsAndDifficulty> &v );
void GetSongsToShowForGroup( const RString &sGroup, vector<Song*> &vpSongsOut ); void GetSongsToShowForGroup( const RString &sGroup, std::vector<Song*> &vpSongsOut );
void GetGroupsToShow( vector<RString> &vsGroupsOut ); void GetGroupsToShow( std::vector<RString> &vsGroupsOut );
void UpdateArrows(); void UpdateArrows();
AutoActor m_sprArrows[NUM_ARROWS]; AutoActor m_sprArrows[NUM_ARROWS];
@@ -220,13 +220,13 @@ private:
}; };
/** @brief The list of groups. */ /** @brief The list of groups. */
vector<RString> m_sGroups; std::vector<RString> m_sGroups;
/** @brief The list of Songs in a group. */ /** @brief The list of Songs in a group. */
vector<Song*> m_pSongs; std::vector<Song*> m_pSongs;
vector<StepsType> m_StepsTypes; std::vector<StepsType> m_StepsTypes;
vector<StepsAndDifficulty> m_vpSteps; std::vector<StepsAndDifficulty> m_vpSteps;
vector<StepsAndDifficulty> m_vpSourceSteps; std::vector<StepsAndDifficulty> m_vpSourceSteps;
vector<EditMenuAction> m_Actions; std::vector<EditMenuAction> m_Actions;
void OnRowValueChanged( EditMenuRow row ); void OnRowValueChanged( EditMenuRow row );
void ChangeToRow( EditMenuRow newRow ); void ChangeToRow( EditMenuRow newRow );
+3 -3
View File
@@ -80,17 +80,17 @@ int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const
} }
// szNameArray is of size iMax; pNameCache is of size iMax+2. // szNameArray is of size iMax; pNameCache is of size iMax+2.
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, unique_ptr<RString> *pNameCache ) const RString &EnumToString( int iVal, int iMax, const char **szNameArray, std::unique_ptr<RString> *pNameCache )
{ {
if( unlikely(pNameCache[0].get() == nullptr) ) if( unlikely(pNameCache[0].get() == nullptr) )
{ {
for( int i = 0; i < iMax; ++i ) for( int i = 0; i < iMax; ++i )
{ {
unique_ptr<RString> ap( new RString( szNameArray[i] ) ); std::unique_ptr<RString> ap( new RString( szNameArray[i] ) );
pNameCache[i] = move(ap); pNameCache[i] = move(ap);
} }
unique_ptr<RString> ap( new RString ); std::unique_ptr<RString> ap( new RString );
pNameCache[iMax+1] = move(ap); pNameCache[iMax+1] = move(ap);
} }
+4 -4
View File
@@ -70,14 +70,14 @@ namespace Enum
void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName ); void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName );
}; };
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, unique_ptr<RString> *pNameCache ); // XToString helper const RString &EnumToString( int iVal, int iMax, const char **szNameArray, std::unique_ptr<RString> *pNameCache ); // XToString helper
#define XToString(X) \ #define XToString(X) \
const RString& X##ToString(X x); \ const RString& X##ToString(X x); \
COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \ COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \
const RString& X##ToString( X x ) \ const RString& X##ToString( X x ) \
{ \ { \
static unique_ptr<RString> as_##X##Name[NUM_##X+2]; \ static std::unique_ptr<RString> as_##X##Name[NUM_##X+2]; \
return EnumToString( x, NUM_##X, X##Names, as_##X##Name ); \ return EnumToString( x, NUM_##X, X##Names, as_##X##Name ); \
} \ } \
namespace StringConversion { template<> RString ToString<X>( const X &value ) { return X##ToString(value); } } namespace StringConversion { template<> RString ToString<X>( const X &value ) { return X##ToString(value); } }
@@ -86,11 +86,11 @@ namespace StringConversion { template<> RString ToString<X>( const X &value ) {
const RString &X##ToLocalizedString(X x); \ const RString &X##ToLocalizedString(X x); \
const RString &X##ToLocalizedString( X x ) \ const RString &X##ToLocalizedString( X x ) \
{ \ { \
static unique_ptr<LocalizedString> g_##X##Name[NUM_##X]; \ static std::unique_ptr<LocalizedString> g_##X##Name[NUM_##X]; \
if( g_##X##Name[0].get() == nullptr ) { \ if( g_##X##Name[0].get() == nullptr ) { \
for( unsigned i = 0; i < NUM_##X; ++i ) \ for( unsigned i = 0; i < NUM_##X; ++i ) \
{ \ { \
unique_ptr<LocalizedString> ap( new LocalizedString(#X, X##ToString((X)i)) ); \ std::unique_ptr<LocalizedString> ap( new LocalizedString(#X, X##ToString((X)i)) ); \
g_##X##Name[i] = move(ap); \ g_##X##Name[i] = move(ap); \
} \ } \
} \ } \
+28 -28
View File
@@ -37,7 +37,7 @@ void FontPage::Load( const FontPageSettings &cfg )
RageTextureID ID2 = ID1; RageTextureID ID2 = ID1;
// "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png" // "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png"
if( ID2.filename.find("]") != string::npos ) if( ID2.filename.find("]") != std::string::npos )
{ {
ID2.filename.Replace( "]", "-stroke]" ); ID2.filename.Replace( "]", "-stroke]" );
if( IsAFile(ID2.filename) ) if( IsAFile(ID2.filename) )
@@ -76,7 +76,7 @@ void FontPage::Load( const FontPageSettings &cfg )
} }
// load character widths // load character widths
vector<int> aiFrameWidths; std::vector<int> aiFrameWidths;
int default_width = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth(); int default_width = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth();
if( cfg.m_iDefaultWidth != -1 ) if( cfg.m_iDefaultWidth != -1 )
@@ -85,7 +85,7 @@ void FontPage::Load( const FontPageSettings &cfg )
// Assume each character is the width of the frame by default. // Assume each character is the width of the frame by default.
for( int i=0; i<m_FontPageTextures.m_pTextureMain->GetNumFrames(); i++ ) for( int i=0; i<m_FontPageTextures.m_pTextureMain->GetNumFrames(); i++ )
{ {
map<int,int>::const_iterator it = cfg.m_mapGlyphWidths.find(i); std::map<int, int>::const_iterator it = cfg.m_mapGlyphWidths.find(i);
if( it != cfg.m_mapGlyphWidths.end() ) if( it != cfg.m_mapGlyphWidths.end() )
aiFrameWidths.push_back( it->second ); aiFrameWidths.push_back( it->second );
else else
@@ -140,7 +140,7 @@ void FontPage::Load( const FontPageSettings &cfg )
// m_sTexturePath.c_str(), height, baseline, baseline-height); // m_sTexturePath.c_str(), height, baseline, baseline-height);
} }
void FontPage::SetTextureCoords( const vector<int> &widths, int iAdvanceExtraPixels ) void FontPage::SetTextureCoords( const std::vector<int> &widths, int iAdvanceExtraPixels )
{ {
for(int i = 0; i < m_FontPageTextures.m_pTextureMain->GetNumFrames(); ++i) for(int i = 0; i < m_FontPageTextures.m_pTextureMain->GetNumFrames(); ++i)
{ {
@@ -207,8 +207,8 @@ void FontPage::SetExtraPixels( int iDrawExtraPixelsLeft, int iDrawExtraPixelsRig
/* Extra pixels to draw to the left and right. We don't have to /* Extra pixels to draw to the left and right. We don't have to
* worry about alignment here; fCharWidth is always even (by * worry about alignment here; fCharWidth is always even (by
* SetTextureCoords) and iFrameWidth are almost always even. */ * SetTextureCoords) and iFrameWidth are almost always even. */
float fExtraLeft = min( float(iDrawExtraPixelsLeft), (iFrameWidth-fCharWidth)/2.0f ); float fExtraLeft = std::min( float(iDrawExtraPixelsLeft), (iFrameWidth-fCharWidth)/2.0f );
float fExtraRight = min( float(iDrawExtraPixelsRight), (iFrameWidth-fCharWidth)/2.0f ); float fExtraRight = std::min( float(iDrawExtraPixelsRight), (iFrameWidth-fCharWidth)/2.0f );
// Move left and expand right. // Move left and expand right.
m_aGlyphs[i].m_TexRect.left -= fExtraLeft * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); m_aGlyphs[i].m_TexRect.left -= fExtraLeft * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX();
@@ -232,7 +232,7 @@ FontPage::~FontPage()
} }
} }
int Font::GetLineWidthInSourcePixels( const wstring &szLine ) const int Font::GetLineWidthInSourcePixels( const std::wstring &szLine ) const
{ {
int iLineWidth = 0; int iLineWidth = 0;
@@ -242,19 +242,19 @@ int Font::GetLineWidthInSourcePixels( const wstring &szLine ) const
return iLineWidth; return iLineWidth;
} }
int Font::GetLineHeightInSourcePixels( const wstring &szLine ) const int Font::GetLineHeightInSourcePixels( const std::wstring &szLine ) const
{ {
int iLineHeight = 0; int iLineHeight = 0;
// The height of a line is the height of its tallest used font page. // The height of a line is the height of its tallest used font page.
for( unsigned i=0; i<szLine.size(); i++ ) for( unsigned i=0; i<szLine.size(); i++ )
iLineHeight = max( iLineHeight, GetGlyph(szLine[i]).m_pPage->m_iHeight ); iLineHeight = std::max( iLineHeight, GetGlyph(szLine[i]).m_pPage->m_iHeight );
return iLineHeight; return iLineHeight;
} }
// width is a pointer so that we can return the used width through it. // width is a pointer so that we can return the used width through it.
int Font::GetGlyphsThatFit(const wstring& line, int* width) const int Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
{ {
if(*width == 0) if(*width == 0)
{ {
@@ -310,7 +310,7 @@ void Font::AddPage( FontPage *m_pPage )
{ {
m_apPages.push_back( m_pPage ); m_apPages.push_back( m_pPage );
for( map<wchar_t,int>::const_iterator it = m_pPage->m_iCharToGlyphNo.begin(); for( std::map<wchar_t,int>::const_iterator it = m_pPage->m_iCharToGlyphNo.begin();
it != m_pPage->m_iCharToGlyphNo.end(); ++it ) it != m_pPage->m_iCharToGlyphNo.end(); ++it )
{ {
m_iCharToGlyph[it->first] = &m_pPage->m_aGlyphs[it->second]; m_iCharToGlyph[it->first] = &m_pPage->m_aGlyphs[it->second];
@@ -326,7 +326,7 @@ void Font::MergeFont(Font &f)
if( m_pDefault == nullptr ) if( m_pDefault == nullptr )
m_pDefault = f.m_pDefault; m_pDefault = f.m_pDefault;
for(map<wchar_t,glyph*>::iterator it = f.m_iCharToGlyph.begin(); for(std::map<wchar_t,glyph*>::iterator it = f.m_iCharToGlyph.begin();
it != f.m_iCharToGlyph.end(); ++it) it != f.m_iCharToGlyph.end(); ++it)
{ {
m_iCharToGlyph[it->first] = it->second; m_iCharToGlyph[it->first] = it->second;
@@ -355,7 +355,7 @@ const glyph &Font::GetGlyph( wchar_t c ) const
return *m_iCharToGlyphCache[c]; return *m_iCharToGlyphCache[c];
// Try the regular character. // Try the regular character.
map<wchar_t,glyph*>::const_iterator it = m_iCharToGlyph.find(c); std::map<wchar_t, glyph*>::const_iterator it = m_iCharToGlyph.find(c);
// If that's missing, use the default glyph. // If that's missing, use the default glyph.
if(it == m_iCharToGlyph.end()) if(it == m_iCharToGlyph.end())
@@ -367,9 +367,9 @@ const glyph &Font::GetGlyph( wchar_t c ) const
return *it->second; return *it->second;
} }
bool Font::FontCompleteForString( const wstring &str ) const bool Font::FontCompleteForString( const std::wstring &str ) const
{ {
map<wchar_t,glyph*>::const_iterator mapDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH ); std::map<wchar_t, glyph*>::const_iterator mapDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH );
if( mapDefault == m_iCharToGlyph.end() ) if( mapDefault == m_iCharToGlyph.end() )
RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() ); RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() );
@@ -389,7 +389,7 @@ void Font::CapsOnly()
* a lowercase one. */ * a lowercase one. */
for( char c = 'A'; c <= 'Z'; ++c ) for( char c = 'A'; c <= 'Z'; ++c )
{ {
map<wchar_t,glyph*>::const_iterator it = m_iCharToGlyph.find(c); std::map<wchar_t, glyph*>::const_iterator it = m_iCharToGlyph.find(c);
if(it == m_iCharToGlyph.end()) if(it == m_iCharToGlyph.end())
continue; continue;
@@ -413,10 +413,10 @@ void Font::SetDefaultGlyph( FontPage *pPage )
// Given the INI for a font, find all of the texture pages for the font. // Given the INI for a font, find all of the texture pages for the font.
void Font::GetFontPaths( const RString &sFontIniPath, vector<RString> &asTexturePathsOut ) void Font::GetFontPaths( const RString &sFontIniPath, std::vector<RString> &asTexturePathsOut )
{ {
RString sPrefix = SetExtension( sFontIniPath, "" ); RString sPrefix = SetExtension( sFontIniPath, "" );
vector<RString> asFiles; std::vector<RString> asFiles;
GetDirListing( sPrefix + "*", asFiles, false, true ); GetDirListing( sPrefix + "*", asFiles, false, true );
for( unsigned i = 0; i < asFiles.size(); ++i ) for( unsigned i = 0; i < asFiles.size(); ++i )
@@ -429,11 +429,11 @@ void Font::GetFontPaths( const RString &sFontIniPath, vector<RString> &asTexture
RString Font::GetPageNameFromFileName( const RString &sFilename ) RString Font::GetPageNameFromFileName( const RString &sFilename )
{ {
size_t begin = sFilename.find_first_of( '[' ); size_t begin = sFilename.find_first_of( '[' );
if( begin == string::npos ) if( begin == std::string::npos )
return "main"; return "main";
size_t end = sFilename.find_first_of( ']', begin ); size_t end = sFilename.find_first_of( ']', begin );
if( end == string::npos ) if( end == std::string::npos )
return "main"; return "main";
begin++; begin++;
@@ -545,7 +545,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
* Map hiragana to 0-84: * Map hiragana to 0-84:
* range Unicode #3041-3094=0 * range Unicode #3041-3094=0
*/ */
vector<RString> asMatches; std::vector<RString> asMatches;
static Regex parse("^RANGE ([A-Z0-9\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$"); static Regex parse("^RANGE ([A-Z0-9\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$");
bool match = parse.Compare( sName, asMatches ); bool match = parse.Compare( sName, asMatches );
ASSERT( asMatches.size() == 4 ); // 4 parens ASSERT( asMatches.size() == 4 ); // 4 parens
@@ -617,7 +617,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
} }
// Decode the string. // Decode the string.
const wstring wdata( RStringToWstring(pValue->GetValue<RString>()) ); const std::wstring wdata( RStringToWstring(pValue->GetValue<RString>()) );
if(int(wdata.size()) > num_frames_wide) if(int(wdata.size()) > num_frames_wide)
{ {
@@ -720,7 +720,7 @@ RString FontPageSettings::MapRange( RString sMapping, int iMapOffset, int iGlyph
return RString(); return RString();
} }
static vector<RString> LoadStack; static std::vector<RString> LoadStack;
/* A font set is a set of files, eg: /* A font set is a set of files, eg:
* *
@@ -772,7 +772,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
m_sChars = sChars; m_sChars = sChars;
// Get the filenames associated with this font. // Get the filenames associated with this font.
vector<RString> asTexturePaths; std::vector<RString> asTexturePaths;
GetFontPaths( sIniPath, asTexturePaths ); GetFontPaths( sIniPath, asTexturePaths );
bool bCapitalsOnly = false; bool bCapitalsOnly = false;
@@ -792,7 +792,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
} }
{ {
vector<RString> ImportList; std::vector<RString> ImportList;
bool bIsTopLevelFont = LoadStack.size() == 1; bool bIsTopLevelFont = LoadStack.size() == 1;
@@ -838,7 +838,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
RString sPagename = GetPageNameFromFileName( sTexturePath ); RString sPagename = GetPageNameFromFileName( sTexturePath );
// Ignore stroke textures // Ignore stroke textures
if( sTexturePath.find("-stroke") != string::npos ) if( sTexturePath.find("-stroke") != std::string::npos )
continue; continue;
// Create this down here so it doesn't leak if the continue gets triggered. // Create this down here so it doesn't leak if the continue gets triggered.
@@ -855,7 +855,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
/* Expect at least as many frames as we have premapped characters. */ /* Expect at least as many frames as we have premapped characters. */
/* Make sure that we don't map characters to frames we don't actually /* Make sure that we don't map characters to frames we don't actually
* have. This can happen if the font is too small for an sChars. */ * have. This can happen if the font is too small for an sChars. */
for(map<wchar_t,int>::iterator it = pPage->m_iCharToGlyphNo.begin(); for(std::map<wchar_t,int>::iterator it = pPage->m_iCharToGlyphNo.begin();
it != pPage->m_iCharToGlyphNo.end(); ++it) it != pPage->m_iCharToGlyphNo.end(); ++it)
{ {
if( it->second < pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() ) if( it->second < pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() )
@@ -892,7 +892,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
{ {
// Cache ASCII glyphs. // Cache ASCII glyphs.
ZERO( m_iCharToGlyphCache ); ZERO( m_iCharToGlyphCache );
map<wchar_t,glyph*>::iterator it; std::map<wchar_t,glyph*>::iterator it;
for( it = m_iCharToGlyph.begin(); it != m_iCharToGlyph.end(); ++it ) for( it = m_iCharToGlyph.begin(); it != m_iCharToGlyph.end(); ++it )
if( it->first < (int) ARRAYLEN(m_iCharToGlyphCache) ) if( it->first < (int) ARRAYLEN(m_iCharToGlyphCache) )
m_iCharToGlyphCache[it->first] = it->second; m_iCharToGlyphCache[it->first] = it->second;
+12 -12
View File
@@ -79,9 +79,9 @@ struct FontPageSettings
float m_fScaleAllWidthsBy; float m_fScaleAllWidthsBy;
RString m_sTextureHints; RString m_sTextureHints;
map<wchar_t,int> CharToGlyphNo; std::map<wchar_t,int> CharToGlyphNo;
// If a value is missing, the width of the texture frame is used. // If a value is missing, the width of the texture frame is used.
map<int,int> m_mapGlyphWidths; std::map<int,int> m_mapGlyphWidths;
/** @brief The initial settings for the FontPage. */ /** @brief The initial settings for the FontPage. */
FontPageSettings(): m_sTexturePath(""), FontPageSettings(): m_sTexturePath(""),
@@ -132,13 +132,13 @@ public:
RString m_sTexturePath; RString m_sTexturePath;
/** @brief All glyphs in this list will point to m_pTexture. */ /** @brief All glyphs in this list will point to m_pTexture. */
vector<glyph> m_aGlyphs; std::vector<glyph> m_aGlyphs;
map<wchar_t,int> m_iCharToGlyphNo; std::map<wchar_t,int> m_iCharToGlyphNo;
private: private:
void SetExtraPixels( int iDrawExtraPixelsLeft, int DrawExtraPixelsRight ); void SetExtraPixels( int iDrawExtraPixelsLeft, int DrawExtraPixelsRight );
void SetTextureCoords( const vector<int> &aiWidths, int iAdvanceExtraPixels ); void SetTextureCoords( const std::vector<int> &aiWidths, int iAdvanceExtraPixels );
}; };
class Font class Font
@@ -152,11 +152,11 @@ public:
const glyph &GetGlyph( wchar_t c ) const; const glyph &GetGlyph( wchar_t c ) const;
int GetLineWidthInSourcePixels( const wstring &szLine ) const; int GetLineWidthInSourcePixels( const std::wstring &szLine ) const;
int GetLineHeightInSourcePixels( const wstring &szLine ) const; int GetLineHeightInSourcePixels( const std::wstring &szLine ) const;
int GetGlyphsThatFit(const wstring& line, int* width) const; int GetGlyphsThatFit(const std::wstring& line, int* width) const;
bool FontCompleteForString( const wstring &str ) const; bool FontCompleteForString( const std::wstring &str ) const;
/** /**
* @brief Add a FontPage to this font. * @brief Add a FontPage to this font.
@@ -188,7 +188,7 @@ public:
private: private:
/** @brief List of pages and fonts that we use (and are responsible for freeing). */ /** @brief List of pages and fonts that we use (and are responsible for freeing). */
vector<FontPage *> m_apPages; std::vector<FontPage *> m_apPages;
/** /**
* @brief This is the primary fontpage of this font. * @brief This is the primary fontpage of this font.
@@ -198,7 +198,7 @@ private:
FontPage *m_pDefault; FontPage *m_pDefault;
/** @brief Map from characters to glyphs. */ /** @brief Map from characters to glyphs. */
map<wchar_t,glyph*> m_iCharToGlyph; std::map<wchar_t,glyph*> m_iCharToGlyph;
/** @brief Each glyph is part of one of the pages[]. */ /** @brief Each glyph is part of one of the pages[]. */
glyph *m_iCharToGlyphCache[128]; glyph *m_iCharToGlyphCache[128];
@@ -217,7 +217,7 @@ private:
RString m_sChars; RString m_sChars;
void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars ); void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars );
static void GetFontPaths( const RString &sFontOrTextureFilePath, vector<RString> &sTexturePaths ); static void GetFontPaths( const RString &sFontOrTextureFilePath, std::vector<RString> &sTexturePaths );
RString GetPageNameFromFileName( const RString &sFilename ); RString GetPageNameFromFileName( const RString &sFilename );
Font(const Font& rhs); Font(const Font& rhs);
+2 -2
View File
@@ -7,9 +7,9 @@
#include <map> #include <map>
// Map from "&foo;" to a UTF-8 string. // Map from "&foo;" to a UTF-8 string.
typedef map<RString, wchar_t, StdString::StdStringLessNoCase> aliasmap; typedef std::map<RString, wchar_t, StdString::StdStringLessNoCase> aliasmap;
static aliasmap CharAliases; static aliasmap CharAliases;
static map<RString,RString> CharAliasRepl; static std::map<RString,RString> CharAliasRepl;
/* Editing this file in VC6 will be rather ugly, since it contains a lot of UTF-8. /* Editing this file in VC6 will be rather ugly, since it contains a lot of UTF-8.
* Just don't change anything you can't read. :) */ * Just don't change anything you can't read. :) */
+2 -2
View File
@@ -5,7 +5,7 @@
const wchar_t FontCharmaps::M_SKIP = 0xFEFF; const wchar_t FontCharmaps::M_SKIP = 0xFEFF;
static map<RString,const wchar_t*> charmaps; static std::map<RString, const wchar_t*> charmaps;
using namespace FontCharmaps; using namespace FontCharmaps;
@@ -224,7 +224,7 @@ const wchar_t *FontCharmaps::get_char_map(RString name)
name.MakeLower(); name.MakeLower();
map<RString,const wchar_t*>::const_iterator i = charmaps.find(name); std::map<RString, const wchar_t*>::const_iterator i = charmaps.find(name);
if(i == charmaps.end()) if(i == charmaps.end())
return nullptr; return nullptr;
+3 -3
View File
@@ -8,8 +8,8 @@
FontManager* FONT = nullptr; // global and accessible from anywhere in our program FontManager* FONT = nullptr; // global and accessible from anywhere in our program
// map from file name to a texture holder // map from file name to a texture holder
typedef pair<RString,RString> FontName; typedef std::pair<RString,RString> FontName;
static map<FontName, Font*> g_mapPathToFont; static std::map<FontName, Font*> g_mapPathToFont;
FontManager::FontManager() FontManager::FontManager()
{ {
@@ -39,7 +39,7 @@ Font* FontManager::LoadFont( const RString &sFontOrTextureFilePath, RString sCha
CHECKPOINT_M( ssprintf("FontManager::LoadFont(%s).", sFontOrTextureFilePath.c_str()) ); CHECKPOINT_M( ssprintf("FontManager::LoadFont(%s).", sFontOrTextureFilePath.c_str()) );
const FontName NewName( sFontOrTextureFilePath, sChars ); const FontName NewName( sFontOrTextureFilePath, sChars );
map<FontName, Font*>::iterator p = g_mapPathToFont.find( NewName ); std::map<FontName, Font*>::iterator p = g_mapPathToFont.find( NewName );
if( p != g_mapPathToFont.end() ) if( p != g_mapPathToFont.end() )
{ {
pFont=p->second; pFont=p->second;
+1 -1
View File
@@ -108,7 +108,7 @@ void Foreground::Update( float fDeltaTime )
} }
// This shouldn't go down, but be safe: // This shouldn't go down, but be safe:
lDeltaTime = max( lDeltaTime, 0 ); lDeltaTime = std::max( lDeltaTime, 0.0f );
bga.m_bga->Update( lDeltaTime / fRate ); bga.m_bga->Update( lDeltaTime / fRate );
+1 -1
View File
@@ -24,7 +24,7 @@ protected:
bool m_bFinished; bool m_bFinished;
}; };
vector<LoadedBGA> m_BGAnimations; std::vector<LoadedBGA> m_BGAnimations;
float m_fLastMusicSeconds; float m_fLastMusicSeconds;
const Song *m_pSong; const Song *m_pSong;
}; };
+8 -8
View File
@@ -490,7 +490,7 @@ int GetNumCreditsPaid()
// players other than the first joined for free // players other than the first joined for free
if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit ) if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit )
iNumCreditsPaid = min( iNumCreditsPaid, 1 ); iNumCreditsPaid = std::min( iNumCreditsPaid, 1 );
return iNumCreditsPaid; return iNumCreditsPaid;
} }
@@ -611,7 +611,7 @@ bool GameCommand::IsPlayable( RString *why ) const
if( !m_sScreen.CompareNoCase("ScreenEditCoursesMenu") ) if( !m_sScreen.CompareNoCase("ScreenEditCoursesMenu") )
{ {
vector<Course*> vCourses; std::vector<Course*> vCourses;
SONGMAN->GetAllCourses( vCourses, false ); SONGMAN->GetAllCourses( vCourses, false );
if( vCourses.size() == 0 ) if( vCourses.size() == 0 )
@@ -659,7 +659,7 @@ bool GameCommand::IsPlayable( RString *why ) const
void GameCommand::ApplyToAllPlayers() const void GameCommand::ApplyToAllPlayers() const
{ {
vector<PlayerNumber> vpns; std::vector<PlayerNumber> vpns;
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
vpns.push_back( pn ); vpns.push_back( pn );
@@ -669,12 +669,12 @@ void GameCommand::ApplyToAllPlayers() const
void GameCommand::Apply( PlayerNumber pn ) const void GameCommand::Apply( PlayerNumber pn ) const
{ {
vector<PlayerNumber> vpns; std::vector<PlayerNumber> vpns;
vpns.push_back( pn ); vpns.push_back( pn );
Apply( vpns ); Apply( vpns );
} }
void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const void GameCommand::Apply( const std::vector<PlayerNumber> &vpns ) const
{ {
if( m_Commands.v.size() ) if( m_Commands.v.size() )
{ {
@@ -696,7 +696,7 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const
} }
} }
void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const void GameCommand::ApplySelf( const std::vector<PlayerNumber> &vpns ) const
{ {
const PlayMode OldPlayMode = GAMESTATE->m_PlayMode; const PlayMode OldPlayMode = GAMESTATE->m_PlayMode;
@@ -790,7 +790,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
if( m_pCharacter ) if( m_pCharacter )
for (PlayerNumber const &pn : vpns) for (PlayerNumber const &pn : vpns)
GAMESTATE->m_pCurCharacters[pn] = m_pCharacter; GAMESTATE->m_pCurCharacters[pn] = m_pCharacter;
for( map<RString,RString>::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ ) for( std::map<RString, RString>::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ )
{ {
Lua *L = LUA->Get(); Lua *L = LUA->Get();
GAMESTATE->m_Environment->PushSelf(L); GAMESTATE->m_Environment->PushSelf(L);
@@ -800,7 +800,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
lua_pop( L, 1 ); lua_pop( L, 1 );
LUA->Release(L); LUA->Release(L);
} }
for(map<RString,RString>::const_iterator setting= m_SetPref.begin(); setting != m_SetPref.end(); ++setting) for(std::map<RString, RString>::const_iterator setting= m_SetPref.begin(); setting != m_SetPref.end(); ++setting)
{ {
IPreference* pref= IPreference::GetPreferenceByName(setting->first); IPreference* pref= IPreference::GetPreferenceByName(setting->first);
if(pref != nullptr) if(pref != nullptr)
+3 -3
View File
@@ -54,8 +54,8 @@ public:
void ApplyToAllPlayers() const; void ApplyToAllPlayers() const;
void Apply( PlayerNumber pn ) const; void Apply( PlayerNumber pn ) const;
private: private:
void Apply( const vector<PlayerNumber> &vpns ) const; void Apply( const std::vector<PlayerNumber> &vpns ) const;
void ApplySelf( const vector<PlayerNumber> &vpns ) const; void ApplySelf( const std::vector<PlayerNumber> &vpns ) const;
public: public:
bool DescribesCurrentMode( PlayerNumber pn ) const; bool DescribesCurrentMode( PlayerNumber pn ) const;
@@ -96,7 +96,7 @@ public:
RString m_sSongGroup; RString m_sSongGroup;
SortOrder m_SortOrder; SortOrder m_SortOrder;
RString m_sSoundPath; // "" for no sound RString m_sSoundPath; // "" for no sound
vector<RString> m_vsScreensToPrepare; std::vector<RString> m_vsScreensToPrepare;
/** /**
* @brief What is the player's weight in pounds? * @brief What is the player's weight in pounds?
* *
+5 -5
View File
@@ -13,14 +13,14 @@
RString StepsTypeToString( StepsType st ); RString StepsTypeToString( StepsType st );
static vector<RString> GenerateRankingToFillInMarker() static std::vector<RString> GenerateRankingToFillInMarker()
{ {
vector<RString> vRankings; std::vector<RString> vRankings;
FOREACH_ENUM( PlayerNumber, pn ) FOREACH_ENUM( PlayerNumber, pn )
vRankings.push_back( ssprintf("#P%d#", pn+1) ); vRankings.push_back( ssprintf("#P%d#", pn+1) );
return vRankings; return vRankings;
} }
extern const vector<RString> RANKING_TO_FILL_IN_MARKER( GenerateRankingToFillInMarker() ); extern const std::vector<RString> RANKING_TO_FILL_IN_MARKER( GenerateRankingToFillInMarker() );
extern const RString GROUP_ALL = "---Group All---"; extern const RString GROUP_ALL = "---Group All---";
@@ -380,7 +380,7 @@ float DisplayBpms::GetMin() const
for (float const &f : vfBpms) for (float const &f : vfBpms)
{ {
if( f != -1 ) if( f != -1 )
fMin = min( fMin, f ); fMin = std::min( fMin, f );
} }
if( fMin == FLT_MAX ) if( fMin == FLT_MAX )
return 0; return 0;
@@ -399,7 +399,7 @@ float DisplayBpms::GetMaxWithin(float highest) const
for (float const &f : vfBpms) for (float const &f : vfBpms)
{ {
if( f != -1 ) if( f != -1 )
fMax = clamp(max( fMax, f ), 0, highest); fMax = clamp(std::max( fMax, f ), 0.0f, highest);
} }
return fMax; return fMax;
} }
+2 -2
View File
@@ -380,7 +380,7 @@ const RString& RankingCategoryToString( RankingCategory rc );
RankingCategory StringToRankingCategory( const RString& rc ); RankingCategory StringToRankingCategory( const RString& rc );
LuaDeclareType( RankingCategory ); LuaDeclareType( RankingCategory );
extern const vector<RString> RANKING_TO_FILL_IN_MARKER; extern const std::vector<RString> RANKING_TO_FILL_IN_MARKER;
inline bool IsRankingToFillIn( const RString& sName ) { return !sName.empty() && sName[0]=='#'; } inline bool IsRankingToFillIn( const RString& sName ) { return !sName.empty() && sName[0]=='#'; }
RankingCategory AverageMeterToRankingCategory( int iAverageMeter ); RankingCategory AverageMeterToRankingCategory( int iAverageMeter );
@@ -547,7 +547,7 @@ struct DisplayBpms
/** /**
* @brief The list of the BPMs for the song or course. * @brief The list of the BPMs for the song or course.
*/ */
vector<float> vfBpms; std::vector<float> vfBpms;
}; };
/** @brief The various style types available. */ /** @brief The various style types available. */
+2 -2
View File
@@ -69,14 +69,14 @@ static bool ChangeAppPri()
// if using NTPAD don't boost or else input is laggy // if using NTPAD don't boost or else input is laggy
#if defined(_WINDOWS) #if defined(_WINDOWS)
{ {
vector<InputDeviceInfo> vDevices; std::vector<InputDeviceInfo> vDevices;
// This can get called before INPUTMAN is constructed. // This can get called before INPUTMAN is constructed.
if( INPUTMAN ) if( INPUTMAN )
{ {
INPUTMAN->GetDevicesAndDescriptions(vDevices); INPUTMAN->GetDevicesAndDescriptions(vDevices);
if (std::any_of(vDevices.begin(), vDevices.end(), [](InputDeviceInfo const &d) { if (std::any_of(vDevices.begin(), vDevices.end(), [](InputDeviceInfo const &d) {
return d.sDesc.find("NTPAD") != string::npos; return d.sDesc.find("NTPAD") != std::string::npos;
})) }))
{ {
LOG->Trace( "Using NTPAD. Don't boost priority." ); LOG->Trace( "Using NTPAD. Don't boost priority." );
+9 -9
View File
@@ -3250,7 +3250,7 @@ GameManager::~GameManager()
} }
void GameManager::GetStylesForGame( const Game *pGame, vector<const Style*>& aStylesAddTo, bool editor ) void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>& aStylesAddTo, bool editor )
{ {
for( int s=0; pGame->m_apStyles[s]; ++s ) for( int s=0; pGame->m_apStyles[s]; ++s )
{ {
@@ -3296,7 +3296,7 @@ const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
} }
void GameManager::GetStepsTypesForGame( const Game *pGame, vector<StepsType>& aStepsTypeAddTo ) void GameManager::GetStepsTypesForGame( const Game *pGame, std::vector<StepsType>& aStepsTypeAddTo )
{ {
for( int i=0; pGame->m_apStyles[i]; ++i ) for( int i=0; pGame->m_apStyles[i]; ++i )
{ {
@@ -3314,7 +3314,7 @@ void GameManager::GetStepsTypesForGame( const Game *pGame, vector<StepsType>& aS
} }
} }
void GameManager::GetDemonstrationStylesForGame( const Game *pGame, vector<const Style*> &vpStylesOut ) void GameManager::GetDemonstrationStylesForGame( const Game *pGame, std::vector<const Style*> &vpStylesOut )
{ {
vpStylesOut.clear(); vpStylesOut.clear();
@@ -3340,7 +3340,7 @@ const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame )
FAIL_M(ssprintf("Game has no Style that can be used with HowToPlay: %s", pGame->m_szName)); FAIL_M(ssprintf("Game has no Style that can be used with HowToPlay: %s", pGame->m_szName));
} }
void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector<const Style*> &vpStylesOut ) void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, std::vector<const Style*> &vpStylesOut )
{ {
FOREACH_ENUM( StyleType, styleType ) FOREACH_ENUM( StyleType, styleType )
{ {
@@ -3376,7 +3376,7 @@ void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, vecto
const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ) const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st )
{ {
vector<const Style*> vpStyles; std::vector<const Style*> vpStyles;
GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); GetCompatibleStyles( pGame, iNumPlayers, vpStyles );
for (Style const *s : vpStyles) for (Style const *s : vpStyles)
{ {
@@ -3389,7 +3389,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
} }
void GameManager::GetEnabledGames( vector<const Game*>& aGamesOut ) void GameManager::GetEnabledGames( std::vector<const Game*>& aGamesOut )
{ {
for( size_t g=0; g<ARRAYLEN(g_Games); ++g ) for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
{ {
@@ -3501,7 +3501,7 @@ public:
{ {
Game *pGame = Luna<Game>::check( L, 1 ); Game *pGame = Luna<Game>::check( L, 1 );
vector<StepsType> vstAddTo; std::vector<StepsType> vstAddTo;
p->GetStepsTypesForGame( pGame, vstAddTo ); p->GetStepsTypesForGame( pGame, vstAddTo );
ASSERT( !vstAddTo.empty() ); ASSERT( !vstAddTo.empty() );
StepsType st = vstAddTo[0]; StepsType st = vstAddTo[0];
@@ -3526,7 +3526,7 @@ public:
{ {
luaL_error(L, "GetStylesForGame: Invalid Game: '%s'", game_name.c_str()); luaL_error(L, "GetStylesForGame: Invalid Game: '%s'", game_name.c_str());
} }
vector<Style*> aStyles; std::vector<Style*> aStyles;
lua_createtable(L, 0, 0); lua_createtable(L, 0, 0);
for( int s=0; pGame->m_apStyles[s]; ++s ) for( int s=0; pGame->m_apStyles[s]; ++s )
{ {
@@ -3538,7 +3538,7 @@ public:
} }
static int GetEnabledGames( T* p, lua_State *L ) static int GetEnabledGames( T* p, lua_State *L )
{ {
vector<const Game*> aGames; std::vector<const Game*> aGames;
p->GetEnabledGames( aGames ); p->GetEnabledGames( aGames );
lua_createtable(L, aGames.size(), 0); lua_createtable(L, aGames.size(), 0);
for(size_t i= 0; i < aGames.size(); ++i) for(size_t i= 0; i < aGames.size(); ++i)
+5 -5
View File
@@ -29,16 +29,16 @@ public:
GameManager(); GameManager();
~GameManager(); ~GameManager();
void GetStylesForGame( const Game* pGame, vector<const Style*>& aStylesAddTo, bool editor=false ); void GetStylesForGame( const Game* pGame, std::vector<const Style*>& aStylesAddTo, bool editor=false );
const Game *GetGameForStyle( const Style *pStyle ); const Game *GetGameForStyle( const Style *pStyle );
void GetStepsTypesForGame( const Game* pGame, vector<StepsType>& aStepsTypeAddTo ); void GetStepsTypesForGame( const Game* pGame, std::vector<StepsType>& aStepsTypeAddTo );
const Style *GetEditorStyleForStepsType( StepsType st ); const Style *GetEditorStyleForStepsType( StepsType st );
void GetDemonstrationStylesForGame( const Game *pGame, vector<const Style*> &vpStylesOut ); void GetDemonstrationStylesForGame( const Game *pGame, std::vector<const Style*> &vpStylesOut );
const Style *GetHowToPlayStyleForGame( const Game* pGame ); const Style *GetHowToPlayStyleForGame( const Game* pGame );
void GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector<const Style*> &vpStylesOut ); void GetCompatibleStyles( const Game *pGame, int iNumPlayers, std::vector<const Style*> &vpStylesOut );
const Style *GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ); const Style *GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st );
void GetEnabledGames( vector<const Game*>& aGamesOut ); void GetEnabledGames( std::vector<const Game*>& aGamesOut );
const Game* GetDefaultGame(); const Game* GetDefaultGame();
bool IsGameEnabled( const Game* pGame ); bool IsGameEnabled( const Game* pGame );
int GetIndexFromGame( const Game* pGame ); int GetIndexFromGame( const Game* pGame );
+15 -15
View File
@@ -80,11 +80,11 @@ static MusicPlaying *g_Playing;
static RageThread MusicThread; static RageThread MusicThread;
vector<RString> g_SoundsToPlayOnce; std::vector<RString> g_SoundsToPlayOnce;
vector<RString> g_SoundsToPlayOnceFromDir; std::vector<RString> g_SoundsToPlayOnceFromDir;
vector<RString> g_SoundsToPlayOnceFromAnnouncer; std::vector<RString> g_SoundsToPlayOnceFromAnnouncer;
// This should get updated to unordered_map when once C++11 is supported // This should get updated to unordered_map when once C++11 is supported
std::map<RString, vector<int>> g_DirSoundOrder; std::map<RString, std::vector<int>> g_DirSoundOrder;
struct MusicToPlay struct MusicToPlay
{ {
@@ -100,7 +100,7 @@ struct MusicToPlay
HasTiming = false; HasTiming = false;
} }
}; };
vector<MusicToPlay> g_MusicsToPlay; std::vector<MusicToPlay> g_MusicsToPlay;
static GameSoundManager::PlayMusicParams g_FallbackMusicParams; static GameSoundManager::PlayMusicParams g_FallbackMusicParams;
static void StartMusic( MusicToPlay &ToPlay ) static void StartMusic( MusicToPlay &ToPlay )
@@ -242,7 +242,7 @@ static void StartMusic( MusicToPlay &ToPlay )
const float fSecondToStartOn = g_Playing->m_Timing.GetElapsedTimeFromBeatNoOffset( fCurBeatToStartOn ); const float fSecondToStartOn = g_Playing->m_Timing.GetElapsedTimeFromBeatNoOffset( fCurBeatToStartOn );
const float fMaximumDistance = 2; const float fMaximumDistance = 2;
const float fDistance = min( fSecondToStartOn - GAMESTATE->m_Position.m_fMusicSeconds, fMaximumDistance ); const float fDistance = std::min( fSecondToStartOn - GAMESTATE->m_Position.m_fMusicSeconds, fMaximumDistance );
when = GAMESTATE->m_Position.m_LastBeatUpdate + fDistance; when = GAMESTATE->m_Position.m_LastBeatUpdate + fDistance;
} }
@@ -293,7 +293,7 @@ static void DoPlayOnceFromDir( RString sPath )
if( sPath.Right(1) != "/" ) if( sPath.Right(1) != "/" )
sPath += "/"; sPath += "/";
vector<RString> arraySoundFiles; std::vector<RString> arraySoundFiles;
GetDirListing( sPath + "*.mp3", arraySoundFiles ); GetDirListing( sPath + "*.mp3", arraySoundFiles );
GetDirListing( sPath + "*.wav", arraySoundFiles ); GetDirListing( sPath + "*.wav", arraySoundFiles );
GetDirListing( sPath + "*.ogg", arraySoundFiles ); GetDirListing( sPath + "*.ogg", arraySoundFiles );
@@ -310,7 +310,7 @@ static void DoPlayOnceFromDir( RString sPath )
} }
g_Mutex->Lock(); g_Mutex->Lock();
vector<int> &order = g_DirSoundOrder.insert({sPath, vector<int>()}).first->second; std::vector<int> &order = g_DirSoundOrder.insert({sPath, std::vector<int>()}).first->second;
// If order is exhausted, repopulate and reshuffle // If order is exhausted, repopulate and reshuffle
if (order.size() == 0) if (order.size() == 0)
{ {
@@ -340,13 +340,13 @@ static bool SoundWaiting()
static void StartQueuedSounds() static void StartQueuedSounds()
{ {
g_Mutex->Lock(); g_Mutex->Lock();
vector<RString> aSoundsToPlayOnce = g_SoundsToPlayOnce; std::vector<RString> aSoundsToPlayOnce = g_SoundsToPlayOnce;
g_SoundsToPlayOnce.clear(); g_SoundsToPlayOnce.clear();
vector<RString> aSoundsToPlayOnceFromDir = g_SoundsToPlayOnceFromDir; std::vector<RString> aSoundsToPlayOnceFromDir = g_SoundsToPlayOnceFromDir;
g_SoundsToPlayOnceFromDir.clear(); g_SoundsToPlayOnceFromDir.clear();
vector<RString> aSoundsToPlayOnceFromAnnouncer = g_SoundsToPlayOnceFromAnnouncer; std::vector<RString> aSoundsToPlayOnceFromAnnouncer = g_SoundsToPlayOnceFromAnnouncer;
g_SoundsToPlayOnceFromAnnouncer.clear(); g_SoundsToPlayOnceFromAnnouncer.clear();
vector<MusicToPlay> aMusicsToPlay = g_MusicsToPlay; std::vector<MusicToPlay> aMusicsToPlay = g_MusicsToPlay;
g_MusicsToPlay.clear(); g_MusicsToPlay.clear();
g_Mutex->Unlock(); g_Mutex->Unlock();
@@ -507,7 +507,7 @@ float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime )
return 0; return 0;
/* Subtract the extra delay. */ /* Subtract the extra delay. */
return min( -fExtraDelay, 0 ); return std::min( -fExtraDelay, 0.0f );
} }
void GameSoundManager::Update( float fDeltaTime ) void GameSoundManager::Update( float fDeltaTime )
@@ -638,7 +638,7 @@ void GameSoundManager::Update( float fDeltaTime )
float fSongBeat = GAMESTATE->m_Position.m_fSongBeat; float fSongBeat = GAMESTATE->m_Position.m_fSongBeat;
int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
iRowNow = max( 0, iRowNow ); iRowNow = std::max( 0, iRowNow );
int iBeatNow = iRowNow / ROWS_PER_BEAT; int iBeatNow = iRowNow / ROWS_PER_BEAT;
@@ -900,7 +900,7 @@ LUA_REGISTER_CLASS(GameSoundManager);
int LuaFunc_get_sound_driver_list(lua_State* L); int LuaFunc_get_sound_driver_list(lua_State* L);
int LuaFunc_get_sound_driver_list(lua_State* L) int LuaFunc_get_sound_driver_list(lua_State* L)
{ {
vector<RString> driver_names; std::vector<RString> driver_names;
split(RageSoundDriver::GetDefaultSoundDriverList(), ",", driver_names, true); split(RageSoundDriver::GetDefaultSoundDriverList(), ",", driver_names, true);
lua_createtable(L, driver_names.size(), 0); lua_createtable(L, driver_names.size(), 0);
for(size_t n= 0; n < driver_names.size(); ++n) for(size_t n= 0; n < driver_names.size(); ++n)
+27 -27
View File
@@ -708,7 +708,7 @@ int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() const
else else
return -1; return -1;
iNumStagesOfThisSong = max( iNumStagesOfThisSong, 1 ); iNumStagesOfThisSong = std::max( iNumStagesOfThisSong, 1 );
return iNumStagesOfThisSong; return iNumStagesOfThisSong;
} }
@@ -789,7 +789,7 @@ void GameState::CommitStageStats()
STATSMAN->CommitStatsToProfiles( &STATSMAN->m_CurStageStats ); STATSMAN->CommitStatsToProfiles( &STATSMAN->m_CurStageStats );
// Update TotalPlaySeconds. // Update TotalPlaySeconds.
int iPlaySeconds = max( 0, (int) m_timeGameStarted.GetDeltaTime() ); int iPlaySeconds = std::max( 0, (int) m_timeGameStarted.GetDeltaTime() );
Profile* pMachineProfile = PROFILEMAN->GetMachineProfile(); Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
pMachineProfile->m_iTotalSessionSeconds += iPlaySeconds; pMachineProfile->m_iTotalSessionSeconds += iPlaySeconds;
@@ -1007,7 +1007,7 @@ void GameState::SetCompatibleStylesForPlayers()
} }
else if(GetCurrentStyle(PLAYER_INVALID) == nullptr) else if(GetCurrentStyle(PLAYER_INVALID) == nullptr)
{ {
vector<StepsType> vst; std::vector<StepsType> vst;
GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst); GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst);
const Style *style = GAMEMAN->GetFirstCompatibleStyle( const Style *style = GAMEMAN->GetFirstCompatibleStyle(
m_pCurGame, GetNumSidesJoined(), vst[0]); m_pCurGame, GetNumSidesJoined(), vst[0]);
@@ -1029,7 +1029,7 @@ void GameState::SetCompatibleStylesForPlayers()
} }
else else
{ {
vector<StepsType> vst; std::vector<StepsType> vst;
GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst); GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst);
st= vst[0]; st= vst[0];
} }
@@ -1302,7 +1302,7 @@ int GameState::GetSmallestNumStagesLeftForAnyHumanPlayer() const
return 999; return 999;
int iSmallest = INT_MAX; int iSmallest = INT_MAX;
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
iSmallest = min( iSmallest, m_iPlayerStageTokens[p] ); iSmallest = std::min( iSmallest, m_iPlayerStageTokens[p] );
return iSmallest; return iSmallest;
} }
@@ -1459,11 +1459,11 @@ int GameState::prepare_song_for_gameplay()
// specify their own music file, and the variety of step file formats. // specify their own music file, and the variety of step file formats.
// Complex logic to figure out what files the song actually uses would be // Complex logic to figure out what files the song actually uses would be
// bug prone. Just copy all audio files and step files. -Kyz // bug prone. Just copy all audio files and step files. -Kyz
vector<RString> copy_exts= ActorUtil::GetTypeExtensionList(FT_Sound); std::vector<RString> copy_exts= ActorUtil::GetTypeExtensionList(FT_Sound);
copy_exts.push_back("sm"); copy_exts.push_back("sm");
copy_exts.push_back("ssc"); copy_exts.push_back("ssc");
copy_exts.push_back("lrc"); copy_exts.push_back("lrc");
vector<RString> files_in_dir; std::vector<RString> files_in_dir;
FILEMAN->GetDirListingWithMultipleExtensions(from_dir, copy_exts, files_in_dir); FILEMAN->GetDirListingWithMultipleExtensions(from_dir, copy_exts, files_in_dir);
for(size_t i= 0; i < files_in_dir.size(); ++i) for(size_t i= 0; i < files_in_dir.size(); ++i)
{ {
@@ -1937,7 +1937,7 @@ bool GameState::CurrentOptionsDisqualifyPlayer( PlayerNumber pn )
* *
*/ */
void GameState::GetAllUsedNoteSkins( vector<RString> &out ) const void GameState::GetAllUsedNoteSkins( std::vector<RString> &out ) const
{ {
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
@@ -1979,13 +1979,13 @@ void GameState::AddStageToPlayer( PlayerNumber pn )
template<class T> template<class T>
void setmin( T &a, const T &b ) void setmin( T &a, const T &b )
{ {
a = min(a, b); a = std::min(a, b);
} }
template<class T> template<class T>
void setmax( T &a, const T &b ) void setmax( T &a, const T &b )
{ {
a = max(a, b); a = std::max(a, b);
} }
FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const
@@ -2000,7 +2000,7 @@ FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const
if( IsCourseMode() ) if( IsCourseMode() )
{ {
if( PREFSMAN->m_bMinimum1FullSongInCourses && GetCourseSongIndex()==0 ) if( PREFSMAN->m_bMinimum1FullSongInCourses && GetCourseSongIndex()==0 )
ft = max( ft, FailType_ImmediateContinue ); // take the least harsh of the two FailTypes ft = std::max( ft, FailType_ImmediateContinue ); // take the least harsh of the two FailTypes
} }
else else
{ {
@@ -2047,7 +2047,7 @@ bool GameState::ShowW1() const
static ThemeMetric<bool> PROFILE_RECORD_FEATS("GameState","ProfileRecordFeats"); static ThemeMetric<bool> PROFILE_RECORD_FEATS("GameState","ProfileRecordFeats");
static ThemeMetric<bool> CATEGORY_RECORD_FEATS("GameState","CategoryRecordFeats"); static ThemeMetric<bool> CATEGORY_RECORD_FEATS("GameState","CategoryRecordFeats");
void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOut ) const void GameState::GetRankingFeats( PlayerNumber pn, std::vector<RankingFeat> &asFeatsOut ) const
{ {
if( !IsHumanPlayer(pn) ) if( !IsHumanPlayer(pn) )
return; return;
@@ -2071,7 +2071,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
// Find unique Song and Steps combinations that were played. // Find unique Song and Steps combinations that were played.
// We must keep only the unique combination or else we'll double-count // We must keep only the unique combination or else we'll double-count
// high score markers. // high score markers.
vector<SongAndSteps> vSongAndSteps; std::vector<SongAndSteps> vSongAndSteps;
for( unsigned i=0; i<STATSMAN->m_vPlayedStageStats.size(); i++ ) for( unsigned i=0; i<STATSMAN->m_vPlayedStageStats.size(); i++ )
{ {
@@ -2090,7 +2090,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
sort( vSongAndSteps.begin(), vSongAndSteps.end() ); sort( vSongAndSteps.begin(), vSongAndSteps.end() );
vector<SongAndSteps>::iterator toDelete = unique( vSongAndSteps.begin(), vSongAndSteps.end() ); std::vector<SongAndSteps>::iterator toDelete = unique( vSongAndSteps.begin(), vSongAndSteps.end() );
vSongAndSteps.erase(toDelete, vSongAndSteps.end()); vSongAndSteps.erase(toDelete, vSongAndSteps.end());
CHECKPOINT_M( "About to find records from the gathered."); CHECKPOINT_M( "About to find records from the gathered.");
@@ -2283,7 +2283,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
bool GameState::AnyPlayerHasRankingFeats() const bool GameState::AnyPlayerHasRankingFeats() const
{ {
vector<RankingFeat> vFeats; std::vector<RankingFeat> vFeats;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
GetRankingFeats( p, vFeats ); GetRankingFeats( p, vFeats );
@@ -2314,7 +2314,7 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName )
} }
sLine.MakeUpper(); sLine.MakeUpper();
if( !sLine.empty() && sName.find(sLine) != string::npos ) // name contains a bad word if( !sLine.empty() && sName.find(sLine) != std::string::npos ) // name contains a bad word
{ {
LOG->Trace( "entered '%s' matches blacklisted item '%s'", sName.c_str(), sLine.c_str() ); LOG->Trace( "entered '%s' matches blacklisted item '%s'", sName.c_str(), sLine.c_str() );
sName = ""; sName = "";
@@ -2324,7 +2324,7 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName )
} }
} }
vector<RankingFeat> aFeats; std::vector<RankingFeat> aFeats;
GetRankingFeats( pn, aFeats ); GetRankingFeats( pn, aFeats );
for( unsigned i=0; i<aFeats.size(); i++ ) for( unsigned i=0; i<aFeats.size(); i++ )
@@ -2430,7 +2430,7 @@ bool GameState::ChangePreferredDifficultyAndStepsType( PlayerNumber pn, Difficul
* difficulty. */ * difficulty. */
bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir ) bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir )
{ {
const vector<Difficulty> &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); const std::vector<Difficulty> &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue();
Difficulty d = GetClosestShownDifficulty(pn); Difficulty d = GetClosestShownDifficulty(pn);
for(;;) for(;;)
@@ -2453,7 +2453,7 @@ bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir )
* Difficulty_Edit. Return the closest shown difficulty <= m_PreferredDifficulty. */ * Difficulty_Edit. Return the closest shown difficulty <= m_PreferredDifficulty. */
Difficulty GameState::GetClosestShownDifficulty( PlayerNumber pn ) const Difficulty GameState::GetClosestShownDifficulty( PlayerNumber pn ) const
{ {
const vector<Difficulty> &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); const std::vector<Difficulty> &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue();
Difficulty iClosest = (Difficulty) 0; Difficulty iClosest = (Difficulty) 0;
int iClosestDist = -1; int iClosestDist = -1;
@@ -2488,7 +2488,7 @@ bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, int dir )
/* If we have a course selected, only choose among difficulties available in the course. */ /* If we have a course selected, only choose among difficulties available in the course. */
const Course *pCourse = m_pCurCourse; const Course *pCourse = m_pCurCourse;
const vector<CourseDifficulty> &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue(); const std::vector<CourseDifficulty> &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue();
CourseDifficulty cd = m_PreferredCourseDifficulty[pn]; CourseDifficulty cd = m_PreferredCourseDifficulty[pn];
for(;;) for(;;)
@@ -2512,7 +2512,7 @@ bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, int dir )
bool GameState::IsCourseDifficultyShown( CourseDifficulty cd ) bool GameState::IsCourseDifficultyShown( CourseDifficulty cd )
{ {
const vector<CourseDifficulty> &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue(); const std::vector<CourseDifficulty> &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue();
return find(v.begin(), v.end(), cd) != v.end(); return find(v.begin(), v.end(), cd) != v.end();
} }
@@ -2526,7 +2526,7 @@ Difficulty GameState::GetEasiestStepsDifficulty() const
LuaHelpers::ReportScriptErrorFmt( "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", p+1 ); LuaHelpers::ReportScriptErrorFmt( "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
continue; continue;
} }
dc = min( dc, m_pCurSteps[p]->GetDifficulty() ); dc = std::min( dc, m_pCurSteps[p]->GetDifficulty() );
} }
return dc; return dc;
} }
@@ -2541,7 +2541,7 @@ Difficulty GameState::GetHardestStepsDifficulty() const
LuaHelpers::ReportScriptErrorFmt( "GetHardestStepsDifficulty called but p%i hasn't chosen notes", p+1 ); LuaHelpers::ReportScriptErrorFmt( "GetHardestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
continue; continue;
} }
dc = max( dc, m_pCurSteps[p]->GetDifficulty() ); dc = std::max( dc, m_pCurSteps[p]->GetDifficulty() );
} }
return dc; return dc;
} }
@@ -2950,7 +2950,7 @@ public:
return 0; return 0;
// use a vector and not a set so that ordering is maintained // use a vector and not a set so that ordering is maintained
vector<const Steps*> vpStepsToShow; std::vector<const Steps*> vpStepsToShow;
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
const Steps* pSteps = GAMESTATE->m_pCurSteps[p]; const Steps* pSteps = GAMESTATE->m_pCurSteps[p];
@@ -2977,7 +2977,7 @@ public:
DEFINE_METHOD( GetPreferredSongGroup, m_sPreferredSongGroup.Get() ); DEFINE_METHOD( GetPreferredSongGroup, m_sPreferredSongGroup.Get() );
static int GetHumanPlayers( T* p, lua_State *L ) static int GetHumanPlayers( T* p, lua_State *L )
{ {
vector<PlayerNumber> vHP; std::vector<PlayerNumber> vHP;
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( pn )
vHP.push_back( pn ); vHP.push_back( pn );
LuaHelpers::CreateTableFromArray( vHP, L ); LuaHelpers::CreateTableFromArray( vHP, L );
@@ -2985,7 +2985,7 @@ public:
} }
static int GetEnabledPlayers(T* , lua_State *L ) static int GetEnabledPlayers(T* , lua_State *L )
{ {
vector<PlayerNumber> vEP; std::vector<PlayerNumber> vEP;
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
vEP.push_back( pn ); vEP.push_back( pn );
LuaHelpers::CreateTableFromArray( vEP, L ); LuaHelpers::CreateTableFromArray( vEP, L );
@@ -3130,7 +3130,7 @@ public:
// Do not allow styles with StepsTypes with shared sides or that are one player only with Battle or Rave. // Do not allow styles with StepsTypes with shared sides or that are one player only with Battle or Rave.
if( style->m_StyleType != StyleType_TwoPlayersSharedSides ) if( style->m_StyleType != StyleType_TwoPlayersSharedSides )
{ {
vector<const Style*> vpStyles; std::vector<const Style*> vpStyles;
GAMEMAN->GetCompatibleStyles( p->m_pCurGame, 2, vpStyles ); GAMEMAN->GetCompatibleStyles( p->m_pCurGame, 2, vpStyles );
for (const Style *s : vpStyles) for (const Style *s : vpStyles)
{ {
+7 -7
View File
@@ -266,7 +266,7 @@ public:
BroadcastOnChange<bool> m_bGameplayLeadIn; BroadcastOnChange<bool> m_bGameplayLeadIn;
// if re-adding noteskin changes in courses, add functions and such here -aj // if re-adding noteskin changes in courses, add functions and such here -aj
void GetAllUsedNoteSkins( vector<RString> &out ) const; void GetAllUsedNoteSkins( std::vector<RString> &out ) const;
static const float MUSIC_SECONDS_INVALID; static const float MUSIC_SECONDS_INVALID;
@@ -289,7 +289,7 @@ public:
float m_DanceDuration; float m_DanceDuration;
// Random Attacks & Attack Mines // Random Attacks & Attack Mines
vector<RString> m_RandomAttacks; std::vector<RString> m_RandomAttacks;
// used in PLAY_MODE_BATTLE // used in PLAY_MODE_BATTLE
float m_fOpponentHealthPercent; float m_fOpponentHealthPercent;
@@ -353,15 +353,15 @@ public:
RString *pStringToFill; RString *pStringToFill;
}; };
void GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &vFeatsOut ) const; void GetRankingFeats( PlayerNumber pn, std::vector<RankingFeat> &vFeatsOut ) const;
bool AnyPlayerHasRankingFeats() const; bool AnyPlayerHasRankingFeats() const;
void StoreRankingName( PlayerNumber pn, RString name ); // Called by name entry screens void StoreRankingName( PlayerNumber pn, RString name ); // Called by name entry screens
vector<RString*> m_vpsNamesThatWereFilled; // filled on StoreRankingName, std::vector<RString*> m_vpsNamesThatWereFilled; // filled on StoreRankingName,
// Award stuff // Award stuff
// lowest priority in front, highest priority at the back. // lowest priority in front, highest priority at the back.
deque<StageAward> m_vLastStageAwards[NUM_PLAYERS]; std::deque<StageAward> m_vLastStageAwards[NUM_PLAYERS];
deque<PeakComboAward> m_vLastPeakComboAwards[NUM_PLAYERS]; std::deque<PeakComboAward> m_vLastPeakComboAwards[NUM_PLAYERS];
// Attract stuff // Attract stuff
int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting
@@ -416,7 +416,7 @@ public:
if(i >= m_autogen_fargs.size()) { return 0.0f; } if(i >= m_autogen_fargs.size()) { return 0.0f; }
return m_autogen_fargs[i]; return m_autogen_fargs[i];
} }
vector<float> m_autogen_fargs; std::vector<float> m_autogen_fargs;
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
+1 -1
View File
@@ -37,7 +37,7 @@ void GameplayAssist::PlayTicks( const NoteData &nd, const PlayerState *ps )
const TimingData &timing = *GAMESTATE->m_pCurSteps[ps->m_PlayerNumber]->GetTimingData(); const TimingData &timing = *GAMESTATE->m_pCurSteps[ps->m_PlayerNumber]->GetTimingData();
const float fSongBeat = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds ); const float fSongBeat = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds );
const int iSongRow = max( 0, BeatToNoteRowNotRounded( fSongBeat ) ); const int iSongRow = std::max( 0, BeatToNoteRowNotRounded( fSongBeat ) );
static int iRowLastCrossed = -1; static int iRowLastCrossed = -1;
if( iSongRow < iRowLastCrossed ) if( iSongRow < iRowLastCrossed )
iRowLastCrossed = iSongRow; iRowLastCrossed = iSongRow;
+2 -2
View File
@@ -24,7 +24,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
{ {
const RString &sButton = GAMESTATE->GetCurrentStyle(pn)->ColToButtonName( c ); const RString &sButton = GAMESTATE->GetCurrentStyle(pn)->ColToButtonName( c );
vector<GameInput> GameI; std::vector<GameInput> GameI;
GAMESTATE->GetCurrentStyle(pn)->StyleInputToGameInput( c, pn, GameI ); GAMESTATE->GetCurrentStyle(pn)->StyleInputToGameInput( c, pn, GameI );
NOTESKIN->SetGameController( GameI[0].controller ); NOTESKIN->SetGameController( GameI[0].controller );
@@ -36,7 +36,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
} }
} }
void GhostArrowRow::SetColumnRenderers(vector<NoteColumnRenderer>& renderers) void GhostArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
{ {
ASSERT_M(renderers.size() == m_Ghost.size(), "Notefield has different number of columns than ghost row."); ASSERT_M(renderers.size() == m_Ghost.size(), "Notefield has different number of columns than ghost row.");
for(size_t c= 0; c < m_Ghost.size(); ++c) for(size_t c= 0; c < m_Ghost.size(); ++c)
+5 -5
View File
@@ -16,7 +16,7 @@ public:
virtual void DrawPrimitives(); virtual void DrawPrimitives();
void Load( const PlayerState* pPlayerState, float fYReverseOffset ); void Load( const PlayerState* pPlayerState, float fYReverseOffset );
void SetColumnRenderers(vector<NoteColumnRenderer>& renderers); void SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers);
void DidTapNote( int iCol, TapNoteScore tns, bool bBright ); void DidTapNote( int iCol, TapNoteScore tns, bool bBright );
void DidHoldNote( int iCol, HoldNoteScore hns, bool bBright ); void DidHoldNote( int iCol, HoldNoteScore hns, bool bBright );
@@ -26,10 +26,10 @@ protected:
float m_fYReverseOffsetPixels; float m_fYReverseOffsetPixels;
const PlayerState* m_pPlayerState; const PlayerState* m_pPlayerState;
vector<NoteColumnRenderer> const* m_renderers; std::vector<NoteColumnRenderer> const* m_renderers;
vector<Actor *> m_Ghost; std::vector<Actor *> m_Ghost;
vector<TapNoteSubType> m_bHoldShowing; std::vector<TapNoteSubType> m_bHoldShowing;
vector<TapNoteSubType> m_bLastHoldShowing; std::vector<TapNoteSubType> m_bLastHoldShowing;
}; };
+1 -1
View File
@@ -18,7 +18,7 @@ public:
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
protected: protected:
vector<AutoActor> m_vSpr; std::vector<AutoActor> m_vSpr;
}; };
#endif #endif
+3 -3
View File
@@ -104,8 +104,8 @@ public:
virtual GraphLine *Copy() const; virtual GraphLine *Copy() const;
private: private:
vector<RageSpriteVertex> m_Quads; std::vector<RageSpriteVertex> m_Quads;
vector<RageSpriteVertex> m_pCircles; std::vector<RageSpriteVertex> m_pCircles;
}; };
REGISTER_ACTOR_CLASS( GraphLine ); REGISTER_ACTOR_CLASS( GraphLine );
@@ -177,7 +177,7 @@ void GraphDisplay::Set( const StageStats &ss, const PlayerStageStats &pss )
// Show song boundaries // Show song boundaries
float fSec = 0; float fSec = 0;
vector<Song *> const &possibleSongs = ss.m_vpPossibleSongs; std::vector<Song *> const &possibleSongs = ss.m_vpPossibleSongs;
std::for_each(possibleSongs.begin(), possibleSongs.end() - 1, [&](Song *song) { std::for_each(possibleSongs.begin(), possibleSongs.end() - 1, [&](Song *song) {
fSec += song->GetStepsSeconds(); fSec += song->GetStepsSeconds();
+2 -2
View File
@@ -25,11 +25,11 @@ public:
private: private:
void UpdateVerts(); void UpdateVerts();
vector<float> m_Values; std::vector<float> m_Values;
RectF m_quadVertices; RectF m_quadVertices;
vector<Actor*> m_vpSongBoundaries; std::vector<Actor*> m_vpSongBoundaries;
AutoActor m_sprBarely; AutoActor m_sprBarely;
AutoActor m_sprBacking; AutoActor m_sprBacking;
AutoActor m_sprSongBoundary; AutoActor m_sprSongBoundary;
+5 -5
View File
@@ -78,7 +78,7 @@ void GrooveRadar::SetFromSteps( PlayerNumber pn, Steps* pSteps ) // nullptr mean
m_GrooveRadarValueMap[pn].SetFromSteps( rv ); m_GrooveRadarValueMap[pn].SetFromSteps( rv );
} }
void GrooveRadar::SetFromValues( PlayerNumber pn, vector<float> vals ) void GrooveRadar::SetFromValues( PlayerNumber pn, std::vector<float> vals )
{ {
m_GrooveRadarValueMap[pn].SetFromValues(vals); m_GrooveRadarValueMap[pn].SetFromValues(vals);
} }
@@ -107,7 +107,7 @@ void GrooveRadar::GrooveRadarValueMap::SetFromSteps( const RadarValues &rv )
{ {
const float fValueCurrent = m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew; const float fValueCurrent = m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew;
m_fValuesOld[c] = fValueCurrent; m_fValuesOld[c] = fValueCurrent;
m_fValuesNew[c] = clamp(rv[c], 0.0, 1.0); m_fValuesNew[c] = clamp(rv[c], 0.0f, 1.0f);
} }
if( !m_bValuesVisible ) // the values WERE invisible if( !m_bValuesVisible ) // the values WERE invisible
@@ -116,7 +116,7 @@ void GrooveRadar::GrooveRadarValueMap::SetFromSteps( const RadarValues &rv )
m_PercentTowardNew = 0; m_PercentTowardNew = 0;
} }
void GrooveRadar::GrooveRadarValueMap::SetFromValues( vector<float> vals ) void GrooveRadar::GrooveRadarValueMap::SetFromValues( std::vector<float> vals )
{ {
m_bValuesVisible = true; m_bValuesVisible = true;
for( int c=0; c<NUM_SHOWN_RADAR_CATEGORIES; c++ ) for( int c=0; c<NUM_SHOWN_RADAR_CATEGORIES; c++ )
@@ -136,7 +136,7 @@ void GrooveRadar::GrooveRadarValueMap::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
m_PercentTowardNew = min( m_PercentTowardNew+4.0f*fDeltaTime, 1 ); m_PercentTowardNew = std::min( m_PercentTowardNew + 4.0f * fDeltaTime, 1.0f );
} }
void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
@@ -235,7 +235,7 @@ public:
} }
else else
{ {
vector<float> vals; std::vector<float> vals;
LuaHelpers::ReadArrayFromTable( vals, L ); LuaHelpers::ReadArrayFromTable( vals, L );
p->SetFromValues(pn, vals); p->SetFromValues(pn, vals);
} }
+2 -2
View File
@@ -26,7 +26,7 @@ public:
* @param pn the Player to give a GrooveRadar. * @param pn the Player to give a GrooveRadar.
* @param pSteps the Steps to use to make the radar. If nullptr, there are no Steps. */ * @param pSteps the Steps to use to make the radar. If nullptr, there are no Steps. */
void SetFromSteps( PlayerNumber pn, Steps* pSteps ); void SetFromSteps( PlayerNumber pn, Steps* pSteps );
void SetFromValues( PlayerNumber pn, vector<float> vals ); void SetFromValues( PlayerNumber pn, std::vector<float> vals );
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
@@ -46,7 +46,7 @@ protected:
void SetEmpty(); void SetEmpty();
void SetFromSteps( const RadarValues &rv ); void SetFromSteps( const RadarValues &rv );
void SetFromValues( vector<float> vals ); void SetFromValues( std::vector<float> vals );
void SetRadius( float f ) { m_size.x = f; m_size.y = f; } void SetRadius( float f ) { m_size.x = f; m_size.y = f; }
+6 -6
View File
@@ -21,7 +21,7 @@ void HelpDisplay::Load( const RString &sType )
m_fSecsBetweenSwitches = THEME->GetMetricF(sType,"TipSwitchTime"); m_fSecsBetweenSwitches = THEME->GetMetricF(sType,"TipSwitchTime");
} }
void HelpDisplay::SetTips( const vector<RString> &arrayTips, const vector<RString> &arrayTipsAlt ) void HelpDisplay::SetTips( const std::vector<RString> &arrayTips, const std::vector<RString> &arrayTipsAlt )
{ {
ASSERT( arrayTips.size() == arrayTipsAlt.size() ); ASSERT( arrayTips.size() == arrayTipsAlt.size() );
@@ -48,7 +48,7 @@ void HelpDisplay::Update( float fDeltaTime )
if( m_arrayTips.empty() ) if( m_arrayTips.empty() )
return; return;
m_fSecsUntilSwitch -= max( fDeltaTime - fHibernate, 0 ); m_fSecsUntilSwitch -= std::max( fDeltaTime - fHibernate, 0.0f );
if( m_fSecsUntilSwitch > 0 ) if( m_fSecsUntilSwitch > 0 )
return; return;
@@ -71,14 +71,14 @@ public:
{ {
luaL_checktype( L, 1, LUA_TTABLE ); luaL_checktype( L, 1, LUA_TTABLE );
lua_pushvalue( L, 1 ); lua_pushvalue( L, 1 );
vector<RString> arrayTips; std::vector<RString> arrayTips;
LuaHelpers::ReadArrayFromTable( arrayTips, L ); LuaHelpers::ReadArrayFromTable( arrayTips, L );
lua_pop( L, 1 ); lua_pop( L, 1 );
for( unsigned i = 0; i < arrayTips.size(); ++i ) for( unsigned i = 0; i < arrayTips.size(); ++i )
FontCharAliases::ReplaceMarkers( arrayTips[i] ); FontCharAliases::ReplaceMarkers( arrayTips[i] );
if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) ) if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) )
{ {
vector<RString> arrayTipsAlt; std::vector<RString> arrayTipsAlt;
luaL_checktype( L, 2, LUA_TTABLE ); luaL_checktype( L, 2, LUA_TTABLE );
lua_pushvalue( L, 2 ); lua_pushvalue( L, 2 );
LuaHelpers::ReadArrayFromTable( arrayTipsAlt, L ); LuaHelpers::ReadArrayFromTable( arrayTipsAlt, L );
@@ -95,7 +95,7 @@ public:
} }
static int SetTipsColonSeparated( T* p, lua_State *L ) static int SetTipsColonSeparated( T* p, lua_State *L )
{ {
vector<RString> vs; std::vector<RString> vs;
split( SArg(1), "::", vs ); split( SArg(1), "::", vs );
p->SetTips( vs ); p->SetTips( vs );
COMMON_RETURN_SELF; COMMON_RETURN_SELF;
@@ -103,7 +103,7 @@ public:
static int gettips( T* p, lua_State *L ) static int gettips( T* p, lua_State *L )
{ {
vector<RString> arrayTips, arrayTipsAlt; std::vector<RString> arrayTips, arrayTipsAlt;
p->GetTips( arrayTips, arrayTipsAlt ); p->GetTips( arrayTips, arrayTipsAlt );
LuaHelpers::CreateTableFromArray( arrayTips, L ); LuaHelpers::CreateTableFromArray( arrayTips, L );
+7 -4
View File
@@ -13,9 +13,12 @@ public:
virtual HelpDisplay *Copy() const; virtual HelpDisplay *Copy() const;
void SetTips( const vector<RString> &arrayTips ) { SetTips( arrayTips, arrayTips ); } void SetTips( const std::vector<RString> &arrayTips ) { SetTips( arrayTips, arrayTips ); }
void SetTips( const vector<RString> &arrayTips, const vector<RString> &arrayTipsAlt ); void SetTips( const std::vector<RString> &arrayTips, const std::vector<RString> &arrayTipsAlt );
void GetTips( vector<RString> &arrayTipsOut, vector<RString> &arrayTipsAltOut ) const { arrayTipsOut = m_arrayTips; arrayTipsAltOut = m_arrayTipsAlt; } void GetTips( std::vector<RString> &arrayTipsOut, std::vector<RString> &arrayTipsAltOut ) const {
arrayTipsOut = m_arrayTips;
arrayTipsAltOut = m_arrayTipsAlt;
}
void SetSecsBetweenSwitches( float fSeconds ) { m_fSecsBetweenSwitches = m_fSecsUntilSwitch = fSeconds; } void SetSecsBetweenSwitches( float fSeconds ) { m_fSecsBetweenSwitches = m_fSecsUntilSwitch = fSeconds; }
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
@@ -24,7 +27,7 @@ public:
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
protected: protected:
vector<RString> m_arrayTips, m_arrayTipsAlt; std::vector<RString> m_arrayTips, m_arrayTipsAlt;
int m_iCurTipIndex; int m_iCurTipIndex;
float m_fSecsBetweenSwitches; float m_fSecsBetweenSwitches;
+5 -5
View File
@@ -324,7 +324,7 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine
if( !bIsMachine ) if( !bIsMachine )
ClampSize( bIsMachine ); ClampSize( bIsMachine );
} }
HighGrade = min( hs.GetGrade(), HighGrade ); HighGrade = std::min( hs.GetGrade(), HighGrade );
} }
void HighScoreList::IncrementPlayCount( DateTime _dtLastPlayed ) void HighScoreList::IncrementPlayCount( DateTime _dtLastPlayed )
@@ -398,16 +398,16 @@ void HighScoreList::LoadFromNode( const XNode* pHighScoreList )
if( vHighScores.back().GetScore() == 0 ) if( vHighScores.back().GetScore() == 0 )
vHighScores.pop_back(); vHighScores.pop_back();
else else
HighGrade = min( vHighScores.back().GetGrade(), HighGrade ); HighGrade = std::min( vHighScores.back().GetGrade(), HighGrade );
} }
} }
} }
void HighScoreList::RemoveAllButOneOfEachName() void HighScoreList::RemoveAllButOneOfEachName()
{ {
for (vector<HighScore>::iterator i = vHighScores.begin(); i != vHighScores.end(); ++i) for (std::vector<HighScore>::iterator i = vHighScores.begin(); i != vHighScores.end(); ++i)
{ {
for( vector<HighScore>::iterator j = i+1; j != vHighScores.end(); j++ ) for( std::vector<HighScore>::iterator j = i+1; j != vHighScores.end(); j++ )
{ {
if( i->GetName() == j->GetName() ) if( i->GetName() == j->GetName() )
{ {
@@ -437,7 +437,7 @@ void HighScoreList::MergeFromOtherHSL(HighScoreList& other, bool is_machine)
std::sort(vHighScores.begin(), vHighScores.end()); std::sort(vHighScores.begin(), vHighScores.end());
// Remove non-unique scores because they probably come from an accidental // Remove non-unique scores because they probably come from an accidental
// repeated merge. -Kyz // repeated merge. -Kyz
vector<HighScore>::iterator unique_end= std::vector<HighScore>::iterator unique_end=
std::unique(vHighScores.begin(), vHighScores.end()); std::unique(vHighScores.begin(), vHighScores.end());
vHighScores.erase(unique_end, vHighScores.end()); vHighScores.erase(unique_end, vHighScores.end());
// Reverse it because sort moved the lesser scores to the top. // Reverse it because sort moved the lesser scores to the top.
+1 -1
View File
@@ -140,7 +140,7 @@ public:
XNode* CreateNode() const; XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode ); void LoadFromNode( const XNode* pNode );
vector<HighScore> vHighScores; std::vector<HighScore> vHighScores;
Grade HighGrade; Grade HighGrade;
// Lua // Lua
+5 -5
View File
@@ -49,7 +49,7 @@ static Preference<bool> g_bPalettedImageCache( "PalettedImageCache", false );
ImageCache *IMAGECACHE; // global and accessible from anywhere in our program ImageCache *IMAGECACHE; // global and accessible from anywhere in our program
static map<RString,RageSurface *> g_ImagePathToImage; static std::map<RString, RageSurface*> g_ImagePathToImage;
static int g_iDemandRefcount = 0; static int g_iDemandRefcount = 0;
RString ImageCache::GetImageCachePath( RString sImageDir ,RString sImagePath ) RString ImageCache::GetImageCachePath( RString sImageDir ,RString sImagePath )
@@ -220,8 +220,8 @@ struct ImageTexture: public RageTexture
m_pImage->h > DISPLAY->GetMaxTextureSize() ) m_pImage->h > DISPLAY->GetMaxTextureSize() )
{ {
LOG->Warn( "Converted %s at runtime", GetID().filename.c_str() ); LOG->Warn( "Converted %s at runtime", GetID().filename.c_str() );
int iWidth = min( m_pImage->w, DISPLAY->GetMaxTextureSize() ); int iWidth = std::min( m_pImage->w, DISPLAY->GetMaxTextureSize() );
int iHeight = min( m_pImage->h, DISPLAY->GetMaxTextureSize() ); int iHeight = std::min( m_pImage->h, DISPLAY->GetMaxTextureSize() );
RageSurfaceUtils::Zoom( m_pImage, iWidth, iHeight ); RageSurfaceUtils::Zoom( m_pImage, iWidth, iHeight );
} }
@@ -392,8 +392,8 @@ void ImageCache::CacheImageInternal( RString sImageDir, RString sImagePath )
/* Don't resize the image to less than 32 pixels in either dimension or the next /* Don't resize the image to less than 32 pixels in either dimension or the next
* power of two of the source (whichever is smaller); it's already very low res. */ * power of two of the source (whichever is smaller); it's already very low res. */
iWidth = max( iWidth, min(32, power_of_two(iSourceWidth)) ); iWidth = std::max( iWidth, std::min(32, power_of_two(iSourceWidth)) );
iHeight = max( iHeight, min(32, power_of_two(iSourceHeight)) ); iHeight = std::max( iHeight, std::min(32, power_of_two(iSourceHeight)) );
//RageSurfaceUtils::ApplyHotPinkColorKey( pImage ); //RageSurfaceUtils::ApplyHotPinkColorKey( pImage );
+1 -1
View File
@@ -94,7 +94,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
{ break; } { break; }
// New value. // New value.
size_t iEqualIndex = line.find("="); size_t iEqualIndex = line.find("=");
if( iEqualIndex != string::npos ) if( iEqualIndex != std::string::npos )
{ {
RString valuename = line.Left((int) iEqualIndex); RString valuename = line.Left((int) iEqualIndex);
RString value = line.Right(line.size()-valuename.size()-1); RString value = line.Right(line.size()-valuename.size()-1);
-1
View File
@@ -4,7 +4,6 @@
#define INIFILE_H #define INIFILE_H
#include "XmlFile.h" #include "XmlFile.h"
using namespace std;
class RageFileBasic; class RageFileBasic;
/** @brief The functions to read and write .INI files. */ /** @brief The functions to read and write .INI files. */

Some files were not shown because too many files have changed in this diff Show More