GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/charserverhandler.h Lines: 7 7 100.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 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
#ifndef NET_CHARSERVERHANDLER_H
24
#define NET_CHARSERVERHANDLER_H
25
26
#include "enums/being/gender.h"
27
28
#include "enums/simpletypes/beingid.h"
29
30
#include "net/characters.h"
31
32
#include "utils/vector.h"
33
34
#include <string>
35
36
class CharCreateDialog;
37
class CharSelectDialog;
38
39
namespace Net
40
{
41
42
struct Character;
43
44
class CharServerHandler notfinal
45
{
46
    public:
47
        A_DELETE_COPY(CharServerHandler)
48
49
        virtual ~CharServerHandler()
50
        { }
51
52
        virtual void setCharSelectDialog(CharSelectDialog *const window)
53
                                         const = 0;
54
55
        virtual void setCharCreateDialog(CharCreateDialog *const window)
56
                                         const = 0;
57
58
        virtual void requestCharacters() const = 0;
59
60
        virtual void chooseCharacter(Net::Character *const character)
61
                                     const = 0;
62
63
        virtual void newCharacter(const std::string &name,
64
                                  const int slot,
65
                                  const GenderT gender,
66
                                  const int hairstyle,
67
                                  const int hairColor,
68
                                  const unsigned char race,
69
                                  const uint16_t look,
70
                                  const STD_VECTOR<int> &stats) const = 0;
71
72
        virtual void deleteCharacter(Net::Character *const character,
73
                                     const std::string &email) const = 0;
74
75
        virtual void renameCharacter(const BeingId id,
76
                                     const std::string &newName) const = 0;
77
78
        virtual void switchCharacter() const = 0;
79
80
        virtual unsigned int baseSprite() const A_WARN_UNUSED = 0;
81
82
        virtual unsigned int hairSprite() const A_WARN_UNUSED = 0;
83
84
        virtual unsigned int hatSprite() const A_WARN_UNUSED = 0;
85
86
        virtual unsigned int maxSprite() const A_WARN_UNUSED = 0;
87
88
        virtual void clear() const = 0;
89
90
        virtual bool isNeedCreatePin() const = 0;
91
92
        virtual void setNewPincode(const std::string &pin) const = 0;
93
94
        virtual void changeSlot(const int oldSlot,
95
                                const int newSlot) const = 0;
96
97
        virtual void ping() const = 0;
98
99
        /** The list of available characters. */
100
        static Net::Characters mCharacters;
101
102
        static CharSelectDialog *mCharSelectDialog;
103
        static CharCreateDialog *mCharCreateDialog;
104
105
        /** The selected character. */
106
        static Net::Character *mSelectedCharacter;
107
108
        static void updateCharSelectDialog();
109
        static void unlockCharSelectDialog();
110
111
    protected:
112
152
        CharServerHandler()
113
152
        {
114
152
            mCharacters.clear();
115
152
            mSelectedCharacter = nullptr;
116
152
            mCharSelectDialog = nullptr;
117
152
            mCharCreateDialog = nullptr;
118
152
        }
119
};
120
121
}  // namespace Net
122
123
extern Net::CharServerHandler *charServerHandler;
124
125
#endif  // NET_CHARSERVERHANDLER_H