Simulator::StarID struct

32 bits field used to uniquely identify a star within the galaxy.

The galaxy is divided in sectors, the star ID keeps the index to the sector and the index of the star within the sector. Some bits are reserved to be able to form PlanetID. The bits are organized as:

31    24 23       12 11      0
00000000 sectorIndex starIndex

Constructors, destructors, conversion operators

StarID(unsigned int sectorIndex, unsigned int starIndex)
Creates a star ID using the given sector and index of star within that sector.
StarID(uint32_t value)

Public functions

auto GetRecord() const -> cStarRecord*
auto GetSectorIndex() const -> unsigned int
Returns the index of the sector where this star is stored.
auto GetStarIndex() const -> unsigned int
Returns the index of the star within its star sector.

Public variables

uint32_t internalValue

Function documentation

Simulator::StarID::StarID(unsigned int sectorIndex, unsigned int starIndex)

Creates a star ID using the given sector and index of star within that sector.

Parameters
sectorIndex Index of galaxy sector, between 0 and 4095.
starIndex Index of star within the sector, between 0 and 4095.