1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

possibility to delete unsupported saves

This commit is contained in:
Laserlicht
2024-10-31 21:57:20 +01:00
parent e45be3c5e6
commit 1f0847660b
8 changed files with 78 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include "../lib/serializer/Connection.h"
#include "../lib/mapping/CMapInfo.h"
#include "../lib/mapping/CMapHeader.h"
#include "../lib/filesystem/Filesystem.h"
void ClientPermissionsCheckerNetPackVisitor::visitForLobby(CPackForLobby & pack)
{
@@ -383,7 +384,6 @@ void ApplyOnServerNetPackVisitor::visitLobbyForceSetPlayer(LobbyForceSetPlayer &
result = true;
}
void ClientPermissionsCheckerNetPackVisitor::visitLobbyPvPAction(LobbyPvPAction & pack)
{
result = true;
@@ -433,3 +433,19 @@ void ApplyOnServerNetPackVisitor::visitLobbyPvPAction(LobbyPvPAction & pack)
}
result = true;
}
void ClientPermissionsCheckerNetPackVisitor::visitLobbyDelete(LobbyDelete & pack)
{
result = srv.isClientHost(pack.c->connectionID);
}
void ApplyOnServerNetPackVisitor::visitLobbyDelete(LobbyDelete & pack)
{
if(pack.type == LobbyDelete::SAVEGAME)
{
auto res = ResourcePath(pack.name, EResType::SAVEGAME);
auto file = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(res));
boost::filesystem::remove(file);
}
}