In GridService, have GetRegionByName() call GetRegionsByName() with a max return of 1 instead of duplicating code.

This also fixes the problem where this method would not return a hypergrid region, unlike GetRegionsByName()
bulletsim
Justin Clark-Casey (justincc) 2011-08-02 00:26:17 +01:00
parent b6ac1c46cd
commit 8d33a2eaa1
1 changed files with 5 additions and 4 deletions

View File

@ -322,16 +322,17 @@ namespace OpenSim.Services.GridService
public GridRegion GetRegionByName(UUID scopeID, string regionName) public GridRegion GetRegionByName(UUID scopeID, string regionName)
{ {
List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID); List<GridRegion> rinfos = GetRegionsByName(scopeID, regionName, 1);
if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first if (rinfos.Count > 0)
return rinfos[0];
return null; return null;
} }
public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{ {
m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
List<RegionData> rdatas = m_Database.Get(name + "%", scopeID); List<RegionData> rdatas = m_Database.Get(name + "%", scopeID);