• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Return-To-The-Roots / s25client / 5719043347

pending completion
5719043347

Pull #1617

github

web-flow
Merge eeb6009bc into ff0589e50
Pull Request #1617: Show Popup on missing game files

12 of 12 new or added lines in 3 files covered. (100.0%)

21703 of 43073 relevant lines covered (50.39%)

31942.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/s25main/desktops/dskSplash.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "dskSplash.h"
6
#include "GlobalVars.h"
7
#include "Loader.h"
8
#include "MusicPlayer.h"
9
#include "Playlist.h"
10
#include "RttrConfig.h"
11
#include "Settings.h"
12
#include "WindowManager.h"
13
#include "controls/ctrlTimer.h"
14
#include "dskMainMenu.h"
15
#include "helpers/format.hpp"
16
#include "ingameWindows/iwMusicPlayer.h"
17
#include "mygettext/mygettext.h"
18
#include "ogl/glArchivItem_Bitmap.h"
19
#include "gameData/ApplicationLoader.h"
20
#include "s25util/Log.h"
21
#include "s25util/error.h"
22
#include <drivers/VideoDriverWrapper.h>
23

24
using namespace std::chrono_literals;
25

26
dskSplash::dskSplash(std::unique_ptr<glArchivItem_Bitmap> splashImg)
×
27
    : Desktop(splashImg.get()), splashImg(std::move(splashImg)), isLoading(false), isLoaded(false)
×
28
{
29
    background->setInterpolateTexture(false);
×
30
    WINDOWMANAGER.SetCursor(Cursor::None);
×
31
}
×
32

33
dskSplash::~dskSplash()
×
34
{
35
    WINDOWMANAGER.SetCursor();
×
36
}
×
37

38
void dskSplash::SetActive(bool activate)
×
39
{
40
    Desktop::SetActive(activate);
×
41
    if(activate && !GetCtrl<ctrlTimer>(0))
×
42
        AddTimer(0, 1ms);
×
43
}
×
44

45
void dskSplash::Msg_Timer(const unsigned ctrl_id)
×
46
{
47
    GetCtrl<ctrlTimer>(ctrl_id)->Stop();
×
48
    if(ctrl_id == 0)
×
49
        AddTimer(1, 1ms);
×
50
    else if(ctrl_id == 1 && !isLoaded && !isLoading)
×
51
    {
52
        isLoading = true;
×
53
        LoadFiles();
×
54
    } else if(isLoaded)
×
55
        WINDOWMANAGER.Switch(std::make_unique<dskMainMenu>());
×
56
}
×
57

58
bool dskSplash::Msg_LeftDown(const MouseCoords& /*mc*/)
×
59
{
60
    if(isLoaded)
×
61
        WINDOWMANAGER.Switch(std::make_unique<dskMainMenu>());
×
62

63
    return true;
×
64
}
65

66
void dskSplash::LoadFiles()
×
67
{
68
    ApplicationLoader loader(RTTRCONFIG, LOADER, LOG, SETTINGS.sound.playlist);
×
69
    if(loader.load())
×
70
    {
71
        isLoaded = true;
×
72
        AddTimer(2, 5s);
×
73
        SetFpsDisplay(true);
×
74
        if(loader.getPlaylist())
×
75
            MUSICPLAYER.SetPlaylist(std::move(*loader.getPlaylist()));
×
76
        if(SETTINGS.sound.musicEnabled)
×
77
            MUSICPLAYER.Play();
×
78

79
    } else
80
    {
81
        const auto fmt = boost::format(_("Some essential game files failed to load.\n"
×
82
                                         "Please ensure that the Settlers 2 Gold-Edition is installed in\n"
83
                                         "%1%"))
84
                         % RTTRCONFIG.ExpandPath("<RTTR_GAME>").string();
×
85

86
        s25util::error(fmt.str());
×
87
        VIDEODRIVER.ShowErrorMessage(_("Missing game files"), fmt.str());
×
88

89
        GLOBALVARS.notdone = false;
×
90
    }
91
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc