diff options
author | Melanie Thielker | 2009-02-10 23:15:48 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-02-10 23:15:48 +0000 |
commit | 9bfbfa381abc92f3c5fc8e97405943128c85c5d4 (patch) | |
tree | 06248d4262cfd0e053010d6b8b6a19b8f6db2d40 /OpenSim/Framework/Console | |
parent | Fixes the problem of attachment offset after crossings/TPs. Hopefully it fixe... (diff) | |
download | opensim-SC_OLD-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.zip opensim-SC_OLD-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.gz opensim-SC_OLD-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.bz2 opensim-SC_OLD-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.xz |
Add proper handling for shared vs. unshared modules to the command
interface. Shared modules will now only get added once, so the command
handler is called once per module, not once per scene. Removal of scenes
has no adverse effects. Nonshared modules will be called for each scene.
Diffstat (limited to 'OpenSim/Framework/Console')
-rw-r--r-- | OpenSim/Framework/Console/ConsoleBase.cs | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index 8e61587..721e91a 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs | |||
@@ -49,6 +49,11 @@ namespace OpenSim.Framework.Console | |||
49 | public string module; | 49 | public string module; |
50 | 50 | ||
51 | /// <value> | 51 | /// <value> |
52 | /// Whether the module is shared | ||
53 | /// </value> | ||
54 | public bool shared; | ||
55 | |||
56 | /// <value> | ||
52 | /// Very short BNF description | 57 | /// Very short BNF description |
53 | /// </value> | 58 | /// </value> |
54 | public string help_text; | 59 | public string help_text; |
@@ -66,7 +71,7 @@ namespace OpenSim.Framework.Console | |||
66 | /// <value> | 71 | /// <value> |
67 | /// The method to invoke for this command | 72 | /// The method to invoke for this command |
68 | /// </value> | 73 | /// </value> |
69 | public CommandDelegate fn; | 74 | public List<CommandDelegate> fn; |
70 | } | 75 | } |
71 | 76 | ||
72 | /// <value> | 77 | /// <value> |
@@ -172,10 +177,11 @@ namespace OpenSim.Framework.Console | |||
172 | /// <param name="help"></param> | 177 | /// <param name="help"></param> |
173 | /// <param name="longhelp"></param> | 178 | /// <param name="longhelp"></param> |
174 | /// <param name="fn"></param> | 179 | /// <param name="fn"></param> |
175 | public void AddCommand( | 180 | public void AddCommand(string module, bool shared, string command, |
176 | string module, string command, string help, string longhelp, CommandDelegate fn) | 181 | string help, string longhelp, CommandDelegate fn) |
177 | { | 182 | { |
178 | AddCommand(module, command, help, longhelp, String.Empty, fn); | 183 | AddCommand(module, shared, command, help, longhelp, |
184 | String.Empty, fn); | ||
179 | } | 185 | } |
180 | 186 | ||
181 | /// <summary> | 187 | /// <summary> |
@@ -187,8 +193,9 @@ namespace OpenSim.Framework.Console | |||
187 | /// <param name="longhelp"></param> | 193 | /// <param name="longhelp"></param> |
188 | /// <param name="descriptivehelp"></param> | 194 | /// <param name="descriptivehelp"></param> |
189 | /// <param name="fn"></param> | 195 | /// <param name="fn"></param> |
190 | public void AddCommand( | 196 | public void AddCommand(string module, bool shared, string command, |
191 | string module, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) | 197 | string help, string longhelp, string descriptivehelp, |
198 | CommandDelegate fn) | ||
192 | { | 199 | { |
193 | string[] parts = Parser.Parse(command); | 200 | string[] parts = Parser.Parse(command); |
194 | 201 | ||
@@ -212,15 +219,25 @@ namespace OpenSim.Framework.Console | |||
212 | } | 219 | } |
213 | } | 220 | } |
214 | 221 | ||
222 | CommandInfo info; | ||
223 | |||
215 | if (current.ContainsKey(String.Empty)) | 224 | if (current.ContainsKey(String.Empty)) |
225 | { | ||
226 | info = (CommandInfo)current[String.Empty]; | ||
227 | if (!info.shared && !info.fn.Contains(fn)) | ||
228 | info.fn.Add(fn); | ||
229 | |||
216 | return; | 230 | return; |
231 | } | ||
217 | 232 | ||
218 | CommandInfo info = new CommandInfo(); | 233 | info = new CommandInfo(); |
219 | info.module = module; | 234 | info.module = module; |
235 | info.shared = shared; | ||
220 | info.help_text = help; | 236 | info.help_text = help; |
221 | info.long_help = longhelp; | 237 | info.long_help = longhelp; |
222 | info.descriptive_help = descriptivehelp; | 238 | info.descriptive_help = descriptivehelp; |
223 | info.fn = fn; | 239 | info.fn = new List<CommandDelegate>(); |
240 | info.fn.Add(fn); | ||
224 | current[String.Empty] = info; | 241 | current[String.Empty] = info; |
225 | } | 242 | } |
226 | 243 | ||
@@ -275,7 +292,7 @@ namespace OpenSim.Framework.Console | |||
275 | if (s == String.Empty) | 292 | if (s == String.Empty) |
276 | { | 293 | { |
277 | CommandInfo ci = (CommandInfo)current[String.Empty]; | 294 | CommandInfo ci = (CommandInfo)current[String.Empty]; |
278 | if (ci.fn != null) | 295 | if (ci.fn.Count != null) |
279 | addcr = true; | 296 | addcr = true; |
280 | } | 297 | } |
281 | else | 298 | else |
@@ -337,9 +354,10 @@ namespace OpenSim.Framework.Console | |||
337 | if (current.ContainsKey(String.Empty)) | 354 | if (current.ContainsKey(String.Empty)) |
338 | { | 355 | { |
339 | CommandInfo ci = (CommandInfo)current[String.Empty]; | 356 | CommandInfo ci = (CommandInfo)current[String.Empty]; |
340 | if (ci.fn == null) | 357 | if (ci.fn.Count == null) |
341 | return new string[0]; | 358 | return new string[0]; |
342 | ci.fn(ci.module, result); | 359 | foreach (CommandDelegate fn in ci.fn) |
360 | fn(ci.module, result); | ||
343 | return result; | 361 | return result; |
344 | } | 362 | } |
345 | return new string[0]; | 363 | return new string[0]; |
@@ -409,9 +427,8 @@ namespace OpenSim.Framework.Console | |||
409 | { | 427 | { |
410 | DefaultPrompt = defaultPrompt; | 428 | DefaultPrompt = defaultPrompt; |
411 | 429 | ||
412 | Commands.AddCommand( | 430 | Commands.AddCommand("console", false, "help", "help [<command>]", |
413 | "console", "help", "help [<command>]", | 431 | "Get general command list or more detailed help on a specific command", Help); |
414 | "Get general command list or more detailed help on a specific command", Help); | ||
415 | } | 432 | } |
416 | 433 | ||
417 | public void SetGuiMode(bool mode) | 434 | public void SetGuiMode(bool mode) |