GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/updateprotocol.cpp Lines: 0 30 0.0 %
Date: 2019-10-15 Branches: 0 14 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2015-2019  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 (packetVersionMain >= 20181121 ||
72
        packetVersionRe >= 20180704 ||
73
        packetVersionZero >= 20181114)
74
    {
75
        itemIdLen = 4;
76
    }
77
#define PACKETS_UPDATE
78
#include "net/protocoloutupdate.h"
79
#include "net/eathena/packetsout.inc"
80
#undef packet
81
    updateProtocolMain();
82
    updateProtocolRe();
83
    updateProtocolZero();
84
    Network *const network = Network::mInstance;
85
    if (network != nullptr)
86
    {
87
        network->clearHandlers();
88
        network->registerHandlers();
89
        network->registerFakeHandlers();
90
    }
91
}
92
93
PACKETSOUT_VOID
94
PROTOCOLOUTUPDATE_VOID
95
PROTOCOLOUT_VOID
96
97
}  // namespace EAthena