Moved error reporting to ScreenSystemLayer error.lua. ScreenSystemLayer overlay/default.lua restored to previous. Error messages are now broadcast with the ScriptError message instead of SystemMessage. Added show/hide error messages toggle and clear error messages to debug menu. Nuked ScreenConsoleOverlay for being unfinished and duplicating ScreenSystemLayer. Changed Actor:tween and Tween::CreateFromStack to use ReportScriptError on invalid tween params. Changed some OptionRowList things to use ReportScriptError on invalid metrics.

This commit is contained in:
Kyzentun
2014-08-02 00:38:21 -07:00
committed by Jonathan Payne
parent 8e74a512ad
commit cc548a8cb5
13 changed files with 321 additions and 179 deletions
+4 -1
View File
@@ -1458,7 +1458,10 @@ public:
return 0;
}
ITween *pTween = ITween::CreateFromStack( L, 2 );
p->BeginTweening(fTime, pTween);
if(pTween != NULL)
{
p->BeginTweening(fTime, pTween);
}
return 0;
}
static int stoptweening( T* p, lua_State * ) { p->StopTweening(); return 0; }
+9 -1
View File
@@ -18,7 +18,15 @@ void DynamicActorScroller::LoadFromNode( const XNode *pNode )
*
* Make one extra copy if masking is enabled. */
if( m_SubActors.size() != 1 )
RageException::Throw( "%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size() );
{
LuaHelpers::ReportScriptErrorFmt("%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size());
// Remove all but one.
for( size_t i=1; i<m_SubActors.size(); i++ )
{
delete m_SubActors[i];
}
m_SubActors.resize(1);
}
int iNumCopies = (int) m_fNumItemsToDraw;
if( m_quadMask.GetVisible() )
+4 -2
View File
@@ -11,7 +11,7 @@
#include "Command.h"
#include "RageLog.h"
#include "RageTypes.h"
#include "ScreenManager.h"
#include "MessageManager.h"
#include <sstream> // conversion for lua functions.
#include <csetjmp>
@@ -801,7 +801,9 @@ void LuaHelpers::ReportScriptError(RString const& Error, RString ErrorType)
{
short_error= Error.substr(0, line_break_pos);
}
SCREENMAN->SystemMessage(short_error);
Message msg("ScriptError");
msg.SetParam("Message", short_error);
MESSAGEMAN->Broadcast(msg);
LOG->Warn(Error.c_str());
Dialog::OK(Error, ErrorType);
}
+21 -6
View File
@@ -153,7 +153,10 @@ public:
// Parse the basic configuration metric.
Commands lCmds = ParseCommands( ENTRY(sParam) );
if( lCmds.v.size() < 1 )
RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );
{
LuaHelpers::ReportScriptErrorFmt("Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str());
lCmds= ParseCommands("0");
}
m_Def.m_bOneChoiceForAllPlayers = false;
const int NumCols = StringToInt( lCmds.v[0].m_vsArgs[0] );
@@ -195,10 +198,20 @@ public:
}
else
{
RageException::Throw( "Unkown row flag \"%s\".", sName.c_str() );
LuaHelpers::ReportScriptErrorFmt( "Unkown row flag \"%s\".", sName.c_str() );
}
}
if(NumCols < 1)
{
LuaHelpers::ReportScriptErrorFmt(sParam + " has %d choices.", NumCols);
GameCommand mc;
mc.ApplyCommitsScreens( false );
mc.Load( 0, ParseCommands("name,Error") );
m_aListEntries.push_back(mc);
RString sChoice = mc.m_sName;
m_Def.m_vsChoices.push_back( sChoice );
}
for( int col = 0; col < NumCols; ++col )
{
GameCommand mc;
@@ -209,17 +222,19 @@ public:
if( mc.m_sName == "" && NumCols == 1 )
mc.m_sName = sParam;
if( mc.m_sName == "" )
RageException::Throw( "List \"%s\", col %i has no name.", sParam.c_str(), col );
{
LuaHelpers::ReportScriptErrorFmt("List \"%s\", col %i has no name.", sParam.c_str(), col);
mc.m_sName= "";
}
if( !mc.IsPlayable() )
{
LOG->Trace( "\"%s\" is not playable.", sParam.c_str() );
LuaHelpers::ReportScriptErrorFmt("\"%s\" is not playable.", sParam.c_str());
continue;
}
m_aListEntries.push_back( mc );
RString sName = mc.m_sName;
RString sChoice = mc.m_sName;
m_Def.m_vsChoices.push_back( sChoice );
}
@@ -543,7 +558,7 @@ public:
}
else
{
RageException::Throw( "Invalid StepsType param \"%s\".", sParam.c_str() );
LuaHelpers::ReportScriptErrorFmt("Invalid StepsType param \"%s\".", sParam.c_str());
}
m_Def.m_sName = sParam;
+33 -1
View File
@@ -549,6 +549,8 @@ static LocalizedString RESTART ( "ScreenDebugOverlay", "Restart" );
static LocalizedString SCREEN_ON ( "ScreenDebugOverlay", "Send On To Screen" );
static LocalizedString SCREEN_OFF ( "ScreenDebugOverlay", "Send Off To Screen" );
static LocalizedString RELOAD_OVERLAY_SCREENS( "ScreenDebugOverlay", "Reload Overlay Screens" );
static LocalizedString TOGGLE_ERRORS( "ScreenDebugOverlay", "Toggle Errors" );
static LocalizedString CLEAR_ERRORS( "ScreenDebugOverlay", "Clear Errors" );
static LocalizedString RELOAD_THEME_AND_TEXTURES( "ScreenDebugOverlay", "Reload Theme and Textures" );
static LocalizedString WRITE_PROFILES ( "ScreenDebugOverlay", "Write Profiles" );
static LocalizedString WRITE_PREFERENCES ( "ScreenDebugOverlay", "Write Preferences" );
@@ -1039,8 +1041,36 @@ class DebugLineReloadOverlayScreens : public IDebugLine
virtual RString GetPageName() const { return "Theme"; }
virtual void DoAndLog( RString &sMessageOut )
{
IDebugLine::DoAndLog(sMessageOut);
SCREENMAN->ReloadOverlayScreensAfterInputFinishes();
IDebugLine::DoAndLog(sMessageOut);
}
};
class DebugLineToggleErrors : public IDebugLine
{
virtual RString GetDisplayTitle() { return TOGGLE_ERRORS.GetValue(); }
virtual RString GetDisplayValue() { return RString(); }
virtual bool IsEnabled() { return true; }
virtual RString GetPageName() const { return "Theme"; }
virtual void DoAndLog( RString &sMessageOut )
{
Message msg("ToggleErrors");
MESSAGEMAN->Broadcast(msg);
IDebugLine::DoAndLog(sMessageOut);
}
};
class DebugLineClearErrors : public IDebugLine
{
virtual RString GetDisplayTitle() { return CLEAR_ERRORS.GetValue(); }
virtual RString GetDisplayValue() { return RString(); }
virtual bool IsEnabled() { return true; }
virtual RString GetPageName() const { return "Theme"; }
virtual void DoAndLog( RString &sMessageOut )
{
Message msg("ClearErrors");
MESSAGEMAN->Broadcast(msg);
IDebugLine::DoAndLog(sMessageOut);
}
};
@@ -1227,6 +1257,8 @@ DECLARE_ONE( DebugLineCurrentScreenOn );
DECLARE_ONE( DebugLineCurrentScreenOff );
DECLARE_ONE( DebugLineReloadTheme );
DECLARE_ONE( DebugLineReloadOverlayScreens );
DECLARE_ONE( DebugLineToggleErrors );
DECLARE_ONE( DebugLineClearErrors );
DECLARE_ONE( DebugLineWriteProfiles );
DECLARE_ONE( DebugLineWritePreferences );
DECLARE_ONE( DebugLineMenuTimer );
+3 -1
View File
@@ -155,8 +155,10 @@ void ScreenSystemLayer::Init()
{
Screen::Init();
m_sprOverlay.Load( THEME->GetPathB("ScreenSystemLayer", "overlay") );
m_sprOverlay.Load( THEME->GetPathB(m_sName, "overlay") );
this->AddChild( m_sprOverlay );
m_errLayer.Load( THEME->GetPathB(m_sName, "error") );
this->AddChild( m_errLayer );
}
/*
+1
View File
@@ -13,6 +13,7 @@ public:
private:
AutoActor m_sprOverlay;
AutoActor m_errLayer;
};
+4 -1
View File
@@ -97,7 +97,10 @@ ITween *ITween::CreateFromStack( Lua *L, int iStackPos )
luaL_checktype( L, iStackPos+1, LUA_TTABLE );
int iArgs = lua_objlen( L, iStackPos+1 );
if( iArgs != 4 && iArgs != 8 )
RageException::Throw( "CreateFromStack: table argument must have 4 or 8 entries" );
{
LuaHelpers::ReportScriptErrorFmt("Tween::CreateFromStack: table argument must have 4 or 8 entries");
return NULL;
}
float fC[8];
for( int i = 0; i < iArgs; ++i )