aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorMelanie2011-03-27 21:22:31 +0100
committerMelanie2011-03-27 21:22:31 +0100
commitf25749f0259bdfe334f77ab049ac5f892135bbc6 (patch)
tree5fd38027cbe794a1da1d87009f9975d3792f085a /OpenSim/Region/Application
parentDon't send a windlight profile to clients if windlight is not set for (diff)
parentAdd SignpostMarv to contributors (diff)
downloadopensim-SC-f25749f0259bdfe334f77ab049ac5f892135bbc6.zip
opensim-SC-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.gz
opensim-SC-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.bz2
opensim-SC-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs125
1 files changed, 87 insertions, 38 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index e950613..6405811 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -793,66 +793,115 @@ namespace OpenSim
793 } 793 }
794 794
795 /// <summary> 795 /// <summary>
796 /// Load the estate information for the provided RegionInfo object. 796 /// Create an estate with an initial region.
797 /// </summary> 797 /// </summary>
798 /// <remarks>
799 /// This method doesn't allow an estate to be created with the same name as existing estates.
800 /// </remarks>
798 /// <param name="regInfo"></param> 801 /// <param name="regInfo"></param>
799 public void PopulateRegionEstateInfo(RegionInfo regInfo) 802 /// <param name="existingName">A list of estate names that already exist.</param>
803 /// <returns>true if the estate was created, false otherwise</returns>
804 public bool CreateEstate(RegionInfo regInfo, List<string> existingNames)
800 { 805 {
801 IEstateDataService estateDataService = EstateDataService; 806 // Create a new estate
807 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
808 string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
802 809
803 if (estateDataService != null) 810 if (existingNames.Contains(newName))
804 { 811 {
805 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); 812 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
813 return false;
806 } 814 }
815
816 regInfo.EstateSettings.EstateName = newName;
817
818 // FIXME: Later on, the scene constructor will reload the estate settings no matter what.
819 // Therefore, we need to do an initial save here otherwise the new estate name will be reset
820 // back to the default. The reloading of estate settings by scene could be eliminated if it
821 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
822 // possible to eliminate some additional later saves made by callers of this method.
823 regInfo.EstateSettings.Save();
824
825 return true;
826 }
827
828 /// <summary>
829 /// Load the estate information for the provided RegionInfo object.
830 /// </summary>
831 /// <param name="regInfo"></param>
832 public void PopulateRegionEstateInfo(RegionInfo regInfo)
833 {
834 if (EstateDataService != null)
835 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false);
807 836
808 if (regInfo.EstateSettings.EstateID == 0) // No record at all 837 if (regInfo.EstateSettings.EstateID == 0) // No record at all
809 { 838 {
810 MainConsole.Instance.Output("Your region is not part of an estate."); 839 MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName);
840
841 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
842 List<string> estateNames = new List<string>();
843 foreach (EstateSettings estate in estates)
844 estateNames.Add(estate.EstateName);
845
811 while (true) 846 while (true)
812 { 847 {
813 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" }); 848 if (estates.Count == 0)
814 if (response == "no") 849 {
815 { 850 MainConsole.Instance.Output("No existing estates found. You must create a new one.");
816 // Create a new estate
817 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
818
819 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
820 851
821 // FIXME: Later on, the scene constructor will reload the estate settings no matter what. 852 if (CreateEstate(regInfo, estateNames))
822 // Therefore, we need to do an initial save here otherwise the new estate name will be reset 853 break;
823 // back to the default. The reloading of estate settings by scene could be eliminated if it 854 else
824 // knows that the passed in settings in RegionInfo are already valid. Also, it might be 855 continue;
825 // possible to eliminate some additional later saves made by callers of this method.
826 regInfo.EstateSettings.Save();
827 break;
828 } 856 }
829 else 857 else
830 { 858 {
831 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); 859 string response
832 if (response == "None") 860 = MainConsole.Instance.CmdPrompt(
833 continue; 861 string.Format(
834 862 "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName),
835 List<int> estateIDs = estateDataService.GetEstates(response); 863 "no",
836 if (estateIDs.Count < 1) 864 new List<string>() { "yes", "no" });
865
866 if (response == "no")
837 { 867 {
838 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); 868 if (CreateEstate(regInfo, estateNames))
839 continue; 869 break;
870 else
871 continue;
872 }
873 else
874 {
875 response
876 = MainConsole.Instance.CmdPrompt(
877 string.Format(
878 "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
879 "None");
880
881 if (response == "None")
882 continue;
883
884 List<int> estateIDs = EstateDataService.GetEstates(response);
885 if (estateIDs.Count < 1)
886 {
887 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
888 continue;
889 }
890
891 int estateID = estateIDs[0];
892
893 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
894
895 if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
896 break;
897
898 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
840 } 899 }
841
842 int estateID = estateIDs[0];
843
844 regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
845
846 if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
847 break;
848
849 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
850 } 900 }
851 } 901 }
852 } 902 }
853 } 903 }
854 } 904 }
855
856 905
857 public class OpenSimConfigSource 906 public class OpenSimConfigSource
858 { 907 {