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

Merge pull request #4346 from Laserlicht/mod_comp

[1.5.6?] online lobby - mod compatibility improvements
This commit is contained in:
Ivan Savenko 2024-08-01 21:18:30 +03:00 committed by GitHub
commit 9f7abfe6e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,7 +58,12 @@ GlobalLobbyRoomModCard::GlobalLobbyRoomModCard(const GlobalLobbyRoomModInfo & mo
labelName = std::make_shared<CLabel>(5, 10, FONT_SMALL, ETextAlignment::CENTERLEFT, Colors::WHITE, modInfo.modName, 190); labelName = std::make_shared<CLabel>(5, 10, FONT_SMALL, ETextAlignment::CENTERLEFT, Colors::WHITE, modInfo.modName, 190);
labelVersion = std::make_shared<CLabel>(195, 30, FONT_SMALL, ETextAlignment::CENTERRIGHT, Colors::YELLOW, modInfo.version); labelVersion = std::make_shared<CLabel>(195, 30, FONT_SMALL, ETextAlignment::CENTERRIGHT, Colors::YELLOW, modInfo.version);
labelStatus = std::make_shared<CLabel>(5, 30, FONT_SMALL, ETextAlignment::CENTERLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.lobby.mod.state." + statusToString.at(modInfo.status))); auto statusColor = Colors::RED;
if(modInfo.status == ModVerificationStatus::FULL_MATCH)
statusColor = ColorRGBA(128, 128, 128);
else if(modInfo.status == ModVerificationStatus::VERSION_MISMATCH)
statusColor = Colors::YELLOW;
labelStatus = std::make_shared<CLabel>(5, 30, FONT_SMALL, ETextAlignment::CENTERLEFT, statusColor, CGI->generaltexth->translate("vcmi.lobby.mod.state." + statusToString.at(modInfo.status)));
} }
static const std::string getJoinRoomErrorMessage(const GlobalLobbyRoom & roomDescription, const std::vector<GlobalLobbyRoomModInfo> & modVerificationList) static const std::string getJoinRoomErrorMessage(const GlobalLobbyRoom & roomDescription, const std::vector<GlobalLobbyRoomModInfo> & modVerificationList)
@ -134,6 +139,13 @@ GlobalLobbyRoomWindow::GlobalLobbyRoomWindow(GlobalLobbyWindow * window, const s
modVerificationList.push_back(modInfo); modVerificationList.push_back(modInfo);
} }
std::sort(modVerificationList.begin(), modVerificationList.end(), [](const GlobalLobbyRoomModInfo &a, const GlobalLobbyRoomModInfo &b)
{
if(a.status == b.status)
return a.modName < b.modName;
return a.status < b.status;
});
MetaString subtitleText; MetaString subtitleText;
subtitleText.appendTextID("vcmi.lobby.preview.subtitle"); subtitleText.appendTextID("vcmi.lobby.preview.subtitle");