ODR protection for solar system states.

This commit is contained in:
2024-05-03 03:22:23 -04:00
parent d99e5cf176
commit 902048134c
+6 -4
View File
@@ -13,7 +13,8 @@
#include <vector> #include <vector>
#include <map> #include <map>
namespace
{
struct Coord struct Coord
{ {
int x; int x;
@@ -38,14 +39,14 @@ struct WorldDescriptor
using SolarSystemTable= std::map< WorldDescriptor, WorldState >; using SolarSystemTable= std::map< WorldDescriptor, WorldState >;
using GalaxyTable= std::map< Coord, SolarSystemTable >; using GalaxyTable= std::map< Coord, SolarSystemTable >;
static auto & auto &
galaxy() galaxy()
{ {
static GalaxyTable table; static GalaxyTable table;
return table; return table;
} }
static auto auto
getCurrentCoord() getCurrentCoord()
{ {
const auto &star= *CurStarDescPtr; const auto &star= *CurStarDescPtr;
@@ -53,7 +54,7 @@ getCurrentCoord()
return pos; return pos;
} }
static auto & auto &
getCurrentWorldMasks() getCurrentWorldMasks()
{ {
const Coord pos= getCurrentCoord(); const Coord pos= getCurrentCoord();
@@ -68,6 +69,7 @@ getCurrentWorldMasks()
return galaxy()[ pos ][ { planet_index, moon_index } ].ScanRetrieveMask; return galaxy()[ pos ][ { planet_index, moon_index } ].ScanRetrieveMask;
} }
}
extern "C" extern "C"
{ {