diff --git a/source/game/StarPlayerUniverseMap.cpp b/source/game/StarPlayerUniverseMap.cpp index 2f911ea..64f20d7 100644 --- a/source/game/StarPlayerUniverseMap.cpp +++ b/source/game/StarPlayerUniverseMap.cpp @@ -71,30 +71,30 @@ List> PlayerUniverseMap::orbitBookmarks() const { return bookmarks; } -void PlayerUniverseMap::addOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark) { +bool PlayerUniverseMap::addOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark) { if (system.isNull()) throw StarException("Cannot add orbit bookmark to null system"); - m_universeMaps[*m_serverUuid].systems[system.location()].bookmarks.add(std::move(bookmark)); + return m_universeMaps[*m_serverUuid].systems[system.location()].bookmarks.add(std::move(bookmark)); } -void PlayerUniverseMap::removeOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark) { +bool PlayerUniverseMap::removeOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark) { if (system.isNull()) throw StarException("Cannot remove orbit bookmark from null system"); - m_universeMaps[*m_serverUuid].systems[system.location()].bookmarks.remove(bookmark); + return m_universeMaps[*m_serverUuid].systems[system.location()].bookmarks.remove(bookmark); } List PlayerUniverseMap::teleportBookmarks() const { return universeMap().teleportBookmarks.values(); } -void PlayerUniverseMap::addTeleportBookmark(TeleportBookmark bookmark) { - m_universeMaps[*m_serverUuid].teleportBookmarks.add(std::move(bookmark)); +bool PlayerUniverseMap::addTeleportBookmark(TeleportBookmark bookmark) { + return m_universeMaps[*m_serverUuid].teleportBookmarks.add(std::move(bookmark)); } -void PlayerUniverseMap::removeTeleportBookmark(TeleportBookmark const& bookmark) { - m_universeMaps[*m_serverUuid].teleportBookmarks.remove(bookmark); +bool PlayerUniverseMap::removeTeleportBookmark(TeleportBookmark const& bookmark) { + return m_universeMaps[*m_serverUuid].teleportBookmarks.remove(bookmark); } void PlayerUniverseMap::invalidateWarpAction(WarpAction const& warpAction) { diff --git a/source/game/StarPlayerUniverseMap.hpp b/source/game/StarPlayerUniverseMap.hpp index fad0c41..bf8efec 100644 --- a/source/game/StarPlayerUniverseMap.hpp +++ b/source/game/StarPlayerUniverseMap.hpp @@ -53,12 +53,12 @@ public: // pair of system location and bookmark, not all orbit bookmarks include the system List> orbitBookmarks() const; - void addOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark); - void removeOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark); + bool addOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark); + bool removeOrbitBookmark(CelestialCoordinate const& system, OrbitBookmark const& bookmark); List teleportBookmarks() const; - void addTeleportBookmark(TeleportBookmark bookmark); - void removeTeleportBookmark(TeleportBookmark const& bookmark); + bool addTeleportBookmark(TeleportBookmark bookmark); + bool removeTeleportBookmark(TeleportBookmark const& bookmark); void invalidateWarpAction(WarpAction const& bookmark); Maybe worldBookmark(CelestialCoordinate const& world) const; diff --git a/source/game/scripting/StarPlayerLuaBindings.cpp b/source/game/scripting/StarPlayerLuaBindings.cpp index 5f12ee3..c12efc1 100644 --- a/source/game/scripting/StarPlayerLuaBindings.cpp +++ b/source/game/scripting/StarPlayerLuaBindings.cpp @@ -594,12 +594,12 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { }); }); - callbacks.registerCallback("addOrbitBookmark", [player](Json const& system, Json const& bookmarkConfig) { + callbacks.registerCallback("addOrbitBookmark", [player](Json const& system, Json const& bookmarkConfig) -> bool { CelestialCoordinate coordinate = CelestialCoordinate(system); return player->universeMap()->addOrbitBookmark(coordinate, OrbitBookmark::fromJson(bookmarkConfig)); }); - callbacks.registerCallback("removeOrbitBookmark", [player](Json const& system, Json const& bookmarkConfig) { + callbacks.registerCallback("removeOrbitBookmark", [player](Json const& system, Json const& bookmarkConfig) -> bool { CelestialCoordinate coordinate = CelestialCoordinate(system); return player->universeMap()->removeOrbitBookmark(coordinate, OrbitBookmark::fromJson(bookmarkConfig)); }); @@ -610,11 +610,11 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { }); }); - callbacks.registerCallback("addTeleportBookmark", [player](Json const& bookmarkConfig) { + callbacks.registerCallback("addTeleportBookmark", [player](Json const& bookmarkConfig) -> bool { return player->universeMap()->addTeleportBookmark(TeleportBookmark::fromJson(bookmarkConfig)); }); - callbacks.registerCallback("removeTeleportBookmark", [player](Json const& bookmarkConfig) { + callbacks.registerCallback("removeTeleportBookmark", [player](Json const& bookmarkConfig) -> bool { player->universeMap()->removeTeleportBookmark(TeleportBookmark::fromJson(bookmarkConfig)); });