SaveTool: fix a few bugs.
This commit is contained in:
parent
592fd2ba3a
commit
f4adb9e26a
3 changed files with 6 additions and 7 deletions
|
@ -69,7 +69,7 @@ auto MassManager::importMass(Containers::StringView staged_fn, Int hangar) -> bo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = _stagedMasses.find(staged_fn);
|
auto it = _stagedMasses.find(Containers::String::nullTerminatedView(staged_fn));
|
||||||
|
|
||||||
if(it == _stagedMasses.end()) {
|
if(it == _stagedMasses.end()) {
|
||||||
_lastError = "Couldn't find "_s + staged_fn + " in the staged M.A.S.S.es."_s;
|
_lastError = "Couldn't find "_s + staged_fn + " in the staged M.A.S.S.es."_s;
|
||||||
|
|
|
@ -208,13 +208,12 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
event.user.code = action;
|
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) {
|
if(action == efsw::Actions::Moved) {
|
||||||
event.user.data2 = Containers::String{old_filename}.release();
|
event.user.data2 = Containers::String{old_filename}.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveTool::drawEvent() {
|
void SaveTool::drawEvent() {
|
||||||
|
|
|
@ -475,14 +475,14 @@ void SaveTool::drawMassManager() {
|
||||||
}
|
}
|
||||||
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
||||||
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
|
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",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
|
||||||
"payload->DataSize != sizeof(std::string) in SaveTool::drawMassManager()",
|
"payload->DataSize != sizeof(Containers::String) in SaveTool::drawMassManager()",
|
||||||
window());
|
window());
|
||||||
exit(EXIT_FAILURE);
|
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)) {
|
if(!_massManager->importMass(file, i)) {
|
||||||
_queue.addToast(Toast::Type::Error, _massManager->lastError());
|
_queue.addToast(Toast::Type::Error, _massManager->lastError());
|
||||||
|
@ -584,7 +584,7 @@ void SaveTool::drawMassManager() {
|
||||||
drawTooltip(staged_formatted.data());
|
drawTooltip(staged_formatted.data());
|
||||||
}
|
}
|
||||||
if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) {
|
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());
|
ImGui::Text("%s - Staged", pair.second.data());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue