Fix problem where restarting the currently selected region would stop various console commands (e.g. "show users") from working.

This was because the "currently selected" scene reference was being left as the dead scene instead of the restarted Scene object.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-11-23 02:22:30 +00:00
parent 049987925d
commit 8c8c8a00a4
4 changed files with 51 additions and 36 deletions

View File

@@ -664,12 +664,20 @@ namespace OpenSim
if (!SceneManager.TrySetCurrentScene(newRegionName))
MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
else
RefreshPrompt();
}
else
{
MainConsole.Instance.Output("Usage: change region <region name>");
}
}
/// <summary>
/// Refreshs prompt with the current selection details.
/// </summary>
private void RefreshPrompt()
{
string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
@@ -691,6 +699,18 @@ namespace OpenSim
m_console.ConsoleScene = SceneManager.CurrentScene;
}
protected override void HandleRestartRegion(RegionInfo whichRegion)
{
base.HandleRestartRegion(whichRegion);
// Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the
// m_console.ConsoleScene to null (indicating all scenes).
if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name)
SceneManager.TrySetCurrentScene(whichRegion.RegionName);
RefreshPrompt();
}
/// <summary>
/// Turn on some debugging values for OpenSim.
/// </summary>