From 63ccc3dbf595d56fb9f08ee9575b81f3b39ca290 Mon Sep 17 00:00:00 2001 From: Eva Comaroski Date: Fri, 6 Dec 2013 13:12:35 +0000 Subject: Convert if-blocks to return statements in small functions such as GetStartParameter(). --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 5804aa8..b261b9f 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -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) -- cgit v1.1