Remove m_moduleCommands. It wasn't used anywhere; probably a left-over from before ICommander times

0.6.5-rc1
Homer Horwitz 2009-04-13 21:23:24 +00:00
parent bcf31a76bb
commit b717f991ed
1 changed files with 8 additions and 31 deletions

View File

@ -77,11 +77,6 @@ namespace OpenSim.Region.Framework.Scenes
/// </value> /// </value>
protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
/// <value>
/// The module commands available for this scene
/// </value>
protected Dictionary<string, ICommand> m_moduleCommands = new Dictionary<string, ICommand>();
/// <value> /// <value>
/// Registered classes that are capable of creating entities. /// Registered classes that are capable of creating entities.
/// </value> /// </value>
@ -311,38 +306,20 @@ namespace OpenSim.Region.Framework.Scenes
lock (m_moduleCommanders) lock (m_moduleCommanders)
{ {
m_moduleCommanders.Add(commander.Name, commander); m_moduleCommanders.Add(commander.Name, commander);
lock (m_moduleCommands)
{
foreach (ICommand command in commander.Commands.Values)
{
if (m_moduleCommands.ContainsKey(command.Name))
{
m_log.ErrorFormat(
"[MODULES]: Module commander {0} tried to register the command {1} which has already been registered",
commander.Name, command.Name);
continue;
}
m_moduleCommands[command.Name] = command;
}
}
} }
} }
/// <summary> /// <summary>
/// Get an available module command /// Unregister a module commander and all its commands
/// </summary> /// </summary>
/// <param name="commandName"></param> /// <param name="name"></param>
/// <returns>The command if it was found, null if no command is available with that name</returns> public void UnregisterModuleCommander(string name)
public ICommand GetCommand(string commandName)
{ {
lock (m_moduleCommands) lock (m_moduleCommanders)
{ {
if (m_moduleCommands.ContainsKey(commandName)) ICommander commander;
return m_moduleCommands[commandName]; if (m_moduleCommanders.TryGetValue(name, out commander))
else m_moduleCommanders.Remove(name);
return null;
} }
} }