Convert if-blocks to return statements in small functions such as GetStartParameter().

master-beforevarregion
Eva Comaroski 2013-12-06 13:12:35 +00:00 committed by Justin Clark-Casey (justincc)
parent d656ec2a07
commit 63ccc3dbf5
1 changed files with 5 additions and 15 deletions

View File

@ -1709,9 +1709,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public bool GetScriptState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.Running;
return false;
return instance != null && instance.Running;
}
public void ApiResetScript(UUID itemID)
@ -1755,9 +1753,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public DetectParams GetDetectParams(UUID itemID, int idx)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.GetDetectParams(idx);
return null;
return instance != null ? instance.GetDetectParams(idx) : null;
}
public void SetMinEventDelay(UUID itemID, double delay)
@ -1770,9 +1766,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public UUID GetDetectID(UUID itemID, int idx)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.GetDetectID(idx);
return UUID.Zero;
return instance != null ? instance.GetDetectID(idx) : UUID.Zero;
}
public void SetState(UUID itemID, string newState)
@ -1786,9 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public int GetStartParameter(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return 0;
return instance.StartParam;
return instance == null ? 0 : instance.StartParam;
}
public void OnShutdown()
@ -1822,9 +1814,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public IScriptApi GetApi(UUID itemID, string name)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return null;
return instance.GetApi(name);
return instance == null ? null : instance.GetApi(name);
}
public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)