aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-08-05 17:00:35 +0000
committerJustin Clarke Casey2008-08-05 17:00:35 +0000
commit1da99022949b7d69e08dc63f639b06613e55ce0f (patch)
treee0ae821ef4592265cd3226ee88383f669080c1c5
parent* minor: slightly pointlessly increase the verbosity of the message given whe... (diff)
downloadopensim-SC_OLD-1da99022949b7d69e08dc63f639b06613e55ce0f.zip
opensim-SC_OLD-1da99022949b7d69e08dc63f639b06613e55ce0f.tar.gz
opensim-SC_OLD-1da99022949b7d69e08dc63f639b06613e55ce0f.tar.bz2
opensim-SC_OLD-1da99022949b7d69e08dc63f639b06613e55ce0f.tar.xz
* refactor: clean up code for selecting regions on the region console
-rw-r--r--OpenSim/Region/Application/OpenSim.cs67
1 files changed, 32 insertions, 35 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 2b59e5d..85ae1f4 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -89,7 +89,7 @@ namespace OpenSim
89 m_log.Info("===================================================================="); 89 m_log.Info("====================================================================");
90 m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (m_sandbox ? "sandbox" : "grid")); 90 m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (m_sandbox ? "sandbox" : "grid"));
91 91
92 m_console = CreateConsole(); 92 m_console = new ConsoleBase("Region", this);
93 MainConsole.Instance = m_console; 93 MainConsole.Instance = m_console;
94 94
95 base.Startup(); 95 base.Startup();
@@ -116,12 +116,6 @@ namespace OpenSim
116 PrintFileToConsole("startuplogo.txt"); 116 PrintFileToConsole("startuplogo.txt");
117 RegisterCmd("echoTest", RunEchoTest, "this echos your command args to see how they are parsed"); 117 RegisterCmd("echoTest", RunEchoTest, "this echos your command args to see how they are parsed");
118 RegisterCmd("kickuser", KickUserCommand, "kickuser [first] [last] - attempts to log off a user from any region we are serving"); 118 RegisterCmd("kickuser", KickUserCommand, "kickuser [first] [last] - attempts to log off a user from any region we are serving");
119
120 }
121
122 protected ConsoleBase CreateConsole()
123 {
124 return new ConsoleBase("Region", this);
125 } 119 }
126 120
127 private void RunAutoTimerScript(object sender, EventArgs e) 121 private void RunAutoTimerScript(object sender, EventArgs e)
@@ -132,13 +126,16 @@ namespace OpenSim
132 } 126 }
133 } 127 }
134 128
135 private string GetActualSimName() 129 /// <summary>
130 /// Get the name of the region which is currently selected for single region operations
131 /// </summary>
132 /// <returns></returns>
133 private string GetSelectedRegionName()
136 { 134 {
137 if (m_sceneManager.CurrentScene == null) return "Root"; 135 if (m_sceneManager.CurrentScene == null) return "Root";
138 return m_sceneManager.CurrentScene.RegionInfo.RegionName; 136 return m_sceneManager.CurrentScene.RegionInfo.RegionName;
139 } 137 }
140 138
141
142 #region Console Commands 139 #region Console Commands
143 140
144 private void RunEchoTest(string[] cmdparams) 141 private void RunEchoTest(string[] cmdparams)
@@ -289,11 +286,10 @@ namespace OpenSim
289 { 286 {
290 m_console.Notice(""); 287 m_console.Notice("");
291 m_console.Notice("create user - adds a new user."); 288 m_console.Notice("create user - adds a new user.");
292 } 289 }
293
294 290
295 m_console.Notice(""); 291 m_console.Notice("");
296 m_console.Notice("Serving region " + GetActualSimName()); 292 m_console.Notice("Selected region: " + GetSelectedRegionName());
297 m_console.Notice(""); 293 m_console.Notice("");
298 break; 294 break;
299 295
@@ -386,26 +382,7 @@ namespace OpenSim
386 break; 382 break;
387 383
388 case "change-region": 384 case "change-region":
389 if (cmdparams.Length > 0) 385 ChangeWorkingRegion(cmdparams);
390 {
391 string regionName = CombineParams(cmdparams, 0);
392
393 if (!m_sceneManager.TrySetCurrentScene(regionName))
394 {
395 m_console.Error("Couldn't set current region to: " + regionName);
396 }
397 }
398
399 if (m_sceneManager.CurrentScene == null)
400 {
401 m_console.Error("CONSOLE", "Currently at Root level. To change region please use 'change-region <regioname>'");
402 }
403 else
404 {
405 m_console.Error("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
406 ". To change region please use 'change-region <region name>'");
407 }
408
409 break; 386 break;
410 387
411 case "export-map": 388 case "export-map":
@@ -532,6 +509,25 @@ namespace OpenSim
532 } 509 }
533 510
534 /// <summary> 511 /// <summary>
512 /// Change the current working region. The working region is that operated upon by single region commands.
513 /// </summary>
514 /// <param name="cmdParams"></param>
515 protected void ChangeWorkingRegion(string[] cmdparams)
516 {
517 if (cmdparams.Length > 0)
518 {
519 string regionName = CombineParams(cmdparams, 0);
520
521 if (!m_sceneManager.TrySetCurrentScene(regionName))
522 {
523 m_console.Error("Couldn't set current region to: " + regionName);
524 }
525 }
526
527 m_console.Notice("CONSOLE", "Selected region: " + GetSelectedRegionName());
528 }
529
530 /// <summary>
535 /// Execute switch for some of the create commands 531 /// Execute switch for some of the create commands
536 /// </summary> 532 /// </summary>
537 /// <param name="args"></param> 533 /// <param name="args"></param>
@@ -674,9 +670,10 @@ namespace OpenSim
674 }); 670 });
675 break; 671 break;
676 } 672 }
677 m_console.Notice(""); 673
678 m_console.Notice("Serving region " + GetActualSimName()); 674 m_console.Notice("");
679 m_console.Notice(""); 675 m_console.Notice("Selected region: " + GetSelectedRegionName());
676 m_console.Notice("");
680 } 677 }
681 678
682 /// <summary> 679 /// <summary>