Fix local browser offering to open broken saves

It wouldn't actually open them, it'd just exit back to the currently open save. It's better to tell the user the reason why the save is broken instead.
This commit is contained in:
Tamás Bálint Misius 2022-12-18 15:32:45 +01:00
parent e5c88f154a
commit 7bfce3e4a8
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -10,6 +10,7 @@
#include "client/SaveFile.h"
#include "client/SaveInfo.h"
#include "gui/dialogues/ErrorMessage.h"
#include "graphics/Graphics.h"
namespace ui {
@ -297,6 +298,11 @@ void SaveButton::OnMouseUnclick(int x, int y, unsigned int button)
{
return; //left click only!
}
if (file && !file->GetGameSave())
{
new ErrorMessage("Error loading save", file->GetError());
return;
}
if(x>=Size.X-20 && y>=6 && y<=20 && x<=Size.X-6 && selectable)
{