mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Added Set and SetScript with const_str
Fixed try/catch
This commit is contained in:
parent
1a03288144
commit
fe5473bc85
2 changed files with 38 additions and 8 deletions
|
@ -1008,6 +1008,11 @@ void ScriptThreadLabel::Set(const char *label)
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::Set(const_str label)
|
||||
{
|
||||
return Set(Director.GetString(label));
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::SetScript( const ScriptVariable& label )
|
||||
{
|
||||
if( label.GetType() == VARIABLE_STRING || label.GetType() == VARIABLE_CONSTSTRING )
|
||||
|
@ -1101,6 +1106,11 @@ void ScriptThreadLabel::SetScript( const char *label )
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::SetScript(const_str label)
|
||||
{
|
||||
SetScript(Director.GetString(label));
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::SetThread( const ScriptVariable& label )
|
||||
{
|
||||
ScriptThread *thread = NULL;
|
||||
|
@ -1138,10 +1148,9 @@ bool ScriptThreadLabel::TrySet( const char *label )
|
|||
{
|
||||
Set( label );
|
||||
}
|
||||
catch( const char *string )
|
||||
catch(const ScriptException& exc)
|
||||
{
|
||||
Com_Printf( "%s\n", string );
|
||||
|
||||
Com_Printf( "%s\n", exc.string.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1159,17 @@ bool ScriptThreadLabel::TrySet( const char *label )
|
|||
|
||||
bool ScriptThreadLabel::TrySet( const_str label )
|
||||
{
|
||||
return TrySet( Director.GetString( label ) );
|
||||
try
|
||||
{
|
||||
Set( label );
|
||||
}
|
||||
catch(const ScriptException& exc)
|
||||
{
|
||||
Com_Printf( "%s\n", exc.string.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScriptThreadLabel::TrySetScript( const char *label )
|
||||
|
@ -1159,10 +1178,9 @@ bool ScriptThreadLabel::TrySetScript( const char *label )
|
|||
{
|
||||
SetScript( label );
|
||||
}
|
||||
catch( const char *string )
|
||||
catch(const ScriptException &exc)
|
||||
{
|
||||
Com_Printf( "%s\n", string );
|
||||
|
||||
Com_Printf( "%s\n", exc.string.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1189,17 @@ bool ScriptThreadLabel::TrySetScript( const char *label )
|
|||
|
||||
bool ScriptThreadLabel::TrySetScript( const_str label )
|
||||
{
|
||||
return TrySetScript( Director.GetString( label ) );
|
||||
try
|
||||
{
|
||||
SetScript(label);
|
||||
}
|
||||
catch (const ScriptException& exc)
|
||||
{
|
||||
Com_Printf("%s\n", exc.string.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::GetScriptValue(ScriptVariable *var)
|
||||
|
|
|
@ -165,8 +165,10 @@ public:
|
|||
void Execute(const SafePtr<Listener>& listener, const SafePtr<Listener>& param);
|
||||
|
||||
void Set( const char *label );
|
||||
void Set( const_str label );
|
||||
void SetScript( const ScriptVariable& label );
|
||||
void SetScript( const char *label );
|
||||
void SetScript( const_str label );
|
||||
void SetThread( const ScriptVariable& label );
|
||||
|
||||
bool TrySet( const_str label );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue