mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Read error message from translate.json
This commit is contained in:
parent
e74890c4b1
commit
8f6f9707a6
@ -31,7 +31,8 @@
|
|||||||
{
|
{
|
||||||
"errors" :
|
"errors" :
|
||||||
{
|
{
|
||||||
"existingProcess" : "Another vcmiserver process is running, please terminate it first"
|
"existingProcess" : "Another vcmiserver process is running, please terminate it first",
|
||||||
|
"modsIncompatibility" : "Mods are required to load game:"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systemOptions" :
|
"systemOptions" :
|
||||||
|
@ -276,18 +276,16 @@ class DLL_LINKAGE CModHandler
|
|||||||
void loadOneMod(std::string modName, std::string parent, const JsonNode & modSettings, bool enableMods);
|
void loadOneMod(std::string modName, std::string parent, const JsonNode & modSettings, bool enableMods);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class DLL_LINKAGE Incompatibility: public std::logic_error
|
class DLL_LINKAGE Incompatibility: public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using StringPair = std::pair<const std::string, const std::string>;
|
using StringPair = std::pair<const std::string, const std::string>;
|
||||||
using ModList = std::list<StringPair>;
|
using ModList = std::list<StringPair>;
|
||||||
|
|
||||||
Incompatibility(ModList && _missingMods):
|
Incompatibility(ModList && _missingMods):
|
||||||
std::logic_error("Mods are required to load game"),
|
|
||||||
missingMods(std::move(_missingMods))
|
missingMods(std::move(_missingMods))
|
||||||
{
|
{
|
||||||
std::ostringstream _ss;
|
std::ostringstream _ss;
|
||||||
_ss << std::logic_error::what() << std::endl;
|
|
||||||
for(auto & m : missingMods)
|
for(auto & m : missingMods)
|
||||||
_ss << m.first << ' ' << m.second << std::endl;
|
_ss << m.first << ' ' << m.second << std::endl;
|
||||||
message = _ss.str();
|
message = _ss.str();
|
||||||
|
@ -2987,7 +2987,9 @@ bool CGameHandler::load(const std::string & filename)
|
|||||||
catch(const CModHandler::Incompatibility & e)
|
catch(const CModHandler::Incompatibility & e)
|
||||||
{
|
{
|
||||||
logGlobal->error("Failed to load game: %s", e.what());
|
logGlobal->error("Failed to load game: %s", e.what());
|
||||||
lobby->announceMessage(e.what());
|
auto errorMsg = VLC->generaltexth->localizedTexts["server"]["errors"]["modsIncompatibility"].String() + '\n';
|
||||||
|
errorMsg += e.what();
|
||||||
|
lobby->announceMessage(errorMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch(const std::exception & e)
|
catch(const std::exception & e)
|
||||||
|
Loading…
Reference in New Issue
Block a user