diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-10-17 22:52:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-17 22:52:09 +0200 |
commit | 1484dd3aa73489cc66572f1c431e08c610e201af (patch) | |
tree | f227cc7e896ce5be07816919342da0bf580f47e6 /src/openvic-simulation/history/Bookmark.cpp | |
parent | b0a1dc5adef58671c1f1b8a73c7a8b9b26bb84ac (diff) | |
parent | 81f68d59f0e9cf6fa183a86db7128580ea7a986a (diff) |
Merge pull request #59 from OpenVicProject/fix/bookmarks
Diffstat (limited to 'src/openvic-simulation/history/Bookmark.cpp')
-rw-r--r-- | src/openvic-simulation/history/Bookmark.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/openvic-simulation/history/Bookmark.cpp b/src/openvic-simulation/history/Bookmark.cpp index 7ab96b4..1786821 100644 --- a/src/openvic-simulation/history/Bookmark.cpp +++ b/src/openvic-simulation/history/Bookmark.cpp @@ -12,14 +12,14 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; Bookmark::Bookmark( - std::string_view new_identifier, + size_t new_index, std::string_view new_name, std::string_view new_description, Date new_date, uint32_t new_initial_camera_x, uint32_t new_initial_camera_y ) - : HasIdentifier { new_identifier }, + : HasIdentifier { std::to_string(new_index) }, name { new_name }, description { new_description }, date { new_date }, @@ -50,19 +50,13 @@ uint32_t Bookmark::get_initial_camera_y() const { BookmarkManager::BookmarkManager() : bookmarks { "bookmarks" } {} bool BookmarkManager::add_bookmark( - std::string_view identifier, std::string_view name, std::string_view description, Date date, uint32_t initial_camera_x, uint32_t initial_camera_y ) { - if (identifier.empty()) { - Logger::error("Invalid bookmark identifier - empty!"); - return false; - } - - return bookmarks.add_item({ identifier, name, description, date, initial_camera_x, initial_camera_y }); + return bookmarks.add_item({ bookmarks.size(), name, description, date, initial_camera_x, initial_camera_y }); } bool BookmarkManager::load_bookmark_file(ast::NodeCPtr root) { @@ -85,7 +79,7 @@ bool BookmarkManager::load_bookmark_file(ast::NodeCPtr root) { "cameraY", ONE_EXACTLY, expect_uint(assign_variable_callback(initial_camera_y)) )(value); - ret &= add_bookmark(date.to_string(), name, description, date, initial_camera_x, initial_camera_y); + ret &= add_bookmark(name, description, date, initial_camera_x, initial_camera_y); return ret; } )(root); |