Make static data tables in StarSystem const.

master
lwho 2014-02-21 22:34:07 +01:00
parent 916c48a261
commit 47685c1c9a
4 changed files with 12 additions and 12 deletions

View File

@ -152,7 +152,7 @@ void Camera::Update()
attrs.billboardPos = vector3f(&pos.x);
attrs.billboardSize = float(size);
if (b->IsType(Object::STAR)) {
Uint8 *col = StarSystem::starRealColors[b->GetSystemBody()->GetType()];
const Uint8 *col = StarSystem::starRealColors[b->GetSystemBody()->GetType()];
attrs.billboardColor = Color(col[0], col[1], col[2], 255);
}
else if (b->IsType(Object::PLANET)) {

View File

@ -1014,7 +1014,7 @@ void SectorView::DrawNearSector(const int sx, const int sy, const int sz, const
systrans.Scale((StarSystem::starScale[(*i).starType[0]]));
m_renderer->SetTransform(systrans);
Uint8 *col = StarSystem::starColors[(*i).starType[0]];
const Uint8 *col = StarSystem::starColors[(*i).starType[0]];
AddStarBillboard(systrans, vector3f(0.f), Color(col[0], col[1], col[2], 255), 0.5f);
// player location indicator

View File

@ -42,7 +42,7 @@ static const fixed SUN_MASS_TO_EARTH_MASS = fixed(332998,1);
static const fixed FIXED_PI = fixed(103993,33102);
// indexed by enum type turd
Uint8 StarSystem::starColors[][3] = {
const Uint8 StarSystem::starColors[][3] = {
{ 0, 0, 0 }, // gravpoint
{ 128, 0, 0 }, // brown dwarf
{ 102, 102, 204 }, // white dwarf
@ -83,7 +83,7 @@ Uint8 StarSystem::starColors[][3] = {
};
// indexed by enum type turd
Uint8 StarSystem::starRealColors[][3] = {
const Uint8 StarSystem::starRealColors[][3] = {
{ 0, 0, 0 }, // gravpoint
{ 128, 0, 0 }, // brown dwarf
{ 255, 255, 255 }, // white dwarf
@ -123,7 +123,7 @@ Uint8 StarSystem::starRealColors[][3] = {
{ 10, 0, 16 }, // massive BH
};
double StarSystem::starLuminosities[] = {
const double StarSystem::starLuminosities[] = {
0,
0.0003, // brown dwarf
0.1, // white dwarf
@ -163,7 +163,7 @@ double StarSystem::starLuminosities[] = {
0.000003, // Supermassive Black hole
};
float StarSystem::starScale[] = { // Used in sector view
const float StarSystem::starScale[] = { // Used in sector view
0,
0.6f, // brown dwarf
0.5f, // white dwarf
@ -203,7 +203,7 @@ float StarSystem::starScale[] = { // Used in sector view
4.0f // Supermassive blackhole
};
fixed StarSystem::starMetallicities[] = {
const fixed StarSystem::starMetallicities[] = {
fixed(1,1), // GRAVPOINT - for planets that orbit them
fixed(9,10), // brown dwarf
fixed(5,10), // white dwarf

View File

@ -283,11 +283,11 @@ public:
int GetNumStars() const { return m_numStars; }
const SysPolit &GetSysPolit() const { return m_polit; }
static Uint8 starColors[][3];
static Uint8 starRealColors[][3];
static double starLuminosities[];
static float starScale[];
static fixed starMetallicities[];
static const Uint8 starColors[][3];
static const Uint8 starRealColors[][3];
static const double starLuminosities[];
static const float starScale[];
static const fixed starMetallicities[];
RefCountedPtr<SystemBody> m_rootBody;
std::vector<SystemBody*> m_spaceStations;