From 248b652ad13fbc54b15b41d756afbee899ea24d7 Mon Sep 17 00:00:00 2001 From: Axtel Sturnclaw Date: Wed, 8 Jan 2025 19:36:57 -0500 Subject: [PATCH] Ensure randomly-generated starports have population - PopulateStage1() was not being called for starports added at the end of the generation process, leading to orbital and surface starports without any population. - This manifested as an almost total lack of paintshops across the galaxy :) --- src/galaxy/StarSystemGenerator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/galaxy/StarSystemGenerator.cpp b/src/galaxy/StarSystemGenerator.cpp index 5209f82196..4b2acc2688 100644 --- a/src/galaxy/StarSystemGenerator.cpp +++ b/src/galaxy/StarSystemGenerator.cpp @@ -1643,6 +1643,8 @@ void PopulateStarSystemGenerator::PopulateAddStations(SystemBody *sbody, StarSys // with respect to well-spaced orbital shells (e.g. a "station belt" around a high-population planet) // as well as generating station placement for e.g. research, industrial, or communications stations + fixed totalPop = system->GetTotalPop(); + if (sbody->GetPopulationAsFixed() < fixed(1, 1000)) return; fixed orbMaxS = fixed(1, 4) * fixed(CalcHillRadius(sbody)); fixed orbMinS = fixed().FromDouble((sbody->CalcAtmosphereParams().atmosRadius + +500000.0 / EARTH_RADIUS)) * AU_EARTH_RADIUS; @@ -1747,6 +1749,7 @@ void PopulateStarSystemGenerator::PopulateAddStations(SystemBody *sbody, StarSys sp->m_orbMax = sp->GetSemiMajorAxisAsFixed(); sp->m_name = gen_unique_station_name(sp, system, namerand); + PopulateStage1(sp, system, totalPop); } } } @@ -1771,6 +1774,7 @@ void PopulateStarSystemGenerator::PopulateAddStations(SystemBody *sbody, StarSys PositionSettlementOnPlanet(sp, previousOrbits); sbody->m_children.insert(sbody->m_children.begin(), sp); system->AddSpaceStation(sp); + PopulateStage1(sp, system, totalPop); } // guarantee that there is always a star port on a populated world @@ -1786,7 +1790,10 @@ void PopulateStarSystemGenerator::PopulateAddStations(SystemBody *sbody, StarSys PositionSettlementOnPlanet(sp, previousOrbits); sbody->m_children.insert(sbody->m_children.begin(), sp); system->AddSpaceStation(sp); + PopulateStage1(sp, system, totalPop); } + + system->SetTotalPop(totalPop); } void PopulateStarSystemGenerator::SetSysPolit(RefCountedPtr galaxy, RefCountedPtr system, const fixed &human_infestedness)