diff options
author | Justin Clark-Casey (justincc) | 2012-07-04 21:54:30 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-04 21:54:30 +0100 |
commit | eacba4fc0b1e3a34f8bae140c402eacb68ecbb94 (patch) | |
tree | 6c350a79b3254c3b0a0a7246c76bf87c4c8af6a8 | |
parent | refactor: In llGetInventoryType() use existing GetInventoryItem() (diff) | |
download | opensim-SC-eacba4fc0b1e3a34f8bae140c402eacb68ecbb94.zip opensim-SC-eacba4fc0b1e3a34f8bae140c402eacb68ecbb94.tar.gz opensim-SC-eacba4fc0b1e3a34f8bae140c402eacb68ecbb94.tar.bz2 opensim-SC-eacba4fc0b1e3a34f8bae140c402eacb68ecbb94.tar.xz |
refactor: use existing GetInventoryItem() in GetScriptByName(), itself renamed from ScriptByName()
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a8a2a50..38f146f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
192 | 192 | ||
193 | m_host.AddScriptLPS(1); | 193 | m_host.AddScriptLPS(1); |
194 | 194 | ||
195 | if ((item = ScriptByName(name)) != UUID.Zero) | 195 | if ((item = GetScriptByName(name)) != UUID.Zero) |
196 | m_ScriptEngine.ResetScript(item); | 196 | m_ScriptEngine.ResetScript(item); |
197 | else | 197 | else |
198 | ShoutError("llResetOtherScript: script "+name+" not found"); | 198 | ShoutError("llResetOtherScript: script "+name+" not found"); |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
204 | 204 | ||
205 | m_host.AddScriptLPS(1); | 205 | m_host.AddScriptLPS(1); |
206 | 206 | ||
207 | if ((item = ScriptByName(name)) != UUID.Zero) | 207 | if ((item = GetScriptByName(name)) != UUID.Zero) |
208 | { | 208 | { |
209 | return m_ScriptEngine.GetScriptState(item) ?1:0; | 209 | return m_ScriptEngine.GetScriptState(item) ?1:0; |
210 | } | 210 | } |
@@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
226 | // These functions are supposed to be robust, | 226 | // These functions are supposed to be robust, |
227 | // so get the state one step at a time. | 227 | // so get the state one step at a time. |
228 | 228 | ||
229 | if ((item = ScriptByName(name)) != UUID.Zero) | 229 | if ((item = GetScriptByName(name)) != UUID.Zero) |
230 | { | 230 | { |
231 | m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); | 231 | m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); |
232 | } | 232 | } |
@@ -10455,18 +10455,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10455 | return new LSL_List(); | 10455 | return new LSL_List(); |
10456 | } | 10456 | } |
10457 | 10457 | ||
10458 | internal UUID ScriptByName(string name) | 10458 | internal UUID GetScriptByName(string name) |
10459 | { | 10459 | { |
10460 | lock (m_host.TaskInventory) | 10460 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); |
10461 | { | 10461 | |
10462 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 10462 | if (item == null || item.Type != 10) |
10463 | { | 10463 | return UUID.Zero; |
10464 | if (item.Type == 10 && item.Name == name) | ||
10465 | return item.ItemID; | ||
10466 | } | ||
10467 | } | ||
10468 | 10464 | ||
10469 | return UUID.Zero; | 10465 | return item.ItemID; |
10470 | } | 10466 | } |
10471 | 10467 | ||
10472 | internal void ShoutError(string msg) | 10468 | internal void ShoutError(string msg) |