コード例 #1
0
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle)
{
	sim_info_map_t::const_iterator it = mSimInfoMap.find(handle);
	if (it != mSimInfoMap.end())
	{
		return it->second;
	}

// <FS:CR> Aurora Sim
	U32 x = 0, y = 0;
	from_region_handle(handle, &x, &y);
	for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
	{
		U32 checkRegionX, checkRegionY;
		from_region_handle((*it).first, &checkRegionX, &checkRegionY);

		LLSimInfo* info = (*it).second;
		if (x >= checkRegionX && x < (checkRegionX + info->getSizeX()) &&
			y >= checkRegionY && y < (checkRegionY + info->getSizeY()))
		{
			return info;
		}
	}
// </FS:CR> Aurora Sim
	return NULL;
}
コード例 #2
0
ファイル: llworldmap.cpp プロジェクト: Barosonix/AstraViewer
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 findhandle)
{
	std::map<U64, LLSimInfo*>::const_iterator it;
	for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
	{
		const U64 handle = (*it).first;
		LLSimInfo* info = (*it).second;
		if(handle == findhandle)
		{
			return info;
		}
		U32 x = 0, y = 0;
		from_region_handle(findhandle, &x, &y);
		U32 checkRegionX, checkRegionY;
		from_region_handle(handle, &checkRegionX, &checkRegionY);

		if(x >= checkRegionX && x < (checkRegionX + info->getSizeX()) &&
			y >= checkRegionY && y < (checkRegionY + info->getSizeY()))
		{
			return info;
		}
	}
	return NULL;
}