1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Backward compatibility with mods

This commit is contained in:
nordsoft 2023-08-22 00:32:26 +04:00
parent a60d503078
commit b1bfc2239f
4 changed files with 27 additions and 17 deletions

View File

@ -551,7 +551,7 @@ void CServerHandler::sendStartGame(bool allowOnlyAI) const
catch (const std::exception & e)
{
showServerError( std::string("Unable to start map! Reason: ") + e.what());
return;
throw e;
}
LobbyStartGame lsg;

View File

@ -590,16 +590,18 @@ CLoadingScreen::CLoadingScreen()
CCS->musich->stopMusic(5000);
const auto & conf = CMainMenuConfig::get().getConfig()["loading"];
const int posx = conf["x"].Integer(), posy = conf["y"].Integer();
const int blockSize = conf["size"].Integer();
const int blocksAmount = conf["amount"].Integer();
for(int i = 0; i < blocksAmount; ++i)
if(conf.isStruct())
{
progressBlocks.push_back(std::make_shared<CAnimImage>(conf["name"].String(), i, 0, posx + i * blockSize, posy));
progressBlocks.back()->deactivate();
progressBlocks.back()->visible = false;
const int posx = conf["x"].Integer(), posy = conf["y"].Integer();
const int blockSize = conf["size"].Integer();
const int blocksAmount = conf["amount"].Integer();
for(int i = 0; i < blocksAmount; ++i)
{
progressBlocks.push_back(std::make_shared<CAnimImage>(conf["name"].String(), i, 0, posx + i * blockSize, posy));
progressBlocks.back()->deactivate();
progressBlocks.back()->visible = false;
}
}
}
@ -628,14 +630,22 @@ void CLoadingScreen::showAll(Canvas & to)
std::string CLoadingScreen::getBackground()
{
const auto & conf = CMainMenuConfig::get().getConfig()["loading"]["background"].Vector();
std::string fname = "loadbar";
const auto & conf = CMainMenuConfig::get().getConfig()["loading"];
if(conf.empty())
if(conf.isStruct())
{
return "loadbar";
}
else
{
return RandomGeneratorUtil::nextItem(conf, CRandomGenerator::getDefault())->String();
if(conf["background"].isVector())
return RandomGeneratorUtil::nextItem(conf["background"].Vector(), CRandomGenerator::getDefault())->String();
if(conf["background"].isString())
return conf["background"].String();
return fname;
}
if(conf.isVector() and !conf.Vector().empty())
return RandomGeneratorUtil::nextItem(conf.Vector(), CRandomGenerator::getDefault())->String();
return fname;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B