1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix progress bar

This commit is contained in:
nordsoft 2023-08-21 19:09:56 +04:00
parent 45f13c7964
commit a60d503078
3 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,7 @@ public:
virtual void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
virtual void visitLobbyChatMessage(LobbyChatMessage & pack) override;
virtual void visitLobbyGuiAction(LobbyGuiAction & pack) override;
virtual void visitLobbyStartGame(LobbyStartGame & pack) override;
virtual void visitLobbyLoadProgress(LobbyLoadProgress & pack) override;
virtual void visitLobbyUpdateState(LobbyUpdateState & pack) override;
virtual void visitLobbyShowMessage(LobbyShowMessage & pack) override;

View File

@ -128,6 +128,17 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyStartGame(LobbyStartGame & pac
handler.startGameplay(pack.initializedGameState);
}
void ApplyOnLobbyScreenNetPackVisitor::visitLobbyStartGame(LobbyStartGame & pack)
{
if(auto w = GH.windows().topWindow<CLoadingScreen>())
{
w->finish();
w->redraw();
}
else
GH.windows().createAndPushWindow<CLoadingScreen>();
}
void ApplyOnLobbyScreenNetPackVisitor::visitLobbyLoadProgress(LobbyLoadProgress & pack)
{
if(auto w = GH.windows().topWindow<CLoadingScreen>())

View File

@ -614,7 +614,7 @@ void CLoadingScreen::showAll(Canvas & to)
//CSDL_Ext::fillRect(to, rect, Colors::TRANSPARENCY);
if(!progressBlocks.empty())
{
int status = float(get()) / (2.55f * progressBlocks.size());
int status = float(get()) / 255.f * progressBlocks.size();
for(int i = 0; i < status; ++i)
{