diff --git a/src/Makefile.am b/src/Makefile.am index b7abfaa..45aa8f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,7 @@ Lephisto3D_SOURCES = main.cpp gui_button.cpp gui.cpp gui_fixed.cpp gui_screen.cp gui_image_radio_button.cpp gui_multi_state_image_button.cpp ship_cpanel.cpp gui_widget.cpp sector_view.cpp \ mtrand.cpp world_view.cpp system_view.cpp star_system.cpp sector.cpp system_info_view.cpp generic_system_view.cpp \ gui_container.cpp date.cpp space_station.cpp space_station_view.cpp model_body.cpp ship_type.cpp \ - info_view.cpp model_coll_mesh_data.cpp object_viewer_view.cpp + info_view.cpp model_coll_mesh_data.cpp object_viewer_view.cpp custom_starsystems.cpp Lephisto3D_LDADD = sbre/libsbre.a include_HEADERS = body.h frame.h generic_system_view.h glfreetype.h gui_button.h gui_container.h gui_events.h gui_fixed.h \ @@ -16,5 +16,5 @@ include_HEADERS = body.h frame.h generic_system_view.h glfreetype.h gui_button.h gui_radio_group.h gui_screen.h gui_toggle_button.h gui_widget.h libs.h matrix4x4.h mtrand.h objimport.h l3d.h \ planet.h player.h dynamic_body.h sector.h sector_view.h ship_cpanel.h ship.h space.h star.h star_system.h system_info_view.h \ system_view.h vector3.h view.h world_view.h date.h space_station.h space_station_view.h model_body.h gui_iselectable.h \ - ship_type.h object.h info_view.h model_coll_mesh_data.h object_viewer_view.h fixed.h + ship_type.h object.h info_view.h model_coll_mesh_data.h object_viewer_view.h fixed.h custom_starsystems.h diff --git a/src/custom_starsystems.cpp b/src/custom_starsystems.cpp new file mode 100644 index 0000000..5f1fa6b --- /dev/null +++ b/src/custom_starsystems.cpp @@ -0,0 +1,82 @@ +#include "custom_starsystems.h" + +const CustomSBody sol_system[] = { + { + "Sol", StarSystem::TYPE_STAR_G, + -1, fixed(1,1), fixed(1,1), 5700 + }, + + { + "Mercury", StarSystem::TYPE_PLANET_SMALL, + 0, fixed(38, 100), fixed(55, 1000), 340, + fixed(387,1000), fixed(205,1000), DEG2RAD(7.0) + }, + + { + "Venus", StarSystem::TYPE_PLANET_CO2_THICK_ATMOS, + 0, fixed(95,100), fixed(815,1000), 735, + fixed(723,1000), fixed(7,1000), DEG2RAD(3.39) + }, + + { + "Earth", StarSystem::TYPE_PLANET_INDIGENOUS_LIFE, + 0, fixed(1,1), fixed(1,1), 288, + fixed(1,1), fixed(167,10000), + }, + + { + "Moon", StarSystem::TYPE_PLANET_DWARF, + 3, fixed(273,1000), fixed(12,1000), 220, + fixed(257,100000), fixed(549,10000), DEG2RAD(5.145) + }, + + { + "Mars", StarSystem::TYPE_PLANET_SMALL, + 0, fixed(533,1000), fixed(107,1000), 227, + fixed(152,100), fixed(933,10000), DEG2RAD(1.85) + }, + + { + "Jupiter", StarSystem::TYPE_PLANET_LARGE_GAS_GIANT, + 0, fixed(11,1), fixed(3178,10), 165, + fixed(5204,1000), fixed(488,10000), DEG2RAD(1.305) + }, + + { + "Saturn", StarSystem::TYPE_PLANET_MEDIUM_GAS_GIANT, + 0, fixed(9,1), fixed(95152,100), 134, + fixed(9582,1000), fixed(557,10000), DEG2RAD(2.485) + }, + + { + "Uranus", StarSystem::TYPE_PLANET_SMALL_GAS_GIANT, + 0, fixed(4,1), fixed(145,10), 76, + fixed(19229,1000), fixed(444,10000), DEG2RAD(0.772) + }, + + { + "Neptune", StarSystem::TYPE_PLANET_SMALL_GAS_GIANT, + 0, fixed(38,10), fixed(17147,100), 72, + fixed(30104,1000), fixed(112, 10000), DEG2RAD(1.768) + }, + /* Moons of jupiter. */ + { + "Io", StarSystem::TYPE_PLANET_HIGHLY_VOLCANIC, + 6, fixed(286,1000), fixed(15,1000), 130, + fixed(282,100000), fixed(41,10000), DEG2RAD(2.21) + }, + + { + "Europa", StarSystem::TYPE_PLANET_WATER, + 6, fixed(245,1000), fixed(8,1000), 102, + fixed(441,100000), fixed(9,1000), 0.0 + }, + { 0 } +}; + +const CustomSystem custom_systems[] = { + { "Sol", sol_system, StarSystem::TYPE_STAR_G, 0, 0, vector3f(.5, .5, .5) }, + { "Barnard's Star", 0, StarSystem::TYPE_STAR_M, 0, 0, vector3f(.2, .3, .2) }, + { "Ross 154", 0, StarSystem::TYPE_STAR_M, 0, 0, vector3f(.1, .6, -.2) }, + { 0 } +}; diff --git a/src/custom_starsystems.h b/src/custom_starsystems.h new file mode 100644 index 0000000..aeab42a --- /dev/null +++ b/src/custom_starsystems.h @@ -0,0 +1,26 @@ +#pragma once +#include "star_system.h" +#include "fixed.h" + +struct CustomSBody { + const char* name; /* Null to end system. */ + StarSystem::BodyType type; + int primaryIdx; /* -1 for primary. */ + fixed radius; /* In earth radii for planets, sol radii for stars. */ + fixed mass; /* Earth masses or sol masses. */ + int averageTemp; /* Kelvin. */ + fixed semiMajorAxis; /* In AUs. */ + fixed eccentricity; + float inclination; /* Radians. */ +}; + +struct CustomSystem { + const char* name; + const CustomSBody* sbodies; /* 0 to let system be random. */ + StarSystem::BodyType primaryType; + int sectorX, sectorY; + vector3f pos; +}; + +extern const CustomSystem custom_systems[]; + diff --git a/src/libs.h b/src/libs.h index 6bf5353..4de3565 100644 --- a/src/libs.h +++ b/src/libs.h @@ -29,6 +29,8 @@ #define DEBUG +#define UNIVERSE_SEED 0xabcd1234 + /* * Normal use: * foreach(container, iter) { do_something(*iter); } @@ -50,4 +52,5 @@ #define MAX(x,y) ((x)>(y)?(x):(y)) #define CLAMP(a, min, max) (((a) > (max)) ? (max) : (((a) < (min)) ? (min) : (a))) #define DEG_2_RAD 0.0174532925 +#define DEG2RAD(x) ((x)*M_PI/180.0) diff --git a/src/main.cpp b/src/main.cpp index 6fe0f84..1be50c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -192,9 +192,8 @@ void L3D::MainLoop(void) { StarSystem s(0, 0, 0); HyperspaceTo(&s); - /* Linked list eh... Put player at planet f. */ const float zpos = EARTH_RADIUS * 7; - Frame* pframe = *(++(++(++(Space::rootFrame->m_children.begin())))); + Frame* pframe = *(Space::rootFrame->m_children.begin()); player->SetFrame(pframe); player->SetPosition(vector3d(0, zpos*0.1, zpos)); diff --git a/src/sector.cpp b/src/sector.cpp index 70ab8cf..b6fe706 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -1,4 +1,6 @@ #include "sector.h" +#include "star_system.h" +#include "custom_starsystems.h" #define SYS_NAME_FLAGS 32 static const char* sys_names[SYS_NAME_FLAGS] = @@ -6,39 +8,65 @@ static const char* sys_names[SYS_NAME_FLAGS] = "lia", "an", "ar", "ur", "mi", "in", "ti", "qu", "so", "ed", "ess", "ex", "io", "ce", "ze", "fa", "ay", "wa", "da", "ack", "gre" }; -Sector::Sector(int x, int y) { - unsigned long _init[2] = { x, y }; - sx = x; sy = y; - MTRand rng(_init, 2); +void Sector::GetCustomSystems(void) { + int n = 0; + for(int i = 0; ; i++) { + if(custom_systems[i].name == 0) break; + if((custom_systems[i].sectorX == sx) && + (custom_systems[i].sectorY == sy)) { + n++; + const CustomSystem* sys = &custom_systems[i]; - m_numSystems = rng.Int32(3,6); - - for(int i = 0; i < m_numSystems; i++) { - System s; - s.p.x = rng.Double(SIZE); - s.p.y = rng.Double(SIZE); - s.p.z = rng.Double(2*SIZE)-SIZE; - s.name = GenName(rng); - - float spec = rng.Int32(1000000); - /* Frequences are from our friends over at wikipedia. ^.^ */ - if(spec < 1) { - s.primaryStarClass = StarSystem::TYPE_STAR_O; - } else if(spec < 1300) { - s.primaryStarClass = StarSystem::TYPE_STAR_B; - } else if(spec < 7300) { - s.primaryStarClass = StarSystem::TYPE_STAR_A; - } else if(spec < 37300) { - s.primaryStarClass = StarSystem::TYPE_STAR_F; - } else if(spec < 113300) { - s.primaryStarClass = StarSystem::TYPE_STAR_G; - } else if(spec < 234300) { - s.primaryStarClass = StarSystem::TYPE_STAR_K; - } else { - s.primaryStarClass = StarSystem::TYPE_STAR_M; + System s; + s.p = SIZE*sys->pos; + s.name = custom_systems[i].name; + s.primaryStarClass = custom_systems[i].primaryType; + s.customDef = sys->sbodies; + m_systems.push_back(s); } + } +} - m_systems.push_back(s); +Sector::Sector(int x, int y) { + unsigned long _init[3] = { x, y, UNIVERSE_SEED }; + sx = x; sy = y; + MTRand rng(_init, 3); + + GetCustomSystems(); + + if(m_systems.size() != 0) { + /* Custom sector. */ + } else { + int numSystems = rng.Int32(3,6); + + for(int i = 0; i < numSystems; i++) { + System s; + s.p.x = rng.Double(SIZE); + s.p.y = rng.Double(SIZE); + s.p.z = rng.Double(2*SIZE)-SIZE; + s.name = GenName(rng); + s.customDef = 0; + + float spec = rng.Int32(1000000); + /* Frequencies from wiki. :D */ + if(spec < 1) { + s.primaryStarClass = StarSystem::TYPE_STAR_O; + } else if(spec < 1300) { + s.primaryStarClass = StarSystem::TYPE_STAR_B; + } else if(spec < 7300) { + s.primaryStarClass = StarSystem::TYPE_STAR_A; + } else if(spec < 37300) { + s.primaryStarClass = StarSystem::TYPE_STAR_F; + } else if(spec < 113300) { + s.primaryStarClass = StarSystem::TYPE_STAR_G; + } else if(spec < 234300) { + s.primaryStarClass = StarSystem::TYPE_STAR_K; + } else { + s.primaryStarClass = StarSystem::TYPE_STAR_M; + } + + m_systems.push_back(s); + } } } diff --git a/src/sector.h b/src/sector.h index 6b09794..dcd7bc2 100644 --- a/src/sector.h +++ b/src/sector.h @@ -4,6 +4,8 @@ #include "libs.h" #include "star_system.h" +class CustomSBody; + class Sector { public: /* Lightyears. */ @@ -11,15 +13,16 @@ public: Sector(int x, int y); static float DistanceBetween(const Sector* a, int sysIdxA, const Sector* b, int sysIdxB); - int m_numSystems; struct System { std::string name; vector3f p; StarSystem::BodyType primaryStarClass; + const CustomSBody* customDef; }; std::vector<System>m_systems; private: + void GetCustomSystems(void); std::string GenName(MTRand& rand); int sx, sy; }; diff --git a/src/space.cpp b/src/space.cpp index b9f6978..bfac75e 100644 --- a/src/space.cpp +++ b/src/space.cpp @@ -43,7 +43,7 @@ void Space::Clear(void) { void Space::GenBody(StarSystem* system, StarSystem::SBody* sbody, Frame* f) { Body* b; - if(sbody->supertype == StarSystem::SUPERTYPE_STAR) { + if(sbody->GetSuperType() == StarSystem::SUPERTYPE_STAR) { Star* star = new Star(sbody); b = star; } else { diff --git a/src/star_system.cpp b/src/star_system.cpp index 498e893..be087fb 100644 --- a/src/star_system.cpp +++ b/src/star_system.cpp @@ -1,5 +1,6 @@ #include "star_system.h" #include "sector.h" +#include "custom_starsystems.h" #define CELSIUS 273.15 #define DEBUG_DUMP @@ -16,6 +17,7 @@ float StarSystem::starColors[7][3] = { }; static const struct SBodySubTypeInfo { + StarSystem::BodySuperType supertype; int mass; /* % sol for stars, unused for planets. */ int radius; /* % Sol radii for stars, % earth radii for planets. */ const char *description; @@ -23,102 +25,128 @@ static const struct SBodySubTypeInfo { int tempMin, tempMax; } bodyTypeInfo[StarSystem::TYPE_MAX] = { { + StarSystem::SUPERTYPE_STAR, 40, 50, "Type 'M' red star", "icons/object_star_m.png", 2000, 3500 }, { + StarSystem::SUPERTYPE_STAR, 80, 90, "Type 'K' orange star", "icons/object_star_k.png", 3500, 5000 }, { + StarSystem::SUPERTYPE_STAR, 110, 110, "Type 'G' yellow star", "icons/object_star_g.png", 5000, 6000 }, { + StarSystem::SUPERTYPE_STAR, 170, 140, "Type 'F' white star", "icons/object_star_f.png", 6000, 7500 }, { + StarSystem::SUPERTYPE_STAR, 310, 210, "Type 'A' hot white star", "icons/object_star_a.png", 7500, 10000 }, { + StarSystem::SUPERTYPE_STAR, 1800, 700, "Bright type 'B' blue star", "icons/object_star_b.png", 10000, 30000 }, { + StarSystem::SUPERTYPE_STAR, 6400, 1600, "Hot, massive type 'O' blue star", "icons/object_star_o.png", 30000, 60000 }, { + StarSystem::SUPERTYPE_GAS_GIANT, 0, 30, "Brown dwarf sub-stellar object", "icons/object_brown_dwarf.png" }, { + StarSystem::SUPERTYPE_GAS_GIANT, 0, 390, "Small gas giant", "icons/object_planet_small_gas_giant.png" }, { + StarSystem::SUPERTYPE_GAS_GIANT, 0, 950, "Medium gas giant", "icons/object_planet_medium_gas_giant.png" }, { + StarSystem::SUPERTYPE_GAS_GIANT, 0, 1110, "Large gas giant", "icons/object_planet_large_gas_giant.png" }, { + StarSystem::SUPERTYPE_GAS_GIANT, 0, 1500, "Very large gas giant", "icons/object_planet_large_gas_giant.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 26, "Small, rocky dwarf planet", "icons/object_planet_dwarf.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 52, "Small, rocky planet with a thin atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with liquid water and a nitrogen atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with a carbon dioxide atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with a methane atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with running water and a thick nitrogen atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with a thick carbon dioxide atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Rocky planet with a thick methane atmosphere", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "Highly volcanic world", "icons/object_planet_small.png" }, { + StarSystem::SUPERTYPE_ROCKY_PLANET, 0, 100, "World with indigenous life and an oxygen atmosphere", "icons/object_planet_life.png" } }; +StarSystem::BodySuperType StarSystem::SBody::GetSuperType(void) const { + return bodyTypeInfo[type].supertype; +} + const char* StarSystem::SBody::GetAstroDescription(void) { return bodyTypeInfo[type].description; } @@ -241,7 +269,7 @@ double calc_orbital_period(double semiMajorAxis, double centralMass) { void StarSystem::SBody::EliminateBadChildren(void) { /* Check for overlapping & unacceptably close orbits. Merge planets. */ for (std::vector<SBody*>::iterator i = children.begin(); i != children.end(); ++i) { - if((*i)->temp) continue; + if((*i)->tmp) continue; for(std::vector<SBody*>::iterator j = children.begin(); j != children.end(); ++j) { if((*j) == (*i)) continue; /* Don't eat anything bigger than self. */ @@ -254,40 +282,108 @@ void StarSystem::SBody::EliminateBadChildren(void) { fixed j_avg = (j_min+j_max)>>1; bool eat = false; if(i_avg > j_avg) { - if(i_min < j_max*fixed(12, 10)) eat = true; + if(i_min < j_max*fixed(13, 10)) eat = true; } else { - if(i_max > j_min*fixed(8, 10)) eat = true; + if(i_max > j_min*fixed(7, 10)) eat = true; } if(eat) { (*i)->mass += (*j)->mass; - (*j)->temp = 1; + (*j)->tmp = 1; } } } /* Kill the eaten ones. */ for(std::vector<SBody*>::iterator i = children.begin(); i != children.end();) { - if((*i)->temp) { + if((*i)->tmp) { i = children.erase(i); } else i++; } } +#if 0 +struct CustomSBody { + const char* name; /* Null to end system. */ + StarSystem::BodyType type; + int primaryIdx; /* -1 for primary. */ + fixed radius; /* In earth radii for planets, sol radii for stars. */ + fixed mass; /* Earth masses or sol masses. */ + int averageTemp; /* Kelvin. */ + fixed semiMajorAxis; /* in AUs. */ + fixed eccentricity; +} +#endif + +void StarSystem::CustomGetChildOf(SBody* parent, const CustomSBody* customDef, const int primaryIdx) { + const CustomSBody* c = customDef; + for(int i = 0; c->name; c++, i++) { + if(c->primaryIdx != primaryIdx) continue; + + SBody* child = new SBody; + StarSystem::BodyType type = c->type; + child->type = type; + child->parent = parent; + child->radius = c->radius; + child->mass = c->mass; + child->averageTemp = c->averageTemp; + child->name = c->name; + + child->orbit.eccentricity = c->eccentricity.ToDouble(); + child->orbit.semiMajorAxis = c->semiMajorAxis.ToDouble() * AU; + child->orbit.period = calc_orbital_period(child->orbit.semiMajorAxis, parent->GetMass()); + child->orbit.rotMatrix = matrix4x4d::RotateYMatrix(c->inclination) * + matrix4x4d::RotateZMatrix(rand.Double(M_PI)); + parent->children.push_back(child); + + /* Perihelion and Aphelion (in AUS). */ + child->radMin = c->semiMajorAxis - c->eccentricity*c->semiMajorAxis; + child->radMax = 2*c->semiMajorAxis - child->radMin; + + CustomGetChildOf(child, customDef, i); + } +} + +void StarSystem::GenerateFromCustom(const CustomSBody* customDef) { + /* Find primary. */ + const CustomSBody* csbody = customDef; + + int idx = 0; + while((csbody->name) && (csbody->primaryIdx != -1)) { csbody++; idx++; } + assert(csbody->primaryIdx == -1); + + rootBody = new SBody; + StarSystem::BodyType type = csbody->type; + rootBody->type = type; + rootBody->parent = NULL; + rootBody->radius = csbody->radius; + rootBody->mass = csbody->mass; + rootBody->averageTemp = csbody->averageTemp; + rootBody->name = csbody->name; + + CustomGetChildOf(rootBody, customDef, idx); +} + /* * Choices that depend on floating point values will result in * different universes on different platforms it seems. * As a result we should avoid floating point values in these places. */ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) { - unsigned long _init[3] = { system_idx, sector_x, sector_y }; + unsigned long _init[4] = { system_idx, sector_x, sector_y, UNIVERSE_SEED }; loc.secX = sector_x; loc.secY = sector_y; loc.sysIdx = system_idx; rootBody = 0; if(system_idx == -1) return; - rand.seed(_init, 3); + rand.seed(_init, 4); Sector s = Sector(sector_x, sector_y); + + if(s.m_systems[system_idx].customDef) { + GenerateFromCustom(s.m_systems[system_idx].customDef); + return; + } + /* Primary. */ SBody* primary = new SBody; @@ -296,7 +392,6 @@ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) { primary->parent = NULL; primary->radius = fixed(bodyTypeInfo[type].radius, 100); primary->mass = fixed(bodyTypeInfo[type].mass, 100); - primary->supertype = SUPERTYPE_STAR; primary->averageTemp = rand.Int32(bodyTypeInfo[type].tempMin, bodyTypeInfo[type].tempMax); rootBody = primary; @@ -312,9 +407,8 @@ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) { SBody* planet = new SBody; planet->type = TYPE_PLANET_DWARF; - planet->supertype = SUPERTYPE_NONE; planet->seed = rand.Int32(); - planet->temp = 0; + planet->tmp = 0; planet->parent = primary; //planet->radius = EARTH_RADIUS*bodyTypeInfo[type].radius; planet->mass = mass; @@ -444,21 +538,20 @@ void StarSystem::SBody::PickPlanetType(SBody* star, const fixed distToPrimary, M radius = fixed(bodyTypeInfo[type].radius, 100); /* Generate moons. */ if((genMoons) && (mass > fixed(1,2))) { - std::vector<int>* disc = AccreteDisc(isqrt(mass.v>>12), 10, rand.Int32(1, 10), rand); + std::vector<int>* disc = AccreteDisc(isqrt(mass.v>>13), 10, rand.Int32(1, 10), rand); for(unsigned int i = 0; i < disc->size(); i++) { fixed mass = fixed((*disc)[i]); if(mass == 0) continue; SBody* moon = new SBody; moon->type = TYPE_PLANET_DWARF; - moon->supertype = SUPERTYPE_NONE; moon->seed = rand.Int32(); - moon->temp = 0; + moon->tmp = 0; moon->parent = this; //moon->radius = EARTH_RADIUS*bodyTypeInfo[type].radius; moon->mass = mass; fixed ecc = rand.NFixed(3); - fixed semiMajorAxis = fixed(i+1, 2000); + fixed semiMajorAxis = fixed(i+2, 2000); moon->orbit.eccentricity = ecc.ToDouble(); moon->orbit.semiMajorAxis = semiMajorAxis.ToDouble()*AU; moon->orbit.period = calc_orbital_period(moon->orbit.semiMajorAxis, this->mass.ToDouble() * EARTH_MASS); diff --git a/src/star_system.h b/src/star_system.h index c923ca5..2e5e681 100644 --- a/src/star_system.h +++ b/src/star_system.h @@ -17,6 +17,8 @@ struct systemloc_t { int secX, secY, sysIdx; }; +class CustomSBody; + /* Doubles: All masses are in Kg, all lengths in meters. */ class StarSystem { public: @@ -83,14 +85,21 @@ public: const char* GetAstroDescription(void); const char* GetIcon(void); + BodySuperType GetSuperType() const; double GetRadius(void) const { - if(supertype == SUPERTYPE_STAR) + if(GetSuperType() == SUPERTYPE_STAR) return radius.ToDouble() * SOL_RADIUS; else return radius.ToDouble() * EARTH_RADIUS; } + double GetMass(void) const { + if(GetSuperType() == SUPERTYPE_STAR) + return mass.ToDouble() * SOL_MASS; + else + return mass.ToDouble() * EARTH_MASS; + } - int temp; + int tmp; Orbit orbit; int seed; /* planet.cpp can use to generate terrain. */ std::string name; @@ -106,6 +115,8 @@ public: SBody* rootBody; private: + void CustomGetChildOf(SBody* parent, const CustomSBody* customDef, const int parentIdx); + void GenerateFromCustom(const CustomSBody*); systemloc_t loc; MTRand rand; diff --git a/src/system_info_view.cpp b/src/system_info_view.cpp index 026daf9..74a9806 100644 --- a/src/system_info_view.cpp +++ b/src/system_info_view.cpp @@ -18,7 +18,7 @@ void SystemInfoView::OnBodySelected(StarSystem::SBody* b) { snprintf(buf, sizeof(buf), "%s: %s\n" "Mass %.2f %s masses\n", b->name.c_str(), b->GetAstroDescription(), b->mass.ToDouble(), - (b->supertype == StarSystem::SUPERTYPE_STAR ? "Solar" : "Earth")); + (b->GetSuperType() == StarSystem::SUPERTYPE_STAR ? "Solar" : "Earth")); desc += buf; snprintf(buf, sizeof(buf), "Surface temperature %d C\n", b->averageTemp-273);