From e13024d723463388f8d35ca16e2b3b8a6f906789 Mon Sep 17 00:00:00 2001 From: Andrew Tribick Date: Tue, 17 Dec 2024 19:25:09 +0100 Subject: [PATCH] Remove unused Simulation::findObject, make Universe::find private --- src/celengine/simulation.cpp | 22 ---------------------- src/celengine/simulation.h | 8 +++----- src/celengine/universe.h | 12 +++++------- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/src/celengine/simulation.cpp b/src/celengine/simulation.cpp index 563cf2ae2e..581969dd46 100644 --- a/src/celengine/simulation.cpp +++ b/src/celengine/simulation.cpp @@ -417,28 +417,6 @@ void Simulation::selectPlanet(int index) } } - -// Select an object by name, with the following priority: -// 1. Try to look up the name in the star database -// 2. Search the deep sky catalog for a matching name. -// 3. Search the planets and moons in the planetary system of the currently selected -// star -// 4. Search the planets and moons in any 'nearby' (< 0.1 ly) planetary systems -Selection Simulation::findObject(std::string_view s, bool i18n) const -{ - Selection path[2]; - std::size_t nPathEntries = 0; - - if (!selection.empty()) - path[nPathEntries++] = selection; - - if (auto nearestSolarSystem = getNearestSolarSystem(); nearestSolarSystem != nullptr) - path[nPathEntries++] = Selection(nearestSolarSystem->getStar()); - - return universe->find(s, {path, nPathEntries}, i18n); -} - - // Find an object from a path, for example Sol/Earth/Moon or Upsilon And/b // Currently, 'absolute' paths starting with a / are not supported nor are // paths that contain galaxies. diff --git a/src/celengine/simulation.h b/src/celengine/simulation.h index dc01696800..bcf0f7f7b2 100644 --- a/src/celengine/simulation.h +++ b/src/celengine/simulation.h @@ -28,13 +28,12 @@ #include #include - class Renderer; class Simulation { - public: - Simulation(Universe*); +public: + explicit Simulation(Universe*); ~Simulation(); double getTime() const; // Julian date @@ -65,7 +64,6 @@ class Simulation void setTrackedObject(const Selection&); void selectPlanet(int); - Selection findObject(std::string_view s, bool i18n = false) const; Selection findObjectFromPath(std::string_view s, bool i18n = false) const; void getObjectCompletion(std::vector& completion, std::string_view s, @@ -127,7 +125,7 @@ class Simulation void setFrame(ObserverFrame::CoordinateSystem, const Selection& refObject); const ObserverFrame::SharedConstPtr& getFrame() const; - private: +private: double realTime{ 0.0 }; double timeScale{ 1.0 }; double storedTimeScale{ 1.0 }; diff --git a/src/celengine/universe.h b/src/celengine/universe.h index 39c0772f34..fcf2d35e84 100644 --- a/src/celengine/universe.h +++ b/src/celengine/universe.h @@ -28,10 +28,9 @@ #include #include - class Universe { - public: +public: Universe() = default; ~Universe(); @@ -58,9 +57,6 @@ class Universe float tolerance = 0.0f); - Selection find(std::string_view s, - celestia::util::array_view contexts, - bool i18n = false) const; Selection findPath(std::string_view s, celestia::util::array_view contexts, bool i18n = false) const; @@ -90,12 +86,15 @@ class Universe bool isMarked(const Selection&, int priority) const; const celestia::MarkerList& getMarkers() const; - private: +private: void getCompletion(std::vector& completion, std::string_view s, celestia::util::array_view contexts, bool withLocations = false) const; + Selection find(std::string_view s, + celestia::util::array_view contexts, + bool i18n = false) const; Selection findChildObject(const Selection& sel, std::string_view name, bool i18n = false) const; @@ -122,7 +121,6 @@ class Universe float faintest, float tolerance = 0.0f) const; - private: std::unique_ptr starCatalog{nullptr}; std::unique_ptr dsoCatalog{nullptr}; std::unique_ptr solarSystemCatalog{nullptr};