Skip to content

Commit 1ec7fe8

Browse files
committed
Don't create moons with 0kg mass
1 parent 34818b5 commit 1ec7fe8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/galaxy/StarSystemGenerator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,9 @@ SystemBody *StarSystemRandomGenerator::MakeBodyInOrbitSlice(Random &rand, StarSy
11281128

11291129
mass *= discDensity;
11301130

1131+
if (mass == fixed(0, 1))
1132+
return nullptr; // We used our best math, but this body just turned out too small, sorry.
1133+
11311134
if (mass.v < 0) { // hack around overflow
11321135
Output("WARNING: planetary mass has overflowed! (child %d of %s)\n", primary->GetNumChildren(), primary->GetName().c_str());
11331136
mass = fixed(Sint64(0x7fFFffFFffFFffFFull));

0 commit comments

Comments
 (0)