GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/charserverhandler.h Lines: 7 7 100.0 %
Date: 2018-09-20 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-2018  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 void setNewPincode(const BeingId accountId,
91
                                   const std::string &pin) const = 0;
92
93
        virtual void sendCheckPincode(const BeingId accountId,
94
                                      const std::string &pin) const = 0;
95
96
        virtual void changePincode(const BeingId accountId,
97
                                   const std::string &oldPin,
98
                                   const std::string &newPin) const = 0;
99
100
        virtual void changeSlot(const int oldSlot,
101
                                const int newSlot) const = 0;
102
103
        virtual void ping() const = 0;
104
105
        /** The list of available characters. */
106
        static Net::Characters mCharacters;
107
108
        static CharSelectDialog *mCharSelectDialog;
109
        static CharCreateDialog *mCharCreateDialog;
110
111
        /** The selected character. */
112
        static Net::Character *mSelectedCharacter;
113
114
        static void updateCharSelectDialog();
115
        static void unlockCharSelectDialog();
116
117
    protected:
118
77
        CharServerHandler()
119
77
        {
120
77
            mCharacters.clear();
121
77
            mSelectedCharacter = nullptr;
122
77
            mCharSelectDialog = nullptr;
123
77
            mCharCreateDialog = nullptr;
124
77
        }
125
};
126
127
}  // namespace Net
128
129
extern Net::CharServerHandler *charServerHandler;
130
131
#endif  // NET_CHARSERVERHANDLER_H