diff options
author | Justin Clark-Casey (justincc) | 2011-08-06 01:35:01 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-06 01:35:01 +0100 |
commit | 2b26d2f1a54686ed6a03efc26bf75002f80d42ee (patch) | |
tree | 8dd570682b2a8323fb16043285e7439d87a05382 | |
parent | Do proper locking of m_localScenes list in SceneManager (diff) | |
download | opensim-SC_OLD-2b26d2f1a54686ed6a03efc26bf75002f80d42ee.zip opensim-SC_OLD-2b26d2f1a54686ed6a03efc26bf75002f80d42ee.tar.gz opensim-SC_OLD-2b26d2f1a54686ed6a03efc26bf75002f80d42ee.tar.bz2 opensim-SC_OLD-2b26d2f1a54686ed6a03efc26bf75002f80d42ee.tar.xz |
prevent "create region" console command from being able to create a region with the same id as one that already exists.
Addresses http://opensimulator.org/mantis/view.php?id=5617
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 259d753..fe1525b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -549,6 +549,7 @@ namespace OpenSim | |||
549 | { | 549 | { |
550 | string regionName = string.Empty; | 550 | string regionName = string.Empty; |
551 | string regionFile = string.Empty; | 551 | string regionFile = string.Empty; |
552 | |||
552 | if (cmd.Length == 3) | 553 | if (cmd.Length == 3) |
553 | { | 554 | { |
554 | regionFile = cmd[2]; | 555 | regionFile = cmd[2]; |
@@ -558,14 +559,17 @@ namespace OpenSim | |||
558 | regionName = cmd[2]; | 559 | regionName = cmd[2]; |
559 | regionFile = cmd[3]; | 560 | regionFile = cmd[3]; |
560 | } | 561 | } |
562 | |||
561 | string extension = Path.GetExtension(regionFile).ToLower(); | 563 | string extension = Path.GetExtension(regionFile).ToLower(); |
562 | bool isXml = extension.Equals(".xml"); | 564 | bool isXml = extension.Equals(".xml"); |
563 | bool isIni = extension.Equals(".ini"); | 565 | bool isIni = extension.Equals(".ini"); |
566 | |||
564 | if (!isXml && !isIni) | 567 | if (!isXml && !isIni) |
565 | { | 568 | { |
566 | MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>"); | 569 | MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>"); |
567 | return; | 570 | return; |
568 | } | 571 | } |
572 | |||
569 | if (!Path.IsPathRooted(regionFile)) | 573 | if (!Path.IsPathRooted(regionFile)) |
570 | { | 574 | { |
571 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); | 575 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); |
@@ -582,8 +586,18 @@ namespace OpenSim | |||
582 | regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); | 586 | regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); |
583 | } | 587 | } |
584 | 588 | ||
585 | IScene scene; | 589 | Scene existingScene; |
590 | if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene)) | ||
591 | { | ||
592 | MainConsole.Instance.OutputFormat( | ||
593 | "ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}", | ||
594 | regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName); | ||
595 | |||
596 | return; | ||
597 | } | ||
598 | |||
586 | PopulateRegionEstateInfo(regInfo); | 599 | PopulateRegionEstateInfo(regInfo); |
600 | IScene scene; | ||
587 | CreateRegion(regInfo, true, out scene); | 601 | CreateRegion(regInfo, true, out scene); |
588 | regInfo.EstateSettings.Save(); | 602 | regInfo.EstateSettings.Save(); |
589 | } | 603 | } |