Compare commits

...

3 commits

4 changed files with 9 additions and 10 deletions

View file

@ -18,7 +18,7 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(SAVETOOL_PROJECT_VERSION 1.3.0)
set(SAVETOOL_PROJECT_VERSION 1.3.1)
find_package(Corrade REQUIRED Main Containers Utility Interconnect)
find_package(Magnum REQUIRED GL Sdl2Application)

View file

@ -69,7 +69,7 @@ auto MassManager::importMass(Containers::StringView staged_fn, Int hangar) -> bo
return false;
}
auto it = _stagedMasses.find(staged_fn);
auto it = _stagedMasses.find(Containers::String::nullTerminatedView(staged_fn));
if(it == _stagedMasses.end()) {
_lastError = "Couldn't find "_s + staged_fn + " in the staged M.A.S.S.es."_s;

View file

@ -208,13 +208,12 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
}
event.user.code = action;
event.user.data1 = Containers::String{filename}.release();
event.user.data1 = Containers::String{Containers::AllocatedInit, filename.c_str()}.release();
if(action == efsw::Actions::Moved) {
event.user.data2 = Containers::String{old_filename}.release();
}
SDL_PushEvent(&event);
return;
}
void SaveTool::drawEvent() {
@ -324,7 +323,7 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
start_point++;
}
auto components = Containers::StringView{str.data() + start_point, strlen(str.data() + start_point)}.split('.');
auto components = Containers::StringView{str.data() + start_point}.split('.');
major = std::strtol(components[0].data(), nullptr, 10);
minor = std::strtol(components[1].data(), nullptr, 10);
@ -353,7 +352,7 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
continue;
}
Version latest_ver{to_string(release["tag_name"])};
Version latest_ver{release["tag_name"].get<std::string>().c_str()};
if(latest_ver > current_ver || (latest_ver == current_ver && Utility::String::endsWith(SAVETOOL_VERSION, "-pre"))) {
_queue.addToast(Toast::Type::Warning, "Your version is out of date.\nCheck the settings for more information."_s,

View file

@ -475,14 +475,14 @@ void SaveTool::drawMassManager() {
}
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
if(payload->DataSize != sizeof(std::string)) {
if(payload->DataSize != sizeof(Containers::String)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
"payload->DataSize != sizeof(std::string) in SaveTool::drawMassManager()",
"payload->DataSize != sizeof(Containers::String) in SaveTool::drawMassManager()",
window());
exit(EXIT_FAILURE);
}
std::string file = *(static_cast<std::string*>(payload->Data));
Containers::StringView file = *static_cast<Containers::String*>(payload->Data);
if(!_massManager->importMass(file, i)) {
_queue.addToast(Toast::Type::Error, _massManager->lastError());
@ -584,7 +584,7 @@ void SaveTool::drawMassManager() {
drawTooltip(staged_formatted.data());
}
if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) {
ImGui::SetDragDropPayload("StagedMass", &(pair.first), sizeof(std::string));
ImGui::SetDragDropPayload("StagedMass", &(pair.first), sizeof(Containers::String));
ImGui::Text("%s - Staged", pair.second.data());