Allow estate config files to specify a specific EstateID. Defaults to 0 if not specified which uses auto increment id as current behaviour.

This commit is contained in:
Alicia Raven
2020-12-15 17:05:30 +00:00
parent 73d33aee32
commit a969797512
10 changed files with 81 additions and 38 deletions

View File

@@ -69,14 +69,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (!Directory.Exists(estateConfigPath))
return; // if nothing there, don't bother
string[] iniFiles = null;
string[] iniFiles;
try
{
iniFiles = Directory.GetFiles(estateConfigPath, "*.ini");
}
catch
{
m_log.Info("[ESTATE LOADER FILE SYSTEM]: could not open " + estateConfigPath);
m_log.Error("[ESTATE LOADER FILE SYSTEM]: could not open " + estateConfigPath);
return;
}
@@ -88,6 +88,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
List<int> existingEstates;
List<int> existingEstateIDs = m_application.EstateDataService.GetEstatesAll();
int i = 0;
foreach (string file in iniFiles)
{
@@ -100,7 +102,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
}
catch
{
m_log.InfoFormat("[ESTATE LOADER FILE SYSTEM]: failed to parse file {0}", file);
m_log.WarnFormat("[ESTATE LOADER FILE SYSTEM]: failed to parse file {0}", file);
}
if(source == null)
@@ -115,7 +117,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (estateName.Length > 64) // need check this and if utf8 is valid
{
m_log.InfoFormat("[ESTATE LOADER FILE SYSTEM]: Estate name {0} is too large, ignoring", estateName);
m_log.WarnFormat("[ESTATE LOADER FILE SYSTEM]: Estate name {0} is too large, ignoring", estateName);
continue;
}
@@ -134,8 +136,27 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
//### Should check Estate Owner ID but no Scene object available at this point
// Does Config Specify EstateID (0 Defaults To AutoIncrement)
int EstateID = config.GetInt("EstateID", 0);
if (EstateID > 0)
{
if (EstateID < 100)
{
// EstateID Cannot be less than 100
m_log.WarnFormat("[ESTATE LOADER FILE SYSTEM]: Estate name {0} specified estateID that is less that 100, ignoring", estateName);
continue;
}
else if(existingEstateIDs.Contains(EstateID))
{
// Specified EstateID Exists
m_log.WarnFormat("[ESTATE LOADER FILE SYSTEM]: Estate name {0} specified estateID that is already in use, ignoring", estateName);
continue;
}
}
// Create a new estate with the name provided
EstateSettings estateSettings = m_application.EstateDataService.CreateNewEstate();
EstateSettings estateSettings = m_application.EstateDataService.CreateNewEstate(EstateID);
estateSettings.EstateName = estateName;
estateSettings.EstateOwner = estateOwner;