From 08c76989a719803e4cb7c5391bc864046bba31f2 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 23 Feb 2009 02:43:51 +0000 Subject: Mantis#3187. Thank you kindly, DoranZemlja for a patch that: Adds a warning for an LSL construct that exploits a popular list memory saving hack. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 75d0bec..40a6dd1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -516,6 +516,38 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_AddingAssemblies[assembly]++; } } + + string[] warnings = m_Compiler.GetWarnings(); + + if (warnings != null && warnings.Length != 0) + { + if (presence != null && (!postOnRez)) + presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); + + foreach (string warning in warnings) + { + try + { + // DISPLAY WARNING INWORLD + string text = "Warning:\n" + warning; + if (text.Length > 1000) + text = text.Substring(0, 1000); + World.SimChat(Utils.StringToBytes(text), + ChatTypeEnum.DebugChannel, 2147483647, + part.AbsolutePosition, + part.Name, part.UUID, false); + } + catch (Exception e2) // LEGIT: User Scripting + { + m_log.Error("[XEngine]: " + + "Error displaying warning in-world: " + + e2.ToString()); + m_log.Error("[XEngine]: " + + "Warning:\r\n" + + warning); + } + } + } } catch (Exception e) { -- cgit v1.1