Mana
Loading...
Searching...
No Matches
messageout.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana 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#pragma once
23
24#include <cstdint>
25#include <string>
26
27namespace TmwAthena {
28
35{
36 public:
37 MessageOut(uint16_t id);
38
42 void writeInt8(uint8_t value);
43
47 void writeInt16(uint16_t value);
48
52 void writeInt32(uint32_t value);
53
58 void writeString(const std::string &string, int length = -1);
59
63 void writeCoordinates(uint16_t x, uint16_t y,
64 uint8_t direction);
65
66 private:
71 static char *expand(size_t size);
72};
73
74} // namespace TmwAthena
Used for building an outgoing message to eAthena.
Definition messageout.h:35
void writeInt32(uint32_t value)
Writes an unsigned 32-bit integer to the message.
static char * expand(size_t size)
Expand the packet data to be able to hold more data.
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
void writeCoordinates(uint16_t x, uint16_t y, uint8_t direction)
Encodes coordinates and direction in 3 bytes.
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
unsigned char uint8_t
Definition sha256.cpp:81
unsigned int uint32_t
Definition sha256.cpp:82