Hello.
I'd be very thankful if someone could explain me how does the server know to which sector of a map a point belongs to, and also how are sectors stored in memory(as an unidimensional array or as a two dimensional one)
I've been looking through the code, but I can't figure it out. I get lost at this part.
Code:
private Sector InternalGetSector( int x, int y )
{
if ( x >= 0 && x < m_SectorsWidth && y >= 0 && y < m_SectorsHeight )
{
Sector[] xSectors = m_Sectors[x];
if ( xSectors == null )
m_Sectors[x] = xSectors = new Sector[m_SectorsHeight];
Sector sec = xSectors[y];
if ( sec == null )
xSectors[y] = sec = new Sector( x, y, this );
return sec;
}
else
{
return m_InvalidSector;
}
}
Thanks