fix Custom Teleport uncheck All

This commit is contained in:
HarrySilan 2022-06-22 17:58:16 +08:00
parent 2d18941a1f
commit af1b61ff5c

View File

@ -52,6 +52,7 @@ namespace cheat::feature
return; return;
selectedIndex = -1; selectedIndex = -1;
UpdateIndexName();
teleports.push_back({ teleportName, pos }); teleports.push_back({ teleportName, pos });
auto dir = std::filesystem::current_path(); auto dir = std::filesystem::current_path();
@ -69,6 +70,8 @@ namespace cheat::feature
if (ImGui::Button("Reload")) if (ImGui::Button("Reload"))
{ {
selectedIndex = -1; selectedIndex = -1;
UpdateIndexName();
checkedIndices.clear();
auto dir = std::filesystem::current_path(); auto dir = std::filesystem::current_path();
dir /= "teleports"; dir /= "teleports";
auto result = std::filesystem::directory_iterator(dir); auto result = std::filesystem::directory_iterator(dir);
@ -102,6 +105,7 @@ namespace cheat::feature
if (ImGui::Button("Load from JSON")) if (ImGui::Button("Load from JSON"))
{ {
selectedIndex = -1; selectedIndex = -1;
UpdateIndexName();
auto dir = std::filesystem::current_path(); auto dir = std::filesystem::current_path();
dir /= "teleports"; dir /= "teleports";
LOG_INFO("Defined dir"); LOG_INFO("Defined dir");
@ -182,7 +186,9 @@ namespace cheat::feature
if (allChecked) { if (allChecked) {
selectedIndex = -1; selectedIndex = -1;
if (!searchIndices.empty()) { if (!searchIndices.empty()) {
checkedIndices.erase(searchIndices.begin(), searchIndices.end()); for (const auto& i : searchIndices) {
checkedIndices.erase(i);
}
} }
else { else {
checkedIndices.clear(); checkedIndices.clear();