Skip to content

Commit

Permalink
fix(ui): Fix race condition when drawing the planet labels (endless-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
quyykk authored Sep 24, 2023
1 parent 3e11377 commit f52da65
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,14 @@ void Engine::Step(bool isActive)
centerVelocity = flagship->Velocity();
if(flagship->IsHyperspacing() && Preferences::Has("Extended jump effects"))
centerVelocity *= 1. + pow(flagship->GetHyperspacePercentage() / 20., 2);
if(doEnter)
{
// Create the planet labels as soon as we entered a new system.
labels.clear();
for(const StellarObject &object : player.GetSystem()->Objects())
if(object.HasSprite() && object.HasValidPlanet() && object.GetPlanet()->IsAccessible(flagship.get()))
labels.emplace_back(labels, *player.GetSystem(), object);
}
if(doEnter && flagship->Zoom() == 1. && !flagship->IsHyperspacing())
{
doEnter = false;
Expand Down Expand Up @@ -1381,13 +1389,6 @@ void Engine::EnterSystem()
Messages::Add(GameData::HelpMessage("basics 1"), Messages::Importance::High);
Messages::Add(GameData::HelpMessage("basics 2"), Messages::Importance::High);
}

// Create the planet labels.
labels.clear();
if(system)
for(const StellarObject &object : system->Objects())
if(object.HasSprite() && object.HasValidPlanet() && object.GetPlanet()->IsAccessible(flagship))
labels.emplace_back(labels, *system, object);
}


Expand Down

0 comments on commit f52da65

Please sign in to comment.