summaryrefslogtreecommitdiff
path: root/src/net/messageout.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-04-08 17:37:02 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-05-05 22:30:00 +0200
commit96abc4a9658b3318d0052dc5cd31a3c15d76a494 (patch)
treeff1d8e02b5020a08c01ab1605b0474a48eb77c42 /src/net/messageout.cpp
parente9eda63dcad0b842d637c13e415ef4f751ea2adf (diff)
downloadMana-96abc4a9658b3318d0052dc5cd31a3c15d76a494.tar.gz
Mana-96abc4a9658b3318d0052dc5cd31a3c15d76a494.tar.bz2
Mana-96abc4a9658b3318d0052dc5cd31a3c15d76a494.tar.xz
Mana-96abc4a9658b3318d0052dc5cd31a3c15d76a494.zip
Removed the shared base classes of MessageIn and MessageOut
There wasn't a whole lot gained by sharing a common base class, and it makes extending the manaserv Message{In,Out} classes with a debugging mode unnecessarily complicated. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/net/messageout.cpp')
-rw-r--r--src/net/messageout.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
deleted file mode 100644
index 56d1d8b7..00000000
--- a/src/net/messageout.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * The Mana Client
- * Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2012 The Mana Developers
- *
- * This file is part of The Mana Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "net/messageout.h"
-
-#include <cstring>
-
-namespace Net {
-
-MessageOut::MessageOut(uint16_t id):
- mData(0),
- mDataSize(0),
- mPos(0)
-{
-}
-
-void MessageOut::writeInt8(uint8_t value)
-{
- expand(1);
- mData[mPos] = value;
- mPos += 1;
-}
-
-void MessageOut::writeString(const std::string &string, int length)
-{
- int stringLength = string.length();
- if (length < 0)
- {
- // Write the length at the start if not fixed
- writeInt16(stringLength);
- length = stringLength;
- }
- else if (length < stringLength)
- {
- // Make sure the length of the string is no longer than specified
- stringLength = length;
- }
- expand(length);
-
- // Write the actual string
- memcpy(mData + mPos, string.data(), stringLength);
-
- // Pad remaining space with zeros
- if (length > stringLength)
- {
- memset(mData + mPos + stringLength, '\0', length - stringLength);
- }
- mPos += length;
-}
-
-char *MessageOut::getData() const
-{
- return mData;
-}
-
-unsigned int MessageOut::getDataSize() const
-{
- return mDataSize;
-}
-
-}