mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Code review fixes, Sonarcloud fixes
This commit is contained in:
parent
1b2d01c25f
commit
e7af9d5607
@ -196,10 +196,7 @@ void CServerHandler::startLocalServerAndConnect(bool connectToLobby)
|
||||
auto si = std::make_shared<StartInfo>();
|
||||
|
||||
auto lastDifficulty = settings["general"]["lastDifficulty"];
|
||||
if (lastDifficulty.isNumber())
|
||||
{
|
||||
si->difficulty = lastDifficulty.Integer();
|
||||
}
|
||||
si->difficulty = lastDifficulty.Integer();
|
||||
|
||||
logNetwork->trace("\tStarting local server");
|
||||
serverRunner->start(getLocalPort(), connectToLobby, si);
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "../../lib/filesystem/Filesystem.h"
|
||||
#include "../../lib/RoadHandler.h"
|
||||
|
||||
//#include "../../lib/GameSettings.h"
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
#include "../../lib/serializer/JsonSerializer.h"
|
||||
#include "../../lib/serializer/JsonDeserializer.h"
|
||||
@ -168,7 +167,6 @@ RandomMapTab::RandomMapTab():
|
||||
}
|
||||
|
||||
loadOptions();
|
||||
//updateMapInfoByHost();
|
||||
}
|
||||
|
||||
void RandomMapTab::updateMapInfoByHost()
|
||||
@ -467,7 +465,7 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
||||
//int totalPlayers = randomMapTab.obtainMapGenOptions().getPlayerLimit();
|
||||
int totalPlayers = randomMapTab.obtainMapGenOptions().getMaxPlayersCount();
|
||||
assert(totalPlayers <= PlayerColor::PLAYER_LIMIT_I);
|
||||
auto settings = randomMapTab.obtainMapGenOptions().getPlayersSettings();
|
||||
auto playerSettings = randomMapTab.obtainMapGenOptions().getPlayersSettings();
|
||||
variables["totalPlayers"].Integer() = totalPlayers;
|
||||
|
||||
pos.w = variables["windowSize"]["x"].Integer() + totalPlayers * variables["cellMargin"]["x"].Integer();
|
||||
@ -508,20 +506,20 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
||||
// Window should have X * X columns, where X is max players allowed for current settings
|
||||
// For random player count, X is 8
|
||||
|
||||
if (totalPlayers > settings.size())
|
||||
if (totalPlayers > playerSettings.size())
|
||||
{
|
||||
auto savedPlayers = randomMapTab.obtainMapGenOptions().getSavedPlayersMap();
|
||||
for (const auto & player : savedPlayers)
|
||||
{
|
||||
if (!vstd::contains(settings, player.first))
|
||||
if (!vstd::contains(playerSettings, player.first))
|
||||
{
|
||||
settings[player.first] = player.second;
|
||||
playerSettings[player.first] = player.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CMapGenOptions::CPlayerSettings> settingsVec;
|
||||
for (const auto & player : settings)
|
||||
for (const auto & player : playerSettings)
|
||||
{
|
||||
settingsVec.push_back(player.second);
|
||||
}
|
||||
|
@ -168,7 +168,11 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
||||
labelMapSizes = std::make_shared<CLabel>(87, 62, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[510]);
|
||||
|
||||
// TODO: Global constants?
|
||||
int sizes[] = {36, 72, 108, 144, 0};
|
||||
int sizes[] = {CMapHeader::MAP_SIZE_SMALL,
|
||||
CMapHeader::MAP_SIZE_MIDDLE,
|
||||
CMapHeader::MAP_SIZE_LARGE,
|
||||
CMapHeader::MAP_SIZE_XLARGE,
|
||||
0};
|
||||
const char * filterIconNmes[] = {"SCSMBUT.DEF", "SCMDBUT.DEF", "SCLGBUT.DEF", "SCXLBUT.DEF", "SCALBUT.DEF"};
|
||||
for(int i = 0; i < 5; i++)
|
||||
buttonsSortBy.push_back(std::make_shared<CButton>(Point(158 + 47 * i, 46), AnimationPath::builtin(filterIconNmes[i]), CGI->generaltexth->zelp[54 + i], std::bind(&SelectionTab::filter, this, sizes[i], true)));
|
||||
|
@ -69,9 +69,11 @@ QVariant toVariant(const JsonNode & node)
|
||||
return QVariant(node.Bool());
|
||||
break;
|
||||
case JsonNode::JsonType::DATA_FLOAT:
|
||||
case JsonNode::JsonType::DATA_INTEGER:
|
||||
return QVariant(node.Float());
|
||||
break;
|
||||
case JsonNode::JsonType::DATA_INTEGER:
|
||||
return QVariant(node.Integer());
|
||||
break;
|
||||
case JsonNode::JsonType::DATA_STRING:
|
||||
return QVariant(QString::fromUtf8(node.String().c_str()));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user