GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/updateprotocol.cpp Lines: 0 28 0.0 %
Date: 2018-12-09 Branches: 0 10 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2015-2018  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 "net/eathena/updateprotocol.h"
22
23
#include "logger.h"
24
25
#include "net/eathena/network.h"
26
#include "net/eathena/protocolout.h"
27
#include "net/eathena/updateprotocol_main.h"
28
#include "net/eathena/updateprotocol_re.h"
29
#include "net/eathena/updateprotocol_zero.h"
30
31
#include "debug.h"
32
33
extern int packetVersion;
34
extern int packetVersionMain;
35
extern int packetVersionRe;
36
extern int packetVersionZero;
37
extern int evolPacketOffset;
38
extern bool packets_main;
39
extern bool packets_re;
40
extern bool packets_zero;
41
extern int itemIdLen;
42
43
namespace EAthena
44
{
45
46
void updateProtocol()
47
{
48
    itemIdLen = 2;
49
    logger->log("packet version: %d", packetVersion);
50
    if (packets_main == true)
51
    {
52
        logger->log("packets version type: main");
53
        packetVersionMain = packetVersion;
54
        packetVersionRe = 0;
55
        packetVersionZero = 0;
56
    }
57
    else if (packets_re == true)
58
    {
59
        logger->log("packets version type: re");
60
        packetVersionRe = packetVersion;
61
        packetVersionMain = 0;
62
        packetVersionZero = 0;
63
    }
64
    else if (packets_zero == true)
65
    {
66
        logger->log("packets version type: zero");
67
        packetVersionZero = packetVersion;
68
        packetVersionMain = 0;
69
        packetVersionRe = 0;
70
    }
71
    if (packetVersionRe >= 20180704)
72
    {
73
        itemIdLen = 4;
74
    }
75
#define PACKETS_UPDATE
76
#include "net/protocoloutupdate.h"
77
#include "net/eathena/packetsout.inc"
78
#undef packet
79
    updateProtocolMain();
80
    updateProtocolRe();
81
    updateProtocolZero();
82
    Network *const network = Network::mInstance;
83
    if (network != nullptr)
84
    {
85
        network->clearHandlers();
86
        network->registerHandlers();
87
        network->registerFakeHandlers();
88
    }
89
}
90
91
PACKETSOUT_VOID
92
PROTOCOLOUTUPDATE_VOID
93
PROTOCOLOUT_VOID
94
95
}  // namespace EAthena