CString -> RString

This commit is contained in:
Chris Danford
2006-01-22 01:00:06 +00:00
parent 870ed267fc
commit 7f821e8cfc
578 changed files with 3943 additions and 3946 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ void ActiveAttackList::Refresh()
{
const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks;
vector<CString> vsThemedMods;
vector<RString> vsThemedMods;
for( unsigned i=0; i<attacks.size(); i++ )
{
const Attack& attack = attacks[i];
@@ -49,7 +49,7 @@ void ActiveAttackList::Refresh()
po.GetThemedMods( vsThemedMods );
}
CString s = join( "\n", vsThemedMods );
RString s = join( "\n", vsThemedMods );
this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same.
}
+32 -32
View File
@@ -92,7 +92,7 @@ void Actor::InitDefaults()
UnsubcribeAndClearCommands();
}
static bool GetMessageNameFromCommandName( const CString &sCommandName, CString &sMessageNameOut )
static bool GetMessageNameFromCommandName( const RString &sCommandName, RString &sMessageNameOut )
{
if( sCommandName.Right(7) == "Message" )
{
@@ -107,7 +107,7 @@ static bool GetMessageNameFromCommandName( const CString &sCommandName, CString
void Actor::UnsubcribeAndClearCommands()
{
FOREACH_CONST( CString, m_vsSubscribedTo, s )
FOREACH_CONST( RString, m_vsSubscribedTo, s )
MESSAGEMAN->Unsubscribe( this, *s );
m_vsSubscribedTo.clear();
}
@@ -191,14 +191,14 @@ Actor::Actor( const Actor &cpy ):
* initialization (eg. ActorFrame loading children). However, it
* also loads input variables, which should happen first. The
* former is more important. */
void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
{
FOREACH_CONST_Child( pNode, pChild )
{
if( pChild->m_sName == "Input" )
{
/* If parameters are specified here, save their values to the actor. */
CString sName;
RString sName;
if( !pChild->GetAttrValue( "Name", sName ) )
RageException::Throw( ssprintf("Input node in '%s' is missing the attribute 'Name'", sDir.c_str()) );
@@ -222,8 +222,8 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
FOREACH_CONST_Attr( pNode, pAttr )
{
// Load Name, if any.
const CString &sKeyName = pAttr->first;
const CString &sValue = pAttr->second;
const RString &sKeyName = pAttr->first;
const RString &sValue = pAttr->second;
if( sKeyName == "Name" )
{
m_sName = sValue;
@@ -244,7 +244,7 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
{
apActorCommands apac( new ActorCommands( sValue ) );
CString sCmdName = sKeyName.Left( sKeyName.size()-7 );
RString sCmdName = sKeyName.Left( sKeyName.size()-7 );
AddCommand( sCmdName, apac );
}
}
@@ -254,14 +254,14 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
//
FOREACH_CONST_Child( pNode, c )
{
CString sKeyName = c->m_sName;
RString sKeyName = c->m_sName;
if( sKeyName != "Command" )
continue; /* not a command */
CString sName;
RString sName;
c->GetAttrValue( "Name", sName );
CString sValue;
RString sValue;
c->GetAttrValue( "Value", sValue );
LuaHelpers::RunAtExpressionS( sName );
@@ -277,7 +277,7 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
/* Like RTTI: return true if this actor is an sType (or derived from sType).
* This uses the Lua binding check, so only works on bound types. */
bool Actor::IsType( const CString &sType )
bool Actor::IsType( const RString &sType )
{
Lua *L = LUA->Get();
this->PushSelf( L );
@@ -744,7 +744,7 @@ void Actor::BeginTweening( float time, TweenType tt )
// recursing ActorCommand.
if( m_Tweens.size() > 50 )
{
CString sError = ssprintf( "Tween overflow: size = %u. infinitely recursing ActorCommand?", unsigned(m_Tweens.size()) );
RString sError = ssprintf( "Tween overflow: size = %u. infinitely recursing ActorCommand?", unsigned(m_Tweens.size()) );
LOG->Warn( sError );
Dialog::OK( sError );
FinishTweening();
@@ -837,7 +837,7 @@ void Actor::ScaleTo( const RectF &rect, StretchType st )
SetZoom( fNewZoom );
}
void Actor::SetHorizAlignString( const CString &s )
void Actor::SetHorizAlignString( const RString &s )
{
if (s.CompareNoCase("left")==0) this->SetHorizAlign( align_left ); /* call derived */
else if(s.CompareNoCase("center")==0) this->SetHorizAlign( align_center );
@@ -845,7 +845,7 @@ void Actor::SetHorizAlignString( const CString &s )
else ASSERT(0);
}
void Actor::SetVertAlignString( const CString &s )
void Actor::SetVertAlignString( const RString &s )
{
if (s.CompareNoCase("top")==0) this->SetVertAlign( align_top ); /* call derived */
else if(s.CompareNoCase("middle")==0) this->SetVertAlign( align_middle );
@@ -853,7 +853,7 @@ void Actor::SetVertAlignString( const CString &s )
else ASSERT(0);
}
void Actor::SetEffectClockString( const CString &s )
void Actor::SetEffectClockString( const RString &s )
{
if (s.CompareNoCase("timer")==0) this->SetEffectClock( CLOCK_TIMER );
else if(s.CompareNoCase("beat")==0) this->SetEffectClock( CLOCK_BGM_BEAT );
@@ -917,7 +917,7 @@ void Actor::SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, floa
// effect "macros"
void Actor::SetEffectLua( const CString &sCommand )
void Actor::SetEffectLua( const RString &sCommand )
{
m_Effect = effect_lua;
m_sEffectCommand = sCommand;
@@ -1208,7 +1208,7 @@ void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const Twee
average_out.aux = ts1.aux + (ts2.aux - ts1.aux )*fPercentBetween;
}
void Actor::SetBlendModeString( const CString &s )
void Actor::SetBlendModeString( const RString &s )
{
if (s.CompareNoCase("normal")==0) this->SetBlendMode( BLEND_NORMAL );
else if(s.CompareNoCase("add")==0) this->SetBlendMode( BLEND_ADD );
@@ -1216,7 +1216,7 @@ void Actor::SetBlendModeString( const CString &s )
else ASSERT(0);
}
void Actor::SetCullModeString( const CString &s )
void Actor::SetCullModeString( const RString &s )
{
if (s.CompareNoCase("back")==0) this->SetCullMode( CULL_BACK );
else if(s.CompareNoCase("front")==0) this->SetCullMode( CULL_FRONT );
@@ -1224,7 +1224,7 @@ void Actor::SetCullModeString( const CString &s )
else ASSERT(0);
}
void Actor::SetZTestModeString( const CString &s )
void Actor::SetZTestModeString( const RString &s )
{
// for metrics backward compatibility
if(s.CompareNoCase("off")==0) this->SetZTestMode( ZTEST_OFF );
@@ -1239,14 +1239,14 @@ void Actor::Sleep( float time )
BeginTweening( 0, TWEEN_LINEAR );
}
void Actor::QueueCommand( const CString& sCommandName )
void Actor::QueueCommand( const RString& sCommandName )
{
BeginTweening( 0, TWEEN_LINEAR );
TweenInfo &TI = m_Tweens.back()->info;
TI.m_sCommandName = sCommandName;
}
void Actor::QueueMessage( const CString& sMessageName )
void Actor::QueueMessage( const RString& sMessageName )
{
// Hack: use "!" as a marker to broadcast a command, instead of playing a
// command, so we don't have to add yet another element to every tween
@@ -1256,15 +1256,15 @@ void Actor::QueueMessage( const CString& sMessageName )
TI.m_sCommandName = "!" + sMessageName;
}
void Actor::AddCommand( const CString &sCmdName, apActorCommands apac )
void Actor::AddCommand( const RString &sCmdName, apActorCommands apac )
{
if( HasCommand(sCmdName) )
{
CString sWarning = m_sName+"'s command '"+sCmdName+"' defined twice";
RString sWarning = m_sName+"'s command '"+sCmdName+"' defined twice";
Dialog::OK( sWarning, "COMMAND_DEFINED_TWICE" );
}
CString sMessage;
RString sMessage;
if( GetMessageNameFromCommandName(sCmdName, sMessage) )
{
SubscribeToMessage( sMessage );
@@ -1276,22 +1276,22 @@ void Actor::AddCommand( const CString &sCmdName, apActorCommands apac )
}
}
bool Actor::HasCommand( const CString &sCmdName )
bool Actor::HasCommand( const RString &sCmdName )
{
map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCmdName );
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCmdName );
return it != m_mapNameToCommands.end();
}
const apActorCommands& Actor::GetCommand( const CString &sCommandName ) const
const apActorCommands& Actor::GetCommand( const RString &sCommandName ) const
{
map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
ASSERT( it != m_mapNameToCommands.end() );
return it->second;
}
void Actor::PlayCommand( const CString &sCommandName, Actor *pParent )
void Actor::PlayCommand( const RString &sCommandName, Actor *pParent )
{
map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
if( it == m_mapNameToCommands.end() )
return;
@@ -1299,12 +1299,12 @@ void Actor::PlayCommand( const CString &sCommandName, Actor *pParent )
RunCommands( *it->second );
}
void Actor::HandleMessage( const CString& sMessage )
void Actor::HandleMessage( const RString& sMessage )
{
PlayCommand( sMessage );
}
void Actor::SubscribeToMessage( const CString &sMessageName )
void Actor::SubscribeToMessage( const RString &sMessageName )
{
MESSAGEMAN->Subscribe( this, sMessageName );
m_vsSubscribedTo.push_back( sMessageName );
+24 -24
View File
@@ -30,8 +30,8 @@ public:
virtual ~Actor();
virtual Actor *Copy() const;
void UnsubcribeAndClearCommands();
virtual void LoadFromNode( const CString& sDir, const XNode* pNode );
bool IsType( const CString &sType );
virtual void LoadFromNode( const RString& sDir, const XNode* pNode );
bool IsType( const RString &sType );
static void SetBGMTime( float fTime, float fBeat );
static void SetBGMLight( int iLightNumber, float fCabinetLights );
@@ -98,8 +98,8 @@ public:
virtual void UpdateInternal( float fDeltaTime ); // override this
void UpdateTweening( float fDeltaTime );
const CString &GetName() const { return m_sName; }
virtual void SetName( const CString &sName ) { m_sName = sName; }
const RString &GetName() const { return m_sName; }
virtual void SetName( const RString &sName ) { m_sName = sName; }
float GetX() const { return m_current.pos.x; };
float GetY() const { return m_current.pos.y; };
@@ -202,8 +202,8 @@ public:
void BeginTweening( float time, TweenType tt = TWEEN_LINEAR );
void StopTweening();
void Sleep( float time );
void QueueCommand( const CString& sCommandName );
void QueueMessage( const CString& sMessageName );
void QueueCommand( const RString& sCommandName );
void QueueMessage( const RString& sMessageName );
virtual void FinishTweening();
virtual void HurryTweening( float factor );
// Let ActorFrame and BGAnimation override
@@ -234,11 +234,11 @@ public:
//
enum HorizAlign { align_left, align_center, align_right };
virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; }
virtual void SetHorizAlignString( const CString &s ); // convenience
virtual void SetHorizAlignString( const RString &s ); // convenience
enum VertAlign { align_top, align_middle, align_bottom };
virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; }
virtual void SetVertAlignString( const CString &s ); // convenience
virtual void SetVertAlignString( const RString &s ); // convenience
//
@@ -256,12 +256,12 @@ public:
void SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, float fAtZero );
void SetEffectOffset( float fTime ) { m_fEffectOffset = fTime; }
void SetEffectClock( EffectClock c ) { m_EffectClock = c; }
void SetEffectClockString( const CString &s ); // convenience
void SetEffectClockString( const RString &s ); // convenience
void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; }
RageVector3 GetEffectMagnitude() const { return m_vEffectMagnitude; }
void SetEffectLua( const CString &sCommand );
void SetEffectLua( const RString &sCommand );
void SetEffectDiffuseBlink(
float fEffectPeriodSeconds = 1.0f,
RageColor c1 = RageColor(0.5f,0.5f,0.5f,1),
@@ -320,16 +320,16 @@ public:
// render states
//
void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; }
void SetBlendModeString( const CString &s ); // convenience
void SetBlendModeString( const RString &s ); // convenience
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; }
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; }
void SetZTestModeString( const CString &s ); // convenience
void SetZTestModeString( const RString &s ); // convenience
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
void SetZBias( float f ) { m_fZBias = f; }
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
void SetCullModeString( const CString &s ); // convenience
void SetCullModeString( const RString &s ); // convenience
//
// Lua
@@ -339,10 +339,10 @@ public:
//
// Commands
//
void AddCommand( const CString &sCmdName, apActorCommands apac );
bool HasCommand( const CString &sCmdName );
const apActorCommands& GetCommand( const CString &sCommandName ) const;
virtual void PlayCommand( const CString &sCommandName, Actor *pParent = NULL );
void AddCommand( const RString &sCmdName, apActorCommands apac );
bool HasCommand( const RString &sCmdName );
const apActorCommands& GetCommand( const RString &sCommandName ) const;
virtual void PlayCommand( const RString &sCommandName, Actor *pParent = NULL );
virtual void RunCommands( const LuaReference& cmds, Actor *pParent = NULL );
void RunCommands( const apActorCommands& cmds, Actor *pParent = NULL ) { this->RunCommands( *cmds, pParent ); } // convenience
// If we're a leaf, then execute this command.
@@ -355,8 +355,8 @@ public:
// Messages
//
void SubscribeToMessage( Message message ); // will automatically unsubscribe
void SubscribeToMessage( const CString &sMessageName ); // will automatically unsubscribe
virtual void HandleMessage( const CString& sMessage );
void SubscribeToMessage( const RString &sMessageName ); // will automatically unsubscribe
virtual void HandleMessage( const RString& sMessage );
//
@@ -371,7 +371,7 @@ public:
HiddenPtr<LuaClass> m_pLuaInstance;
protected:
CString m_sName;
RString m_sName;
struct TweenInfo
{
@@ -379,7 +379,7 @@ protected:
TweenType m_TweenType;
float m_fTimeLeftInTween; // how far into the tween are we?
float m_fTweenTime; // seconds between Start and End positions/zooms
CString m_sCommandName; // command to execute when this TweenState goes into effect
RString m_sCommandName; // command to execute when this TweenState goes into effect
};
@@ -416,7 +416,7 @@ protected:
// Stuff for effects
//
Effect m_Effect;
CString m_sEffectCommand; // effect_lua
RString m_sEffectCommand; // effect_lua
float m_fSecsIntoEffect, m_fEffectDelta;
// units depend on m_EffectClock
@@ -467,8 +467,8 @@ private:
//
// commands
//
map<CString, apActorCommands> m_mapNameToCommands;
vector<CString> m_vsSubscribedTo;
map<RString, apActorCommands> m_mapNameToCommands;
vector<RString> m_vsSubscribedTo;
};
#endif
+4 -4
View File
@@ -7,7 +7,7 @@
#include <sstream>
#include "LuaBinding.h"
ActorCommands::ActorCommands( const CString &sCommands )
ActorCommands::ActorCommands( const RString &sCommands )
{
if( sCommands.size() > 0 && sCommands[0] == '\033' )
{
@@ -34,7 +34,7 @@ ActorCommands::ActorCommands( const CString &sCommands )
FOREACH_CONST( Command, cmds.v, c )
{
const Command& cmd = (*c);
CString sName = cmd.GetName();
RString sName = cmd.GetName();
TrimLeft( sName );
TrimRight( sName );
s << "\tself:" << sName << "(";
@@ -52,7 +52,7 @@ ActorCommands::ActorCommands( const CString &sCommands )
for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ )
{
CString sArg = cmd.m_vsArgs[i];
RString sArg = cmd.m_vsArgs[i];
// "+200" -> "200"
if( sArg[0] == '+' )
@@ -95,7 +95,7 @@ void ActorCommands::Register()
{
Lua *L = LUA->Get();
CString sError;
RString sError;
if( !LuaHelpers::RunScript( L, m_sLuaFunction, "in", sError, 1 ) )
{
FAIL_M( ssprintf("Compiling \"%s\": %s", m_sLuaFunction.c_str(), sError.c_str()) );
+2 -2
View File
@@ -11,11 +11,11 @@
class ActorCommands: public LuaReference
{
public:
ActorCommands( const CString &sCommands );
ActorCommands( const RString &sCommands );
private:
void Register();
CString m_sLuaFunction;
RString m_sLuaFunction;
};
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
+5 -5
View File
@@ -67,7 +67,7 @@ ActorFrame::ActorFrame( const ActorFrame &cpy ):
}
}
void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
void ActorFrame::LoadFromNode( const RString& sDir, const XNode* pNode )
{
if( AutoLoadChildren() )
LoadChildrenFromNode( sDir, pNode );
@@ -77,7 +77,7 @@ void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
pNode->GetAttrValue( "UpdateRate", m_fUpdateRate );
pNode->GetAttrValue( "FOV", m_fFOV );
CString s;
RString s;
if( pNode->GetAttrValue( "VanishX", s ) )
m_fVanishX = LuaHelpers::RunExpressionF( s );
if( pNode->GetAttrValue( "VanishY", s ) )
@@ -85,7 +85,7 @@ void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting );
}
void ActorFrame::LoadChildrenFromNode( const CString& sDir, const XNode* pNode )
void ActorFrame::LoadChildrenFromNode( const RString& sDir, const XNode* pNode )
{
// Shouldn't be calling this unless we're going to delete our children.
ASSERT( m_bDeleteChildren );
@@ -127,7 +127,7 @@ void ActorFrame::RemoveChild( Actor* pActor )
m_SubActors.erase( iter );
}
Actor* ActorFrame::GetChild( const CString &sName )
Actor* ActorFrame::GetChild( const RString &sName )
{
FOREACH( Actor*, m_SubActors, a )
{
@@ -340,7 +340,7 @@ void ActorFrame::SetPropagateCommands( bool b )
m_bPropagateCommands = b;
}
void ActorFrame::PlayCommand( const CString &sCommandName, Actor* pParent )
void ActorFrame::PlayCommand( const RString &sCommandName, Actor* pParent )
{
Actor::PlayCommand( sCommandName, pParent );
+4 -4
View File
@@ -12,12 +12,12 @@ public:
ActorFrame( const ActorFrame &cpy );
virtual ~ActorFrame();
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromNode( const RString& sDir, const XNode* pNode );
virtual Actor *Copy() const;
virtual void AddChild( Actor* pActor );
virtual void RemoveChild( Actor* pActor );
Actor* GetChild( const CString &sName );
Actor* GetChild( const RString &sName );
int GetNumChildren() const { return m_SubActors.size(); }
void RemoveAllChildren();
@@ -60,12 +60,12 @@ public:
/* Amount of time until all tweens (and all children's tweens) have stopped: */
virtual float GetTweenTimeLeft() const;
virtual void PlayCommand( const CString &sCommandName, Actor* pParent = NULL );
virtual void PlayCommand( const RString &sCommandName, Actor* pParent = NULL );
virtual void RunCommands( const LuaReference& cmds, Actor* pParent = NULL );
void RunCommands( const apActorCommands& cmds, Actor *pParent = NULL ) { this->RunCommands( *cmds, pParent ); } // convenience
protected:
void LoadChildrenFromNode( const CString& sDir, const XNode* pNode );
void LoadChildrenFromNode( const RString& sDir, const XNode* pNode );
vector<Actor*> m_SubActors;
bool m_bPropagateCommands;
+4 -4
View File
@@ -56,7 +56,7 @@ void ActorScroller::Load2(
LUA->Release( L );
}
void ActorScroller::SetTransformFromExpression( const CString &sTransformFunction )
void ActorScroller::SetTransformFromExpression( const RString &sTransformFunction )
{
m_exprTransformFunction.SetFromExpression( sTransformFunction );
}
@@ -96,20 +96,20 @@ float ActorScroller::GetSecondsForCompleteScrollThrough() const
return fTotalItems * (m_fSecondsPerItem + m_fSecondsPauseBetweenItems );
}
void ActorScroller::LoadFromNode( const CString &sDir, const XNode *pNode )
void ActorScroller::LoadFromNode( const RString &sDir, const XNode *pNode )
{
ActorFrame::LoadFromNode( sDir, pNode );
#define GET_VALUE( szName, valueOut ) \
if( !pNode->GetAttrValue( szName, valueOut ) ) { \
CString sError = ssprintf("ActorScroller in '%s' is missing the value Scroller::%s", sDir.c_str(), szName); \
RString sError = ssprintf("ActorScroller in '%s' is missing the value Scroller::%s", sDir.c_str(), szName); \
LOG->Warn( sError ); \
Dialog::OK( sError ); \
}
float fSecondsPerItem = 0;
float fNumItemsToDraw = 0;
CString sTransformFunction;
RString sTransformFunction;
int iSubdivisions = 1;
GET_VALUE( "SecondsPerItem", fSecondsPerItem );
+2 -2
View File
@@ -13,7 +13,7 @@ class ActorScroller : public ActorFrame
public:
ActorScroller();
void SetTransformFromExpression( const CString &sTransformFunction );
void SetTransformFromExpression( const RString &sTransformFunction );
void SetTransformFromHeight( float fItemHeight );
void Load2(
@@ -28,7 +28,7 @@ public:
void PositionItems();
void LoadFromNode( const CString &sDir, const XNode *pNode );
void LoadFromNode( const RString &sDir, const XNode *pNode );
virtual Actor *Copy() const;
void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; }
+4 -4
View File
@@ -8,7 +8,7 @@
REGISTER_ACTOR_CLASS_WITH_NAME( ActorSound, Sound )
void ActorSound::Load( const CString &sPath )
void ActorSound::Load( const RString &sPath )
{
m_Sound.Load( sPath, true );
}
@@ -18,17 +18,17 @@ void ActorSound::Play()
SOUNDMAN->PlayCopyOfSound( m_Sound );
}
void ActorSound::LoadFromNode( const CString& sDir, const XNode* pNode )
void ActorSound::LoadFromNode( const RString& sDir, const XNode* pNode )
{
Actor::LoadFromNode( sDir, pNode );
CString sFile;
RString sFile;
if( pNode->GetAttrValue("File", sFile) || pNode->GetAttrValue("Path", sFile) ) /* Path deprecated */
{
LuaHelpers::RunAtExpressionS( sFile );
FixSlashesInPlace( sFile );
CString sNewPath = sFile.Left(1) == "/"? sFile : sDir+sFile;
RString sNewPath = sFile.Left(1) == "/"? sFile : sDir+sFile;
ActorUtil::ResolvePath( sNewPath, sDir );
Load( sNewPath );
+2 -2
View File
@@ -12,9 +12,9 @@ public:
virtual ~ActorSound() { }
virtual Actor *Copy() const;
void Load( const CString &sPath );
void Load( const RString &sPath );
void Play();
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromNode( const RString& sDir, const XNode* pNode );
//
// Lua
+43 -43
View File
@@ -17,27 +17,27 @@
// Actor registration
static map<CString,CreateActorFn> *g_pmapRegistrees = NULL;
static map<RString,CreateActorFn> *g_pmapRegistrees = NULL;
static bool IsRegistered( const CString& sClassName )
static bool IsRegistered( const RString& sClassName )
{
return g_pmapRegistrees->find( sClassName ) != g_pmapRegistrees->end();
}
void ActorUtil::Register( const CString& sClassName, CreateActorFn pfn )
void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn )
{
if( g_pmapRegistrees == NULL )
g_pmapRegistrees = new map<CString,CreateActorFn>;
g_pmapRegistrees = new map<RString,CreateActorFn>;
map<CString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName );
map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName );
ASSERT_M( iter == g_pmapRegistrees->end(), ssprintf("Actor class '%s' already registered.", sClassName.c_str()) );
(*g_pmapRegistrees)[sClassName] = pfn;
}
Actor* ActorUtil::Create( const CString& sClassName, const CString& sDir, const XNode* pNode )
Actor* ActorUtil::Create( const RString& sClassName, const RString& sDir, const XNode* pNode )
{
map<CString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName );
map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClassName );
ASSERT_M( iter != g_pmapRegistrees->end(), ssprintf("Actor '%s' is not registered.",sClassName.c_str()) );
CreateActorFn pfn = iter->second;
@@ -45,9 +45,9 @@ Actor* ActorUtil::Create( const CString& sClassName, const CString& sDir, const
}
/* Return false to retry. */
void ActorUtil::ResolvePath( CString &sPath, const CString &sName )
void ActorUtil::ResolvePath( RString &sPath, const RString &sName )
{
const CString sOriginalPath( sPath );
const RString sOriginalPath( sPath );
retry:
CollapsePath( sPath );
@@ -57,12 +57,12 @@ retry:
RageFileManager::FileType ft = FILEMAN->GetFileType( sPath );
if( ft != RageFileManager::TYPE_FILE && ft != RageFileManager::TYPE_DIR )
{
vector<CString> asPaths;
vector<RString> asPaths;
GetDirListing( sPath + "*", asPaths, false, true ); // return path too
if( asPaths.empty() )
{
CString sError = ssprintf( "A file in '%s' references a file '%s' which doesn't exist.", sName.c_str(), sPath.c_str() );
RString sError = ssprintf( "A file in '%s' references a file '%s' which doesn't exist.", sName.c_str(), sPath.c_str() );
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
{
case Dialog::abort:
@@ -82,7 +82,7 @@ retry:
}
else if( asPaths.size() > 1 )
{
CString sError = ssprintf( "A file in '%s' references a file '%s' which has multiple matches.", sName.c_str(), sPath.c_str() );
RString sError = ssprintf( "A file in '%s' references a file '%s' which has multiple matches.", sName.c_str(), sPath.c_str() );
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
{
case Dialog::abort:
@@ -121,7 +121,7 @@ static void PushParamsTable( Lua *L )
/* Set an input parameter to the first value on the stack. If pOld is non-NULL,
* set it to the old value. The value used on the stack will be removed. */
void ActorUtil::SetParamFromStack( Lua *L, CString sName, LuaReference *pOld )
void ActorUtil::SetParamFromStack( Lua *L, RString sName, LuaReference *pOld )
{
int iValue = lua_gettop(L);
@@ -154,7 +154,7 @@ void ActorUtil::SetParamFromStack( Lua *L, CString sName, LuaReference *pOld )
}
/* Look up a param set with SetParamFromStack, and push it on the stack. */
void ActorUtil::GetParam( Lua *L, const CString &sName )
void ActorUtil::GetParam( Lua *L, const RString &sName )
{
/* Search the params table. */
PushParamsTable( L );
@@ -170,12 +170,12 @@ void ActorUtil::GetParam( Lua *L, const CString &sName )
}
}
Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ASSERT( pNode );
{
CString expr;
RString expr;
if( pNode->GetAttrValue("Condition",expr) )
{
LuaHelpers::RunAtExpressionS( expr );
@@ -185,13 +185,13 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
}
// Load Params
map<CString, LuaReference> setOldParams;
map<RString, LuaReference> setOldParams;
{
FOREACH_CONST_Child( pNode, pChild )
{
if( pChild->m_sName == "Param" )
{
CString sName;
RString sName;
if( !pChild->GetAttrValue( "Name", sName ) )
{
RageException::Throw( ssprintf("Param node in '%s' is missing the attribute 'Name'", sDir.c_str()) );
@@ -199,7 +199,7 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
LuaHelpers::RunAtExpressionS( sName );
CString s;
RString s;
if( pChild->GetAttrValue( "Value", s ) )
{
Lua *L = LUA->Get();
@@ -221,7 +221,7 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
// Element name is the type in XML.
// Type= is the name in INI.
// TODO: Remove the backward compat fallback
CString sClass = pNode->m_sName;
RString sClass = pNode->m_sName;
bool bHasClass = pNode->GetAttrValue( "Class", sClass );
if( !bHasClass )
bHasClass = pNode->GetAttrValue( "Type", sClass ); // for backward compatibility
@@ -229,7 +229,7 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
// backward compat hack
if( !bHasClass )
{
CString sText;
RString sText;
if( pNode->GetAttrValue( "Text", sText ) )
sClass = "BitmapText";
}
@@ -243,7 +243,7 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
else // sClass is empty or garbage (e.g. "1" or "0 // 0==Sprite")
{
// automatically figure out the type
CString sFile;
RString sFile;
pNode->GetAttrValue( "File", sFile );
LuaHelpers::RunAtExpressionS( sFile );
@@ -254,14 +254,14 @@ Actor* ActorUtil::LoadFromNode( const CString& sDir, const XNode* pNode )
* loading the layer we're in. */
if( sFile == "" )
{
CString sError = ssprintf( "An xml file in '%s' is missing the File attribute or has an invalid Class \"%s\"",
RString sError = ssprintf( "An xml file in '%s' is missing the File attribute or has an invalid Class \"%s\"",
sDir.c_str(), sClass.c_str() );
Dialog::OK( sError );
pReturn = new Actor; // Return a dummy object so that we don't crash in AutoActor later.
goto all_done;
}
CString sNewPath = bIsAbsolutePath ? sFile : sDir+sFile;
RString sNewPath = bIsAbsolutePath ? sFile : sDir+sFile;
ActorUtil::ResolvePath( sNewPath, sDir );
@@ -275,7 +275,7 @@ all_done:
// Unload Params
{
Lua *L = LUA->Get();
FOREACHM( CString, LuaReference, setOldParams, old )
FOREACHM( RString, LuaReference, setOldParams, old )
{
old->second.PushSelf( L );
SetParamFromStack( L, old->first, NULL );
@@ -310,10 +310,10 @@ static void MergeActorXML( XNode *pChild, const XNode *pParent )
if( p->first == "File" )
continue;
CString sOld;
RString sOld;
if( pChild->GetChildValue(p->first, sOld) )
{
CString sWarning =
RString sWarning =
ssprintf( "Overriding \"%s\" (\"%s\") in XML node \"%s\" with \"%s\" in XML node \"%s\"",
p->first.c_str(),
p->second.c_str(),
@@ -330,19 +330,19 @@ static void MergeActorXML( XNode *pChild, const XNode *pParent )
* If pParent is non-NULL, it's the parent node when nesting XML, which is
* used only by ActorUtil::LoadFromNode.
*/
Actor* ActorUtil::MakeActor( const CString &sPath_, const XNode *pParent )
Actor* ActorUtil::MakeActor( const RString &sPath_, const XNode *pParent )
{
static const XNode dummy;
if( pParent == NULL )
pParent = &dummy;
CString sPath( sPath_ );
RString sPath( sPath_ );
/* If @ expressions are allowed through this path, we've already
* evaluated them. Make sure we don't allow double-evaluation. */
ASSERT_M( sPath.empty() || sPath[0] != '@', sPath );
CString sDir = Dirname( sPath );
RString sDir = Dirname( sPath );
FileType ft = GetFileType( sPath );
switch( ft )
{
@@ -397,7 +397,7 @@ Actor* ActorUtil::MakeActor( const CString &sPath_, const XNode *pParent )
}
}
void ActorUtil::SetXY( Actor& actor, const CString &sType )
void ActorUtil::SetXY( Actor& actor, const RString &sType )
{
ASSERT( !actor.GetName().empty() );
@@ -420,17 +420,17 @@ void ActorUtil::SetXY( Actor& actor, const CString &sType )
actor.SetXY( fX, fY );
}
void ActorUtil::LoadCommand( Actor& actor, const CString &sType, const CString &sCommandName )
void ActorUtil::LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName )
{
ActorUtil::LoadCommandFromName( actor, sType, sCommandName, actor.GetName() );
}
void ActorUtil::LoadCommandFromName( Actor& actor, const CString &sType, const CString &sCommandName, const CString &sName )
void ActorUtil::LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName )
{
actor.AddCommand( sCommandName, THEME->GetMetricA(sType,sName+sCommandName+"Command") );
}
void ActorUtil::LoadAndPlayCommand( Actor& actor, const CString &sType, const CString &sCommandName, Actor* pParent )
void ActorUtil::LoadAndPlayCommand( Actor& actor, const RString &sType, const RString &sCommandName, Actor* pParent )
{
// HACK: It's very often that we command things to TweenOffScreen
// that we aren't drawing. We know that an Actor is not being
@@ -461,22 +461,22 @@ void ActorUtil::LoadAndPlayCommand( Actor& actor, const CString &sType, const CS
actor.PlayCommand( sCommandName, pParent );
}
void ActorUtil::LoadAllCommands( Actor& actor, const CString &sType )
void ActorUtil::LoadAllCommands( Actor& actor, const RString &sType )
{
LoadAllCommandsFromName( actor, sType, actor.GetName() );
}
void ActorUtil::LoadAllCommandsFromName( Actor& actor, const CString &sType, const CString &sName )
void ActorUtil::LoadAllCommandsFromName( Actor& actor, const RString &sType, const RString &sName )
{
set<CString> vsValueNames;
set<RString> vsValueNames;
THEME->GetMetricsThatBeginWith( sType, sName, vsValueNames );
FOREACHS_CONST( CString, vsValueNames, v )
FOREACHS_CONST( RString, vsValueNames, v )
{
const CString &sv = *v;
const RString &sv = *v;
if( sv.Right(7) == "Command" )
{
CString sCommandName( sv.begin()+sName.size(), sv.end()-7 );
RString sCommandName( sv.begin()+sName.size(), sv.end()-7 );
LoadCommandFromName( actor, sType, sCommandName, sName );
}
}
@@ -502,9 +502,9 @@ static const char *FileTypeNames[] = {
};
XToString( FileType, NUM_FileType );
FileType ActorUtil::GetFileType( const CString &sPath )
FileType ActorUtil::GetFileType( const RString &sPath )
{
CString sExt = GetExtension( sPath );
RString sExt = GetExtension( sPath );
sExt.MakeLower();
if( sExt=="xml" ) return FT_Xml;
@@ -525,7 +525,7 @@ FileType ActorUtil::GetFileType( const CString &sPath )
}
/* Helper: set actor parameters, and return them to their original value when released. */
ActorUtil::ActorParam::ActorParam( CString sName, CString sValue )
ActorUtil::ActorParam::ActorParam( RString sName, RString sValue )
{
m_pOld = new LuaReference;
m_sName = sName;
+27 -27
View File
@@ -8,11 +8,11 @@
class XNode;
typedef Actor* (*CreateActorFn)(const CString& sDir, const XNode* pNode);
typedef Actor* (*CreateActorFn)(const RString& sDir, const XNode* pNode);
// Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file.
#define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \
Actor* Create##className(const CString& sDir, const XNode* pNode) { \
Actor* Create##className(const RString& sDir, const XNode* pNode) { \
className *pRet = new className; \
pRet->LoadFromNode(sDir, pNode); \
return pRet; } \
@@ -35,57 +35,57 @@ enum FileType
NUM_FileType,
FT_Invalid
};
const CString& FileTypeToString( FileType ft );
const RString& FileTypeToString( FileType ft );
namespace ActorUtil
{
// Every screen should register its class at program initialization.
void Register( const CString& sClassName, CreateActorFn pfn );
Actor* Create( const CString& sClassName, const CString& sDir, const XNode* pNode );
void Register( const RString& sClassName, CreateActorFn pfn );
Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode );
void SetXY( Actor& actor, const CString &sType );
void LoadCommand( Actor& actor, const CString &sType, const CString &sCommandName );
void LoadCommandFromName( Actor& actor, const CString &sType, const CString &sCommandName, const CString &sName );
void LoadAndPlayCommand( Actor& actor, const CString &sType, const CString &sCommandName, Actor* pParent = NULL );
void LoadAllCommands( Actor& actor, const CString &sType );
void LoadAllCommandsFromName( Actor& actor, const CString &sType, const CString &sName );
inline void OnCommand( Actor& actor, const CString &sType, Actor* pParent = NULL ) { LoadAndPlayCommand( actor, sType, "On", pParent ); }
inline void OffCommand( Actor& actor, const CString &sType ) { LoadAndPlayCommand( actor, sType, "Off" ); }
inline void SetXYAndOnCommand( Actor& actor, const CString &sType, Actor* pParent = NULL )
void SetXY( Actor& actor, const RString &sType );
void LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName );
void LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName );
void LoadAndPlayCommand( Actor& actor, const RString &sType, const RString &sCommandName, Actor* pParent = NULL );
void LoadAllCommands( Actor& actor, const RString &sType );
void LoadAllCommandsFromName( Actor& actor, const RString &sType, const RString &sName );
inline void OnCommand( Actor& actor, const RString &sType, Actor* pParent = NULL ) { LoadAndPlayCommand( actor, sType, "On", pParent ); }
inline void OffCommand( Actor& actor, const RString &sType ) { LoadAndPlayCommand( actor, sType, "Off" ); }
inline void SetXYAndOnCommand( Actor& actor, const RString &sType, Actor* pParent = NULL )
{
SetXY( actor, sType );
OnCommand( actor, sType, pParent );
}
/* convenience */
inline void SetXY( Actor* pActor, const CString &sType ) { SetXY( *pActor, sType ); }
inline void LoadAndPlayCommand( Actor* pActor, const CString &sType, const CString &sCommandName, Actor* pParent = NULL ) { if(pActor) LoadAndPlayCommand( *pActor, sType, sCommandName, pParent ); }
inline void OnCommand( Actor* pActor, const CString &sType, Actor* pParent = NULL ) { if(pActor) OnCommand( *pActor, sType, pParent ); }
inline void OffCommand( Actor* pActor, const CString &sType ) { if(pActor) OffCommand( *pActor, sType ); }
inline void SetXYAndOnCommand( Actor* pActor, const CString &sType, Actor* pParent = NULL ) { if(pActor) SetXYAndOnCommand( *pActor, sType, pParent ); }
inline void SetXY( Actor* pActor, const RString &sType ) { SetXY( *pActor, sType ); }
inline void LoadAndPlayCommand( Actor* pActor, const RString &sType, const RString &sCommandName, Actor* pParent = NULL ) { if(pActor) LoadAndPlayCommand( *pActor, sType, sCommandName, pParent ); }
inline void OnCommand( Actor* pActor, const RString &sType, Actor* pParent = NULL ) { if(pActor) OnCommand( *pActor, sType, pParent ); }
inline void OffCommand( Actor* pActor, const RString &sType ) { if(pActor) OffCommand( *pActor, sType ); }
inline void SetXYAndOnCommand( Actor* pActor, const RString &sType, Actor* pParent = NULL ) { if(pActor) SetXYAndOnCommand( *pActor, sType, pParent ); }
// Return a Sprite, BitmapText, or Model depending on the file type
Actor* LoadFromNode( const CString& sAniDir, const XNode* pNode );
Actor* MakeActor( const CString &sPath, const XNode *pParent = NULL );
Actor* LoadFromNode( const RString& sAniDir, const XNode* pNode );
Actor* MakeActor( const RString &sPath, const XNode *pParent = NULL );
void ResolvePath( CString &sPath, const CString &sName );
void ResolvePath( RString &sPath, const RString &sName );
void SortByZPosition( vector<Actor*> &vActors );
FileType GetFileType( const CString &sPath );
FileType GetFileType( const RString &sPath );
void SetParamFromStack( Lua *L, CString sName, LuaReference *pOld=NULL );
void GetParam( Lua *L, const CString &sName );
void SetParamFromStack( Lua *L, RString sName, LuaReference *pOld=NULL );
void GetParam( Lua *L, const RString &sName );
struct ActorParam
{
ActorParam( CString sName, CString sValue );
ActorParam( RString sName, RString sValue );
~ActorParam();
void Release();
private:
CString m_sName;
RString m_sName;
LuaReference *m_pOld;
};
};
+12 -12
View File
@@ -7,15 +7,15 @@
AnnouncerManager* ANNOUNCER = NULL; // global object accessable from anywhere in the program
const CString EMPTY_ANNOUNCER_NAME = "Empty";
const CString ANNOUNCERS_DIR = "Announcers/";
const RString EMPTY_ANNOUNCER_NAME = "Empty";
const RString ANNOUNCERS_DIR = "Announcers/";
AnnouncerManager::AnnouncerManager()
{
LOG->Trace("AnnouncerManager::AnnouncerManager()");
}
void AnnouncerManager::GetAnnouncerNames( vector<CString>& AddTo )
void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
{
GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
@@ -27,12 +27,12 @@ void AnnouncerManager::GetAnnouncerNames( vector<CString>& AddTo )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
}
bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName )
bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
{
if( sAnnouncerName == "" )
return true;
vector<CString> asAnnouncerNames;
vector<RString> asAnnouncerNames;
GetAnnouncerNames( asAnnouncerNames );
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
if( 0==stricmp(sAnnouncerName, asAnnouncerNames[i]) )
@@ -40,12 +40,12 @@ bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName )
return false;
}
CString AnnouncerManager::GetAnnouncerDirFromName( CString sAnnouncerName )
RString AnnouncerManager::GetAnnouncerDirFromName( RString sAnnouncerName )
{
return ANNOUNCERS_DIR + sAnnouncerName + "/";
}
void AnnouncerManager::SwitchAnnouncer( CString sNewAnnouncerName )
void AnnouncerManager::SwitchAnnouncer( RString sNewAnnouncerName )
{
if( !DoesAnnouncerExist(sNewAnnouncerName) )
m_sCurAnnouncerName = "";
@@ -81,12 +81,12 @@ static const char *aliases[][2] = {
* then all aliases above. Ignore directories that are empty, since we might
* have "select difficulty intro" with sounds and an empty "ScreenSelectDifficulty
* intro". */
CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName )
RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName )
{
if(sAnnouncerName == "")
return NULL; /* announcer disabled */
const CString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName);
const RString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName);
if( !DirectoryIsEmpty(AnnouncerPath+sFolderName+"/") )
return AnnouncerPath+sFolderName+"/";
@@ -115,19 +115,19 @@ CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName
return NULL;
}
CString AnnouncerManager::GetPathTo( CString sFolderName )
RString AnnouncerManager::GetPathTo( RString sFolderName )
{
return GetPathTo(m_sCurAnnouncerName, sFolderName);
}
bool AnnouncerManager::HasSoundsFor( CString sFolderName )
bool AnnouncerManager::HasSoundsFor( RString sFolderName )
{
return !DirectoryIsEmpty( GetPathTo(sFolderName) );
}
void AnnouncerManager::NextAnnouncer()
{
vector<CString> as;
vector<RString> as;
GetAnnouncerNames( as );
if( as.size()==0 )
return;
+9 -9
View File
@@ -6,20 +6,20 @@ class AnnouncerManager
public:
AnnouncerManager();
void GetAnnouncerNames( vector<CString>& AddTo );
bool DoesAnnouncerExist( CString sAnnouncerName );
void SwitchAnnouncer( CString sNewAnnouncerName );
CString GetCurAnnouncerName() { return m_sCurAnnouncerName; };
void GetAnnouncerNames( vector<RString>& AddTo );
bool DoesAnnouncerExist( RString sAnnouncerName );
void SwitchAnnouncer( RString sNewAnnouncerName );
RString GetCurAnnouncerName() { return m_sCurAnnouncerName; };
void NextAnnouncer();
CString GetPathTo( CString sFolderName );
bool HasSoundsFor( CString sFolderName );
RString GetPathTo( RString sFolderName );
bool HasSoundsFor( RString sFolderName );
protected:
static CString GetAnnouncerDirFromName( CString sAnnouncerName );
CString GetPathTo( CString AnnouncerPath, CString sFolderName );
static RString GetAnnouncerDirFromName( RString sAnnouncerName );
RString GetPathTo( RString AnnouncerPath, RString sFolderName );
CString m_sCurAnnouncerName;
RString m_sCurAnnouncerName;
};
+3 -3
View File
@@ -55,7 +55,7 @@ bool Attack::ContainsTransformOrTurn() const
return po.ContainsTransformOrTurn();
}
Attack Attack::FromGlobalCourseModifier( const CString &sModifiers )
Attack Attack::FromGlobalCourseModifier( const RString &sModifiers )
{
Attack a;
a.fStartSecond = 0;
@@ -66,9 +66,9 @@ Attack Attack::FromGlobalCourseModifier( const CString &sModifiers )
return a;
}
CString Attack::GetTextDescription() const
RString Attack::GetTextDescription() const
{
CString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining);
RString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining);
return s;
}
+5 -5
View File
@@ -11,7 +11,7 @@ struct Attack
AttackLevel level;
float fStartSecond; // -1 = now
float fSecsRemaining;
CString sModifiers;
RString sModifiers;
bool bOn; // set and used by GAMESTATE
bool bGlobal; // true for song-wide course mods
bool bShowInAttackList;
@@ -21,7 +21,7 @@ struct Attack
level = ATTACK_LEVEL_1;
fStartSecond = -1;
fSecsRemaining = 0;
sModifiers = CString();
sModifiers = RString();
bOn = false;
bGlobal = false;
bShowInAttackList = true;
@@ -31,7 +31,7 @@ struct Attack
AttackLevel level_,
float fStartSecond_,
float fSecsRemaining_,
CString sModifiers_,
RString sModifiers_,
bool bOn_,
bool bGlobal_,
bool bShowInAttackList_ = true )
@@ -49,8 +49,8 @@ struct Attack
bool IsBlank() const { return sModifiers.empty(); }
bool operator== ( const Attack &rhs ) const;
bool ContainsTransformOrTurn() const;
static Attack FromGlobalCourseModifier( const CString &sModifiers );
CString GetTextDescription() const;
static Attack FromGlobalCourseModifier( const RString &sModifiers );
RString GetTextDescription() const;
};
struct AttackArray : public vector<Attack>
+9 -9
View File
@@ -9,9 +9,9 @@
#include "PlayerState.h"
CString GetAttackPieceName( const CString &sAttack )
RString GetAttackPieceName( const RString &sAttack )
{
CString ret = ssprintf( "attack %s", sAttack.c_str() );
RString ret = ssprintf( "attack %s", sAttack.c_str() );
/* 1.5x -> 1_5x. If we pass a period to THEME->GetPathTo, it'll think
* we're looking for a specific file and not search. */
@@ -42,19 +42,19 @@ void AttackDisplay::Init( const PlayerState* pPlayerState )
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
return;
set<CString> attacks;
set<RString> attacks;
for( int al=0; al<NUM_ATTACK_LEVELS; al++ )
{
const Character *ch = GAMESTATE->m_pCurCharacters[pn];
ASSERT( ch );
const CString* asAttacks = ch->m_sAttacks[al];
const RString* asAttacks = ch->m_sAttacks[al];
for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att )
attacks.insert( asAttacks[att] );
}
for( set<CString>::const_iterator it = attacks.begin(); it != attacks.end(); ++it )
for( set<RString>::const_iterator it = attacks.begin(); it != attacks.end(); ++it )
{
const CString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true );
const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true );
if( path == "" )
{
LOG->Trace( "Couldn't find \"%s\"", GetAttackPieceName( *it ).c_str() );
@@ -96,9 +96,9 @@ void AttackDisplay::Update( float fDelta )
}
}
void AttackDisplay::SetAttack( const CString &sText )
void AttackDisplay::SetAttack( const RString &sText )
{
const CString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName(sText), true );
const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName(sText), true );
if( path == "" )
return;
@@ -108,7 +108,7 @@ void AttackDisplay::SetAttack( const CString &sText )
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const CString sName = ssprintf( "%sP%i", sText.c_str(), pn+1 );
const RString sName = ssprintf( "%sP%i", sText.c_str(), pn+1 );
m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand") );
}
+1 -1
View File
@@ -14,7 +14,7 @@ public:
AttackDisplay();
void Init( const PlayerState* pPlayerState );
void SetAttack( const CString &mod );
void SetAttack( const RString &mod );
virtual void Update( float fDelta );
+3 -3
View File
@@ -27,7 +27,7 @@ AutoActor &AutoActor::operator=( const AutoActor &cpy )
return *this;
}
void AutoActor::Load( const CString &sPath )
void AutoActor::Load( const RString &sPath )
{
Unload();
m_pActor = ActorUtil::MakeActor( sPath );
@@ -37,14 +37,14 @@ void AutoActor::Load( const CString &sPath )
m_pActor = new Actor;
}
void AutoActor::LoadFromNode( const CString &sDir, const XNode* pNode )
void AutoActor::LoadFromNode( const RString &sDir, const XNode* pNode )
{
Unload();
m_pActor = ActorUtil::LoadFromNode( sDir, pNode );
}
void AutoActor::LoadAndSetName( const CString &sScreenName, const CString &sActorName )
void AutoActor::LoadAndSetName( const RString &sScreenName, const RString &sActorName )
{
Load( THEME->GetPathG(sScreenName,sActorName) );
m_pActor->SetName( sActorName );
+3 -3
View File
@@ -21,9 +21,9 @@ public:
Actor *operator->() { return m_pActor; }
void Unload();
bool IsLoaded() const { return m_pActor != NULL; }
void Load( const CString &sPath );
void LoadFromNode( const CString &sDir, const XNode* pNode );
void LoadAndSetName( const CString &sScreenName, const CString &sActorName );
void Load( const RString &sPath );
void LoadFromNode( const RString &sDir, const XNode* pNode );
void LoadAndSetName( const RString &sScreenName, const RString &sActorName );
protected:
Actor* m_pActor;
+3 -3
View File
@@ -42,13 +42,13 @@ void AutoKeysounds::FinishLoading()
//
// Load sounds.
//
CString sSongDir = pSong->GetSongDir();
RString sSongDir = pSong->GetSongDir();
/*
m_vKeysounds.clear();
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
for( unsigned i=0; i<m_vKeysounds.size(); i++ )
{
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
RageSound& sound = m_vKeysounds[i];
sound.Load( sKeysoundFilePath );
@@ -106,7 +106,7 @@ void AutoKeysounds::FinishLoading()
ASSERT( tn[pn].type == TapNote::autoKeysound );
if( tn[pn].bKeysound )
{
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex];
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex];
float fSeconds = pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(iRow) );
float fPan = 0;
+15 -15
View File
@@ -17,7 +17,7 @@ BGAnimation::~BGAnimation()
DeleteAllChildren();
}
static bool CompareLayerNames( const CString& s1, const CString& s2 )
static bool CompareLayerNames( const RString& s1, const RString& s2 )
{
int i1, i2;
int ret;
@@ -29,12 +29,12 @@ static bool CompareLayerNames( const CString& s1, const CString& s2 )
return i1 < i2;
}
void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const XNode *pNode )
void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode )
{
const CString& sAniDir = _sAniDir;
const RString& sAniDir = _sAniDir;
{
vector<CString> vsLayerNames;
vector<RString> vsLayerNames;
FOREACH_CONST_Child( pNode, pLayer )
{
if( strncmp(pLayer->m_sName, "Layer", 5) == 0 )
@@ -44,16 +44,16 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const XNode *pNo
sort( vsLayerNames.begin(), vsLayerNames.end(), CompareLayerNames );
FOREACH_CONST( CString, vsLayerNames, s )
FOREACH_CONST( RString, vsLayerNames, s )
{
const CString &sLayer = *s;
const RString &sLayer = *s;
const XNode* pKey = pNode->GetChild( sLayer );
ASSERT( pKey );
CString sImportDir;
RString sImportDir;
if( pKey->GetAttrValue("Import", sImportDir) )
{
CString expr;
RString expr;
if( pKey->GetAttrValue("Condition",expr) )
{
if( !LuaHelpers::RunExpressionB( expr ) )
@@ -69,7 +69,7 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const XNode *pNo
ASSERT_M( IsADirectory(sImportDir), sImportDir + " isn't a directory" );
CString sPathToIni = sImportDir + "BGAnimation.ini";
RString sPathToIni = sImportDir + "BGAnimation.ini";
IniFile ini2;
ini2.ReadFile( sPathToIni );
@@ -87,20 +87,20 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const XNode *pNo
}
}
void BGAnimation::LoadFromAniDir( const CString &_sAniDir )
void BGAnimation::LoadFromAniDir( const RString &_sAniDir )
{
DeleteAllChildren();
if( _sAniDir.empty() )
return;
CString sAniDir = _sAniDir;
RString sAniDir = _sAniDir;
if( sAniDir.Right(1) != "/" )
sAniDir += "/";
ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" );
CString sPathToIni = sAniDir + "BGAnimation.ini";
RString sPathToIni = sAniDir + "BGAnimation.ini";
if( DoesFileExist(sPathToIni) )
{
@@ -123,7 +123,7 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir )
// This is an old style BGAnimation (not using .ini)
// loading a directory of layers
vector<CString> asImagePaths;
vector<RString> asImagePaths;
ASSERT( sAniDir != "" );
GetDirListing( sAniDir+"*.png", asImagePaths, false, true );
@@ -137,7 +137,7 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir )
for( unsigned i=0; i<asImagePaths.size(); i++ )
{
const CString sPath = asImagePaths[i];
const RString sPath = asImagePaths[i];
if( Basename(sPath).Left(1) == "_" )
continue; // don't directly load files starting with an underscore
BGAnimationLayer* pLayer = new BGAnimationLayer;
@@ -147,7 +147,7 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir )
}
}
void BGAnimation::LoadFromNode( const CString& sDir, const XNode* pNode )
void BGAnimation::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ActorFrame::LoadFromNode( sDir, pNode );
+3 -3
View File
@@ -13,11 +13,11 @@ public:
BGAnimation();
virtual ~BGAnimation();
void LoadFromAniDir( const CString &sAniDir );
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromAniDir( const RString &sAniDir );
void LoadFromNode( const RString& sDir, const XNode* pNode );
protected:
void AddLayersFromAniDir( const CString &_sAniDir, const XNode *pNode );
void AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode );
};
#endif
+19 -19
View File
@@ -49,17 +49,17 @@ BGAnimationLayer::~BGAnimationLayer()
ActorFrame::DeleteAllChildren();
}
void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath )
{
/* Generic BGAs are new. Animation directories with no INI are old and obsolete.
* Don't combine them. */
CString lcPath = sPath;
RString lcPath = sPath;
lcPath.MakeLower();
if( lcPath.find("usesongbg") != CString::npos )
if( lcPath.find("usesongbg") != RString::npos )
{
const Song* pSong = GAMESTATE->m_pCurSong;
CString sSongBGPath;
RString sSongBGPath;
if( pSong && pSong->HasBackground() )
sSongBGPath = pSong->GetBackgroundPath();
else
@@ -103,7 +103,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
EFFECT_INVALID
};
const CString EFFECT_STRING[NUM_EFFECTS] = {
const RString EFFECT_STRING[NUM_EFFECTS] = {
"center",
"stretchstill",
"stretchscrollleft",
@@ -313,33 +313,33 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
}
CString sHint = sPath;
RString sHint = sPath;
sHint.MakeLower();
if( sHint.find("cyclecolor") != CString::npos )
if( sHint.find("cyclecolor") != RString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetEffectRainbow( 5 );
if( sHint.find("cyclealpha") != CString::npos )
if( sHint.find("cyclealpha") != RString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) );
if( sHint.find("startonrandomframe") != CString::npos )
if( sHint.find("startonrandomframe") != RString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetState( rand()%m_SubActors[i]->GetNumStates() );
if( sHint.find("dontanimate") != CString::npos )
if( sHint.find("dontanimate") != RString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->StopAnimating();
if( sHint.find("add") != CString::npos )
if( sHint.find("add") != RString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetBlendMode( BLEND_ADD );
}
void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
void BGAnimationLayer::LoadFromNode( const RString& sDir, const XNode* pNode )
{
CString sAniDir = sDir;
RString sAniDir = sDir;
if( sAniDir.Right(1) != "/" )
sAniDir += "/";
@@ -349,7 +349,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
CHECKPOINT_M( ssprintf( "BGAnimationLayer::LoadFromIni \"%s\"", sAniDir.c_str() ) );
{
CString expr;
RString expr;
if( pNode->GetAttrValue("Condition", expr) )
{
if( !LuaHelpers::RunExpressionB(expr) )
@@ -359,7 +359,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
bool bStretch = false;
{
CString type = "sprite";
RString type = "sprite";
pNode->GetAttrValue( "Type", type );
type.MakeLower();
@@ -454,11 +454,11 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
break;
case TYPE_PARTICLES:
{
CString sFile;
RString sFile;
pNode->GetAttrValue( "File", sFile );
FixSlashesInPlace( sFile );
CString sPath = sAniDir+sFile;
RString sPath = sAniDir+sFile;
CollapsePath( sPath );
@@ -485,11 +485,11 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
break;
case TYPE_TILES:
{
CString sFile;
RString sFile;
pNode->GetAttrValue( "File", sFile );
FixSlashesInPlace( sFile );
CString sPath = sAniDir+sFile;
RString sPath = sAniDir+sFile;
CollapsePath( sPath );
AutoActor s;
+3 -3
View File
@@ -15,8 +15,8 @@ public:
BGAnimationLayer();
~BGAnimationLayer();
void LoadFromAniLayerFile( const CString& sPath );
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromAniLayerFile( const RString& sPath );
void LoadFromNode( const RString& sDir, const XNode* pNode );
void UpdateInternal( float fDeltaTime );
bool EarlyAbortDraw() const;
@@ -41,7 +41,7 @@ protected:
//
// common stuff
CString m_sDrawCond;
RString m_sDrawCond;
// stretch stuff
float m_fTexCoordVelocityX;
+1 -1
View File
@@ -69,7 +69,7 @@ void BPMDisplay::Update( float fDeltaTime )
if(m_fBPMTo == -1)
{
m_fBPMFrom = -1;
m_textBPM.SetText( (RandomFloat(0,1)>0.90f) ? CString("xxx") : ssprintf("%03.0f",RandomFloat(0,600)) );
m_textBPM.SetText( (RandomFloat(0,1)>0.90f) ? RString("xxx") : ssprintf("%03.0f",RandomFloat(0,600)) );
}
else if(m_fBPMFrom == -1)
{
+30 -30
View File
@@ -88,7 +88,7 @@ protected:
bool m_bInitted;
DancingCharacters* m_pDancingCharacters;
const Song *m_pSong;
map<CString,BackgroundTransition> m_mapNameToTransition;
map<RString,BackgroundTransition> m_mapNameToTransition;
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 );
@@ -103,10 +103,10 @@ protected:
// return true if created and added to m_BGAnimations
bool CreateBackground( const Song *pSong, const BackgroundDef &bd );
// return def of the background that was created and added to m_BGAnimations. calls CreateBackground
BackgroundDef CreateRandomBGA( const Song *pSong, const CString &sEffect, deque<BackgroundDef> &RandomBGAnimations );
BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations );
int FindBGSegmentForBeat( float fBeat ) const;
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<CString,BackgroundTransition> &mapNameToTransition );
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition );
void ProcessMessages( float fDeltaTime );
map<BackgroundDef,Actor*> m_BGAnimations;
@@ -174,24 +174,24 @@ void BackgroundImpl::Init()
// load transitions
{
ASSERT( m_mapNameToTransition.empty() );
vector<CString> vsPaths, vsNames;
vector<RString> vsPaths, vsNames;
BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames );
for( unsigned i=0; i<vsPaths.size(); i++ )
{
const CString &sPath = vsPaths[i];
const CString &sName = vsNames[i];
const RString &sPath = vsPaths[i];
const RString &sName = vsNames[i];
XNode xml;
XmlFileUtil::LoadFromFileShowErrors(xml, sPath);
ASSERT( xml.m_sName == "BackgroundTransition" );
BackgroundTransition &bgt = m_mapNameToTransition[sName];
CString sCmdLeaves;
RString sCmdLeaves;
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
ASSERT( bSuccess );
bgt.cmdLeaves = apActorCommands( new ActorCommands(sCmdLeaves) );
CString sCmdRoot;
RString sCmdRoot;
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
ASSERT( bSuccess );
bgt.cmdRoot = apActorCommands( new ActorCommands(sCmdRoot) );
@@ -264,13 +264,13 @@ void BackgroundImpl::Layer::Unload()
m_iCurBGChangeIndex = -1;
}
Actor *MakeVisualization( const CString &sVisPath )
Actor *MakeVisualization( const RString &sVisPath )
{
ActorFrame *pFrame = new ActorFrame;
pFrame->DeleteChildrenWhenDone();
const Song* pSong = GAMESTATE->m_pCurSong;
CString sSongBGPath =
RString sSongBGPath =
(pSong && pSong->HasBackground()) ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background");
Sprite* pSprite = new Sprite;
@@ -287,7 +287,7 @@ Actor *MakeVisualization( const CString &sVisPath )
return pFrame;
}
Actor *MakeMovie( const CString &sMoviePath )
Actor *MakeMovie( const RString &sMoviePath )
{
Sprite *pSprite = new Sprite;
pSprite->LoadBG( sMoviePath );
@@ -301,17 +301,17 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() );
// Resolve the background names
vector<CString> vsToResolve;
vector<RString> vsToResolve;
vsToResolve.push_back( bd.m_sFile1 );
vsToResolve.push_back( bd.m_sFile2 );
vector<CString> vsResolved;
vector<RString> vsResolved;
vsResolved.resize( vsToResolve.size() );
for( unsigned i=0; i<vsToResolve.size(); i++ )
{
const CString &sToResolve = vsToResolve[i];
const RString &sToResolve = vsToResolve[i];
LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
LUA->SetGlobal( ssprintf("File%d",i+1), RString() );
if( sToResolve.empty() )
{
@@ -325,7 +325,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
// - song's dir
// - RandomMovies dir
// - BGAnimations dir.
vector<CString> vsPaths, vsThrowAway;
vector<RString> vsPaths, vsThrowAway;
// Look for BGAnims in the song dir
if( sToResolve == SONG_BACKGROUND_FILE )
@@ -336,7 +336,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
if( vsPaths.empty() ) BackgroundUtil::GetGlobalBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway );
if( vsPaths.empty() ) BackgroundUtil::GetGlobalRandomMovies( pSong, sToResolve, vsPaths, vsThrowAway );
CString &sResolved = vsResolved[i];
RString &sResolved = vsResolved[i];
if( !vsPaths.empty() )
{
@@ -356,7 +356,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
LUA->SetGlobal( ssprintf("File%d",i+1), sResolved );
}
CString sEffect = bd.m_sEffect;
RString sEffect = bd.m_sEffect;
if( sEffect.empty() )
{
FileType ft = ActorUtil::GetFileType(vsResolved[0]);
@@ -379,15 +379,15 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
// Set Lua color globals
LUA->SetGlobal( "Color1", bd.m_sColor1.empty() ? CString("1,1,1,1") : bd.m_sColor1 );
LUA->SetGlobal( "Color2", bd.m_sColor2.empty() ? CString("1,1,1,1") : bd.m_sColor2 );
LUA->SetGlobal( "Color1", bd.m_sColor1.empty() ? RString("1,1,1,1") : bd.m_sColor1 );
LUA->SetGlobal( "Color2", bd.m_sColor2.empty() ? RString("1,1,1,1") : bd.m_sColor2 );
// Resolve the effect file.
CString sEffectFile;
RString sEffectFile;
for( int i=0; i<2; i++ )
{
vector<CString> vsPaths, vsThrowAway;
vector<RString> vsPaths, vsThrowAway;
BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway );
if( vsPaths.empty() )
{
@@ -414,14 +414,14 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
m_BGAnimations[bd] = pActor;
for( unsigned i=0; i<vsResolved.size(); i++ )
LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
LUA->SetGlobal( ssprintf("File%d",i+1), RString() );
LUA->UnsetGlobal( "Color1" );
LUA->UnsetGlobal( "Color2" );
return true;
}
BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const CString &sEffect, deque<BackgroundDef> &RandomBGAnimations )
BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations )
{
if( PREFSMAN->m_RandomBackgroundMode == PrefsManager::BGMODE_OFF )
return BackgroundDef();
@@ -508,7 +508,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
// Choose a bunch of background that we'll use for the random file marker
//
{
vector<CString> vsThrowAway, vsNames;
vector<RString> vsThrowAway, vsNames;
switch( PREFSMAN->m_RandomBackgroundMode )
{
default:
@@ -528,7 +528,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
int iSize = min( (int)PREFSMAN->m_iNumBackgrounds, (int)vsNames.size() );
vsNames.resize( iSize );
FOREACH_CONST( CString, vsNames, s )
FOREACH_CONST( RString, vsNames, s )
{
BackgroundDef bd;
bd.m_sFile1 = *s;
@@ -745,7 +745,7 @@ int BackgroundImpl::Layer::FindBGSegmentForBeat( float fBeat ) const
}
/* 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<CString,BackgroundTransition> &mapNameToTransition )
void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition )
{
ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID );
@@ -801,7 +801,7 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
if( !change.m_sTransition.empty() )
{
map<CString,BackgroundTransition>::const_iterator iter = mapNameToTransition.find( change.m_sTransition );
map<RString,BackgroundTransition>::const_iterator iter = mapNameToTransition.find( change.m_sTransition );
ASSERT( iter != mapNameToTransition.end() );
const BackgroundTransition &bt = iter->second;
m_pFadingBGA->RunCommandsOnLeaves( *bt.cmdLeaves );
@@ -813,8 +813,8 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
m_pCurrentBGA->SetUpdateRate( change.m_fRate );
// Set Lua color globals before calling Init and On
LUA->SetGlobal( "Color1", change.m_def.m_sColor1.empty() ? CString("1,1,1,1") : change.m_def.m_sColor1 );
LUA->SetGlobal( "Color2", change.m_def.m_sColor2.empty() ? CString("1,1,1,1") : change.m_def.m_sColor2 );
LUA->SetGlobal( "Color1", change.m_def.m_sColor1.empty() ? RString("1,1,1,1") : change.m_def.m_sColor1 );
LUA->SetGlobal( "Color2", change.m_def.m_sColor2.empty() ? RString("1,1,1,1") : change.m_def.m_sColor2 );
m_pCurrentBGA->PlayCommand( "Init" );
m_pCurrentBGA->PlayCommand( "On" );
+44 -44
View File
@@ -51,9 +51,9 @@ XNode *BackgroundDef::CreateNode() const
}
CString BackgroundChange::GetTextDescription() const
RString BackgroundChange::GetTextDescription() const
{
vector<CString> vsParts;
vector<RString> vsParts;
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_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) );
@@ -65,29 +65,29 @@ CString BackgroundChange::GetTextDescription() const
if( vsParts.empty() )
vsParts.push_back( "(empty)" );
CString s = join( "\n", vsParts );
RString s = join( "\n", vsParts );
return s;
}
const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
const CString BG_ANIMS_DIR = "BGAnimations/";
const CString VISUALIZATIONS_DIR = "Visualizations/";
const CString RANDOMMOVIES_DIR = "RandomMovies/";
const RString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
const RString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
const RString BG_ANIMS_DIR = "BGAnimations/";
const RString VISUALIZATIONS_DIR = "Visualizations/";
const RString RANDOMMOVIES_DIR = "RandomMovies/";
const CString RANDOM_BACKGROUND_FILE = "-random-";
const CString NO_SONG_BG_FILE = "-nosongbg-";
const CString SONG_BACKGROUND_FILE = "songbackground";
const RString RANDOM_BACKGROUND_FILE = "-random-";
const RString NO_SONG_BG_FILE = "-nosongbg-";
const RString SONG_BACKGROUND_FILE = "songbackground";
const CString SBE_UpperLeft = "UpperLeft";
const CString SBE_Centered = "Centered";
const CString SBE_StretchNormal = "StretchNormal";
const CString SBE_StretchNoLoop = "StretchNoLoop";
const CString SBE_StretchRewind = "StretchRewind";
const CString SBT_CrossFade = "CrossFade";
const RString SBE_UpperLeft = "UpperLeft";
const RString SBE_Centered = "Centered";
const RString SBE_StretchNormal = "StretchNormal";
const RString SBE_StretchNoLoop = "StretchNoLoop";
const RString SBE_StretchRewind = "StretchRewind";
const RString SBT_CrossFade = "CrossFade";
static void StripCvs( vector<CString> &vsPathsToStrip, vector<CString> &vsNamesToStrip )
static void StripCvs( vector<RString> &vsPathsToStrip, vector<RString> &vsNamesToStrip )
{
ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() );
for( unsigned i=0; i<vsNamesToStrip.size(); i++ )
@@ -110,9 +110,9 @@ void BackgroundUtil::SortBackgroundChangesArray( vector<BackgroundChange> &vBack
sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges );
}
void BackgroundUtil::GetBackgroundEffects( const CString &_sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
CString sName = _sName;
RString sName = _sName;
if( sName == "" )
sName = "*";
@@ -120,15 +120,15 @@ void BackgroundUtil::GetBackgroundEffects( const CString &_sName, vector<CString
GetDirListing( BACKGROUND_EFFECTS_DIR+sName+".xml", vsPathsOut, false, true );
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( GetFileNameWithoutExtension(*s) );
StripCvs( vsPathsOut, vsNamesOut );
}
void BackgroundUtil::GetBackgroundTransitions( const CString &_sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
CString sName = _sName;
RString sName = _sName;
if( sName == "" )
sName = "*";
@@ -136,13 +136,13 @@ void BackgroundUtil::GetBackgroundTransitions( const CString &_sName, vector<CSt
GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".xml", vsPathsOut, false, true );
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( GetFileNameWithoutExtension(*s) );
StripCvs( vsPathsOut, vsNamesOut );
}
void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
vsPathsOut.clear();
if( sMatch.empty() )
@@ -155,13 +155,13 @@ void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const CString &sMat
}
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( Basename(*s) );
StripCvs( vsPathsOut, vsNamesOut );
}
void BackgroundUtil::GetSongMovies( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
vsPathsOut.clear();
if( sMatch.empty() )
@@ -176,13 +176,13 @@ void BackgroundUtil::GetSongMovies( const Song *pSong, const CString &sMatch, ve
}
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( Basename(*s) );
StripCvs( vsPathsOut, vsNamesOut );
}
void BackgroundUtil::GetSongBitmaps( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
vsPathsOut.clear();
if( sMatch.empty() )
@@ -198,13 +198,13 @@ void BackgroundUtil::GetSongBitmaps( const Song *pSong, const CString &sMatch, v
}
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( Basename(*s) );
StripCvs( vsPathsOut, vsNamesOut );
}
static void GetFilterToFileNames( const CString sBaseDir, const Song *pSong, set<CString> &vsPossibleFileNamesOut )
static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set<RString> &vsPossibleFileNamesOut )
{
vsPossibleFileNamesOut.clear();
@@ -213,10 +213,10 @@ static void GetFilterToFileNames( const CString sBaseDir, const Song *pSong, set
ASSERT( !pSong->m_sGroupName.empty() );
IniFile ini;
CString sPath = sBaseDir+pSong->m_sGroupName+"/"+"BackgroundMapping.ini";
RString sPath = sBaseDir+pSong->m_sGroupName+"/"+"BackgroundMapping.ini";
ini.ReadFile( sPath );
CString sSection;
RString sSection;
bool bSuccess = ini.GetValue( "GenreToSection", pSong->m_sGenre, sSection );
if( !bSuccess )
{
@@ -235,13 +235,13 @@ static void GetFilterToFileNames( const CString sBaseDir, const Song *pSong, set
vsPossibleFileNamesOut.insert( p->first );
}
void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut )
void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut )
{
vsPathsOut.clear();
GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true );
vsNamesOut.clear();
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
vsNamesOut.push_back( Basename(*s) );
StripCvs( vsPathsOut, vsNamesOut );
@@ -249,9 +249,9 @@ void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const CString &sM
void BackgroundUtil::GetGlobalRandomMovies(
const Song *pSong,
const CString &sMatch,
vector<CString> &vsPathsOut,
vector<CString> &vsNamesOut,
const RString &sMatch,
vector<RString> &vsPathsOut,
vector<RString> &vsNamesOut,
bool bTryInsideOfSongGroupAndGenreFirst,
bool bTryInsideOfSongGroupFirst )
{
@@ -273,11 +273,11 @@ void BackgroundUtil::GetGlobalRandomMovies(
// Search for the most appropriate background
//
{
set<CString> ssFileNameWhitelist;
set<RString> ssFileNameWhitelist;
if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() )
GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist );
vector<CString> vsDirsToTry;
vector<RString> vsDirsToTry;
if( bTryInsideOfSongGroupFirst && pSong )
{
ASSERT( !pSong->m_sGroupName.empty() );
@@ -285,7 +285,7 @@ void BackgroundUtil::GetGlobalRandomMovies(
}
vsDirsToTry.push_back( RANDOMMOVIES_DIR );
FOREACH_CONST( CString, vsDirsToTry, sDir )
FOREACH_CONST( RString, vsDirsToTry, sDir )
{
GetDirListing( *sDir+"*.avi", vsPathsOut, false, true );
GetDirListing( *sDir+"*.mpg", vsPathsOut, false, true );
@@ -295,7 +295,7 @@ void BackgroundUtil::GetGlobalRandomMovies(
{
for( unsigned i=0; i<vsPathsOut.size(); i++ )
{
CString sBasename = Basename( vsPathsOut[i] );
RString sBasename = Basename( vsPathsOut[i] );
bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end();
if( !bFound )
{
@@ -312,9 +312,9 @@ void BackgroundUtil::GetGlobalRandomMovies(
found_files:
FOREACH_CONST( CString, vsPathsOut, s )
FOREACH_CONST( RString, vsPathsOut, s )
{
CString sName = s->Right( s->size() - RANDOMMOVIES_DIR.size() - 1 );
RString sName = s->Right( s->size() - RANDOMMOVIES_DIR.size() - 1 );
vsNamesOut.push_back( sName );
}
StripCvs( vsPathsOut, vsNamesOut );
+27 -27
View File
@@ -6,27 +6,27 @@
class Song;
class XNode;
extern const CString RANDOM_BACKGROUND_FILE;
extern const CString NO_SONG_BG_FILE;
extern const CString SONG_BACKGROUND_FILE;
extern const RString RANDOM_BACKGROUND_FILE;
extern const RString NO_SONG_BG_FILE;
extern const RString SONG_BACKGROUND_FILE;
extern const CString SBE_UpperLeft;
extern const CString SBE_Centered;
extern const CString SBE_StretchNormal;
extern const CString SBE_StretchNoLoop;
extern const CString SBE_StretchRewind;
extern const CString SBT_CrossFade;
extern const RString SBE_UpperLeft;
extern const RString SBE_Centered;
extern const RString SBE_StretchNormal;
extern const RString SBE_StretchNoLoop;
extern const RString SBE_StretchRewind;
extern const RString SBT_CrossFade;
struct BackgroundDef
{
bool operator<( const BackgroundDef &other ) const;
bool operator==( const BackgroundDef &other ) const;
bool IsEmpty() const { return m_sFile1.empty() && m_sFile2.empty(); }
CString m_sEffect; // "" == automatically choose
CString m_sFile1; // must not be ""
CString m_sFile2; // may be ""
CString m_sColor1; // "" == use default
CString m_sColor2; // "" == use default
RString m_sEffect; // "" == automatically choose
RString m_sFile1; // must not be ""
RString m_sFile2; // may be ""
RString m_sColor1; // "" == use default
RString m_sColor2; // "" == use default
XNode *CreateNode() const;
};
@@ -40,11 +40,11 @@ struct BackgroundChange
}
BackgroundChange(
float s,
CString f1,
CString f2=CString(),
RString f1,
RString f2=RString(),
float r=1.f,
CString e=SBE_Centered,
CString t=CString()
RString e=SBE_Centered,
RString t=RString()
)
{
m_fStartBeat=s;
@@ -57,23 +57,23 @@ struct BackgroundChange
BackgroundDef m_def;
float m_fStartBeat;
float m_fRate;
CString m_sTransition;
RString m_sTransition;
CString GetTextDescription() const;
RString GetTextDescription() const;
};
namespace BackgroundUtil
{
void SortBackgroundChangesArray( vector<BackgroundChange> &vBackgroundChanges );
void GetBackgroundEffects( const CString &sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetBackgroundTransitions( const CString &sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetBackgroundEffects( const RString &sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetBackgroundTransitions( const RString &sName, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetSongBGAnimations( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetSongMovies( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetSongBitmaps( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetGlobalBGAnimations( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetGlobalRandomMovies( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true );
void GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetSongMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetSongBitmaps( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut );
void GetGlobalRandomMovies( const Song *pSong, const RString &sMatch, vector<RString> &vsPathsOut, vector<RString> &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true );
void BakeAllBackgroundChanges( Song *pSong );
};
+2 -2
View File
@@ -94,9 +94,9 @@ void Banner::LoadMode()
m_bScrolling = false;
}
void Banner::LoadFromSongGroup( CString sSongGroup )
void Banner::LoadFromSongGroup( RString sSongGroup )
{
CString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
if( sGroupBannerPath != "" ) Load( sGroupBannerPath );
else LoadFallback();
m_bScrolling = false;
+1 -1
View File
@@ -23,7 +23,7 @@ public:
void LoadFromSong( Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadMode();
void LoadFromSongGroup( CString sSongGroup );
void LoadFromSongGroup( RString sSongGroup );
void LoadFromCourse( Course* pCourse );
void LoadCardFromCharacter( Character* pCharacter );
void LoadIconFromCharacter( Character* pCharacter );
+15 -15
View File
@@ -23,7 +23,7 @@
/* Neither a global or a file scope static can be used for this because
* the order of initialization of nonlocal objects is unspecified. */
//const CString BANNER_CACHE_INDEX = SpecialFiles::CACHE_DIR + "banners.cache";
//const RString BANNER_CACHE_INDEX = SpecialFiles::CACHE_DIR + "banners.cache";
#define BANNER_CACHE_INDEX (SpecialFiles::CACHE_DIR + "banners.cache")
/* Call CacheBanner to cache a banner by path. If the banner is already
@@ -48,10 +48,10 @@
BannerCache *BANNERCACHE;
static map<CString,RageSurface *> g_BannerPathToImage;
static map<RString,RageSurface *> g_BannerPathToImage;
static int g_iDemandRefcount = 0;
CString BannerCache::GetBannerCachePath( CString BannerPath )
RString BannerCache::GetBannerCachePath( RString BannerPath )
{
return SongCacheIndex::GetCacheFilePath( "Banners", BannerPath );
}
@@ -70,12 +70,12 @@ void BannerCache::Demand()
FOREACH_Child( &BannerData, p )
{
CString sBannerPath = p->m_sName;
RString sBannerPath = p->m_sName;
if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() )
continue; /* already loaded */
const CString CachePath = GetBannerCachePath(sBannerPath);
const RString CachePath = GetBannerCachePath(sBannerPath);
RageSurface *img = RageSurfaceUtils::LoadSurface( CachePath );
if( img == NULL )
{
@@ -103,7 +103,7 @@ void BannerCache::Undemand()
* the cache file if necessary. Unlike CacheBanner(), the original file will
* not be examined unless the cached banner doesn't exist, so the banner will
* not be updated if the original file changes, for efficiency. */
void BannerCache::LoadBanner( CString BannerPath )
void BannerCache::LoadBanner( RString BannerPath )
{
if( BannerPath == "" )
return; // nothing to do
@@ -112,7 +112,7 @@ void BannerCache::LoadBanner( CString BannerPath )
return;
/* Load it. */
const CString CachePath = GetBannerCachePath(BannerPath);
const RString CachePath = GetBannerCachePath(BannerPath);
for( int tries = 0; tries < 2; ++tries )
{
@@ -146,7 +146,7 @@ void BannerCache::LoadBanner( CString BannerPath )
void BannerCache::OutputStats() const
{
map<CString,RageSurface *>::const_iterator ban;
map<RString,RageSurface *>::const_iterator ban;
int total_size = 0;
for( ban = g_BannerPathToImage.begin(); ban != g_BannerPathToImage.end(); ++ban )
{
@@ -159,7 +159,7 @@ void BannerCache::OutputStats() const
void BannerCache::UnloadAllBanners()
{
map<CString,RageSurface *>::iterator it;
map<RString,RageSurface *>::iterator it;
for( it = g_BannerPathToImage.begin(); it != g_BannerPathToImage.end(); ++it )
delete it->second;
@@ -258,7 +258,7 @@ struct BannerTexture: public RageTexture
};
/* If a banner is cached, get its ID for use. */
RageTextureID BannerCache::LoadCachedBanner( CString BannerPath )
RageTextureID BannerCache::LoadCachedBanner( RString BannerPath )
{
RageTextureID ID( GetBannerCachePath(BannerPath) );
@@ -327,7 +327,7 @@ static inline int closest( int num, int n1, int n2 )
/* Create or update the banner cache file as necessary. If in preload mode,
* load the cache file, too. (This is done at startup.) */
void BannerCache::CacheBanner( CString BannerPath )
void BannerCache::CacheBanner( RString BannerPath )
{
if( PREFSMAN->m_BannerCache != PrefsManager::BNCACHE_LOW_RES_PRELOAD &&
PREFSMAN->m_BannerCache != PrefsManager::BNCACHE_LOW_RES_LOAD_ON_DEMAND )
@@ -337,7 +337,7 @@ void BannerCache::CacheBanner( CString BannerPath )
if( !DoesFileExist(BannerPath) )
return;
const CString CachePath = GetBannerCachePath(BannerPath);
const RString CachePath = GetBannerCachePath(BannerPath);
/* Check the full file hash. If it's the loaded and identical, don't recache. */
if( DoesFileExist(CachePath) )
@@ -366,9 +366,9 @@ void BannerCache::CacheBanner( CString BannerPath )
CacheBannerInternal( BannerPath );
}
void BannerCache::CacheBannerInternal( CString BannerPath )
void BannerCache::CacheBannerInternal( RString BannerPath )
{
CString error;
RString error;
RageSurface *img = RageSurfaceUtils::LoadFile( BannerPath, error );
if( img == NULL )
{
@@ -473,7 +473,7 @@ void BannerCache::CacheBannerInternal( CString BannerPath )
img = dst;
}
const CString CachePath = GetBannerCachePath(BannerPath);
const RString CachePath = GetBannerCachePath(BannerPath);
RageSurfaceUtils::SaveSurface( img, CachePath );
/* If an old image is loaded, free it. */
+5 -5
View File
@@ -13,17 +13,17 @@ class BannerCache
{
IniFile BannerData;
static CString GetBannerCachePath( CString BannerPath );
static RString GetBannerCachePath( RString BannerPath );
void UnloadAllBanners();
void CacheBannerInternal( CString BannerPath );
void CacheBannerInternal( RString BannerPath );
public:
BannerCache();
~BannerCache();
RageTextureID LoadCachedBanner( CString BannerPath );
void CacheBanner( CString BannerPath );
void LoadBanner( CString BannerPath );
RageTextureID LoadCachedBanner( RString BannerPath );
void CacheBanner( RString BannerPath );
void LoadBanner( RString BannerPath );
void Demand();
void Undemand();
+2 -2
View File
@@ -51,9 +51,9 @@ static const char *anims[NUM_ANIMATIONS] =
"BeginnerHelper_step-jumplr.bones.txt"
};
static CString GetAnimPath(Animation a)
static RString GetAnimPath(Animation a)
{
return CString("Characters/") + anims[a];
return RString("Characters/") + anims[a];
}
BeginnerHelper::BeginnerHelper()
+22 -22
View File
@@ -93,17 +93,17 @@ BitmapText &BitmapText::operator =( const BitmapText &cpy )
return *this;
}
void BitmapText::LoadFromNode( const CString& sDir, const XNode* pNode )
void BitmapText::LoadFromNode( const RString& sDir, const XNode* pNode )
{
CString sText;
RString sText;
pNode->GetAttrValue( "Text", sText );
CString sAltText;
RString sAltText;
pNode->GetAttrValue( "AltText", sAltText );
ThemeManager::EvaluateString( sText );
ThemeManager::EvaluateString( sAltText );
CString sFont;
RString sFont;
pNode->GetAttrValue( "Font", sFont );
if( sFont.empty() )
pNode->GetAttrValue("File", sFont ); // accept "File" for backward compatibility
@@ -120,7 +120,7 @@ void BitmapText::LoadFromNode( const CString& sDir, const XNode* pNode )
}
bool BitmapText::LoadFromFont( const CString& sFontFilePath )
bool BitmapText::LoadFromFont( const RString& sFontFilePath )
{
CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) );
@@ -138,7 +138,7 @@ bool BitmapText::LoadFromFont( const CString& sFontFilePath )
}
bool BitmapText::LoadFromTextureAndChars( const CString& sTexturePath, const CString& sChars )
bool BitmapText::LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars )
{
CHECKPOINT_M( ssprintf("BitmapText::LoadFromTextureAndChars(\"%s\",\"%s\")", sTexturePath.c_str(), sChars.c_str()) );
@@ -339,11 +339,11 @@ void BitmapText::DrawChars()
/* sText is UTF-8. If not all of the characters in sText are available in the
* font, sAlternateText will be used instead. If there are unavailable characters
* in sAlternateText, too, just use sText. */
void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText, int iWrapWidthPixels )
void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
{
ASSERT( m_pFont );
CString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
if( iWrapWidthPixels == -1 ) // wrap not specified
iWrapWidthPixels = m_iWrapWidthPixels;
@@ -372,20 +372,20 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
/* It doesn't. I can add Japanese wrapping, at least. We could handle hyphens
* and soft hyphens and pretty easily, too. -glenn */
// TODO: Move this wrapping logic into Font
vector<CString> asLines;
vector<RString> asLines;
split( m_sText, "\n", asLines, false );
for( unsigned line = 0; line < asLines.size(); ++line )
{
vector<CString> asWords;
vector<RString> asWords;
split( asLines[line], " ", asWords );
CString sCurLine;
RString sCurLine;
int iCurLineWidth = 0;
for( unsigned i=0; i<asWords.size(); i++ )
{
const CString &sWord = asWords[i];
const RString &sWord = asWords[i];
int iWidthWord = m_pFont->GetLineWidthInSourcePixels( RStringToWstring(sWord) );
if( sCurLine.empty() )
@@ -395,7 +395,7 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
continue;
}
CString sToAdd = " " + sWord;
RString sToAdd = " " + sWord;
int iWidthToAdd = m_pFont->GetLineWidthInSourcePixels(L" ") + iWidthWord;
if( iCurLineWidth + iWidthToAdd <= iWrapWidthPixels ) // will fit on current line
{
@@ -462,7 +462,7 @@ void BitmapText::UpdateBaseZoom()
}
}
bool BitmapText::StringWillUseAlternate( const CString& sText, const CString& sAlternateText ) const
bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const
{
ASSERT( m_pFont );
@@ -598,11 +598,11 @@ ColorBitmapText::ColorBitmapText( ) : BitmapText()
m_vColors.clear();
}
void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternateText, int iWrapWidthPixels )
void ColorBitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
{
ASSERT( m_pFont );
CString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
if( iWrapWidthPixels == -1 ) // wrap not specified
iWrapWidthPixels = m_iWrapWidthPixels;
@@ -621,10 +621,10 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
m_wTextLines.clear();
CString sCurrentLine = "";
RString sCurrentLine = "";
int iLineWidth = 0;
CString sCurrentWord = "";
RString sCurrentWord = "";
int iWordWidth = 0;
int iGlyphsSoFar = 0;
@@ -634,7 +634,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
// First: Check for the special (color) case.
CString FirstThree = m_sText.substr( i, 3 );
RString FirstThree = m_sText.substr( i, 3 );
if( FirstThree.CompareNoCase("|c0") == 0 && iCharsLeft > 8 )
{
ColorChange change;
@@ -652,7 +652,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
continue;
}
CString curCStr = m_sText.substr( i, 1 );
RString curCStr = m_sText.substr( i, 1 );
char curChar = curCStr.c_str()[0];
int iCharLen = m_pFont->GetLineWidthInSourcePixels( RStringToWstring( curCStr ) );
@@ -723,7 +723,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
UpdateBaseZoom();
}
void ColorBitmapText::SimpleAddLine( const CString &sAddition, const int iWidthPixels)
void ColorBitmapText::SimpleAddLine( const RString &sAddition, const int iWidthPixels)
{
m_wTextLines.push_back( RStringToWstring( sAddition ) );
m_iLineWidths.push_back( iWidthPixels );
@@ -851,7 +851,7 @@ public:
static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; }
static int settext( T* p, lua_State *L )
{
CString s = SArg(1);
RString s = SArg(1);
// XXX: Lua strings should simply use "\n" natively. However, some
// settext calls may be made from GetMetric() calls to other strings,
// and it's confusing for :: to work in some strings and not others.
+9 -9
View File
@@ -16,12 +16,12 @@ public:
BitmapText &operator =( const BitmapText &cpy );
virtual ~BitmapText();
virtual void LoadFromNode( const CString& sDir, const XNode* pNode );
virtual void LoadFromNode( const RString& sDir, const XNode* pNode );
virtual Actor *Copy() const;
bool LoadFromFont( const CString& sFontName );
bool LoadFromTextureAndChars( const CString& sTexturePath, const CString& sChars );
void SetText( const CString& sText, const CString& sAlternateText = "", int iWrapWidthPixels = -1 );
bool LoadFromFont( const RString& sFontName );
bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars );
void SetText( const RString& sText, const RString& sAlternateText = "", int iWrapWidthPixels = -1 );
void SetMaxWidth( float fMaxWidth );
void SetMaxHeight( float fMaxHeight );
void SetWrapWidthPixels( int iWrapWidthPixels );
@@ -38,9 +38,9 @@ public:
void GetLines( vector<wstring> &wTextLines ) { wTextLines = m_wTextLines; }
CString GetText() const { return m_sText; }
RString GetText() const { return m_sText; }
/* Return true if the string 's' will use an alternate string, if available. */
bool StringWillUseAlternate( const CString& sText, const CString& sAlternateText ) const;
bool StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const;
//
// Commands
@@ -53,7 +53,7 @@ public:
protected:
// recalculate the items in SetText()
CString m_sText;
RString m_sText;
vector<wstring> m_wTextLines;
vector<int> m_iLineWidths; // in source pixels
int m_iWrapWidthPixels; // -1 = no wrap
@@ -74,10 +74,10 @@ class ColorBitmapText : public BitmapText
{
public:
ColorBitmapText();
void SetText( const CString &sText, const CString &sAlternateText = "", int iWrapWidthPixels = -1 );
void SetText( const RString &sText, const RString &sAlternateText = "", int iWrapWidthPixels = -1 );
void DrawPrimitives();
void SetMaxLines( int iLines, bool bCutBottom = true ); //if bCutBottom = false then, it will crop the top
void SimpleAddLine( const CString &sAddition, int iWidthPixels );
void SimpleAddLine( const RString &sAddition, int iWidthPixels );
void SetMaxLines( int iNumLines, int iDirection );
protected:
struct ColorChange
+1 -1
View File
@@ -13,7 +13,7 @@
Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program
static const CString COINS_DAT = "Save/Coins.xml";
static const RString COINS_DAT = "Save/Coins.xml";
Bookkeeper::Bookkeeper()
{
+10 -10
View File
@@ -31,9 +31,9 @@
#define FOOTER_TEXT THEME->GetMetric ("CatalogXml","FooterText")
#define FOOTER_LINK THEME->GetMetric ("CatalogXml","FooterLink")
const CString CATALOG_XML = "Catalog.xml";
const CString CATALOG_XSL = "Catalog.xsl";
const CString CATALOG_XML_FILE = "Save/" + CATALOG_XML;
const RString CATALOG_XML = "Catalog.xml";
const RString CATALOG_XSL = "Catalog.xsl";
const RString CATALOG_XML_FILE = "Save/" + CATALOG_XML;
static LocalizedString SAVING_CATALOG_XML( "CatalogXml", "Saving %s ..." );
void SaveCatalogXml( LoadingWindow *loading_window )
@@ -44,7 +44,7 @@ void SaveCatalogXml( LoadingWindow *loading_window )
if( loading_window )
loading_window->SetText( ssprintf(SAVING_CATALOG_XML.GetValue(),CATALOG_XML.c_str()) );
CString fn = CATALOG_XML_FILE;
RString fn = CATALOG_XML_FILE;
LOG->Trace( "Writing %s ...", fn.c_str() );
@@ -60,9 +60,9 @@ void SaveCatalogXml( LoadingWindow *loading_window )
int iTotalSongs = 0;
int iTotalSteps = 0;
vector<CString> vsGroups;
vector<RString> vsGroups;
SONGMAN->GetSongGroupNames( vsGroups );
FOREACH_CONST( CString, vsGroups, sGroup )
FOREACH_CONST( RString, vsGroups, sGroup )
{
XNode* p1 = pNumSongsByGroup->AppendChild( "Group" );
p1->AppendAttr( "Name", *sGroup );
@@ -347,14 +347,14 @@ void SaveCatalogXml( LoadingWindow *loading_window )
{
XNode* pNode2 = pNode->AppendChild( "Modifier" );
vector<CString> modifiers;
vector<RString> modifiers;
THEME->GetModifierNames( modifiers );
FOREACH_CONST( CString, modifiers, iter )
FOREACH_CONST( RString, modifiers, iter )
{
PlayerOptions po;
CString s = *iter;
RString s = *iter;
po.FromString( s, false );
vector<CString> v;
vector<RString> v;
po.GetThemedMods( v );
if( v.empty() )
continue;
+3 -3
View File
@@ -5,9 +5,9 @@
class LoadingWindow;
extern const CString CATALOG_XML;
extern const CString CATALOG_XSL;
extern const CString CATALOG_XML_FILE;
extern const RString CATALOG_XML;
extern const RString CATALOG_XSL;
extern const RString CATALOG_XML_FILE;
void SaveCatalogXml( LoadingWindow *ld );
+25 -25
View File
@@ -9,7 +9,7 @@ Character::Character()
m_iPreloadRefcount = 0;
}
bool Character::Load( CString sCharDir )
bool Character::Load( RString sCharDir )
{
// Save character directory
if( sCharDir.Right(1) != "/" )
@@ -19,13 +19,13 @@ bool Character::Load( CString sCharDir )
// save ID
{
vector<CString> as;
vector<RString> as;
split( sCharDir, "/", as );
m_sCharacterID = as.back();
}
{
vector<CString> as;
vector<RString> as;
GetDirListing( m_sCharDir+"card.png", as, false, true );
GetDirListing( m_sCharDir+"card.jpg", as, false, true );
GetDirListing( m_sCharDir+"card.gif", as, false, true );
@@ -37,7 +37,7 @@ bool Character::Load( CString sCharDir )
}
{
vector<CString> as;
vector<RString> as;
GetDirListing( m_sCharDir+"icon.png", as, false, true );
GetDirListing( m_sCharDir+"icon.jpg", as, false, true );
GetDirListing( m_sCharDir+"icon.gif", as, false, true );
@@ -65,45 +65,45 @@ bool Character::Load( CString sCharDir )
}
CString GetRandomFileInDir( CString sDir )
RString GetRandomFileInDir( RString sDir )
{
vector<CString> asFiles;
vector<RString> asFiles;
GetDirListing( sDir, asFiles, false, true );
if( asFiles.empty() )
return CString();
return RString();
else
return asFiles[rand()%asFiles.size()];
}
CString Character::GetModelPath() const
RString Character::GetModelPath() const
{
CString s = m_sCharDir + "model.txt";
RString s = m_sCharDir + "model.txt";
if( DoesFileExist(s) )
return s;
else
return CString();
return RString();
}
CString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); }
CString Character::GetWarmUpAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp/")); }
CString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); }
CString Character::GetTakingABreakPath() const
RString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); }
RString Character::GetWarmUpAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp/")); }
RString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); }
RString Character::GetTakingABreakPath() const
{
vector<CString> as;
vector<RString> as;
GetDirListing( m_sCharDir+"break.png", as, false, true );
GetDirListing( m_sCharDir+"break.jpg", as, false, true );
GetDirListing( m_sCharDir+"break.gif", as, false, true );
GetDirListing( m_sCharDir+"break.bmp", as, false, true );
if( as.empty() )
return CString();
return RString();
else
return as[0];
}
CString Character::GetSongSelectIconPath() const
RString Character::GetSongSelectIconPath() const
{
vector<CString> as;
vector<RString> as;
// first try and find an icon specific to the select music screen
// so you can have different icons for music select / char select
GetDirListing( m_sCharDir+"selectmusicicon.png", as, false, true );
@@ -119,7 +119,7 @@ CString Character::GetSongSelectIconPath() const
GetDirListing( m_sCharDir+"icon.gif", as, false, true );
GetDirListing( m_sCharDir+"icon.bmp", as, false, true );
if( as.empty() )
return CString();
return RString();
else
return as[0];
}
@@ -127,9 +127,9 @@ CString Character::GetSongSelectIconPath() const
return as[0];
}
CString Character::GetStageIconPath() const
RString Character::GetStageIconPath() const
{
vector<CString> as;
vector<RString> as;
// first try and find an icon specific to the select music screen
// so you can have different icons for music select / char select
GetDirListing( m_sCharDir+"stageicon.png", as, false, true );
@@ -145,7 +145,7 @@ CString Character::GetStageIconPath() const
GetDirListing( m_sCharDir+"card.gif", as, false, true );
GetDirListing( m_sCharDir+"card.bmp", as, false, true );
if( as.empty() )
return CString();
return RString();
else
return as[0];
}
@@ -179,7 +179,7 @@ void Character::DemandGraphics()
++m_iPreloadRefcount;
if( m_iPreloadRefcount == 1 )
{
CString s = GetIconPath();
RString s = GetIconPath();
if( !s.empty() )
m_Preload.Load( s );
}
@@ -205,8 +205,8 @@ public:
static int GetSongSelectIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetSongSelectIconPath() ); return 1; }
static int GetStageIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetStageIconPath() ); return 1; }
CString GetCardPath() const;
CString GetIconPath() const;
RString GetCardPath() const;
RString GetIconPath() const;
static void Register( Lua *L )
{
+17 -17
View File
@@ -15,18 +15,18 @@ public:
Character();
~Character() { }
bool Load( CString sCharDir ); // return true if success
bool Load( RString sCharDir ); // return true if success
CString GetTakingABreakPath() const;
CString GetCardPath() const { return m_sCardPath; }
CString GetIconPath() const { return m_sIconPath; }
RString GetTakingABreakPath() const;
RString GetCardPath() const { return m_sCardPath; }
RString GetIconPath() const { return m_sIconPath; }
CString GetModelPath() const;
CString GetRestAnimationPath() const;
CString GetWarmUpAnimationPath() const;
CString GetDanceAnimationPath() const;
CString GetSongSelectIconPath() const;
CString GetStageIconPath() const;
RString GetModelPath() const;
RString GetRestAnimationPath() const;
RString GetWarmUpAnimationPath() const;
RString GetDanceAnimationPath() const;
RString GetSongSelectIconPath() const;
RString GetStageIconPath() const;
bool Has2DElems();
bool IsDefaultCharacter() const
@@ -43,21 +43,21 @@ public:
void PushSelf( Lua *L );
// smart accessor
const CString &GetDisplayName() { return !m_sDisplayName.empty() ? m_sDisplayName : m_sCharacterID; }
const RString &GetDisplayName() { return !m_sDisplayName.empty() ? m_sDisplayName : m_sCharacterID; }
CString m_sCharDir;
CString m_sCharacterID;
RString m_sCharDir;
RString m_sCharacterID;
private:
CString m_sDisplayName;
CString m_sCardPath;
CString m_sIconPath;
RString m_sDisplayName;
RString m_sCardPath;
RString m_sIconPath;
public:
// All the stuff below will be filled in if this character is playable in Rave mode
bool m_bUsableInRave;
CString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
RString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
RageTexturePreloader m_Preload;
int m_iPreloadRefcount;
};
+3 -3
View File
@@ -14,14 +14,14 @@ CharacterManager::CharacterManager()
SAFE_DELETE( m_pCharacters[i] );
m_pCharacters.clear();
vector<CString> as;
vector<RString> as;
GetDirListing( CHARACTERS_DIR "*", as, true, true );
StripCvs( as );
bool FoundDefault = false;
for( unsigned i=0; i<as.size(); i++ )
{
CString sCharName, sDummy;
RString sCharName, sDummy;
splitpath(as[i], sDummy, sCharName, sDummy);
sCharName.MakeLower();
@@ -91,7 +91,7 @@ void CharacterManager::UndemandGraphics()
(*c)->UndemandGraphics();
}
Character* CharacterManager::GetCharacterFromID( CString sCharacterID )
Character* CharacterManager::GetCharacterFromID( RString sCharacterID )
{
for( unsigned i=0; i<m_pCharacters.size(); i++ )
{
+1 -1
View File
@@ -15,7 +15,7 @@ public:
void GetCharacters( vector<Character*> &vpCharactersOut );
Character* GetRandomCharacter();
Character* GetDefaultCharacter();
Character* GetCharacterFromID( CString sCharacterID );
Character* GetCharacterFromID( RString sCharacterID );
void DemandGraphics();
void UndemandGraphics();
+6 -6
View File
@@ -89,12 +89,12 @@ bool CodeItem::EnteredCode( GameController controller ) const
}
}
bool CodeItem::Load( CString sButtonsNames )
bool CodeItem::Load( RString sButtonsNames )
{
buttons.clear();
const Game* pGame = GAMESTATE->GetCurrentGame();
vector<CString> asButtonNames;
vector<RString> asButtonNames;
bool bHasAPlus = sButtonsNames.find( '+' ) != string::npos;
bool bHasADash = sButtonsNames.find( '-' ) != string::npos;
@@ -124,7 +124,7 @@ bool CodeItem::Load( CString sButtonsNames )
for( unsigned i=0; i<asButtonNames.size(); i++ ) // for each button in this code
{
const CString sButtonName = asButtonNames[i];
const RString sButtonName = asButtonNames[i];
// Search for the corresponding GameButton
const GameButton gb = pGame->ButtonNameToIndex( sButtonName );
@@ -166,15 +166,15 @@ bool CodeDetector::EnteredCode( GameController controller, Code code )
}
void CodeDetector::RefreshCacheItems( CString sClass )
void CodeDetector::RefreshCacheItems( RString sClass )
{
if( sClass == "" )
sClass = "CodeDetector";
FOREACH_Code( c )
{
CodeItem& item = g_CodeItems[c];
const CString sCodeName = CodeToString(c);
const CString sButtonsNames = THEME->GetMetric(sClass,sCodeName);
const RString sCodeName = CodeToString(c);
const RString sButtonsNames = THEME->GetMetric(sClass,sCodeName);
item.Load( sButtonsNames );
}
+2 -2
View File
@@ -52,7 +52,7 @@ enum Code {
struct CodeItem
{
public:
bool Load( CString sButtonsNames );
bool Load( RString sButtonsNames );
bool EnteredCode( GameController controller ) const;
private:
@@ -70,7 +70,7 @@ private:
class CodeDetector
{
public:
static void RefreshCacheItems( CString sClass="" ); // call this before checking codes, but call infrequently
static void RefreshCacheItems( RString sClass="" ); // call this before checking codes, but call infrequently
static bool EnteredEasierDifficulty( GameController controller );
static bool EnteredHarderDifficulty( GameController controller );
static bool EnteredNextSort( GameController controller );
+3 -3
View File
@@ -8,7 +8,7 @@
ThemeMetric<float> METER_WIDTH ("CombinedLifeMeterTug","MeterWidth");
static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, CString &sNameOut, float &defaultValueOut )
static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
{
sNameOut = "TugMeterPercentChange" + ScoreEventToString( (ScoreEvent)i );
switch( i )
@@ -32,8 +32,8 @@ CombinedLifeMeterTug::CombinedLifeMeterTug()
{
FOREACH_PlayerNumber( p )
{
CString sStreamPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("stream p%d",p+1));
CString sTipPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("tip p%d",p+1));
RString sStreamPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("stream p%d",p+1));
RString sTipPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("tip p%d",p+1));
m_Stream[p].Load( sStreamPath, METER_WIDTH, sTipPath );
this->AddChild( &m_Stream[p] );
}
+1 -1
View File
@@ -99,7 +99,7 @@ void Combo::SetCombo( int iCombo, int iMisses )
m_sprMissesLabel->SetHidden( !bComboOfMisses );
m_textNumber.SetHidden( false );
CString txt = ssprintf("%d", iNum);
RString txt = ssprintf("%d", iNum);
// Do pulse even if the number isn't changing.
+1 -1
View File
@@ -19,7 +19,7 @@ ComboGraph::ComboGraph()
m_pMaxComboText = NULL;
}
void ComboGraph::LoadFromNode( const CString& sDir, const XNode* pNode )
void ComboGraph::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ActorFrame::LoadFromNode( sDir, pNode );
+1 -1
View File
@@ -12,7 +12,7 @@ class ComboGraph: public ActorFrame
public:
ComboGraph();
void Load( const StageStats &s, const PlayerStageStats &pss );
virtual void LoadFromNode( const CString& sDir, const XNode* pNode );
virtual void LoadFromNode( const RString& sDir, const XNode* pNode );
virtual Actor *Copy() const;
virtual bool AutoLoadChildren() const { return true; }
+18 -18
View File
@@ -9,17 +9,17 @@
void IncorrectNumberArgsWarning( const Command &command, int iMaxIndexAccessed )
{
const CString sError = ssprintf( "Actor::HandleCommand: Wrong number of arguments in command '%s'. Expected %d but there are %u.",
const RString sError = ssprintf( "Actor::HandleCommand: Wrong number of arguments in command '%s'. Expected %d but there are %u.",
command.GetOriginalCommandString().c_str(), iMaxIndexAccessed+1, unsigned(command.m_vsArgs.size()) );
LOG->Warn( sError );
Dialog::OK( sError );
}
CString Command::GetName() const
RString Command::GetName() const
{
if( m_vsArgs.empty() )
return CString();
CString s = m_vsArgs[0];
return RString();
RString s = m_vsArgs[0];
s.MakeLower();
return s;
}
@@ -32,46 +32,46 @@ Command::Arg Command::GetArg( unsigned index ) const
return a;
}
Command::Arg::operator CString () const
Command::Arg::operator RString () const
{
CString sValue = s;
RString sValue = s;
LuaHelpers::RunAtExpressionS( sValue );
return sValue;
}
Command::Arg::operator float () const
{
CString sValue = s;
RString sValue = s;
LuaHelpers::PrepareExpression( sValue ); // strip invalid chars
return LuaHelpers::RunExpressionF( sValue );
}
Command::Arg::operator int () const
{
CString sValue = s;
RString sValue = s;
LuaHelpers::PrepareExpression( sValue ); // strip invalid chars
return (int) LuaHelpers::RunExpressionF( sValue );
}
Command::Arg::operator bool () const
{
CString sValue = s;
RString sValue = s;
LuaHelpers::PrepareExpression( sValue ); // strip invalid chars
return LuaHelpers::RunExpressionF( sValue ) != 0.0f;
}
void Command::Load( const CString &sCommand )
void Command::Load( const RString &sCommand )
{
m_vsArgs.clear();
split( sCommand, ",", m_vsArgs, false ); // don't ignore empty
}
CString Command::GetOriginalCommandString() const
RString Command::GetOriginalCommandString() const
{
return join( ",", m_vsArgs );
}
static void SplitWithQuotes( const CString sSource, const char Delimitor, vector<CString> &asOut, const bool bIgnoreEmpty )
static void SplitWithQuotes( const RString sSource, const char Delimitor, vector<RString> &asOut, const bool bIgnoreEmpty )
{
/* Short-circuit if the source is empty; we want to return an empty vector if
* the string is empty, even if bIgnoreEmpty is true. */
@@ -107,7 +107,7 @@ static void SplitWithQuotes( const CString sSource, const char Delimitor, vector
asOut.push_back( sSource );
else
{
const CString AddCString = sSource.substr( startpos, pos-startpos );
const RString AddCString = sSource.substr( startpos, pos-startpos );
asOut.push_back( AddCString );
}
}
@@ -116,17 +116,17 @@ static void SplitWithQuotes( const CString sSource, const char Delimitor, vector
} while( startpos <= sSource.size() );
}
CString Commands::GetOriginalCommandString() const
RString Commands::GetOriginalCommandString() const
{
CString s;
RString s;
FOREACH_CONST( Command, v, c )
s += c->GetOriginalCommandString();
return s;
}
void ParseCommands( const CString &sCommands, Commands &vCommandsOut )
void ParseCommands( const RString &sCommands, Commands &vCommandsOut )
{
vector<CString> vsCommands;
vector<RString> vsCommands;
SplitWithQuotes( sCommands, ';', vsCommands, true ); // do ignore empty
vCommandsOut.v.resize( vsCommands.size() );
@@ -137,7 +137,7 @@ void ParseCommands( const CString &sCommands, Commands &vCommandsOut )
}
}
Commands ParseCommands( const CString &sCommands )
Commands ParseCommands( const RString &sCommands )
{
Commands vCommands;
ParseCommands( sCommands, vCommands );
+10 -10
View File
@@ -8,25 +8,25 @@
class Command
{
public:
void Load( const CString &sCommand );
void Load( const RString &sCommand );
CString GetOriginalCommandString() const; // used when reporting an error in number of args
RString GetOriginalCommandString() const; // used when reporting an error in number of args
CString GetName() const; // the command name is the first argument in all-lowercase
RString GetName() const; // the command name is the first argument in all-lowercase
void Clear() { m_vsArgs.clear(); }
struct Arg
{
CString s;
operator CString () const;
RString s;
operator RString () const;
operator float () const;
operator int () const;
operator bool () const;
};
Arg GetArg( unsigned index ) const;
vector<CString> m_vsArgs;
vector<RString> m_vsArgs;
};
class Commands
@@ -34,7 +34,7 @@ class Commands
public:
vector<Command> v;
CString GetOriginalCommandString() const; // used when reporting an error in number of args
RString GetOriginalCommandString() const; // used when reporting an error in number of args
};
// Take a command list string and return pointers to each of the tokens in the
@@ -42,13 +42,13 @@ public:
// TODO: This is expensive to do during the game. Eventually,
// move all calls to ParseCommands to happen during load, then execute
// from the parsed Command structures.
void ParseCommands( const CString &sCmds, Commands &vCmdsOut );
Commands ParseCommands( const CString &sCmds );
void ParseCommands( const RString &sCmds, Commands &vCmdsOut );
Commands ParseCommands( const RString &sCmds );
#define BeginHandleArgs int iMaxIndexAccessed = 0;
#define GET_ARG(type,i) iMaxIndexAccessed = max( i, iMaxIndexAccessed ); command.GetArg##type( i );
#define sArg(i) GetArg<CString>(command,i,iMaxIndexAccessed)
#define sArg(i) GetArg<RString>(command,i,iMaxIndexAccessed)
#define fArg(i) GetArg<float>(command,i,iMaxIndexAccessed)
#define iArg(i) GetArg<int>(command,i,iMaxIndexAccessed)
#define bArg(i) GetArg<bool>(command,i,iMaxIndexAccessed)
+25 -25
View File
@@ -8,12 +8,12 @@
#include "ProductInfo.h"
static CString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%dCommand",int(p+1)); }
static RString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%dCommand",int(p+1)); }
ThemeMetric<CString> CommonMetrics::INITIAL_SCREEN ("Common","InitialScreen", true); // always reevaluate metric
ThemeMetric<CString> CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen");
ThemeMetric<CString> CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" );
ThemeMetric<CString> CommonMetrics::DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" );
ThemeMetric<RString> CommonMetrics::INITIAL_SCREEN ("Common","InitialScreen", true); // always reevaluate metric
ThemeMetric<RString> CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen");
ThemeMetric<RString> CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" );
ThemeMetric<RString> CommonMetrics::DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" );
ThemeMetric1D<apActorCommands> CommonMetrics::PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS);
LocalizedString CommonMetrics::WINDOW_TITLE ("Common","WindowTitle");
ThemeMetric<int> CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS("Common","MaxCourseEntriesBeforeShowVarious");
@@ -23,8 +23,8 @@ ThemeMetricCourseDifficultiesToShow CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW
ThemeMetricStepsTypesToShow CommonMetrics::STEPS_TYPES_TO_SHOW ("Common","StepsTypesToHide");
ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const CString& sGroup, const CString& sName ) :
ThemeMetric<CString>(sGroup,sName)
ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ) :
ThemeMetric<RString>(sGroup,sName)
{
// re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one
if( IsLoaded() )
@@ -34,15 +34,15 @@ void ThemeMetricDifficultiesToShow::Read()
{
ASSERT( GetName().Right(6) == "ToShow" );
ThemeMetric<CString>::Read();
ThemeMetric<RString>::Read();
m_v.clear();
vector<CString> v;
split( ThemeMetric<CString>::GetValue(), ",", v );
vector<RString> v;
split( ThemeMetric<RString>::GetValue(), ",", v );
ASSERT( v.size() > 0 );
FOREACH_CONST( CString, v, i )
FOREACH_CONST( RString, v, i )
{
Difficulty d = StringToDifficulty( *i );
if( d == DIFFICULTY_INVALID )
@@ -53,8 +53,8 @@ void ThemeMetricDifficultiesToShow::Read()
const vector<Difficulty>& ThemeMetricDifficultiesToShow::GetValue() { return m_v; }
ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const CString& sGroup, const CString& sName ) :
ThemeMetric<CString>(sGroup,sName)
ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ) :
ThemeMetric<RString>(sGroup,sName)
{
// re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one
if( IsLoaded() )
@@ -64,15 +64,15 @@ void ThemeMetricCourseDifficultiesToShow::Read()
{
ASSERT( GetName().Right(6) == "ToShow" );
ThemeMetric<CString>::Read();
ThemeMetric<RString>::Read();
m_v.clear();
vector<CString> v;
split( ThemeMetric<CString>::GetValue(), ",", v );
vector<RString> v;
split( ThemeMetric<RString>::GetValue(), ",", v );
ASSERT( v.size() > 0 );
FOREACH_CONST( CString, v, i )
FOREACH_CONST( RString, v, i )
{
CourseDifficulty d = StringToCourseDifficulty( *i );
if( d == DIFFICULTY_INVALID )
@@ -83,14 +83,14 @@ void ThemeMetricCourseDifficultiesToShow::Read()
const vector<CourseDifficulty>& ThemeMetricCourseDifficultiesToShow::GetValue() { return m_v; }
static void RemoveStepsTypes( vector<StepsType>& inout, CString sStepsTypesToRemove )
static void RemoveStepsTypes( vector<StepsType>& inout, RString sStepsTypesToRemove )
{
vector<CString> v;
vector<RString> v;
split( sStepsTypesToRemove, ",", v );
ASSERT( v.size() > 0 );
// subtract StepsTypes
FOREACH_CONST( CString, v, i )
FOREACH_CONST( RString, v, i )
{
StepsType st = GameManager::StringToStepsType(*i);
if( st == STEPS_TYPE_INVALID )
@@ -101,8 +101,8 @@ static void RemoveStepsTypes( vector<StepsType>& inout, CString sStepsTypesToRem
inout.erase( iter );
}
}
ThemeMetricStepsTypesToShow::ThemeMetricStepsTypesToShow( const CString& sGroup, const CString& sName ) :
ThemeMetric<CString>(sGroup,sName)
ThemeMetricStepsTypesToShow::ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ) :
ThemeMetric<RString>(sGroup,sName)
{
// re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one
if( IsLoaded() )
@@ -112,17 +112,17 @@ void ThemeMetricStepsTypesToShow::Read()
{
ASSERT( GetName().Right(6) == "ToHide" );
ThemeMetric<CString>::Read();
ThemeMetric<RString>::Read();
m_v.clear();
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, m_v );
RemoveStepsTypes( m_v, ThemeMetric<CString>::GetValue() );
RemoveStepsTypes( m_v, ThemeMetric<RString>::GetValue() );
}
const vector<StepsType>& ThemeMetricStepsTypesToShow::GetValue() { return m_v; }
CString CommonMetrics::ThemeOptionItem( CString s, bool bOptional )
RString CommonMetrics::ThemeOptionItem( RString s, bool bOptional )
{
if( bOptional && !THEME->HasMetric("OptionNames",s) )
return s;
+11 -11
View File
@@ -13,31 +13,31 @@
//
// Types
//
class ThemeMetricDifficultiesToShow : public ThemeMetric<CString>
class ThemeMetricDifficultiesToShow : public ThemeMetric<RString>
{
public:
ThemeMetricDifficultiesToShow() { }
ThemeMetricDifficultiesToShow( const CString& sGroup, const CString& sName );
ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName );
void Read();
const vector<Difficulty> &GetValue();
private:
vector<Difficulty> m_v;
};
class ThemeMetricCourseDifficultiesToShow : public ThemeMetric<CString>
class ThemeMetricCourseDifficultiesToShow : public ThemeMetric<RString>
{
public:
ThemeMetricCourseDifficultiesToShow() { }
ThemeMetricCourseDifficultiesToShow( const CString& sGroup, const CString& sName );
ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName );
void Read();
const vector<CourseDifficulty> &GetValue();
private:
vector<CourseDifficulty> m_v;
};
class ThemeMetricStepsTypesToShow : public ThemeMetric<CString>
class ThemeMetricStepsTypesToShow : public ThemeMetric<RString>
{
public:
ThemeMetricStepsTypesToShow() { }
ThemeMetricStepsTypesToShow( const CString& sGroup, const CString& sName );
ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName );
void Read();
const vector<StepsType> &GetValue();
private:
@@ -50,10 +50,10 @@ private:
//
namespace CommonMetrics
{
extern ThemeMetric<CString> INITIAL_SCREEN;
extern ThemeMetric<CString> FIRST_ATTRACT_SCREEN;
extern ThemeMetric<CString> DEFAULT_MODIFIERS;
extern ThemeMetric<CString> DEFAULT_CPU_MODIFIERS;
extern ThemeMetric<RString> INITIAL_SCREEN;
extern ThemeMetric<RString> FIRST_ATTRACT_SCREEN;
extern ThemeMetric<RString> DEFAULT_MODIFIERS;
extern ThemeMetric<RString> DEFAULT_CPU_MODIFIERS;
extern ThemeMetric1D<apActorCommands> PLAYER_COLOR;
extern LocalizedString WINDOW_TITLE;
extern ThemeMetric<int> MAX_COURSE_ENTRIES_BEFORE_VARIOUS;
@@ -62,7 +62,7 @@ namespace CommonMetrics
extern ThemeMetricCourseDifficultiesToShow COURSE_DIFFICULTIES_TO_SHOW;
extern ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW;
CString ThemeOptionItem( CString s, bool bOptional );
RString ThemeOptionItem( RString s, bool bOptional );
};
#endif
+13 -13
View File
@@ -58,9 +58,9 @@ const int MAX_BOTTOM_RANGE = 10;
#define SORT_LEVEL5_COLOR THEME->GetMetricC("Course","SortLevel5Color")
CString CourseEntry::GetTextDescription() const
RString CourseEntry::GetTextDescription() const
{
vector<CString> vsEntryDescription;
vector<RString> vsEntryDescription;
if( pSong )
vsEntryDescription.push_back( pSong->GetTranslitFullTitle() );
else
@@ -83,7 +83,7 @@ CString CourseEntry::GetTextDescription() const
if( fGainSeconds != 0 )
vsEntryDescription.push_back( ssprintf("Low meter: %.0f", fGainSeconds) );
CString s = join( ",", vsEntryDescription );
RString s = join( ",", vsEntryDescription );
return s;
}
@@ -191,7 +191,7 @@ void Course::RevertFromDisk()
CourseLoaderCRS::LoadFromCRSFile( m_sPath, *this );
}
CString Course::GetCacheFilePath() const
RString Course::GetCacheFilePath() const
{
return SongCacheIndex::GetCacheFilePath( "Courses", m_sPath );
}
@@ -232,33 +232,33 @@ struct SortTrailEntry
bool operator< ( const SortTrailEntry &rhs ) const { return SortMeter < rhs.SortMeter; }
};
CString Course::GetDisplayMainTitle() const
RString Course::GetDisplayMainTitle() const
{
if( !PREFSMAN->m_bShowNativeLanguage )
return GetTranslitMainTitle();
return m_sMainTitle;
}
CString Course::GetDisplaySubTitle() const
RString Course::GetDisplaySubTitle() const
{
if( !PREFSMAN->m_bShowNativeLanguage )
return GetTranslitSubTitle();
return m_sSubTitle;
}
CString Course::GetDisplayFullTitle() const
RString Course::GetDisplayFullTitle() const
{
CString Title = GetDisplayMainTitle();
CString SubTitle = GetDisplaySubTitle();
RString Title = GetDisplayMainTitle();
RString SubTitle = GetDisplaySubTitle();
if(!SubTitle.empty()) Title += " " + SubTitle;
return Title;
}
CString Course::GetTranslitFullTitle() const
RString Course::GetTranslitFullTitle() const
{
CString Title = GetTranslitMainTitle();
CString SubTitle = GetTranslitSubTitle();
RString Title = GetTranslitMainTitle();
RString SubTitle = GetTranslitSubTitle();
if(!SubTitle.empty()) Title += " " + SubTitle;
return Title;
@@ -843,7 +843,7 @@ void Course::UpdateCourseStats( StepsType st )
bool Course::IsRanking() const
{
vector<CString> rankingsongs;
vector<RString> rankingsongs;
split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs);
+20 -20
View File
@@ -30,8 +30,8 @@ enum CourseType
NUM_CourseType
};
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_CourseType, i )
const CString& CourseTypeToString( CourseType i );
const CString& CourseTypeToLocalizedString( CourseType i );
const RString& CourseTypeToString( CourseType i );
const RString& CourseTypeToLocalizedString( CourseType i );
inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); }
inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); }
@@ -47,8 +47,8 @@ enum SongSort
NUM_SongSort,
};
#define FOREACH_SongSort( i ) FOREACH_ENUM( SongSort, NUM_SongSort, i )
const CString& SongSortToString( SongSort ss );
const CString& SongSortToLocalizedString( SongSort ss );
const RString& SongSortToString( SongSort ss );
const RString& SongSortToLocalizedString( SongSort ss );
class CourseEntry
{
@@ -58,7 +58,7 @@ public:
// filter criteria, applied from top to bottom
// TODO: change this to be a SongID
Song* pSong; // don't filter if NULL
CString sSongGroup; // don't filter if empty
RString sSongGroup; // don't filter if empty
Difficulty baseDifficulty; // don't filter if DIFFICULTY_INVALID
bool bNoDifficult; // if true, CourseDifficulty doesn't affect this entry
int iLowMeter; // don't filter if -1
@@ -67,7 +67,7 @@ public:
SongSort songSort; // sort by this after filtering
int iChooseIndex; //
CString sModifiers; // set player and song options using these
RString sModifiers; // set player and song options using these
AttackArray attacks; // timed sModifiers
float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only.
@@ -96,7 +96,7 @@ public:
pSong == NULL;
}
CString GetTextDescription() const;
RString GetTextDescription() const;
int GetNumModChanges() const;
// Lua
@@ -111,16 +111,16 @@ public:
Course();
bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath;
RString m_sPath;
CString m_sMainTitle, m_sMainTitleTranslit;
CString m_sSubTitle, m_sSubTitleTranslit;
RString m_sMainTitle, m_sMainTitleTranslit;
RString m_sSubTitle, m_sSubTitleTranslit;
bool HasBanner() const;
CString m_sBannerPath;
CString m_sCDTitlePath;
CString m_sGroupName;
RString m_sBannerPath;
RString m_sCDTitlePath;
RString m_sGroupName;
bool m_bRepeat; // repeat after last song? "Endless"
bool m_bShuffle; // play the songs in a random order
@@ -132,16 +132,16 @@ public:
/* If PREFSMAN->m_bShowNative is off, these are the same as GetTranslit* below.
* Otherwise, they return the main titles. */
CString GetDisplayMainTitle() const;
CString GetDisplaySubTitle() const;
RString GetDisplayMainTitle() const;
RString GetDisplaySubTitle() const;
/* Returns the transliterated titles, if any; otherwise returns the main titles. */
CString GetTranslitMainTitle() const { return m_sMainTitleTranslit.size()? m_sMainTitleTranslit: m_sMainTitle; }
CString GetTranslitSubTitle() const { return m_sSubTitleTranslit.size()? m_sSubTitleTranslit: m_sSubTitle; }
RString GetTranslitMainTitle() const { return m_sMainTitleTranslit.size()? m_sMainTitleTranslit: m_sMainTitle; }
RString GetTranslitSubTitle() const { return m_sSubTitleTranslit.size()? m_sSubTitleTranslit: m_sSubTitle; }
/* "title subtitle" */
CString GetDisplayFullTitle() const;
CString GetTranslitFullTitle() const;
RString GetDisplayFullTitle() const;
RString GetTranslitFullTitle() const;
// Dereferences course_entries and returns only the playable Songs and Steps
Trail* GetTrail( StepsType st, CourseDifficulty cd=DIFFICULTY_MEDIUM ) const;
@@ -186,7 +186,7 @@ public:
void Invalidate( Song *pStaleSong );
void GetAllCachedTrails( vector<Trail *> &out );
CString GetCacheFilePath() const;
RString GetCacheFilePath() const;
const CourseEntry *FindFixedSong( const Song *pSong ) const;
+1 -1
View File
@@ -44,7 +44,7 @@ void CourseContentsList::Load()
}
}
void CourseContentsList::LoadFromNode( const CString& sDir, const XNode* pNode )
void CourseContentsList::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ActorScroller::LoadFromNode( sDir, pNode );
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual Actor *Copy() const;
void Load();
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromNode( const RString& sDir, const XNode* pNode );
void SetFromGameState();
void TweenInAfterChangedCourse();
+5 -5
View File
@@ -49,12 +49,12 @@ void CourseEntryDisplay::Load()
if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber )
continue; // skip
m_textFoot[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("FootP%i", pn+1):CString("Foot") );
m_textFoot[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("FootP%i", pn+1):RString("Foot") );
m_textFoot[pn].LoadFromTextureAndChars( THEME->GetPathF("CourseEntryDisplay","difficulty"),"10" );
SET_XY_AND_ON_COMMAND( &m_textFoot[pn] );
this->AddChild( &m_textFoot[pn] );
m_textDifficultyNumber[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("DifficultyP%i", pn+1):CString("Difficulty") );
m_textDifficultyNumber[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("DifficultyP%i", pn+1):RString("Difficulty") );
m_textDifficultyNumber[pn].LoadFromFont( THEME->GetPathF("Common","normal") );
SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber[pn] );
this->AddChild( &m_textDifficultyNumber[pn] );
@@ -66,14 +66,14 @@ void CourseEntryDisplay::Load()
this->AddChild( &m_textModifiers );
}
void CourseEntryDisplay::LoadFromNode( const CString& sDir, const XNode* pNode )
void CourseEntryDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ActorFrame::LoadFromNode( sDir, pNode );
Load();
}
void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const CString &text, Difficulty dc )
void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const RString &text, Difficulty dc )
{
if( !GAMESTATE->IsHumanPlayer(pn) )
return; // skip
@@ -135,7 +135,7 @@ void CourseEntryDisplay::SetFromGameState( int iCourseEntryIndex )
bool bLowIsSet = iLow != -1;
bool bHighIsSet = iHigh != -1;
CString s;
RString s;
if( !bLowIsSet && !bHighIsSet )
{
s = "?";
+3 -3
View File
@@ -19,7 +19,7 @@ public:
virtual Actor *Copy() const;
void Load();
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromNode( const RString& sDir, const XNode* pNode );
void SetFromGameState( int iCourseEntryIndex );
@@ -27,7 +27,7 @@ public:
void PushSelf( lua_State *L );
private:
void SetDifficulty( PlayerNumber pn, const CString &text, Difficulty dc );
void SetDifficulty( PlayerNumber pn, const RString &text, Difficulty dc );
Sprite m_sprFrame;
BitmapText m_textNumber;
@@ -37,7 +37,7 @@ private:
BitmapText m_textModifiers;
ThemeMetric<bool> SEPARATE_COURSE_METERS;
ThemeMetric<CString> TEXT_BANNER_TYPE;
ThemeMetric<RString> TEXT_BANNER_TYPE;
};
#endif
+19 -19
View File
@@ -16,18 +16,18 @@
const int MAX_EDIT_COURSE_SIZE_BYTES = 30*1024; // 30KB
bool CourseLoaderCRS::LoadFromBuffer( const CString &sPath, const CString &sBuffer, Course &out )
bool CourseLoaderCRS::LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out )
{
MsdFile msd;
msd.ReadFromString( sBuffer );
return LoadFromMsd( sPath, msd, out, true );
}
bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Course &out, bool bFromCache )
bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache )
{
const CString sFName = SetExtension( out.m_sPath, "" );
const RString sFName = SetExtension( out.m_sPath, "" );
vector<CString> arrayPossibleBanners;
vector<RString> arrayPossibleBanners;
GetDirListing( sFName + "*.png", arrayPossibleBanners, false, true );
GetDirListing( sFName + "*.jpg", arrayPossibleBanners, false, true );
GetDirListing( sFName + "*.bmp", arrayPossibleBanners, false, true );
@@ -39,7 +39,7 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
float fGainSeconds = 0;
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
CString sValueName = msd.GetParam(i, 0);
RString sValueName = msd.GetParam(i, 0);
const MsdFile::value_t &sParams = msd.GetValue(i);
// handle the data
@@ -49,7 +49,7 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
out.m_sMainTitleTranslit = sParams[1];
else if( 0 == stricmp(sValueName, "REPEAT") )
{
CString str = sParams[1];
RString str = sParams[1];
str.MakeLower();
if( str.find("yes") != string::npos )
out.m_bRepeat = true;
@@ -86,7 +86,7 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
float end = -9999;
for( unsigned j = 1; j < sParams.params.size(); ++j )
{
vector<CString> sBits;
vector<RString> sBits;
split( sParams[j], "=", sBits, false );
if( sBits.size() < 2 )
continue;
@@ -147,9 +147,9 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
else if( sParams[1].Right(1) == "*" )
{
//new_entry.bSecret = true;
CString sSong = sParams[1];
RString sSong = sParams[1];
sSong.Replace( "\\", "/" );
vector<CString> bits;
vector<RString> bits;
split( sSong, "/", bits );
if( bits.size() == 2 )
{
@@ -174,7 +174,7 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
}
else
{
CString sSong = sParams[1];
RString sSong = sParams[1];
new_entry.pSong = SONGMAN->FindSong( sSong );
if( new_entry.pSong == NULL )
@@ -206,11 +206,11 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
{
/* If "showcourse" or "noshowcourse" is in the list, force new_entry.secret
* on or off. */
vector<CString> mods;
vector<RString> mods;
split( sParams[3], ",", mods, true );
for( int j = (int) mods.size()-1; j >= 0 ; --j )
{
CString &sMod = mods[j];
RString &sMod = mods[j];
TrimLeft( sMod );
TrimRight( sMod );
if( !sMod.CompareNoCase("showcourse") )
@@ -268,9 +268,9 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
return true;
}
bool CourseLoaderCRS::LoadFromCRSFile( const CString &_sPath, Course &out )
bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out )
{
CString sPath = _sPath;
RString sPath = _sPath;
out.Init();
@@ -278,7 +278,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const CString &_sPath, Course &out )
// save group name
{
vector<CString> parts;
vector<RString> parts;
split( sPath, "/", parts, false );
if( parts.size() >= 4 ) // e.g. "/Courses/blah/fun.cvs"
out.m_sGroupName = parts[parts.size()-2];
@@ -301,7 +301,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const CString &_sPath, Course &out )
if( bUseCache )
{
CString sCacheFile = out.GetCacheFilePath();
RString sCacheFile = out.GetCacheFilePath();
LOG->Trace( "CourseLoaderCRS::LoadFromCRSFile(\"%s\") (\"%s\")", sPath.c_str(), sCacheFile.c_str() );
sPath = sCacheFile.c_str();
}
@@ -322,7 +322,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const CString &_sPath, Course &out )
/* If we have any cache data, write the cache file. */
if( out.m_RadarCache.size() )
{
CString sCachePath = out.GetCacheFilePath();
RString sCachePath = out.GetCacheFilePath();
CourseWriterCRS::Write( out, sCachePath, true );
SONGINDEX->AddCacheIndex( out.m_sPath, GetHashForFile(out.m_sPath) );
@@ -332,7 +332,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const CString &_sPath, Course &out )
return true;
}
bool CourseLoaderCRS::LoadEdit( const CString &sEditFilePath, ProfileSlot slot )
bool CourseLoaderCRS::LoadEdit( const RString &sEditFilePath, ProfileSlot slot )
{
LOG->Trace( "CourseLoaderCRS::LoadEdit(%s)", sEditFilePath.c_str() );
@@ -358,7 +358,7 @@ bool CourseLoaderCRS::LoadEdit( const CString &sEditFilePath, ProfileSlot slot )
return true;
}
bool CourseLoaderCRS::LoadEditFromBuffer( const CString &sBuffer, const CString &sPath, ProfileSlot slot )
bool CourseLoaderCRS::LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot )
{
Course *pCourse = new Course;
if( !LoadFromBuffer(sPath, sBuffer, *pCourse) )
+5 -5
View File
@@ -10,11 +10,11 @@ class MsdFile;
class CourseLoaderCRS
{
public:
static bool LoadFromCRSFile( const CString &sPath, Course &out );
static bool LoadFromMsd( const CString &sPath, const MsdFile &msd, Course &out, bool bFromCache );
static bool LoadFromBuffer( const CString &sPath, const CString &sBuffer, Course &out );
static bool LoadEdit( const CString &sEditFilePath, ProfileSlot slot );
static bool LoadEditFromBuffer( const CString &sBuffer, const CString &sPath, ProfileSlot slot );
static bool LoadFromCRSFile( const RString &sPath, Course &out );
static bool LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache );
static bool LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out );
static bool LoadEdit( const RString &sEditFilePath, ProfileSlot slot );
static bool LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot );
};
#endif
+10 -10
View File
@@ -17,8 +17,8 @@
//
static bool CompareCoursePointersByName( const Course* pCourse1, const Course* pCourse2 )
{
CString sName1 = pCourse1->GetDisplayFullTitle();
CString sName2 = pCourse2->GetDisplayFullTitle();
RString sName1 = pCourse1->GetDisplayFullTitle();
RString sName2 = pCourse2->GetDisplayFullTitle();
return sName1.CompareNoCase( sName2 ) < 0;
}
@@ -119,7 +119,7 @@ void CourseUtil::MoveRandomToEnd( vector<Course*> &vpCoursesInOut )
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareRandom );
}
static map<const Course*, CString> course_sort_val;
static map<const Course*, RString> course_sort_val;
bool CompareCoursePointersBySortValueAscending( const Course *pSong1, const Course *pSong2 )
{
@@ -181,7 +181,7 @@ void CourseUtil::SortByMostRecentlyPlayedForMachine( vector<Course*> &vpCoursesI
FOREACH_CONST( Course*, vpCoursesInOut, c )
{
int iNumTimesPlayed = pProfile->GetCourseNumTimesPlayed( *c );
CString val = iNumTimesPlayed ? pProfile->GetCourseLastPlayedDateTime(*c).GetString() : "9999999999999";
RString val = iNumTimesPlayed ? pProfile->GetCourseLastPlayedDateTime(*c).GetString() : "9999999999999";
course_sort_val[*c] = val;
}
@@ -199,7 +199,7 @@ void CourseUtil::MakeDefaultEditCourseEntry( CourseEntry& out )
// Autogen
//////////////////////////////////
void CourseUtil::AutogenEndlessFromGroup( const CString &sGroupName, Difficulty diff, Course &out )
void CourseUtil::AutogenEndlessFromGroup( const RString &sGroupName, Difficulty diff, Course &out )
{
out.m_bIsAutogen = true;
out.m_bRepeat = true;
@@ -233,7 +233,7 @@ void CourseUtil::AutogenEndlessFromGroup( const CString &sGroupName, Difficulty
out.m_vEntries.push_back( e );
}
void CourseUtil::AutogenNonstopFromGroup( const CString &sGroupName, Difficulty diff, Course &out )
void CourseUtil::AutogenNonstopFromGroup( const RString &sGroupName, Difficulty diff, Course &out )
{
AutogenEndlessFromGroup( sGroupName, diff, out );
@@ -248,7 +248,7 @@ void CourseUtil::AutogenNonstopFromGroup( const CString &sGroupName, Difficulty
out.m_vEntries.pop_back();
}
void CourseUtil::AutogenOniFromArtist( const CString &sArtistName, CString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc, Course &out )
void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc, Course &out )
{
out.m_bIsAutogen = true;
out.m_bRepeat = false;
@@ -329,7 +329,7 @@ Course *CourseID::ToCourse() const
{
// HACK for backwards compatibility:
// Re-add the leading "/". 2005/05/21 file layer changes added a leading slash.
CString sPath2 = sPath;
RString sPath2 = sPath;
if( sPath2.Left(1) != "/" )
sPath2 = "/" + sPath2;
@@ -370,13 +370,13 @@ void CourseID::LoadFromNode( const XNode* pNode )
pNode->GetAttrValue("FullTitle", sFullTitle);
}
CString CourseID::ToString() const
RString CourseID::ToString() const
{
if( !sPath.empty() )
return sPath;
if( !sFullTitle.empty() )
return sFullTitle;
return CString();
return RString();
}
bool CourseID::IsValid() const
+6 -6
View File
@@ -28,16 +28,16 @@ namespace CourseUtil
void MakeDefaultEditCourseEntry( CourseEntry &out );
void AutogenEndlessFromGroup( const CString &sGroupName, Difficulty dc, Course &out );
void AutogenNonstopFromGroup( const CString &sGroupName, Difficulty dc, Course &out );
void AutogenOniFromArtist( const CString &sArtistName, CString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc, Course &out );
void AutogenEndlessFromGroup( 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 );
};
class CourseID
{
public:
CString sPath;
CString sFullTitle;
RString sPath;
RString sFullTitle;
public:
CourseID() { Unset(); }
@@ -51,7 +51,7 @@ public:
XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode );
CString ToString() const;
RString ToString() const;
bool IsValid() const;
};
+8 -8
View File
@@ -8,7 +8,7 @@
#include "RageFileDriverMemory.h"
bool CourseWriterCRS::Write( const Course &course, const CString &sPath, bool bSavingCache )
bool CourseWriterCRS::Write( const Course &course, const RString &sPath, bool bSavingCache )
{
RageFile f;
if( !f.Open( sPath, RageFile::WRITE ) )
@@ -20,7 +20,7 @@ bool CourseWriterCRS::Write( const Course &course, const CString &sPath, bool bS
return CourseWriterCRS::Write( course, f, bSavingCache );
}
void CourseWriterCRS::GetEditFileContents( const Course *pCourse, CString &sOut )
void CourseWriterCRS::GetEditFileContents( const Course *pCourse, RString &sOut )
{
RageFileObjMem mem;
CourseWriterCRS::Write( *pCourse, mem, true );
@@ -58,11 +58,11 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
StepsType st = entry.first;
CourseDifficulty cd = entry.second;
vector<CString> asRadarValues;
vector<RString> asRadarValues;
const RadarValues &rv = it->second;
for( int r=0; r < NUM_RadarCategory; r++ )
asRadarValues.push_back( ssprintf("%.3f", rv[r]) );
CString sLine = ssprintf( "#RADAR:%i:%i:", st, cd );
RString sLine = ssprintf( "#RADAR:%i:%i:", st, cd );
sLine += join( ",", asRadarValues ) + ";";
f.PutLine( sLine );
}
@@ -103,12 +103,12 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
else if( entry.pSong )
{
// strip off everything but the group name and song dir
vector<CString> as;
vector<RString> as;
ASSERT( entry.pSong != NULL );
split( entry.pSong->GetSongDir(), "/", as );
ASSERT( as.size() >= 2 );
CString sGroup = as[ as.size()-2 ];
CString sSong = as[ as.size()-1 ];
RString sGroup = as[ as.size()-2 ];
RString sSong = as[ as.size()-1 ];
f.Write( "#SONG:" + sGroup + '/' + sSong );
}
else if( !entry.sSongGroup.empty() )
@@ -127,7 +127,7 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
f.Write( ssprintf( "%d..%d", entry.iLowMeter, entry.iHighMeter ) );
f.Write( ":" );
CString sModifiers = entry.sModifiers;
RString sModifiers = entry.sModifiers;
bool bDefaultSecret = entry.IsRandomSong();
if( bDefaultSecret != entry.bSecret )
{
+2 -2
View File
@@ -10,8 +10,8 @@ class CourseWriterCRS
{
public:
static bool Write( const Course &course, RageFileBasic &f, bool bSavingCache );
static bool Write( const Course &course, const CString &sPath, bool bSavingCache );
static void GetEditFileContents( const Course *pCourse, CString &sOut );
static bool Write( const Course &course, const RString &sPath, bool bSavingCache );
static void GetEditFileContents( const Course *pCourse, RString &sOut );
static void WriteEditFileToMachine( const Course *pCourse );
};
+3 -3
View File
@@ -190,7 +190,7 @@ unsigned int RageFileStore::CopyRangeTo2(BufferedTransformation &target, unsigne
return 0;
}
bool CryptHelpers::GenerateRSAKey( unsigned int keyLength, CString sSeed, CString &sPublicKey, CString &sPrivateKey )
bool CryptHelpers::GenerateRSAKey( unsigned int keyLength, RString sSeed, RString &sPublicKey, RString &sPrivateKey )
{
#ifdef _XBOX
return false;
@@ -217,7 +217,7 @@ bool CryptHelpers::GenerateRSAKey( unsigned int keyLength, CString sSeed, CStrin
#endif
}
bool CryptHelpers::SignFile( RageFileBasic &file, CString sPrivKey, CString &sSignatureOut, CString &sError )
bool CryptHelpers::SignFile( RageFileBasic &file, RString sPrivKey, RString &sSignatureOut, RString &sError )
{
#ifdef _XBOX
return false;
@@ -238,7 +238,7 @@ bool CryptHelpers::SignFile( RageFileBasic &file, CString sPrivKey, CString &sSi
#endif
}
bool CryptHelpers::VerifyFile( RageFileBasic &file, CString sSignature, CString sPublicKey, CString &sError )
bool CryptHelpers::VerifyFile( RageFileBasic &file, RString sSignature, RString sPublicKey, RString &sError )
{
try {
StringSource pubFile( sPublicKey, true );
+3 -3
View File
@@ -5,9 +5,9 @@ class RageFileBasic;
namespace CryptHelpers
{
bool GenerateRSAKey( unsigned int keyLength, CString sSeed, CString &sPublicKey, CString &sPrivateKey );
bool SignFile( RageFileBasic &file, CString sPrivKey, CString &sSignatureOut, CString &sError );
bool VerifyFile( RageFileBasic &file, CString sSignature, CString sPublicKey, CString &sError );
bool GenerateRSAKey( unsigned int keyLength, RString sSeed, RString &sPublicKey, RString &sPrivateKey );
bool SignFile( RageFileBasic &file, RString sPrivKey, RString &sSignatureOut, RString &sError );
bool VerifyFile( RageFileBasic &file, RString sSignature, RString sPublicKey, RString &sError );
};
#endif
+35 -35
View File
@@ -9,22 +9,22 @@
CryptManager* CRYPTMAN = NULL; // global and accessable from anywhere in our program
static const CString PRIVATE_KEY_PATH = "Data/private.rsa";
static const CString PUBLIC_KEY_PATH = "Data/public.rsa";
static const CString ALTERNATE_PUBLIC_KEY_DIR = "Data/keys/";
static const RString PRIVATE_KEY_PATH = "Data/private.rsa";
static const RString PUBLIC_KEY_PATH = "Data/public.rsa";
static const RString ALTERNATE_PUBLIC_KEY_DIR = "Data/keys/";
#if !defined(HAVE_CRYPTOPP)
CryptManager::CryptManager() { }
CryptManager::~CryptManager() { }
void CryptManager::GenerateRSAKey( unsigned int keyLength, CString privFilename, CString pubFilename, CString seed ) { }
void CryptManager::SignFileToFile( CString sPath, CString sSignatureFile ) { }
bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile, CString sPublicKeyFile ) { return true; }
bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile )
void CryptManager::GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename, RString seed ) { }
void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) { }
bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) { return true; }
bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile )
{
return true;
}
bool CryptManager::Verify( CString sPath, CString sSignature )
bool CryptManager::Verify( RString sPath, RString sSignature )
{
return true;
}
@@ -58,7 +58,7 @@ CryptManager::~CryptManager()
}
static bool WriteFile( CString sFile, CString sBuf )
static bool WriteFile( RString sFile, RString sBuf )
{
RageFile output;
if( !output.Open(sFile, RageFile::WRITE) )
@@ -78,11 +78,11 @@ static bool WriteFile( CString sFile, CString sBuf )
return true;
}
void CryptManager::GenerateRSAKey( unsigned int keyLength, CString privFilename, CString pubFilename, CString seed )
void CryptManager::GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename, RString seed )
{
ASSERT( PREFSMAN->m_bSignProfileData );
CString sPubKey, sPrivKey;
RString sPubKey, sPrivKey;
if( !CryptHelpers::GenerateRSAKey(keyLength, seed, sPubKey, sPrivKey) )
return;
@@ -97,16 +97,16 @@ void CryptManager::GenerateRSAKey( unsigned int keyLength, CString privFilename,
}
}
void CryptManager::SignFileToFile( CString sPath, CString sSignatureFile )
void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile )
{
ASSERT( PREFSMAN->m_bSignProfileData );
CString sPrivFilename = PRIVATE_KEY_PATH;
CString sMessageFilename = sPath;
RString sPrivFilename = PRIVATE_KEY_PATH;
RString sMessageFilename = sPath;
if( sSignatureFile.empty() )
sSignatureFile = sPath + SIGNATURE_APPEND;
CString sPrivKey;
RString sPrivKey;
if( !GetFileContents(sPrivFilename, sPrivKey) )
return;
@@ -123,8 +123,8 @@ void CryptManager::SignFileToFile( CString sPath, CString sSignatureFile )
return;
}
CString sSignature;
CString sError;
RString sSignature;
RString sError;
if( !CryptHelpers::SignFile(file, sPrivKey, sSignature, sError) )
{
LOG->Warn( "SignFileToFile failed: %s", sError.c_str() );
@@ -134,18 +134,18 @@ void CryptManager::SignFileToFile( CString sPath, CString sSignatureFile )
WriteFile( sSignatureFile, sSignature );
}
bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile )
bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile )
{
ASSERT( PREFSMAN->m_bSignProfileData );
if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) )
return true;
vector<CString> asKeys;
vector<RString> asKeys;
GetDirListing( ALTERNATE_PUBLIC_KEY_DIR, asKeys, false, true );
for( unsigned i = 0; i < asKeys.size(); ++i )
{
const CString &sKey = asKeys[i];
const RString &sKey = asKeys[i];
LOG->Trace( "Trying alternate key \"%s\" ...", sKey.c_str() );
if( VerifyFileWithFile(sPath, sSignatureFile, sKey) )
@@ -155,15 +155,15 @@ bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile )
return false;
}
bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile, CString sPublicKeyFile )
bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile )
{
ASSERT( PREFSMAN->m_bSignProfileData );
CString sMessageFilename = sPath;
RString sMessageFilename = sPath;
if( sSignatureFile.empty() )
sSignatureFile = sPath + SIGNATURE_APPEND;
CString sPublicKey;
RString sPublicKey;
if( !GetFileContents(sPublicKeyFile, sPublicKey) )
return false;
@@ -171,7 +171,7 @@ bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile, CS
if( iBytes > MAX_SIGNATURE_SIZE_BYTES )
return false;
CString sSignature;
RString sSignature;
if( !GetFileContents(sSignatureFile, sSignature) )
return false;
@@ -182,7 +182,7 @@ bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile, CS
return false;
}
CString sError;
RString sError;
if( !CryptHelpers::VerifyFile(file, sSignature, sPublicKey, sError) )
{
LOG->Warn( "VerifyFile(%s) failed: %s", sPath.c_str(), sError.c_str() );
@@ -192,14 +192,14 @@ bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile, CS
return true;
}
bool CryptManager::Verify( CString sPath, CString sSignature )
bool CryptManager::Verify( RString sPath, RString sSignature )
{
ASSERT( PREFSMAN->m_bSignProfileData );
CString sPublicKeyFile = PUBLIC_KEY_PATH;
CString sMessageFilename = sPath;
RString sPublicKeyFile = PUBLIC_KEY_PATH;
RString sMessageFilename = sPath;
CString sPublicKey;
RString sPublicKey;
if( !GetFileContents(sPublicKeyFile, sPublicKey) )
return false;
@@ -210,7 +210,7 @@ bool CryptManager::Verify( CString sPath, CString sSignature )
return false;
}
CString sError;
RString sError;
if( !CryptHelpers::VerifyFile(file, sSignature, sPublicKey, sError) )
{
LOG->Warn( "Verify(%s) failed: %s", sPath.c_str(), sError.c_str() );
@@ -221,9 +221,9 @@ bool CryptManager::Verify( CString sPath, CString sSignature )
}
#endif
static CString BinaryToHex( const unsigned char *string, int iNumBytes )
static RString BinaryToHex( const unsigned char *string, int iNumBytes )
{
CString s;
RString s;
for( int i=0; i<iNumBytes; i++ )
{
unsigned val = string[i];
@@ -232,7 +232,7 @@ static CString BinaryToHex( const unsigned char *string, int iNumBytes )
return s;
}
CString CryptManager::GetMD5( CString fn )
RString CryptManager::GetMD5( RString fn )
{
struct MD5Context md5c;
unsigned char digest[16];
@@ -243,7 +243,7 @@ CString CryptManager::GetMD5( CString fn )
if( !file.Open( fn, RageFile::READ ) )
{
LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() );
return CString();
return RString();
}
MD5Init(&md5c);
@@ -257,7 +257,7 @@ CString CryptManager::GetMD5( CString fn )
return BinaryToHex( digest, sizeof(digest) );
}
CString CryptManager::GetPublicKeyFileName()
RString CryptManager::GetPublicKeyFileName()
{
ASSERT( PREFSMAN->m_bSignProfileData );
+9 -9
View File
@@ -3,7 +3,7 @@
class RageFileBasic;
const CString SIGNATURE_APPEND = ".sig";
const RString SIGNATURE_APPEND = ".sig";
class CryptManager
{
@@ -11,17 +11,17 @@ public:
CryptManager();
~CryptManager();
static void GenerateRSAKey( unsigned int keyLength, CString privFilename, CString pubFilename, CString seed );
static void SignFileToFile( CString sPath, CString sSignatureFile = "" );
static bool VerifyFileWithFile( CString sPath, CString sSignatureFile = "" );
static bool VerifyFileWithFile( CString sPath, CString sSignatureFile, CString sPublicKeyFile );
static void GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename, RString seed );
static void SignFileToFile( RString sPath, RString sSignatureFile = "" );
static bool VerifyFileWithFile( RString sPath, RString sSignatureFile = "" );
static bool VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile );
static CString Sign( CString sPath );
static bool Verify( CString sPath, CString sSignature );
static RString Sign( RString sPath );
static bool Verify( RString sPath, RString sSignature );
static CString GetMD5( CString fn ); // in Hex
static RString GetMD5( RString fn ); // in Hex
static CString GetPublicKeyFileName();
static RString GetPublicKeyFileName();
};
extern CryptManager* CRYPTMAN; // global and accessable from anywhere in our program
+1 -1
View File
@@ -115,7 +115,7 @@ bool CsvFile::WriteFile( RageFileBasic &f ) const
{
FOREACH_CONST( StringVector, m_vvs, line )
{
CString sLine;
RString sLine;
FOREACH_CONST( RString, *line, value )
{
RString sVal = *value;
+2 -2
View File
@@ -52,8 +52,8 @@ DancingCharacters::DancingCharacters()
continue;
// load in any potential 2D stuff
CString sCharacterDirectory = pChar->m_sCharDir;
CString sCurrentAnim;
RString sCharacterDirectory = pChar->m_sCharDir;
RString sCurrentAnim;
sCurrentAnim = sCharacterDirectory + "2DIdle";
if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists
{
+15 -15
View File
@@ -76,9 +76,9 @@ void DateTime::StripTime()
//
// Common SQL/XML format: "YYYY-MM-DD HH:MM:SS"
//
CString DateTime::GetString() const
RString DateTime::GetString() const
{
CString s = ssprintf( "%d-%02d-%02d",
RString s = ssprintf( "%d-%02d-%02d",
tm_year+1900,
tm_mon+1,
tm_mday );
@@ -96,7 +96,7 @@ CString DateTime::GetString() const
return s;
}
bool DateTime::FromString( const CString sDateTime )
bool DateTime::FromString( const RString sDateTime )
{
Init();
@@ -129,12 +129,12 @@ success:
CString DayInYearToString( int iDayInYear )
RString DayInYearToString( int iDayInYear )
{
return ssprintf("DayInYear%03d",iDayInYear);
}
int StringToDayInYear( CString sDayInYear )
int StringToDayInYear( RString sDayInYear )
{
int iDayInYear;
if( sscanf( sDayInYear, "DayInYear%d", &iDayInYear ) != 1 )
@@ -142,7 +142,7 @@ int StringToDayInYear( CString sDayInYear )
return iDayInYear;
}
static const CString LAST_DAYS_NAME[NUM_LAST_DAYS] =
static const RString LAST_DAYS_NAME[NUM_LAST_DAYS] =
{
"Today",
"Yesterday",
@@ -153,7 +153,7 @@ static const CString LAST_DAYS_NAME[NUM_LAST_DAYS] =
"Day6Ago",
};
CString LastDayToString( int iLastDayIndex )
RString LastDayToString( int iLastDayIndex )
{
return LAST_DAYS_NAME[iLastDayIndex];
}
@@ -169,12 +169,12 @@ static const char *DAY_OF_WEEK_TO_NAME[DAYS_IN_WEEK] =
"Saturday",
};
CString DayOfWeekToString( int iDayOfWeekIndex )
RString DayOfWeekToString( int iDayOfWeekIndex )
{
return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex];
}
CString HourInDayToString( int iHourInDayIndex )
RString HourInDayToString( int iHourInDayIndex )
{
return ssprintf("Hour%02d", iHourInDayIndex);
}
@@ -197,7 +197,7 @@ static const char *MonthNames[] =
XToString( Month, NUM_Month );
XToLocalizedString( Month );
CString LastWeekToString( int iLastWeekIndex )
RString LastWeekToString( int iLastWeekIndex )
{
switch( iLastWeekIndex )
{
@@ -207,23 +207,23 @@ CString LastWeekToString( int iLastWeekIndex )
}
}
CString LastDayToLocalizedString( int iLastDayIndex )
RString LastDayToLocalizedString( int iLastDayIndex )
{
CString s = LastDayToString( iLastDayIndex );
RString s = LastDayToString( iLastDayIndex );
s.Replace( "Day", "" );
s.Replace( "Ago", " Ago" );
return s;
}
CString LastWeekToLocalizedString( int iLastWeekIndex )
RString LastWeekToLocalizedString( int iLastWeekIndex )
{
CString s = LastWeekToString( iLastWeekIndex );
RString s = LastWeekToString( iLastWeekIndex );
s.Replace( "Week", "" );
s.Replace( "Ago", " Ago" );
return s;
}
CString HourInDayToLocalizedString( int iHourIndex )
RString HourInDayToLocalizedString( int iHourIndex )
{
int iBeginHour = iHourIndex;
iBeginHour--;
+13 -13
View File
@@ -10,17 +10,17 @@ const int HOURS_IN_DAY = 24;
const int DAYS_IN_WEEK = 7;
enum Month { NUM_Month = 12 };
CString DayInYearToString( int iDayInYearIndex );
CString LastDayToString( int iLastDayIndex );
CString LastDayToLocalizedString( int iLastDayIndex );
CString DayOfWeekToString( int iDayOfWeekIndex );
CString DayOfWeekToLocalizedString( int iDayOfWeekIndex );
CString HourInDayToString( int iHourIndex );
CString HourInDayToLocalizedString( int iHourIndex );
const CString &MonthToString( Month month );
const CString &MonthToLocalizedString( Month month );
CString LastWeekToString( int iLastWeekIndex );
CString LastWeekToLocalizedString( int iLastWeekIndex );
RString DayInYearToString( int iDayInYearIndex );
RString LastDayToString( int iLastDayIndex );
RString LastDayToLocalizedString( int iLastDayIndex );
RString DayOfWeekToString( int iDayOfWeekIndex );
RString DayOfWeekToLocalizedString( int iDayOfWeekIndex );
RString HourInDayToString( int iHourIndex );
RString HourInDayToLocalizedString( int iHourIndex );
const RString &MonthToString( Month month );
const RString &MonthToLocalizedString( Month month );
RString LastWeekToString( int iLastWeekIndex );
RString LastWeekToLocalizedString( int iLastWeekIndex );
tm AddDays( tm start, int iDaysToMove );
tm GetYesterday( tm start );
@@ -51,8 +51,8 @@ struct DateTime
void StripTime();
CString GetString() const;
bool FromString( const CString sDateTime );
RString GetString() const;
bool FromString( const RString sDateTime );
};
+4 -4
View File
@@ -22,9 +22,9 @@ LuaFunction( DifficultyToLocalizedString, DifficultyToLocalizedString((Difficult
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
Difficulty StringToDifficulty( const CString& sDC )
Difficulty StringToDifficulty( const RString& sDC )
{
CString s2 = sDC;
RString s2 = sDC;
s2.MakeLower();
if( s2 == "beginner" ) return DIFFICULTY_BEGINNER;
else if( s2 == "easy" ) return DIFFICULTY_EASY;
@@ -51,7 +51,7 @@ static void LuaDifficulty(lua_State* L)
{
FOREACH_Difficulty( d )
{
CString s = DifficultyToString(d);
RString s = DifficultyToString(d);
s.MakeUpper();
LUA->SetGlobal( "DIFFICULTY_"+s, d );
}
@@ -90,7 +90,7 @@ static void LuaCourseDifficulty(lua_State* L)
{
FOREACH_CourseDifficulty( d )
{
CString s = CourseDifficultyToString(d);
RString s = CourseDifficultyToString(d);
s.MakeUpper();
LUA->SetGlobal( "COURSE_DIFFICULTY_"+s, d );
}
+6 -6
View File
@@ -18,9 +18,9 @@ enum Difficulty
DIFFICULTY_INVALID
};
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_Difficulty, dc )
const CString& DifficultyToString( Difficulty dc );
const CString& DifficultyToLocalizedString( Difficulty dc );
Difficulty StringToDifficulty( const CString& sDC );
const RString& DifficultyToString( Difficulty dc );
const RString& DifficultyToLocalizedString( Difficulty dc );
Difficulty StringToDifficulty( const RString& sDC );
typedef Difficulty CourseDifficulty;
@@ -28,9 +28,9 @@ typedef Difficulty CourseDifficulty;
#define FOREACH_CourseDifficulty FOREACH_Difficulty
#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=DIFFICULTY_INVALID; cd=GetNextShownCourseDifficulty(cd) )
const CString& CourseDifficultyToString( Difficulty dc );
const CString& CourseDifficultyToLocalizedString( Difficulty dc );
Difficulty StringToCourseDifficulty( const CString& sDC );
const RString& CourseDifficultyToString( Difficulty dc );
const RString& CourseDifficultyToLocalizedString( Difficulty dc );
Difficulty StringToCourseDifficulty( const RString& sDC );
Difficulty GetNextShownCourseDifficulty( Difficulty pn );
+4 -4
View File
@@ -18,7 +18,7 @@ DifficultyIcon::DifficultyIcon()
m_bBlank = false;
}
bool DifficultyIcon::Load( CString sPath )
bool DifficultyIcon::Load( RString sPath )
{
Sprite::Load( sPath );
int iStates = GetNumStates();
@@ -27,7 +27,7 @@ bool DifficultyIcon::Load( CString sPath )
bWarn = false;
if( bWarn )
{
CString sError = ssprintf(
RString sError = ssprintf(
"The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.",
sPath.c_str(),
NUM_Difficulty,
@@ -39,9 +39,9 @@ bool DifficultyIcon::Load( CString sPath )
return true;
}
void DifficultyIcon::LoadFromNode( const CString& sDir, const XNode* pNode )
void DifficultyIcon::LoadFromNode( const RString& sDir, const XNode* pNode )
{
CString sFile;
RString sFile;
if( !pNode->GetAttrValue( "File", sFile ) )
RageException::Throw( "MeterDisplay in " + sDir + " missing File attribute" );
+2 -2
View File
@@ -17,8 +17,8 @@ public:
DifficultyIcon();
virtual bool EarlyAbortDraw() const { return m_bBlank || Sprite::EarlyAbortDraw(); }
bool Load( CString sFilePath );
virtual void LoadFromNode( const CString& sDir, const XNode* pNode );
bool Load( RString sFilePath );
virtual void LoadFromNode( const RString& sDir, const XNode* pNode );
virtual Actor *Copy() const;
void SetFromSteps( PlayerNumber pn, const Steps* pSteps );
+1 -1
View File
@@ -25,7 +25,7 @@ DifficultyList::~DifficultyList()
{
}
void DifficultyList::SetName( const CString &sName )
void DifficultyList::SetName( const RString &sName )
{
ActorFrame::SetName( sName );
+1 -1
View File
@@ -16,7 +16,7 @@ class DifficultyList: public ActorFrame
public:
DifficultyList();
virtual ~DifficultyList();
virtual void SetName( const CString &sName );
virtual void SetName( const RString &sName );
void Load();
void SetFromGameState();
+16 -16
View File
@@ -19,9 +19,9 @@ DifficultyMeter::DifficultyMeter()
{
}
static CString GetDifficultyCommandName( Difficulty d ) { return "Set"+DifficultyToString(d); }
static CString GetCourseDifficultyCommandName( CourseDifficulty d ) { return "Set"+CourseDifficultyToString(d)+"Course"; }
static const CString DIFFICULTY_COMMAND_NAME_NONE = "SetNone";
static RString GetDifficultyCommandName( Difficulty d ) { return "Set"+DifficultyToString(d); }
static RString GetCourseDifficultyCommandName( CourseDifficulty d ) { return "Set"+CourseDifficultyToString(d)+"Course"; }
static const RString DIFFICULTY_COMMAND_NAME_NONE = "SetNone";
/* sID experiment:
*
@@ -45,9 +45,9 @@ static const CString DIFFICULTY_COMMAND_NAME_NONE = "SetNone";
* so I'm trying it first in only this object.
*/
void DifficultyMeter::Load( const CString &sType )
void DifficultyMeter::Load( const RString &sType )
{
/* We can't use global ThemeMetric<CString>s, because we can have multiple
/* We can't use global ThemeMetric<RString>s, because we can have multiple
* DifficultyMeters on screen at once, with different names. */
m_iNumFeetInMeter.Load(sType,"NumFeetInMeter");
m_iMaxFeetInMeter.Load(sType,"MaxFeetInMeter");
@@ -61,7 +61,7 @@ void DifficultyMeter::Load( const CString &sType )
if( m_bShowFeet )
{
m_textFeet.SetName( "Feet" );
CString Feet;
RString Feet;
if( !m_bAutoColorFeet )
{
for( unsigned i = 0; i < NUM_Difficulty; ++i )
@@ -118,11 +118,11 @@ void DifficultyMeter::Load( const CString &sType )
Unset();
}
void DifficultyMeter::LoadFromNode( const CString& sDir, const XNode* pNode )
void DifficultyMeter::LoadFromNode( const RString& sDir, const XNode* pNode )
{
ActorFrame::LoadFromNode( sDir, pNode );
CString s;
RString s;
pNode->GetAttrValue( "Type", s );
ASSERT( s.size() );
Load( s );
@@ -157,7 +157,7 @@ void DifficultyMeter::SetFromSteps( const Steps* pSteps )
}
Difficulty dc = pSteps->GetDifficulty();
SetInternal( pSteps->GetMeter(), dc, GetDifficultyCommandName(dc), dc == DIFFICULTY_EDIT ? pSteps->GetDescription() : CString() );
SetInternal( pSteps->GetMeter(), dc, GetDifficultyCommandName(dc), dc == DIFFICULTY_EDIT ? pSteps->GetDescription() : RString() );
}
void DifficultyMeter::SetFromTrail( const Trail* pTrail )
@@ -169,25 +169,25 @@ void DifficultyMeter::SetFromTrail( const Trail* pTrail )
}
CourseDifficulty cd = pTrail->m_CourseDifficulty;
SetInternal( pTrail->GetMeter(), cd, GetCourseDifficultyCommandName( cd ), CString() );
SetInternal( pTrail->GetMeter(), cd, GetCourseDifficultyCommandName( cd ), RString() );
}
void DifficultyMeter::Unset()
{
SetInternal( 0, DIFFICULTY_EDIT, DIFFICULTY_COMMAND_NAME_NONE, CString() );
SetInternal( 0, DIFFICULTY_EDIT, DIFFICULTY_COMMAND_NAME_NONE, RString() );
}
void DifficultyMeter::SetFromMeterAndDifficulty( int iMeter, Difficulty dc )
{
SetInternal( 0, dc, GetDifficultyCommandName(dc), CString() );
SetInternal( 0, dc, GetDifficultyCommandName(dc), RString() );
}
void DifficultyMeter::SetFromMeterAndCourseDifficulty( int iMeter, CourseDifficulty cd )
{
SetInternal( 0, cd, GetCourseDifficultyCommandName(cd), CString() );
SetInternal( 0, cd, GetCourseDifficultyCommandName(cd), RString() );
}
void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const CString &sDifficultyCommand, const CString &sDescription )
void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const RString &sDifficultyCommand, const RString &sDescription )
{
if( m_bShowFeet )
{
@@ -196,7 +196,7 @@ void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const CString &sDi
if( !m_bAutoColorFeet )
on = char(dc + '0');
CString sNewText;
RString sNewText;
int iNumOn = min( (int)m_iMaxFeetInMeter, iMeter );
sNewText.insert( sNewText.end(), iNumOn, on );
int iNumOff = max( 0, m_iNumFeetInMeter-iNumOn );
@@ -221,7 +221,7 @@ void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const CString &sDi
}
else
{
const CString sMeter = ssprintf( "%i", iMeter );
const RString sMeter = ssprintf( "%i", iMeter );
m_textMeter.SetText( sMeter );
}
+5 -5
View File
@@ -20,9 +20,9 @@ class DifficultyMeter: public ActorFrame
public:
DifficultyMeter();
void Load( const CString &sType );
void Load( const RString &sType );
void LoadFromNode( const CString& sDir, const XNode* pNode );
void LoadFromNode( const RString& sDir, const XNode* pNode );
virtual Actor *Copy() const;
void SetFromGameState( PlayerNumber pn );
@@ -36,10 +36,10 @@ public:
void PushSelf( lua_State *L );
private:
void SetInternal( int iMeter, Difficulty dc, const CString &sDifficultyCommand, const CString &sDescription );
void SetInternal( int iMeter, Difficulty dc, const RString &sDifficultyCommand, const RString &sDescription );
BitmapText m_textFeet; // bar
CString m_sCurDifficultyCommand;
RString m_sCurDifficultyCommand;
AutoActor m_Difficulty; /* "easy", "hard" */
BitmapText m_textMeter; /* 3, 9 */
BitmapText m_textEditDescription;
@@ -51,7 +51,7 @@ private:
ThemeMetric<bool> m_bShowMeter;
ThemeMetric<bool> m_bShowEditDescription;
ThemeMetric<bool> m_bAutoColorFeet;
ThemeMetric<CString> m_sZeroMeterString;
ThemeMetric<RString> m_sZeroMeterString;
};
#endif
+1 -1
View File
@@ -9,7 +9,7 @@ DualScrollBar::DualScrollBar()
m_fBarTime = 1;
}
void DualScrollBar::Load( const CString &sType )
void DualScrollBar::Load( const RString &sType )
{
FOREACH_PlayerNumber( pn )
{
+1 -1
View File
@@ -12,7 +12,7 @@ class DualScrollBar: public ActorFrame
public:
DualScrollBar();
void Load( const CString &sType );
void Load( const RString &sType );
void SetBarHeight( float fHeight ) { m_fBarHeight = fHeight; }
void SetBarTime( float fTime ) { m_fBarTime = fTime; }
void SetPercentage( PlayerNumber pn, float fPercent );
+2 -2
View File
@@ -8,7 +8,7 @@
Actor *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); }
void DynamicActorScroller::LoadFromNode( const CString &sDir, const XNode *pNode )
void DynamicActorScroller::LoadFromNode( const RString &sDir, const XNode *pNode )
{
ActorScroller::LoadFromNode( sDir, pNode );
@@ -30,7 +30,7 @@ void DynamicActorScroller::LoadFromNode( const CString &sDir, const XNode *pNode
this->AddChild( pCopy );
}
CString sLoadFunction;
RString sLoadFunction;
pNode->GetAttrValue( "LoadFunction", sLoadFunction );
m_LoadFunction.SetFromExpression( sLoadFunction );
+1 -1
View File
@@ -10,7 +10,7 @@ class DynamicActorScroller: public ActorScroller
{
public:
virtual Actor *Copy() const;
void LoadFromNode( const CString &sDir, const XNode *pNode );
void LoadFromNode( const RString &sDir, const XNode *pNode );
protected:
virtual void ShiftSubActors( int iDist );
+9 -9
View File
@@ -37,12 +37,12 @@ XToString( EditMenuAction, NUM_EditMenuAction );
XToLocalizedString( EditMenuAction );
StringToX( EditMenuAction );
static CString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
static CString ROW_VALUE_X_NAME( size_t i ) { return ssprintf("RowValue%dX",int(i+1)); }
static CString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); }
static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
static RString ROW_VALUE_X_NAME( size_t i ) { return ssprintf("RowValue%dX",int(i+1)); }
static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); }
void EditMenu::GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpSongsOut )
void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector<Song*> &vpSongsOut )
{
vpSongsOut.clear();
if( !SHOW_GROUPS.GetValue() )
@@ -68,7 +68,7 @@ void EditMenu::GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpS
SongUtil::SortSongPointerArrayByTitle( vpSongsOut );
}
void EditMenu::GetGroupsToShow( vector<CString> &vsGroupsOut )
void EditMenu::GetGroupsToShow( vector<RString> &vsGroupsOut )
{
vsGroupsOut.clear();
if( !SHOW_GROUPS.GetValue() )
@@ -77,7 +77,7 @@ void EditMenu::GetGroupsToShow( vector<CString> &vsGroupsOut )
SONGMAN->GetSongGroupNames( vsGroupsOut );
for( int i = vsGroupsOut.size()-1; i>=0; i-- )
{
const CString &sGroup = vsGroupsOut[i];
const RString &sGroup = vsGroupsOut[i];
vector<Song*> vpSongs;
GetSongsToShowForGroup( sGroup, vpSongs );
// strip groups that have no unlocked songs
@@ -95,7 +95,7 @@ EditMenu::~EditMenu()
BANNERCACHE->Undemand();
}
void EditMenu::Load( const CString &sType )
void EditMenu::Load( const RString &sType )
{
LOG->Trace( "EditMenu::Load" );
@@ -430,7 +430,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
// fall through
case ROW_STEPS:
{
CString s;
RString s;
Steps *pSteps = GetSelectedSteps();
if( pSteps && GetSelectedDifficulty() == DIFFICULTY_EDIT )
{
@@ -497,7 +497,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
m_textLabel[ROW_SOURCE_STEPS].SetHidden( GetSelectedSteps() ? true : false );
m_textValue[ROW_SOURCE_STEPS].SetHidden( GetSelectedSteps() ? true : false );
{
CString s;
RString s;
Steps *pSourceSteps = GetSelectedSourceSteps();
if( GetSelectedSourceDifficulty() == DIFFICULTY_INVALID )
s = BLANK;
+9 -9
View File
@@ -26,8 +26,8 @@ enum EditMenuRow
NUM_EditMenuRow
};
#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, NUM_EditMenuRow, r )
const CString& EditMenuRowToString( EditMenuRow r );
const CString& EditMenuRowToLocalizedString( EditMenuRow r );
const RString& EditMenuRowToString( EditMenuRow r );
const RString& EditMenuRowToLocalizedString( EditMenuRow r );
enum EditMenuAction
{
@@ -38,8 +38,8 @@ enum EditMenuAction
NUM_EditMenuAction
};
#define FOREACH_EditMenuAction( ema ) FOREACH_ENUM( EditMenuAction, NUM_EditMenuAction, ema )
const CString& EditMenuActionToString( EditMenuAction ema );
const CString& EditMenuActionToLocalizedString( EditMenuAction ema );
const RString& EditMenuActionToString( EditMenuAction ema );
const RString& EditMenuActionToLocalizedString( EditMenuAction ema );
const int NUM_ARROWS = 2;
@@ -48,7 +48,7 @@ class EditMenu: public ActorFrame
public:
EditMenu();
~EditMenu();
void Load( const CString &sType );
void Load( const RString &sType );
bool CanGoUp();
bool CanGoDown();
@@ -62,7 +62,7 @@ public:
void RefreshAll();
CString GetSelectedGroup() const { if( !SHOW_GROUPS.GetValue() ) return GROUP_ALL; ASSERT(m_iSelection[ROW_GROUP] < (int)m_sGroups.size()); return m_sGroups[m_iSelection[ROW_GROUP]]; }
RString GetSelectedGroup() const { if( !SHOW_GROUPS.GetValue() ) return GROUP_ALL; ASSERT(m_iSelection[ROW_GROUP] < (int)m_sGroups.size()); return m_sGroups[m_iSelection[ROW_GROUP]]; }
Song* GetSelectedSong() const { ASSERT(m_iSelection[ROW_SONG] < (int)m_pSongs.size()); return m_pSongs[m_iSelection[ROW_SONG]]; }
StepsType GetSelectedStepsType() const { ASSERT(m_iSelection[ROW_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_STEPS_TYPE]]; }
Steps* GetSelectedSteps() const { ASSERT(m_iSelection[ROW_STEPS] < (int)m_vpSteps.size()); return m_vpSteps[m_iSelection[ROW_STEPS]].pSteps; }
@@ -75,8 +75,8 @@ public:
EditMenuRow GetSelectedRow() const { return m_SelectedRow; }
private:
void GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpSongsOut );
void GetGroupsToShow( vector<CString> &vsGroupsOut );
void GetSongsToShowForGroup( const RString &sGroup, vector<Song*> &vpSongsOut );
void GetGroupsToShow( vector<RString> &vsGroupsOut );
void UpdateArrows();
Sprite m_sprArrows[NUM_ARROWS];
@@ -102,7 +102,7 @@ private:
Difficulty dc;
};
vector<CString> m_sGroups;
vector<RString> m_sGroups;
vector<Song*> m_pSongs;
vector<StepsType> m_StepsTypes;
vector<StepsAndDifficulty> m_vpSteps;
+1 -1
View File
@@ -3,7 +3,7 @@
#include "EnumHelper.h"
#include "ThemeManager.h"
CString GetThemedString( const CString &sClass, const CString &sValue )
RString GetThemedString( const RString &sClass, const RString &sValue )
{
return THEME->GetString( sClass, sValue );
}
+9 -9
View File
@@ -43,21 +43,21 @@ static inline T enum_add2( T val, int iAmt )
#define FOREACH_ENUM2( e, var ) for( e var=(e)0; var<NUM_##e; enum_add<e>( var, +1 ) )
static const CString EMPTY_STRING;
static const RString EMPTY_STRING;
// TypeName[] must be an array of const char *, not RString, to
// avoid initialization order problems when calling XToString.
// Use Check##X##ToStringParamType to enforce that.
#define XToString(X, CNT) \
static void Check##X##ToStringParamType( const char **p ) { } \
const CString& X##ToString( X x ) \
const RString& X##ToString( X x ) \
{ \
Check##X##ToStringParamType( X##Names ); \
static auto_ptr<CString> as_##X##Name[CNT]; \
static auto_ptr<RString> as_##X##Name[CNT]; \
if( as_##X##Name[0].get() == NULL ) { \
for( unsigned i = 0; i < CNT; ++i ) \
{ \
auto_ptr<CString> ap( new CString( X##Names[i] ) ); \
auto_ptr<RString> ap( new RString( X##Names[i] ) ); \
as_##X##Name[i] = ap; \
} \
} \
@@ -69,7 +69,7 @@ static const CString EMPTY_STRING;
}
#define XToLocalizedString(X) \
const CString &X##ToLocalizedString( X x ) \
const RString &X##ToLocalizedString( X x ) \
{ \
static auto_ptr<LocalizedString> g_##X##Name[NUM_##X]; \
if( g_##X##Name[0].get() == NULL ) { \
@@ -83,9 +83,9 @@ static const CString EMPTY_STRING;
}
#define StringToX(X) \
X StringTo##X( const CString& s ) \
X StringTo##X( const RString& s ) \
{ \
CString s2 = s; \
RString s2 = s; \
s2.MakeLower(); \
unsigned i; \
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
@@ -105,11 +105,11 @@ static void Lua##X(lua_State* L) \
{ \
FOREACH_ENUM( X, CNT, i ) \
{ \
CString s = X##Names[i]; \
RString s = X##Names[i]; \
s.MakeUpper(); \
LUA->SetGlobal( Prefix+s, i ); \
} \
CString sType = "NUM" #X "S" ; \
RString sType = "NUM" #X "S" ; \
if( bCapitalize ) \
sType.MakeUpper(); \
LUA->SetGlobal( sType, CNT ); \
+6 -6
View File
@@ -79,7 +79,7 @@ void FadingBanner::Load( RageTextureID ID, bool bLowResToHighRes )
* corresponding high-res banner. */
void FadingBanner::BeforeChange( bool bLowResToHighRes )
{
CString sCommand;
RString sCommand;
if( bLowResToHighRes )
sCommand = "FadeFromCached";
else
@@ -98,7 +98,7 @@ void FadingBanner::BeforeChange( bool bLowResToHighRes )
/* If this returns true, a low-resolution banner was loaded, and the full-res
* banner should be loaded later. */
bool FadingBanner::LoadFromCachedBanner( const CString &path )
bool FadingBanner::LoadFromCachedBanner( const RString &path )
{
/* If we're already on the given banner, don't fade again. */
if( path != "" && m_Banner[m_iIndexLatest].GetTexturePath() == path )
@@ -160,7 +160,7 @@ void FadingBanner::LoadFromSong( const Song* pSong )
/* Don't call HasBanner. That'll do disk access and cause the music wheel
* to skip. */
CString sPath = pSong->GetBannerPath();
RString sPath = pSong->GetBannerPath();
if( sPath.empty() )
LoadFallback();
else
@@ -179,9 +179,9 @@ void FadingBanner::LoadMode()
m_Banner[m_iIndexLatest].LoadMode();
}
void FadingBanner::LoadFromSongGroup( CString sSongGroup )
void FadingBanner::LoadFromSongGroup( RString sSongGroup )
{
const CString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
const RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
LoadFromCachedBanner( sGroupBannerPath );
}
@@ -195,7 +195,7 @@ void FadingBanner::LoadFromCourse( const Course* pCourse )
/* Don't call HasBanner. That'll do disk access and cause the music wheel
* to skip. */
CString sPath = pCourse->m_sBannerPath;
RString sPath = pCourse->m_sBannerPath;
if( sPath.empty() )
LoadCourseFallback();
else
+2 -2
View File
@@ -21,7 +21,7 @@ public:
void LoadFromSong( const Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadMode();
void LoadFromSongGroup( CString sSongGroup );
void LoadFromSongGroup( RString sSongGroup );
void LoadFromCourse( const Course* pCourse );
void LoadIconFromCharacter( Character* pCharacter );
void LoadRoulette();
@@ -29,7 +29,7 @@ public:
void LoadFallback();
void LoadCourseFallback();
bool LoadFromCachedBanner( const CString &path );
bool LoadFromCachedBanner( const RString &path );
void SetMovingFast( bool fast ) { m_bMovingFast=fast; }
virtual void Update( float fDeltaTime );
+25 -25
View File
@@ -330,10 +330,10 @@ void Font::SetDefaultGlyph( FontPage *pPage )
/* Given the INI for a font, find all of the texture pages for the font. */
void Font::GetFontPaths( const CString &sFontIniPath, vector<CString> &asTexturePathsOut )
void Font::GetFontPaths( const RString &sFontIniPath, vector<RString> &asTexturePathsOut )
{
CString sPrefix = SetExtension( sFontIniPath, "" );
vector<CString> asFiles;
RString sPrefix = SetExtension( sFontIniPath, "" );
vector<RString> asFiles;
GetDirListing( sPrefix + "*", asFiles, false, true );
for( unsigned i = 0; i < asFiles.size(); ++i )
@@ -343,7 +343,7 @@ void Font::GetFontPaths( const CString &sFontIniPath, vector<CString> &asTexture
}
}
CString Font::GetPageNameFromFileName( const CString &sFilename )
RString Font::GetPageNameFromFileName( const RString &sFilename )
{
size_t begin = sFilename.find_first_of( '[' );
if( begin == string::npos )
@@ -360,7 +360,7 @@ CString Font::GetPageNameFromFileName( const CString &sFilename )
return sFilename.substr( begin, end-begin+1 );
}
void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CString &sTexturePath, const CString &sPageName, CString sChars )
void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &sPageName, RString sChars )
{
cfg.m_sTexturePath = sTexturePath;
@@ -396,8 +396,8 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
{
FOREACH_CONST_Attr( pNode, pAttr )
{
CString sName = pAttr->first;
const CString &sValue = pAttr->second;
RString sName = pAttr->first;
const RString &sValue = pAttr->second;
sName.MakeUpper();
@@ -421,7 +421,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
* map 1=2 is the same as
* range unicode #1-1=2
*/
CString sCodepoint = sName.substr(4); /* "CODEPOINT" */
RString sCodepoint = sName.substr(4); /* "CODEPOINT" */
const Game* pGame = NULL;
@@ -429,7 +429,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
{
/* There's a space; the first word should be a game type. Split it. */
unsigned pos = sCodepoint.find_first_of( ' ' );
CString gamename = sCodepoint.substr( 0, pos );
RString gamename = sCodepoint.substr( 0, pos );
sCodepoint = sCodepoint.substr( pos+1 );
pGame = GameManager::StringToGameType(gamename);
@@ -483,7 +483,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
* Map hiragana to 0-84:
* range Unicode #3041-3094=0
*/
vector<CString> asMatches;
vector<RString> asMatches;
static Regex parse("^RANGE ([A-Z\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$");
bool bMatch = parse.Compare( sName, asMatches );
@@ -509,7 +509,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
iCount = iLast - iFirst + 1;
}
CString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount );
RString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount );
if( !sRet.empty() )
RageException::Throw( "Font definition '%s' has an invalid range '%s': %s.",
ini.GetPath().c_str(), sName.c_str(), sRet.c_str() );
@@ -525,7 +525,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
*
* This lets us assign characters very compactly and readably. */
CString sRowStr = sName.substr(5);
RString sRowStr = sName.substr(5);
ASSERT( IsAnInt(sRowStr) );
const int iRow = atoi( sRowStr.c_str() );
const int iFirstFrame = iRow * iNumFramesWide;
@@ -568,7 +568,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr
cfg.CharToGlyphNo[0x00A0] = cfg.CharToGlyphNo[' '];
}
CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyphNo, int iCount )
RString FontPageSettings::MapRange( RString sMapping, int iMapOffset, int iGlyphNo, int iCount )
{
if( !sMapping.CompareNoCase("Unicode") )
{
@@ -591,7 +591,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
iCount--;
}
return CString();
return RString();
}
const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping );
@@ -622,10 +622,10 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
if( iCount )
return "Map overflow"; /* there aren't enough characters in the map */
return CString();
return RString();
}
static vector<CString> LoadStack;
static vector<RString> LoadStack;
/*
* A font set is a set of files, eg:
@@ -645,7 +645,7 @@ static vector<CString> LoadStack;
* However, if it doesn't, we don't know what it is and the font will receive
* no default mapping. A font isn't useful with no characters mapped.
*/
void Font::Load( const CString &sIniPath, CString sChars )
void Font::Load( const RString &sIniPath, RString sChars )
{
ASSERT_M( !GetExtension(sIniPath).CompareNoCase("ini"), sIniPath );
@@ -654,7 +654,7 @@ void Font::Load( const CString &sIniPath, CString sChars )
{
if( LoadStack[i] == sIniPath )
{
CString str = join("\n", LoadStack);
RString str = join("\n", LoadStack);
str += "\n" + sIniPath;
RageException::Throw("Font import recursion detected\n%s", str.c_str());
}
@@ -668,7 +668,7 @@ void Font::Load( const CString &sIniPath, CString sChars )
m_sChars = sChars;
/* Get the filenames associated with this font. */
vector<CString> asTexturePaths;
vector<RString> asTexturePaths;
GetFontPaths( sIniPath, asTexturePaths );
bool bCapitalsOnly = false;
@@ -685,19 +685,19 @@ void Font::Load( const CString &sIniPath, CString sChars )
{
/* If this is a top-level font (not a subfont), load the default font first. */
vector<CString> ImportList;
vector<RString> ImportList;
if( LoadStack.size() == 1 )
ImportList.push_back("Common default");
/* Check to see if we need to import any other fonts. Do this
* before loading this font, so any characters in this font
* override imported characters. */
CString imports;
RString imports;
ini.GetValue( "main", "import", imports );
split(imports, ",", ImportList, true);
for(unsigned i = 0; i < ImportList.size(); ++i)
{
CString path = THEME->GetPathF( "", ImportList[i], true );
RString path = THEME->GetPathF( "", ImportList[i], true );
if( path == "" )
{
LOG->Warn("Font \"%s\" imports a font \"%s\" that doesn't exist", sIniPath.c_str(), ImportList[i].c_str());
@@ -713,12 +713,12 @@ void Font::Load( const CString &sIniPath, CString sChars )
/* Load each font page. */
for( unsigned i = 0; i < asTexturePaths.size(); ++i )
{
const CString &sTexturePath = asTexturePaths[i];
const RString &sTexturePath = asTexturePaths[i];
FontPage *pPage = new FontPage;
/* Grab the page name, eg "foo" from "Normal [foo].png". */
CString sPagename = GetPageNameFromFileName( sTexturePath );
RString sPagename = GetPageNameFromFileName( sTexturePath );
/* Load settings for this page from the INI. */
FontPageSettings cfg;
@@ -736,7 +736,7 @@ void Font::Load( const CString &sIniPath, CString sChars )
{
if( it->second < pPage->m_pTexture->GetNumFrames() )
continue; /* OK */
CString sError = ssprintf( "The font '%s' maps %s to frame %i, but the font only has %i frames.",
RString sError = ssprintf( "The font '%s' maps %s to frame %i, but the font only has %i frames.",
sTexturePath.c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, pPage->m_pTexture->GetNumFrames() );
RageException::Throw( sError );
}
+10 -10
View File
@@ -33,7 +33,7 @@ struct glyph
struct FontPageSettings
{
CString m_sTexturePath;
RString m_sTexturePath;
int m_iDrawExtraPixelsLeft,
m_iDrawExtraPixelsRight,
@@ -44,7 +44,7 @@ struct FontPageSettings
m_iDefaultWidth,
m_iAdvanceExtraPixels;
float m_fScaleAllWidthsBy;
CString m_sTextureHints;
RString m_sTextureHints;
map<longchar,int> CharToGlyphNo;
/* If a value is missing, the width of the texture frame is used. */
@@ -64,7 +64,7 @@ struct FontPageSettings
/* Map a range from a character map to glyphs. If cnt is -1, map the
* whole map. Returns "" or an error message. */
CString MapRange( CString sMapping, int iMapOffset, int iGlyphOffset, int iCount );
RString MapRange( RString sMapping, int iMapOffset, int iGlyphOffset, int iCount );
};
class FontPage
@@ -87,7 +87,7 @@ public:
RageTexture* m_pTexture;
// XXX remove?
CString m_sTexturePath;
RString m_sTexturePath;
/* All glyphs in this list will point to m_pTexture. */
vector<glyph> m_aGlyphs;
@@ -103,7 +103,7 @@ class Font
{
public:
int m_iRefCount;
CString path;
RString path;
Font();
~Font();
@@ -121,7 +121,7 @@ public:
/* Steal all of a font's pages. */
void MergeFont(Font &f);
void Load(const CString &sFontOrTextureFilePath, CString sChars);
void Load(const RString &sFontOrTextureFilePath, RString sChars);
void Unload();
void Reload();
@@ -154,11 +154,11 @@ private:
bool m_bRightToLeft;
/* We keep this around only for reloading. */
CString m_sChars;
RString m_sChars;
void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CString &sTexturePath, const CString &PageName, CString sChars );
static void GetFontPaths( const CString &sFontOrTextureFilePath, vector<CString> &sTexturePaths );
CString GetPageNameFromFileName( const CString &sFilename );
void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars );
static void GetFontPaths( const RString &sFontOrTextureFilePath, vector<RString> &sTexturePaths );
RString GetPageNameFromFileName( const RString &sFilename );
};
/* Last private-use Unicode character: */
+6 -6
View File
@@ -7,9 +7,9 @@
#include <map>
/* Map from "&foo;" to a UTF-8 string. */
typedef map<CString, wchar_t, StdString::StdStringLessNoCase> aliasmap;
typedef map<RString, wchar_t, StdString::StdStringLessNoCase> aliasmap;
static aliasmap CharAliases;
static map<CString,CString> CharAliasRepl;
static map<RString,RString> CharAliasRepl;
/* 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. :) */
@@ -322,15 +322,15 @@ static void InitCharAliases()
for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i)
{
CString from = i->first;
CString to = WcharToUTF8(i->second);
RString from = i->first;
RString to = WcharToUTF8(i->second);
from.MakeLower();
CharAliasRepl[from] = to;
}
}
/* Replace all &markers; and &#NNNN;s with UTF-8. */
void FontCharAliases::ReplaceMarkers( CString &sText )
void FontCharAliases::ReplaceMarkers( RString &sText )
{
InitCharAliases();
ReplaceEntityText( sText, CharAliasRepl );
@@ -338,7 +338,7 @@ void FontCharAliases::ReplaceMarkers( CString &sText )
}
/* Replace all &markers; and &#NNNN;s with UTF-8. */
bool FontCharAliases::GetChar( CString &codepoint, wchar_t &ch )
bool FontCharAliases::GetChar( RString &codepoint, wchar_t &ch )
{
InitCharAliases();
aliasmap::const_iterator i = CharAliases.find(codepoint);
+2 -2
View File
@@ -3,8 +3,8 @@
namespace FontCharAliases
{
void ReplaceMarkers( CString &sText );
bool GetChar( CString &codepoint, wchar_t &ch );
void ReplaceMarkers( RString &sText );
bool GetChar( RString &codepoint, wchar_t &ch );
};
#endif
+3 -3
View File
@@ -5,7 +5,7 @@
const wchar_t FontCharmaps::M_SKIP = 0xFEFF;
static map<CString,const wchar_t*> charmaps;
static map<RString,const wchar_t*> charmaps;
using namespace FontCharmaps;
@@ -159,13 +159,13 @@ static void Init()
charmaps["numbers"] = map_numbers;
}
const wchar_t *FontCharmaps::get_char_map(CString name)
const wchar_t *FontCharmaps::get_char_map(RString name)
{
Init();
name.MakeLower();
map<CString,const wchar_t*>::const_iterator i = charmaps.find(name);
map<RString,const wchar_t*>::const_iterator i = charmaps.find(name);
if(i == charmaps.end())
return NULL;
+1 -1
View File
@@ -4,7 +4,7 @@
namespace FontCharmaps
{
extern const wchar_t M_SKIP;
const wchar_t *get_char_map(CString name);
const wchar_t *get_char_map(RString name);
};
#endif
+2 -2
View File
@@ -10,7 +10,7 @@
FontManager* FONT = NULL; // global and accessable from anywhere in our program
// map from file name to a texture holder
typedef pair<CString,CString> FontName;
typedef pair<RString,RString> FontName;
static map<FontName, Font*> g_mapPathToFont;
FontManager::FontManager()
@@ -38,7 +38,7 @@ void FontManager::ReloadFonts()
}
}
Font* FontManager::LoadFont( const CString &sFontOrTextureFilePath, CString sChars )
Font* FontManager::LoadFont( const RString &sFontOrTextureFilePath, RString sChars )
{
// Convert the path to lowercase so that we don't load duplicates.
// Really, this does not solve the duplicate problem. We could have two copies
+1 -1
View File
@@ -12,7 +12,7 @@ public:
FontManager();
~FontManager();
Font* LoadFont( const CString &sFontOrTextureFilePath, CString sChars = "" );
Font* LoadFont( const RString &sFontOrTextureFilePath, RString sChars = "" );
Font *CopyFont( Font *pFont );
void UnloadFont( Font *fp );

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