aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorMelanie2011-03-27 21:41:54 +0100
committerMelanie2011-03-27 21:41:54 +0100
commita62b435a396a5837fd1e26ac905520f895d8610a (patch)
tree743b8cb91fa101ce461b2fc8ebf7078165e3c7d1 /OpenSim/Region/Application
parentUpgrade terse to full update on root rotation change. Not entirely sure why, ... (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-a62b435a396a5837fd1e26ac905520f895d8610a.zip
opensim-SC-a62b435a396a5837fd1e26ac905520f895d8610a.tar.gz
opensim-SC-a62b435a396a5837fd1e26ac905520f895d8610a.tar.bz2
opensim-SC-a62b435a396a5837fd1e26ac905520f895d8610a.tar.xz
Merge branch 'master' into careminster-presence-refactor
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 9960a54..503123e 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -875,66 +875,115 @@ namespace OpenSim
875 } 875 }
876 876
877 /// <summary> 877 /// <summary>
878 /// Load the estate information for the provided RegionInfo object. 878 /// Create an estate with an initial region.
879 /// </summary> 879 /// </summary>
880 /// <remarks>
881 /// This method doesn't allow an estate to be created with the same name as existing estates.
882 /// </remarks>
880 /// <param name="regInfo"></param> 883 /// <param name="regInfo"></param>
881 public void PopulateRegionEstateInfo(RegionInfo regInfo) 884 /// <param name="existingName">A list of estate names that already exist.</param>
885 /// <returns>true if the estate was created, false otherwise</returns>
886 public bool CreateEstate(RegionInfo regInfo, List<string> existingNames)
882 { 887 {
883 IEstateDataService estateDataService = EstateDataService; 888 // Create a new estate
889 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
890 string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
884 891
885 if (estateDataService != null) 892 if (existingNames.Contains(newName))
886 { 893 {
887 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); 894 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
895 return false;
888 } 896 }
897
898 regInfo.EstateSettings.EstateName = newName;
899
900 // FIXME: Later on, the scene constructor will reload the estate settings no matter what.
901 // Therefore, we need to do an initial save here otherwise the new estate name will be reset
902 // back to the default. The reloading of estate settings by scene could be eliminated if it
903 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
904 // possible to eliminate some additional later saves made by callers of this method.
905 regInfo.EstateSettings.Save();
906
907 return true;
908 }
909
910 /// <summary>
911 /// Load the estate information for the provided RegionInfo object.
912 /// </summary>
913 /// <param name="regInfo"></param>
914 public void PopulateRegionEstateInfo(RegionInfo regInfo)
915 {
916 if (EstateDataService != null)
917 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false);
889 918
890 if (regInfo.EstateSettings.EstateID == 0) // No record at all 919 if (regInfo.EstateSettings.EstateID == 0) // No record at all
891 { 920 {
892 MainConsole.Instance.Output("Your region is not part of an estate."); 921 MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName);
922
923 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
924 List<string> estateNames = new List<string>();
925 foreach (EstateSettings estate in estates)
926 estateNames.Add(estate.EstateName);
927
893 while (true) 928 while (true)
894 { 929 {
895 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" }); 930 if (estates.Count == 0)
896 if (response == "no") 931 {
897 { 932 MainConsole.Instance.Output("No existing estates found. You must create a new one.");
898 // Create a new estate
899 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
900
901 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
902 933
903 // FIXME: Later on, the scene constructor will reload the estate settings no matter what. 934 if (CreateEstate(regInfo, estateNames))
904 // Therefore, we need to do an initial save here otherwise the new estate name will be reset 935 break;
905 // back to the default. The reloading of estate settings by scene could be eliminated if it 936 else
906 // knows that the passed in settings in RegionInfo are already valid. Also, it might be 937 continue;
907 // possible to eliminate some additional later saves made by callers of this method.
908 regInfo.EstateSettings.Save();
909 break;
910 } 938 }
911 else 939 else
912 { 940 {
913 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); 941 string response
914 if (response == "None") 942 = MainConsole.Instance.CmdPrompt(
915 continue; 943 string.Format(
916 944 "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName),
917 List<int> estateIDs = estateDataService.GetEstates(response); 945 "no",
918 if (estateIDs.Count < 1) 946 new List<string>() { "yes", "no" });
947
948 if (response == "no")
919 { 949 {
920 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); 950 if (CreateEstate(regInfo, estateNames))
921 continue; 951 break;
952 else
953 continue;
954 }
955 else
956 {
957 response
958 = MainConsole.Instance.CmdPrompt(
959 string.Format(
960 "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
961 "None");
962
963 if (response == "None")
964 continue;
965
966 List<int> estateIDs = EstateDataService.GetEstates(response);
967 if (estateIDs.Count < 1)
968 {
969 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
970 continue;
971 }
972
973 int estateID = estateIDs[0];
974
975 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
976
977 if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
978 break;
979
980 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
922 } 981 }
923
924 int estateID = estateIDs[0];
925
926 regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
927
928 if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
929 break;
930
931 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
932 } 982 }
933 } 983 }
934 } 984 }
935 } 985 }
936 } 986 }
937
938 987
939 public class OpenSimConfigSource 988 public class OpenSimConfigSource
940 { 989 {