GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/resources/loaders/walklayerloader.cpp Lines: 0 11 0.0 %
Date: 2017-11-29 Branches: 0 10 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#include "resources/resourcemanager/resourcemanager.h"
24
25
#include "navigationmanager.h"
26
27
#include "resources/map/walklayer.h"
28
29
#include "resources/loaders/walklayerloader.h"
30
31
#include "utils/checkutils.h"
32
33
#include "debug.h"
34
35
#ifndef DYECMD
36
struct WalkLayerLoader final
37
{
38
    A_DEFAULT_COPY(WalkLayerLoader)
39
40
    const std::string name;
41
    const Map *const map;
42
43
    static Resource *load(const void *const v)
44
    {
45
        if (v == nullptr)
46
            return nullptr;
47
48
        const WalkLayerLoader *const rl = static_cast<const
49
            WalkLayerLoader *>(v);
50
        Resource *const resource = NavigationManager::loadWalkLayer(rl->map);
51
        if (resource == nullptr)
52
            reportAlways("WalkLayer creation error");
53
        return resource;
54
    }
55
};
56
57
WalkLayer *Loader::getWalkLayer(const std::string &name,
58
                                Map *const map)
59
{
60
    WalkLayerLoader rl = {name, map};
61
    return static_cast<WalkLayer*>(ResourceManager::get("walklayer_" + name,
62
        WalkLayerLoader::load, &rl));
63
}
64
#else  // DYECMD
65
66
WalkLayer *Loader::getWalkLayer(const std::string &name A_UNUSED,
67
                                Map *const map A_UNUSED)
68
{
69
    return nullptr;
70
}
71
#endif  // DYECMD