diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 102 |
1 files changed, 63 insertions, 39 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index eae3686..81a10e3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -793,6 +793,25 @@ namespace OpenSim | |||
793 | } | 793 | } |
794 | 794 | ||
795 | /// <summary> | 795 | /// <summary> |
796 | /// Create an estate with an initial region. | ||
797 | /// </summary> | ||
798 | /// <param name="regInfo"></param> | ||
799 | public void CreateEstate(RegionInfo regInfo) | ||
800 | { | ||
801 | // Create a new estate | ||
802 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); | ||
803 | |||
804 | regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); | ||
805 | |||
806 | // FIXME: Later on, the scene constructor will reload the estate settings no matter what. | ||
807 | // Therefore, we need to do an initial save here otherwise the new estate name will be reset | ||
808 | // back to the default. The reloading of estate settings by scene could be eliminated if it | ||
809 | // knows that the passed in settings in RegionInfo are already valid. Also, it might be | ||
810 | // possible to eliminate some additional later saves made by callers of this method. | ||
811 | regInfo.EstateSettings.Save(); | ||
812 | } | ||
813 | |||
814 | /// <summary> | ||
796 | /// Load the estate information for the provided RegionInfo object. | 815 | /// Load the estate information for the provided RegionInfo object. |
797 | /// </summary> | 816 | /// </summary> |
798 | /// <param name="regInfo"></param> | 817 | /// <param name="regInfo"></param> |
@@ -804,56 +823,61 @@ namespace OpenSim | |||
804 | if (regInfo.EstateSettings.EstateID == 0) // No record at all | 823 | if (regInfo.EstateSettings.EstateID == 0) // No record at all |
805 | { | 824 | { |
806 | MainConsole.Instance.Output("Your region is not part of an estate."); | 825 | MainConsole.Instance.Output("Your region is not part of an estate."); |
826 | |||
827 | List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll(); | ||
828 | |||
807 | while (true) | 829 | while (true) |
808 | { | 830 | { |
809 | string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" }); | 831 | if (estates.Count == 0) |
810 | if (response == "no") | 832 | { |
811 | { | 833 | MainConsole.Instance.Output( |
812 | // Create a new estate | 834 | "There aren't any existing estates. You will need to create a new one for this region."); |
813 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); | ||
814 | |||
815 | regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); | ||
816 | 835 | ||
817 | // FIXME: Later on, the scene constructor will reload the estate settings no matter what. | 836 | CreateEstate(regInfo); |
818 | // Therefore, we need to do an initial save here otherwise the new estate name will be reset | ||
819 | // back to the default. The reloading of estate settings by scene could be eliminated if it | ||
820 | // knows that the passed in settings in RegionInfo are already valid. Also, it might be | ||
821 | // possible to eliminate some additional later saves made by callers of this method. | ||
822 | regInfo.EstateSettings.Save(); | ||
823 | break; | 837 | break; |
824 | } | 838 | } |
825 | else | 839 | else |
826 | { | 840 | { |
827 | List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll(); | 841 | string response |
828 | |||
829 | List<string> estateNames = new List<string>(); | ||
830 | foreach (EstateSettings estate in estates) | ||
831 | estateNames.Add(estate.EstateName); | ||
832 | |||
833 | response | ||
834 | = MainConsole.Instance.CmdPrompt( | 842 | = MainConsole.Instance.CmdPrompt( |
835 | string.Format( | 843 | "Do you wish to join an existing estate (yes/no)?", "no", new List<string>() { "yes", "no" }); |
836 | "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), | ||
837 | "None"); | ||
838 | 844 | ||
839 | if (response == "None") | 845 | if (response == "no") |
840 | continue; | ||
841 | |||
842 | List<int> estateIDs = EstateDataService.GetEstates(response); | ||
843 | if (estateIDs.Count < 1) | ||
844 | { | 846 | { |
845 | MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); | 847 | CreateEstate(regInfo); |
846 | continue; | ||
847 | } | ||
848 | |||
849 | int estateID = estateIDs[0]; | ||
850 | |||
851 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); | ||
852 | |||
853 | if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) | ||
854 | break; | 848 | break; |
855 | 849 | } | |
856 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | 850 | else |
851 | { | ||
852 | List<string> estateNames = new List<string>(); | ||
853 | foreach (EstateSettings estate in estates) | ||
854 | estateNames.Add(estate.EstateName); | ||
855 | |||
856 | response | ||
857 | = MainConsole.Instance.CmdPrompt( | ||
858 | string.Format( | ||
859 | "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), | ||
860 | "None"); | ||
861 | |||
862 | if (response == "None") | ||
863 | continue; | ||
864 | |||
865 | List<int> estateIDs = EstateDataService.GetEstates(response); | ||
866 | if (estateIDs.Count < 1) | ||
867 | { | ||
868 | MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); | ||
869 | continue; | ||
870 | } | ||
871 | |||
872 | int estateID = estateIDs[0]; | ||
873 | |||
874 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); | ||
875 | |||
876 | if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) | ||
877 | break; | ||
878 | |||
879 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | ||
880 | } | ||
857 | } | 881 | } |
858 | } | 882 | } |
859 | } | 883 | } |