ManaPlus
maphandler.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "net/eathena/maphandler.h"
23 
24 #include "net/eathena/messageout.h"
26 
27 #include "debug.h"
28 
29 extern int packetVersion;
30 
31 namespace EAthena
32 {
33 
35  Net::MapHandler()
36 {
37  mapHandler = this;
38 }
39 
41 {
42  mapHandler = nullptr;
43 }
44 
46 {
47  createOutPacket(CMSG_MAP_BLOCK_PLAY_CANCEL);
48 }
49 
51 {
52  createOutPacket(CMSG_INSTANCE_COMMAND);
53  outMsg.writeInt32(3, "command");
54 }
55 
56 void MapHandler::camera(const int action,
57  const float range,
58  const float rotation,
59  const float latitude) const
60 {
61  if (packetVersion < 20160525)
62  return;
63  createOutPacket(CMSG_CAMERA_INFO);
64  outMsg.writeInt8(action, "action");
65  outMsg.writeFloat(range, "range");
66  outMsg.writeFloat(rotation, "rotation");
67  outMsg.writeFloat(latitude, "latitude");
68 }
69 
70 void MapHandler::clientVersion(const int version) const
71 {
72  if (packetVersion < 20090406)
73  return;
74  createOutPacket(CMSG_CLIENT_VERSION);
75  outMsg.writeInt32(version, "version");
76 }
77 
78 } // namespace EAthena
void camera(const int action, const float range, const float rotation, const float latitude) const
Definition: maphandler.cpp:56
void destroyInstance() const
Definition: maphandler.cpp:50
void blockPlayCancel() const
Definition: maphandler.cpp:45
void clientVersion(const int version) const
Definition: maphandler.cpp:70
int packetVersion
Definition: client.cpp:125
Net::MapHandler * mapHandler
Definition: net.cpp:115
#define createOutPacket(name)
Definition: messageout.h:37