Changed many uses of Dialog::OK and LOG->Warn to use ReportScriptError.
This commit is contained in:
+13
-17
@@ -4,7 +4,6 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageMath.h"
|
||||
#include "RageLog.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "Foreach.h"
|
||||
#include "XmlFile.h"
|
||||
#include "LuaBinding.h"
|
||||
@@ -793,10 +792,7 @@ void Actor::BeginTweening( float time, ITween *pTween )
|
||||
// recursing ActorCommand.
|
||||
if( m_Tweens.size() > 50 )
|
||||
{
|
||||
RString sError = ssprintf( "Tween overflow: \"%s\"; infinitely recursing ActorCommand?", GetLineage().c_str() );
|
||||
|
||||
LOG->Warn( "%s", sError.c_str() );
|
||||
Dialog::OK( sError );
|
||||
LuaHelpers::ReportScriptErrorFmt("Tween overflow: \"%s\"; infinitely recursing ActorCommand?", GetLineage().c_str());
|
||||
this->FinishTweening();
|
||||
}
|
||||
|
||||
@@ -1129,7 +1125,7 @@ void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTab
|
||||
{
|
||||
if( !cmds.IsSet() || cmds.IsNil() )
|
||||
{
|
||||
LOG->Warn( "RunCommands: command is unset or nil" );
|
||||
LuaHelpers::ReportScriptError("RunCommands: command is unset or nil");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1139,7 +1135,7 @@ void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTab
|
||||
cmds.PushSelf( L );
|
||||
if( lua_isnil(L, -1) )
|
||||
{
|
||||
LOG->Warn("Error compiling commands");
|
||||
LuaHelpers::ReportScriptError("Error compiling commands");
|
||||
LUA->Release(L);
|
||||
return;
|
||||
}
|
||||
@@ -1300,7 +1296,7 @@ void Actor::AddCommand( const RString &sCmdName, apActorCommands apac )
|
||||
if( HasCommand(sCmdName) )
|
||||
{
|
||||
RString sWarning = GetLineage()+"'s command '"+sCmdName+"' defined twice";
|
||||
Dialog::OK( sWarning, "COMMAND_DEFINED_TWICE" );
|
||||
LuaHelpers::ReportScriptError(sWarning, "COMMAND_DEFINED_TWICE");
|
||||
}
|
||||
|
||||
RString sMessage;
|
||||
@@ -1403,7 +1399,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: sleep(%f): time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: sleep(%f): time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
p->Sleep(fTime);
|
||||
@@ -1414,7 +1410,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: linear(%f): tween time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: linear(%f): tween time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
p->BeginTweening(fTime, TWEEN_LINEAR);
|
||||
@@ -1425,7 +1421,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: accelerate(%f): tween time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: accelerate(%f): tween time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
p->BeginTweening(fTime, TWEEN_ACCELERATE);
|
||||
@@ -1436,7 +1432,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: decelerate(%f): tween time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: decelerate(%f): tween time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
p->BeginTweening(fTime, TWEEN_DECELERATE);
|
||||
@@ -1447,7 +1443,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: spring(%f): tween time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: spring(%f): tween time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
p->BeginTweening(fTime, TWEEN_SPRING);
|
||||
@@ -1458,7 +1454,7 @@ public:
|
||||
float fTime = FArg(1);
|
||||
if (fTime < 0)
|
||||
{
|
||||
LOG->Warn("Lua: tween(%f): tween time must not be negative", fTime);
|
||||
LuaHelpers::ReportScriptErrorFmt("Lua: tween(%f): tween time must not be negative", fTime);
|
||||
return 0;
|
||||
}
|
||||
ITween *pTween = ITween::CreateFromStack( L, 2 );
|
||||
@@ -1558,7 +1554,7 @@ public:
|
||||
float fPeriod = FArg(1);
|
||||
if (fPeriod <= 0)
|
||||
{
|
||||
LOG->Warn("Effect period (%f) must be positive; ignoring", fPeriod);
|
||||
LuaHelpers::ReportScriptErrorFmt("Effect period (%f) must be positive; ignoring", fPeriod);
|
||||
return 0;
|
||||
}
|
||||
p->SetEffectPeriod(FArg(1));
|
||||
@@ -1569,13 +1565,13 @@ public:
|
||||
float f1 = FArg(1), f2 = FArg(2), f3 = FArg(3), f4 = FArg(4);
|
||||
if (f1 < 0 || f2 < 0 || f3 < 0 || f4 < 0)
|
||||
{
|
||||
LOG->Warn("Effect timings (%f,%f,%f,%f) must not be negative; ignoring",
|
||||
LuaHelpers::ReportScriptErrorFmt("Effect timings (%f,%f,%f,%f) must not be negative; ignoring",
|
||||
f1, f2, f3, f4);
|
||||
return 0;
|
||||
}
|
||||
if (f1 == 0 && f2 == 0 && f3 == 0 && f4 == 0)
|
||||
{
|
||||
LOG->Warn("Effect timings (0,0,0,0) must not all be zero; ignoring");
|
||||
LuaHelpers::ReportScriptErrorFmt("Effect timings (0,0,0,0) must not all be zero; ignoring");
|
||||
return 0;
|
||||
}
|
||||
p->SetEffectTiming(FArg(1), FArg(2), FArg(3), FArg(4));
|
||||
|
||||
+3
-3
@@ -224,7 +224,7 @@ void ActorFrame::DrawPrimitives()
|
||||
{
|
||||
if( m_bClearZBuffer )
|
||||
{
|
||||
LOG->Warn( "ClearZBuffer not supported on ActorFrames" );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ClearZBuffer not supported on ActorFrames" );
|
||||
m_bClearZBuffer = false;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void ActorFrame::DrawPrimitives()
|
||||
m_DrawFunction.PushSelf( L );
|
||||
if( lua_isnil(L, -1) )
|
||||
{
|
||||
LOG->Warn( "Error compiling DrawFunction" );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Error compiling DrawFunction" );
|
||||
return;
|
||||
}
|
||||
this->PushSelf( L );
|
||||
@@ -478,7 +478,7 @@ void ActorFrame::UpdateInternal( float fDeltaTime )
|
||||
m_UpdateFunction.PushSelf( L );
|
||||
if( lua_isnil(L, -1) )
|
||||
{
|
||||
LOG->Warn( "Error compiling UpdateFunction" );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Error compiling UpdateFunction" );
|
||||
return;
|
||||
}
|
||||
this->PushSelf( L );
|
||||
|
||||
+10
-10
@@ -358,13 +358,13 @@ void ActorMultiVertex::AMV_TweenState::SetDrawState( DrawMode dm, int first, int
|
||||
{
|
||||
if(first >= (int)vertices.size() && vertices.size() > 0)
|
||||
{
|
||||
LOG->Warn("ActorMultiVertex:SetDrawState: FirstToDraw > vertices.size(), %d > %u", FirstToDraw + 1, (unsigned int)vertices.size() );
|
||||
LuaHelpers::ReportScriptErrorFmt("ActorMultiVertex:SetDrawState: FirstToDraw > vertices.size(), %d > %u", FirstToDraw + 1, (unsigned int)vertices.size() );
|
||||
return;
|
||||
}
|
||||
int safe_num= GetSafeNumToDraw( dm, num );
|
||||
if( num != safe_num && num != -1 )
|
||||
{
|
||||
LOG->Warn("ActorMultiVertex:SetDrawState: NumToDraw %d is not valid for %u vertices with DrawMode %s", num, (unsigned int)vertices.size(), DrawModeNames[dm] );
|
||||
LuaHelpers::ReportScriptErrorFmt("ActorMultiVertex:SetDrawState: NumToDraw %d is not valid for %u vertices with DrawMode %s", num, (unsigned int)vertices.size(), DrawModeNames[dm] );
|
||||
return;
|
||||
}
|
||||
_DrawMode= dm;
|
||||
@@ -416,7 +416,7 @@ public:
|
||||
// Use the number of arguments to determine which property a table is for
|
||||
if(lua_type(L, DataStackIndex) != LUA_TTABLE)
|
||||
{
|
||||
LOG->Warn("ActorMultiVertex::SetVertex: non-table parameter supplied. Table of tables of vertex data expected.");
|
||||
LuaHelpers::ReportScriptErrorFmt("ActorMultiVertex::SetVertex: non-table parameter supplied. Table of tables of vertex data expected.");
|
||||
return;
|
||||
}
|
||||
size_t NumDataParts = lua_objlen(L, DataStackIndex);
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
size_t DataPieceElements = lua_objlen(L, DataPieceIndex);
|
||||
if(lua_type(L, DataPieceIndex) != LUA_TTABLE)
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetVertex: non-table parameter %u supplied inside table of parameters, table expected.", (unsigned int)i );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: non-table parameter %u supplied inside table of parameters, table expected.", (unsigned int)i );
|
||||
return;
|
||||
}
|
||||
int pushes = 1;
|
||||
@@ -462,7 +462,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetVertex: Parameter %u has %u elements supplied. 2, 3, or 4 expected.", (unsigned int)i, (unsigned int)DataPieceElements );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: Parameter %u has %u elements supplied. 2, 3, or 4 expected.", (unsigned int)i, (unsigned int)DataPieceElements );
|
||||
|
||||
}
|
||||
// Avoid a stack underflow by only popping the amount we pushed.
|
||||
@@ -477,7 +477,7 @@ public:
|
||||
int Index = IArg(1)-1;
|
||||
if( Index < 0 )
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetVertex: index %d provided, cannot set Index < 1", Index+1 );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: index %d provided, cannot set Index < 1", Index+1 );
|
||||
return 0;
|
||||
}
|
||||
else if( Index == (int) p->GetNumVertices() )
|
||||
@@ -486,7 +486,7 @@ public:
|
||||
}
|
||||
else if( Index > (int) p->GetNumVertices() )
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetVertex: Cannot set vertex %d if there is no vertex %d, only %u vertices.", Index+1 , Index, (unsigned int)p->GetNumVertices() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: Cannot set vertex %d if there is no vertex %d, only %u vertices.", Index+1 , Index, (unsigned int)p->GetNumVertices() );
|
||||
return 0;
|
||||
}
|
||||
SetVertexFromStack(p, L, Index, lua_gettop(L));
|
||||
@@ -504,7 +504,7 @@ public:
|
||||
First = IArg(1)-1;
|
||||
if( First < 0 )
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetVertices: index %d provided, cannot set Index < 1", First+1 );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertices: index %d provided, cannot set Index < 1", First+1 );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -542,7 +542,7 @@ public:
|
||||
float Width = FArg(1);
|
||||
if( Width < 0 )
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex::SetLineWidth: cannot set negative width." );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetLineWidth: cannot set negative width." );
|
||||
return 0;
|
||||
}
|
||||
p->SetLineWidth(Width);
|
||||
@@ -557,7 +557,7 @@ public:
|
||||
int ArgsIndex= 1;
|
||||
if( !lua_istable(L, ArgsIndex) )
|
||||
{
|
||||
LOG->Warn( "ActorMultiVertex:SetDrawState: Table expected, something else recieved. Doing nothing.");
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex:SetDrawState: Table expected, something else recieved. Doing nothing.");
|
||||
return 0;
|
||||
}
|
||||
// Fetch the draw mode, if provided.
|
||||
|
||||
+2
-3
@@ -246,7 +246,7 @@ namespace
|
||||
{
|
||||
LUA->Release( L );
|
||||
sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
|
||||
Dialog::OK( sError, "LUA_ERROR" );
|
||||
LuaHelpers::ReportScriptError(sError);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,6 @@ bool ActorUtil::LoadTableFromStackShowErrors( Lua *L )
|
||||
if( !LuaHelpers::RunScriptOnStack(L, Error, 0, 1, true) )
|
||||
{
|
||||
lua_pop( L, 1 );
|
||||
Dialog::OK( Error, "LUA_ERROR" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -286,7 +285,7 @@ bool ActorUtil::LoadTableFromStackShowErrors( Lua *L )
|
||||
|
||||
Error = ssprintf( "%s: must return a table", debug.short_src );
|
||||
|
||||
Dialog::OK( Error, "LUA_ERROR" );
|
||||
LuaHelpers::ReportScriptError(Error, "LUA_ERROR");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+4
-4
@@ -328,7 +328,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
|
||||
switch( ft )
|
||||
{
|
||||
default:
|
||||
LOG->Warn( "CreateBackground() Unknown file type '%s'", vsResolved[0].c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "CreateBackground() Unknown file type '%s'", vsResolved[0].c_str() );
|
||||
// fall through
|
||||
case FT_Bitmap:
|
||||
case FT_Sprite:
|
||||
@@ -364,12 +364,12 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
|
||||
BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway );
|
||||
if( vsPaths.empty() )
|
||||
{
|
||||
LOG->Warn( "BackgroundEffect '%s' is missing.",sEffect.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "BackgroundEffect '%s' is missing.",sEffect.c_str() );
|
||||
sEffect = SBE_Centered;
|
||||
}
|
||||
else if( vsPaths.size() > 1 )
|
||||
{
|
||||
LOG->Warn( "BackgroundEffect '%s' has more than one match.",sEffect.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "BackgroundEffect '%s' has more than one match.",sEffect.c_str() );
|
||||
sEffect = SBE_Centered;
|
||||
}
|
||||
else
|
||||
@@ -744,7 +744,7 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
|
||||
XNode *pNode = change.m_def.CreateNode();
|
||||
RString xml = XmlFileUtil::GetXML( pNode );
|
||||
Trim( xml );
|
||||
LOG->Warn( "Tried to switch to a background that was never loaded:\n%s", xml.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Tried to switch to a background that was never loaded:\n%s", xml.c_str() );
|
||||
SAFE_DELETE( pNode );
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ void BitmapText::LoadFromNode( const XNode* pNode )
|
||||
if( !pNode->GetAttrValue("Font", sFont) &&
|
||||
!pNode->GetAttrValue("File", sFont) ) // accept "File" for backward compatibility
|
||||
{
|
||||
LOG->Warn( "%s: BitmapText: Font or File attribute not found",
|
||||
LuaHelpers::ReportScriptErrorFmt( "%s: BitmapText: Font or File attribute not found",
|
||||
ActorUtil::GetWhere(pNode).c_str() );
|
||||
sFont = "Common Normal";
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ void ComboGraph::Load( RString sMetricsGroup )
|
||||
if( m_pComboNumber != NULL )
|
||||
this->AddChild( m_pComboNumber );
|
||||
else
|
||||
LOG->Warn( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" );
|
||||
LuaHelpers::ReportScriptErrorFmt( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ static void RemoveStepsTypes( vector<StepsType>& inout, RString sStepsTypesToRem
|
||||
StepsType st = GAMEMAN->StringToStepsType(*i);
|
||||
if( st == StepsType_Invalid )
|
||||
{
|
||||
LOG->Warn( "Invalid StepsType value '%s' in '%s'", i->c_str(), sStepsTypesToRemove.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Invalid StepsType value '%s' in '%s'", i->c_str(), sStepsTypesToRemove.c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "Steps.h"
|
||||
#include "GameState.h"
|
||||
#include "RageDisplay.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "Trail.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "XmlFile.h"
|
||||
@@ -35,7 +34,7 @@ bool DifficultyIcon::Load( RString sPath )
|
||||
NUM_Difficulty,
|
||||
NUM_Difficulty*2,
|
||||
iStates );
|
||||
Dialog::OK( sError );
|
||||
LuaHelpers::ReportScriptError(sError);
|
||||
}
|
||||
StopAnimating();
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const
|
||||
{
|
||||
RString errmsg;
|
||||
LuaHelpers::Pop(L, errmsg);
|
||||
LOG->Warn(errmsg.c_str());
|
||||
LuaHelpers::ReportScriptError(errmsg);
|
||||
lua_pop(L, 2);
|
||||
return iInvalid;
|
||||
}
|
||||
|
||||
+1
-3
@@ -14,7 +14,6 @@
|
||||
#include "Game.h"
|
||||
#include "Style.h"
|
||||
#include "Foreach.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "PlayerState.h"
|
||||
#include "SongManager.h"
|
||||
@@ -426,8 +425,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
else
|
||||
{
|
||||
RString sWarning = ssprintf( "Command '%s' is not valid.", cmd.GetOriginalCommandString().c_str() );
|
||||
LOG->Warn( "%s", sWarning.c_str() );
|
||||
Dialog::OK( sWarning, "INVALID_GAME_COMMAND" );
|
||||
LuaHelpers::ReportScriptError(sWarning, "INVALID_GAME_COMMAND");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1879,7 +1879,7 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName )
|
||||
{
|
||||
if( file.GetLine(sLine) == -1 )
|
||||
{
|
||||
LOG->Warn( "Error reading \"%s\": %s", NAME_BLACKLIST_FILE, file.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Error reading \"%s\": %s", NAME_BLACKLIST_FILE, file.GetError().c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2085,7 +2085,7 @@ Difficulty GameState::GetEasiestStepsDifficulty() const
|
||||
{
|
||||
if( m_pCurSteps[p] == NULL )
|
||||
{
|
||||
LOG->Warn( "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
|
||||
LuaHelpers::ReportScriptErrorFmt( "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
|
||||
continue;
|
||||
}
|
||||
dc = min( dc, m_pCurSteps[p]->GetDifficulty() );
|
||||
@@ -2100,7 +2100,7 @@ Difficulty GameState::GetHardestStepsDifficulty() const
|
||||
{
|
||||
if( m_pCurSteps[p] == NULL )
|
||||
{
|
||||
LOG->Warn( "GetHardestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
|
||||
LuaHelpers::ReportScriptErrorFmt( "GetHardestStepsDifficulty called but p%i hasn't chosen notes", p+1 );
|
||||
continue;
|
||||
}
|
||||
dc = max( dc, m_pCurSteps[p]->GetDifficulty() );
|
||||
|
||||
+14
-5
@@ -789,7 +789,7 @@ bool LuaHelpers::LoadScript( Lua *L, const RString &sScript, const RString &sNam
|
||||
return true;
|
||||
}
|
||||
|
||||
void LuaHelpers::ReportScriptError(RString const& Error)
|
||||
void LuaHelpers::ReportScriptError(RString const& Error, RString ErrorType)
|
||||
{
|
||||
size_t line_break_pos= Error.find('\n');
|
||||
RString short_error;
|
||||
@@ -803,6 +803,17 @@ void LuaHelpers::ReportScriptError(RString const& Error)
|
||||
}
|
||||
SCREENMAN->SystemMessage(short_error);
|
||||
LOG->Warn(Error.c_str());
|
||||
Dialog::OK(Error, ErrorType);
|
||||
}
|
||||
|
||||
// For convenience when replacing uses of LOG->Warn.
|
||||
void LuaHelpers::ReportScriptErrorFmt(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
RString Buff = vssprintf( fmt, va );
|
||||
va_end( va );
|
||||
ReportScriptError(Buff);
|
||||
}
|
||||
|
||||
bool LuaHelpers::RunScriptOnStack( Lua *L, RString &Error, int Args, int ReturnValues, bool ReportError )
|
||||
@@ -862,11 +873,9 @@ bool LuaHelpers::RunScript( Lua *L, const RString &Script, const RString &Name,
|
||||
|
||||
bool LuaHelpers::RunExpression( Lua *L, const RString &sExpression, const RString &sName )
|
||||
{
|
||||
RString sError;
|
||||
if( !LuaHelpers::RunScript(L, "return " + sExpression, sName.empty()? RString("in"):sName, sError, 0, 1) )
|
||||
RString sError= ssprintf("Lua runtime error parsing \"%s\": ", sName.size()? sName.c_str():sExpression.c_str());
|
||||
if(!LuaHelpers::RunScript(L, "return " + sExpression, sName.empty()? RString("in"):sName, sError, 0, 1, true))
|
||||
{
|
||||
sError = ssprintf( "Lua runtime error parsing \"%s\": %s", sName.size()? sName.c_str():sExpression.c_str(), sError.c_str() );
|
||||
Dialog::OK( sError, "LUA_ERROR" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+3
-1
@@ -59,7 +59,9 @@ namespace LuaHelpers
|
||||
bool LoadScript( Lua *L, const RString &sScript, const RString &sName, RString &sError );
|
||||
|
||||
/* Report the error through the log and on the screen. */
|
||||
void ReportScriptError(RString const& Error);
|
||||
void ReportScriptError(RString const& Error, RString ErrorType= "LUA_ERROR");
|
||||
// For convenience when replacing uses of LOG->Warn.
|
||||
void ReportScriptErrorFmt(const char *fmt, ...);
|
||||
|
||||
/* Run the function with arguments at the top of the stack, with the given
|
||||
* number of arguments. The specified number of return values are left on
|
||||
|
||||
@@ -24,7 +24,7 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
||||
RageFile input;
|
||||
if( !input.Open(sPath) )
|
||||
{
|
||||
LOG->Warn("Error opening file '%s' for reading: %s", sPath.c_str(), input.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt("Error opening file '%s' for reading: %s", sPath.c_str(), input.GetError().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
||||
break;
|
||||
if( ret == -1 )
|
||||
{
|
||||
LOG->Warn("Error reading %s: %s", input.GetPath().c_str(), input.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt("Error reading %s: %s", input.GetPath().c_str(), input.GetError().c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1613,7 +1613,7 @@ Song *MusicWheel::GetPreferredSelectionForRandomOrPortal()
|
||||
return wid[iSelection]->m_pSong;
|
||||
}
|
||||
}
|
||||
LOG->Warn( "Couldn't find any songs" );
|
||||
LuaHelpers::ReportScriptError( "Couldn't find any songs" );
|
||||
return wid[0]->m_pSong;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ Actor *NoteSkinManager::LoadActor( const RString &sButton, const RString &sEleme
|
||||
// Make sure pActor is a Sprite (or something derived from Sprite).
|
||||
Sprite *pSprite = dynamic_cast<Sprite *>( pRet );
|
||||
if( pSprite == NULL )
|
||||
LOG->Warn( "%s: %s %s must be a Sprite", m_sCurrentNoteSkin.c_str(), sButton.c_str(), sElement.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "%s: %s %s must be a Sprite", m_sCurrentNoteSkin.c_str(), sButton.c_str(), sElement.c_str() );
|
||||
}
|
||||
|
||||
return pRet;
|
||||
|
||||
+15
-15
@@ -824,7 +824,7 @@ public:
|
||||
{
|
||||
if(m_pLuaTable->GetLuaType() != LUA_TTABLE)
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: Result of \"%s\" is not a table.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: Result of \"%s\" is not a table.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
m_pLuaTable->PushSelf(L);
|
||||
@@ -832,7 +832,7 @@ public:
|
||||
const char *pStr = lua_tostring(L, -1);
|
||||
if( pStr == NULL )
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"Name\" entry is not a string.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"Name\" entry is not a string.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -841,7 +841,7 @@ public:
|
||||
pStr = lua_tostring(L, -1);
|
||||
if(pStr == NULL || StringToLayoutType(pStr) == LayoutType_Invalid)
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"LayoutType\" entry is not a string.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"LayoutType\" entry is not a string.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -850,7 +850,7 @@ public:
|
||||
pStr = lua_tostring(L, -1);
|
||||
if(pStr == NULL || StringToSelectType(pStr) == SelectType_Invalid)
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"SelectType\" entry is not a string.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"SelectType\" entry is not a string.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -858,12 +858,12 @@ public:
|
||||
lua_getfield(L, -1, "Choices");
|
||||
if(!lua_istable(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"Choices\" is not a table.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"Choices\" is not a table.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
if(!TableContainsOnlyStrings(L, lua_gettop(L)))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"Choices\" table contains a non-string.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"Choices\" table contains a non-string.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -873,7 +873,7 @@ public:
|
||||
{
|
||||
if(!lua_isfunction(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"EnabledForPlayers\" is not a function.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"EnabledForPlayers\" is not a function.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
m_pLuaTable->PushSelf( L );
|
||||
@@ -881,7 +881,7 @@ public:
|
||||
LuaHelpers::RunScriptOnStack(L, error, 1, 1, true);
|
||||
if(!lua_istable(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"EnabledForPlayers\" did not return a table.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"EnabledForPlayers\" did not return a table.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pushnil(L);
|
||||
@@ -890,7 +890,7 @@ public:
|
||||
PlayerNumber pn= Enum::Check<PlayerNumber>(L, -1, true, true);
|
||||
if(pn == PlayerNumber_Invalid)
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"EnabledForPlayers\" contains a non-PlayerNumber.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"EnabledForPlayers\" contains a non-PlayerNumber.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -903,12 +903,12 @@ public:
|
||||
{
|
||||
if(!lua_istable(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"ReloadRowMessages\" is not a table.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"ReloadRowMessages\" is not a table.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
if(!TableContainsOnlyStrings(L, lua_gettop(L)))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"ReloadRowMessages\" table contains a non-string.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"ReloadRowMessages\" table contains a non-string.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -917,7 +917,7 @@ public:
|
||||
lua_getfield(L, -1, "LoadSelections");
|
||||
if(!lua_isfunction(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"LoadSelections\" entry is not a function.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"LoadSelections\" entry is not a function.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -925,7 +925,7 @@ public:
|
||||
lua_getfield(L, -1, "SaveSelections");
|
||||
if(!lua_isfunction(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"SaveSelections\" entry is not a function.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"SaveSelections\" entry is not a function.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -933,7 +933,7 @@ public:
|
||||
lua_getfield(L, -1, "NotifyOfSelection");
|
||||
if(!lua_isnil(L, -1) && !lua_isfunction(L, -1))
|
||||
{
|
||||
LOG->Warn("LUA_ERROR: \"%s\" \"NotifyOfSelection\" entry is not a function.", RowName.c_str());
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"NotifyOfSelection\" entry is not a function.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
@@ -1278,7 +1278,7 @@ public:
|
||||
ConfOption *pConfOption = ConfOption::Find( sParam );
|
||||
if( pConfOption == NULL )
|
||||
{
|
||||
LOG->Warn( "Invalid Conf type \"%s\"", sParam.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Invalid Conf type \"%s\"", sParam.c_str() );
|
||||
pConfOption = ConfOption::Find( "Invalid" );
|
||||
ASSERT_M( pConfOption != NULL, "ConfOption::Find(Invalid)" );
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ public:
|
||||
IPreference *pPref = IPreference::GetPreferenceByName( sName );
|
||||
if( pPref == NULL )
|
||||
{
|
||||
LOG->Warn( "GetPreference: unknown preference \"%s\"", sName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "GetPreference: unknown preference \"%s\"", sName.c_str() );
|
||||
lua_pushnil( L );
|
||||
return 1;
|
||||
}
|
||||
@@ -550,7 +550,7 @@ public:
|
||||
IPreference *pPref = IPreference::GetPreferenceByName( sName );
|
||||
if( pPref == NULL )
|
||||
{
|
||||
LOG->Warn( "SetPreference: unknown preference \"%s\"", sName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "SetPreference: unknown preference \"%s\"", sName.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ public:
|
||||
IPreference *pPref = IPreference::GetPreferenceByName( sName );
|
||||
if( pPref == NULL )
|
||||
{
|
||||
LOG->Warn( "SetPreferenceToDefault: unknown preference \"%s\"", sName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "SetPreferenceToDefault: unknown preference \"%s\"", sName.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -905,7 +905,7 @@ ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature
|
||||
int iBytes = pFile->GetFileSize();
|
||||
if( iBytes > MAX_PLAYER_STATS_XML_SIZE_BYTES )
|
||||
{
|
||||
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||
return ProfileLoadResult_FailedTampered;
|
||||
}
|
||||
}
|
||||
@@ -919,7 +919,7 @@ ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature
|
||||
// verify the stats.xml signature with the "don't share" file
|
||||
if( !CryptManager::VerifyFileWithFile(sStatsXmlSigFile, sDontShareFile) )
|
||||
{
|
||||
LOG->Warn( "The don't share check for '%s' failed. Data will be ignored.", sStatsXmlSigFile.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "The don't share check for '%s' failed. Data will be ignored.", sStatsXmlSigFile.c_str() );
|
||||
return ProfileLoadResult_FailedTampered;
|
||||
}
|
||||
LOG->Trace( "Done." );
|
||||
@@ -928,7 +928,7 @@ ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature
|
||||
LOG->Trace( "Verifying stats.xml signature" );
|
||||
if( !CryptManager::VerifyFileWithFile(fn, sStatsXmlSigFile) )
|
||||
{
|
||||
LOG->Warn( "The signature check for '%s' failed. Data will be ignored.", fn.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "The signature check for '%s' failed. Data will be ignored.", fn.c_str() );
|
||||
return ProfileLoadResult_FailedTampered;
|
||||
}
|
||||
LOG->Trace( "Done." );
|
||||
@@ -1065,7 +1065,7 @@ bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const
|
||||
RageFile f;
|
||||
if( !f.Open(fn, RageFile::WRITE) )
|
||||
{
|
||||
LOG->Warn( "Couldn't open %s for writing: %s", fn.c_str(), f.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Couldn't open %s for writing: %s", fn.c_str(), f.GetError().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1288,7 +1288,7 @@ ProfileLoadResult Profile::LoadEditableDataFromDir( RString sDir )
|
||||
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
|
||||
if( iBytes > MAX_EDITABLE_INI_SIZE_BYTES )
|
||||
{
|
||||
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||
return ProfileLoadResult_FailedTampered;
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
||||
// If options set a NextScreen or one is specified in metrics, then fade out
|
||||
if( GetNextScreenName() == "" )
|
||||
{
|
||||
LOG->Warn( "%s::HandleScreenMessage: Tried to fade out, but we have no next screen", m_sName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "%s::HandleScreenMessage: Tried to fade out, but we have no next screen", m_sName.c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,14 @@ void ScreenOptionsMaster::Init()
|
||||
|
||||
OptionRowHandler *pHand = OptionRowHandlerUtil::Make( cmds );
|
||||
if( pHand == NULL )
|
||||
RageException::Throw( "Invalid OptionRowHandler \"%s\" in \"%s::Line%i\".", cmds.GetOriginalCommandString().c_str(), m_sName.c_str(), i );
|
||||
OptionRowHandlers.push_back( pHand );
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt("Invalid OptionRowHandler \"%s\" in \"%s::Line%i\".", cmds.GetOriginalCommandString().c_str(), m_sName.c_str(), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
OptionRowHandlers.push_back( pHand );
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT( OptionRowHandlers.size() == asLineNames.size() );
|
||||
|
||||
InitMenu( OptionRowHandlers );
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM)
|
||||
LOG->Trace("[ScreenSMOnlineLogin::HandleScreenMessage] SMOnlinePack");
|
||||
if(!GAMESTATE->IsPlayerEnabled((PlayerNumber) m_iPlayer))
|
||||
{
|
||||
LOG->Warn("Invalid player number: %i", m_iPlayer);
|
||||
LuaHelpers::ReportScriptErrorFmt("Invalid player number: %i", m_iPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ void ScreenSelectMaster::Init()
|
||||
int from, to;
|
||||
if( sscanf( parts[part], "%d:%d", &from, &to ) != 2 )
|
||||
{
|
||||
LOG->Warn( "%s::OptionOrder%s parse error", m_sName.c_str(), MenuDirToString(dir).c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "%s::OptionOrder%s parse error", m_sName.c_str(), MenuDirToString(dir).c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "GameSoundManager.h"
|
||||
#include "MemoryCardDisplay.h"
|
||||
#include "InputEventPlus.h"
|
||||
#include "arch/Dialog/Dialog.h" // wow I import this for JUST ONE THING. -aj
|
||||
|
||||
#define TIMER_STEALTH THEME->GetMetricB(m_sName,"TimerStealth")
|
||||
#define SHOW_STAGE_DISPLAY THEME->GetMetricB(m_sName,"ShowStageDisplay")
|
||||
@@ -203,7 +202,6 @@ void ScreenWithMenuElements::StartPlayingMusic()
|
||||
if( !LuaHelpers::RunScript(L, Script, "@"+m_sPathToMusic, Error, 0, 1, true) )
|
||||
{
|
||||
LUA->Release( L );
|
||||
Dialog::OK( Error, "LUA_ERROR" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
+6
-6
@@ -935,7 +935,7 @@ void SongManager::InitRandomAttacks()
|
||||
MsdFile msd;
|
||||
|
||||
if( !msd.ReadFile( ATTACK_FILE, true ) )
|
||||
LOG->Warn( "Error opening file '%s' for reading: %s.", ATTACK_FILE.c_str(), msd.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Error opening file '%s' for reading: %s.", ATTACK_FILE.c_str(), msd.GetError().c_str() );
|
||||
else
|
||||
{
|
||||
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
||||
@@ -947,13 +947,13 @@ void SongManager::InitRandomAttacks()
|
||||
|
||||
if( iNumParams > 2 )
|
||||
{
|
||||
LOG->Warn( "Got \"%s:%s\" tag with too many parameters", sType.c_str(), sAttack.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Got \"%s:%s\" tag with too many parameters", sType.c_str(), sAttack.c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !sType.EqualsNoCase("ATTACK") )
|
||||
{
|
||||
LOG->Warn( "Got \"%s:%s\" tag with wrong declaration", sType.c_str(), sAttack.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Got \"%s:%s\" tag with wrong declaration", sType.c_str(), sAttack.c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1219,7 @@ void SongManager::GetExtraStageInfo( bool bExtra2, const Style *sd, Song*& pSong
|
||||
if( GAMESTATE->m_pCurSong == NULL )
|
||||
{
|
||||
// This normally shouldn't happen, but it's helpful to permit it for testing.
|
||||
LOG->Warn( "GetExtraStageInfo() called in GROUP_ALL, but GAMESTATE->m_pCurSong == NULL" );
|
||||
LuaHelpers::ReportScriptErrorFmt( "GetExtraStageInfo() called in GROUP_ALL, but GAMESTATE->m_pCurSong == NULL" );
|
||||
GAMESTATE->m_pCurSong.Set( GetRandomSong() );
|
||||
}
|
||||
sGroup = GAMESTATE->m_pCurSong->m_sGroupName;
|
||||
@@ -1737,7 +1737,7 @@ void SongManager::LoadStepEditsFromProfileDir( const RString &sProfileDir, Profi
|
||||
|
||||
if( (int) vsFiles.size() > MAX_EDIT_STEPS_PER_PROFILE - iNumEditsLoaded )
|
||||
{
|
||||
LOG->Warn("Profile %s has too many edits; some have been skipped.", ProfileSlotToString( slot ).c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt("Profile %s has too many edits; some have been skipped.", ProfileSlotToString( slot ).c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1779,7 +1779,7 @@ void SongManager::LoadStepEditsFromProfileDir( const RString &sProfileDir, Profi
|
||||
|
||||
if( (int) vsEdits.size() > MAX_EDIT_STEPS_PER_PROFILE - iNumEditsLoaded )
|
||||
{
|
||||
LOG->Warn("Profile %s has too many edits; some have been skipped.", ProfileSlotToString( slot ).c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt("Profile %s has too many edits; some have been skipped.", ProfileSlotToString( slot ).c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@
|
||||
#include "RageTexture.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "Foreach.h"
|
||||
#include "LuaBinding.h"
|
||||
#include "LuaManager.h"
|
||||
@@ -743,7 +742,7 @@ void Sprite::SetState( int iNewState )
|
||||
else
|
||||
sError = ssprintf("A Sprite (\"%s\") tried to set state index %d, but no texture is loaded.",
|
||||
this->m_sName.c_str(), iNewState );
|
||||
Dialog::OK( sError, "SPRITE_INVALID_FRAME" );
|
||||
LuaHelpers::ReportScriptError(sError, "SPRITE_INVALID_FRAME");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ public:
|
||||
int iCol = IArg(2) - 1;
|
||||
if( iCol < 0 || iCol >= p->m_iColsPerPlayer )
|
||||
{
|
||||
LOG->Warn( "Style:GetColumnDrawOrder(): column %i out of range( 1 to %i )", iCol+1, p->m_iColsPerPlayer );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Style:GetColumnDrawOrder(): column %i out of range( 1 to %i )", iCol+1, p->m_iColsPerPlayer );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
int iCol = IArg(1) - 1;
|
||||
if( iCol < 0 || iCol >= p->m_iColsPerPlayer*NUM_PLAYERS )
|
||||
{
|
||||
LOG->Warn( "Style:GetColumnDrawOrder(): column %i out of range( 1 to %i )", iCol+1, p->m_iColsPerPlayer*NUM_PLAYERS );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Style:GetColumnDrawOrder(): column %i out of range( 1 to %i )", iCol+1, p->m_iColsPerPlayer*NUM_PLAYERS );
|
||||
return 0;
|
||||
}
|
||||
lua_pushnumber( L, p->m_iColumnDrawOrder[iCol]+1 );
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "FontCharAliases.h"
|
||||
#include "RageFile.h"
|
||||
#include "Foreach.h"
|
||||
#include "LuaManager.h"
|
||||
#include "XmlFile.h"
|
||||
#include "XmlFileUtil.h"
|
||||
|
||||
@@ -62,7 +63,7 @@ void TitleTrans::LoadFromNode( const XNode* pNode )
|
||||
else if( sKeyName == "ArtistTransTo") Replacement.ArtistTranslit = sValue;
|
||||
else if( sKeyName == "SubtitleTransTo") Replacement.SubtitleTranslit = sValue;
|
||||
else
|
||||
LOG->Warn( "Unknown TitleSubst tag: \"%s\"", sKeyName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unknown TitleSubst tag: \"%s\"", sKeyName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ RString UnlockManager::FindEntryID( const RString &sName ) const
|
||||
|
||||
if( pEntry == NULL )
|
||||
{
|
||||
LOG->Warn( "Couldn't find locked entry \"%s\"", sName.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Couldn't find locked entry \"%s\"", sName.c_str() );
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -578,20 +578,20 @@ void UnlockManager::Load()
|
||||
case UnlockRewardType_Song:
|
||||
e->m_Song.FromSong( SONGMAN->FindSong( e->m_cmd.GetArg(0).s ) );
|
||||
if( !e->m_Song.IsValid() )
|
||||
LOG->Warn( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
break;
|
||||
case UnlockRewardType_Steps:
|
||||
e->m_Song.FromSong( SONGMAN->FindSong( e->m_cmd.GetArg(0).s ) );
|
||||
if( !e->m_Song.IsValid() )
|
||||
{
|
||||
LOG->Warn( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
e->m_dc = StringToDifficulty( e->m_cmd.GetArg(1).s );
|
||||
if( e->m_dc == Difficulty_Invalid )
|
||||
{
|
||||
LOG->Warn( "Unlock: Invalid difficulty \"%s\"", e->m_cmd.GetArg(1).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Invalid difficulty \"%s\"", e->m_cmd.GetArg(1).s.c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -601,21 +601,21 @@ void UnlockManager::Load()
|
||||
e->m_Song.FromSong( SONGMAN->FindSong( e->m_cmd.GetArg(0).s ) );
|
||||
if( !e->m_Song.IsValid() )
|
||||
{
|
||||
LOG->Warn( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Cannot find song matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
e->m_dc = StringToDifficulty( e->m_cmd.GetArg(1).s );
|
||||
if( e->m_dc == Difficulty_Invalid )
|
||||
{
|
||||
LOG->Warn( "Unlock: Invalid difficulty \"%s\"", e->m_cmd.GetArg(1).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Invalid difficulty \"%s\"", e->m_cmd.GetArg(1).s.c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
e->m_StepsType = GAMEMAN->StringToStepsType(e->m_cmd.GetArg(2).s);
|
||||
if (e->m_StepsType == StepsType_Invalid)
|
||||
{
|
||||
LOG->Warn( "Unlock: Invalid steps type \"%s\"", e->m_cmd.GetArg(2).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Invalid steps type \"%s\"", e->m_cmd.GetArg(2).s.c_str() );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -623,7 +623,7 @@ void UnlockManager::Load()
|
||||
case UnlockRewardType_Course:
|
||||
e->m_Course.FromCourse( SONGMAN->FindCourse(e->m_cmd.GetArg(0).s) );
|
||||
if( !e->m_Course.IsValid() )
|
||||
LOG->Warn( "Unlock: Cannot find course matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Unlock: Cannot find course matching \"%s\"", e->m_cmd.GetArg(0).s.c_str() );
|
||||
break;
|
||||
case UnlockRewardType_Modifier:
|
||||
// nothing to cache
|
||||
|
||||
+5
-7
@@ -7,6 +7,7 @@
|
||||
#include "RageLog.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "Foreach.h"
|
||||
#include "LuaManager.h"
|
||||
|
||||
bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, RageFileBasic &f )
|
||||
{
|
||||
@@ -20,8 +21,7 @@ bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, RageFileBasic &f )
|
||||
return true;
|
||||
|
||||
RString sWarning = ssprintf( "XML: LoadFromFile failed: %s", sError.c_str() );
|
||||
LOG->Warn( "%s", sWarning.c_str() );
|
||||
Dialog::OK( sWarning, "XML_PARSE_ERROR" );
|
||||
LuaHelpers::ReportScriptError(sWarning, "XML_PARSE_ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, const RString &sFile )
|
||||
RageFile f;
|
||||
if( !f.Open(sFile, RageFile::READ) )
|
||||
{
|
||||
LOG->Warn("Couldn't open %s for reading: %s", sFile.c_str(), f.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt("Couldn't open %s for reading: %s", sFile.c_str(), f.GetError().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, const RString &sFile )
|
||||
if( !bSuccess )
|
||||
{
|
||||
RString sWarning = ssprintf( "XML: LoadFromFile failed for file: %s", sFile.c_str() );
|
||||
LOG->Warn( "%s", sWarning.c_str() );
|
||||
Dialog::OK( sWarning, "XML_PARSE_ERROR" );
|
||||
LuaHelpers::ReportScriptError(sWarning, "XML_PARSE_ERROR");
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
@@ -518,14 +517,13 @@ bool XmlFileUtil::SaveToFile( const XNode *pNode, const RString &sFile, const RS
|
||||
RageFile f;
|
||||
if( !f.Open(sFile, RageFile::WRITE) )
|
||||
{
|
||||
LOG->Warn( "Couldn't open %s for writing: %s", sFile.c_str(), f.GetError().c_str() );
|
||||
LuaHelpers::ReportScriptErrorFmt( "Couldn't open %s for writing: %s", sFile.c_str(), f.GetError().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return SaveToFile( pNode, f, sStylesheet, bWriteTabs );
|
||||
}
|
||||
|
||||
#include "LuaManager.h"
|
||||
#include "LuaReference.h"
|
||||
class XNodeLuaValue: public XNodeValue
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user