GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/resources/cursors.cpp Lines: 7 7 100.0 %
Date: 2017-11-29 Branches: 33 66 50.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2012-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "resources/cursors.h"
22
23
#include "debug.h"
24
25
namespace Cursors
26
{
27
6
    static const StrToCursor hoverCursors[] =
28
    {
29
        {"select", Cursor::CURSOR_POINTER},
30
        {"pointer", Cursor::CURSOR_POINTER},
31
        {"lr", Cursor::CURSOR_RESIZE_ACROSS},
32
        {"rl", Cursor::CURSOR_RESIZE_ACROSS},
33
        {"resizeAcross", Cursor::CURSOR_RESIZE_ACROSS},
34
        {"ud", Cursor::CURSOR_RESIZE_DOWN},
35
        {"du", Cursor::CURSOR_RESIZE_DOWN},
36
        {"resizeDown", Cursor::CURSOR_RESIZE_DOWN},
37
        {"ldru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
38
        {"ruld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
39
        {"ld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
40
        {"ru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
41
        {"resizeDownLeft", Cursor::CURSOR_RESIZE_DOWN_LEFT},
42
        {"lurd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
43
        {"rdlu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
44
        {"rd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
45
        {"lu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
46
        {"resizeDownRight", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
47
        {"attack", Cursor::CURSOR_FIGHT},
48
        {"fight", Cursor::CURSOR_FIGHT},
49
        {"take", Cursor::CURSOR_PICKUP},
50
        {"pickup", Cursor::CURSOR_PICKUP},
51
        {"talk", Cursor::CURSOR_TALK},
52
        {"action", Cursor::CURSOR_ACTION},
53
        {"left", Cursor::CURSOR_LEFT},
54
        {"up", Cursor::CURSOR_UP},
55
        {"right", Cursor::CURSOR_RIGHT},
56
        {"down", Cursor::CURSOR_DOWN}
57














114
    };
58
59
228
    CursorT stringToCursor(const std::string &name)
60
    {
61
5016
        for (size_t f = 0; f < sizeof(hoverCursors) / sizeof(StrToCursor);
62
             f ++)
63
        {
64
5244
            if (hoverCursors[f].str == name)
65
228
                return hoverCursors[f].cursor;
66
        }
67
        return Cursor::CURSOR_POINTER;
68
    }
69

6
}  // namespace Cursors