summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-12 00:22:38 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-12 00:22:38 +0300
commit21cdd2c1dfd1763fcbf93830c3d463b69ea5bbeb (patch)
treefe69bae2c36bb13efd57aa7a487fd744ad4d7949 /src
parent59dc7219d3b8491fdd139183cf09742787e407db (diff)
downloadmv-21cdd2c1dfd1763fcbf93830c3d463b69ea5bbeb.tar.gz
mv-21cdd2c1dfd1763fcbf93830c3d463b69ea5bbeb.tar.bz2
mv-21cdd2c1dfd1763fcbf93830c3d463b69ea5bbeb.tar.xz
mv-21cdd2c1dfd1763fcbf93830c3d463b69ea5bbeb.zip
Add MailOpenType enum for different open types.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/net/mailopentype.h34
-rw-r--r--src/net/eathena/mail2handler.cpp28
-rw-r--r--src/net/eathena/mail2handler.h14
-rw-r--r--src/net/mail2handler.h16
-rw-r--r--src/net/tmwa/mail2handler.cpp14
-rw-r--r--src/net/tmwa/mail2handler.h14
8 files changed, 80 insertions, 42 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 990442f30..420c91cf3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -552,6 +552,7 @@ SET(SRCS
enums/net/battlegroundtype.h
enums/net/deleteitemreason.h
enums/net/downloadstatus.h
+ enums/net/mailopentype.h
enums/net/npcaction.h
enums/net/packettype.h
net/gamehandler.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 79ea08113..be0a7c06f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -420,6 +420,7 @@ BASE_SRC += events/actionevent.h \
enums/net/battlegroundtype.h \
enums/net/deleteitemreason.h \
enums/net/downloadstatus.h \
+ enums/net/mailopentype.h \
enums/net/npcaction.h \
enums/net/packettype.h \
enums/net/partyshare.h \
diff --git a/src/enums/net/mailopentype.h b/src/enums/net/mailopentype.h
new file mode 100644
index 000000000..5040cee18
--- /dev/null
+++ b/src/enums/net/mailopentype.h
@@ -0,0 +1,34 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2014-2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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/>.
+ */
+
+#ifndef NET_EATHENA_MAILOPENTYPE_H
+#define NET_EATHENA_MAILOPENTYPE_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(MailOpenType)
+{
+ Mail = 0,
+ Account = 1,
+ Return = 2
+}
+enumEnd(MailOpenType);
+
+#endif // NET_EATHENA_MAILOPENTYPE_H
diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp
index a4a35b4c2..39f3123f0 100644
--- a/src/net/eathena/mail2handler.cpp
+++ b/src/net/eathena/mail2handler.cpp
@@ -126,7 +126,7 @@ void Mail2Handler::sendMail(const std::string &to,
outMsg.writeString(body, bodySz, "body");
}
-void Mail2Handler::nextPage(const int openType,
+void Mail2Handler::nextPage(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20131218 ||
@@ -135,11 +135,11 @@ void Mail2Handler::nextPage(const int openType,
return;
}
createOutPacket(CMSG_MAIL2_NEXT_PAGE);
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
outMsg.writeInt64(mailId, "mail id");
}
-void Mail2Handler::readMail(const int openType,
+void Mail2Handler::readMail(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20131223 ||
@@ -148,11 +148,11 @@ void Mail2Handler::readMail(const int openType,
return;
}
createOutPacket(CMSG_MAIL2_READ_MAIL);
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
outMsg.writeInt64(mailId, "mail id");
}
-void Mail2Handler::deleteMail(const int openType,
+void Mail2Handler::deleteMail(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20131218 ||
@@ -161,11 +161,11 @@ void Mail2Handler::deleteMail(const int openType,
return;
}
createOutPacket(CMSG_MAIL2_DELETE_MAIL);
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
outMsg.writeInt64(mailId, "mail id");
}
-void Mail2Handler::requestMoney(const int openType,
+void Mail2Handler::requestMoney(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20140326 ||
@@ -175,10 +175,10 @@ void Mail2Handler::requestMoney(const int openType,
}
createOutPacket(CMSG_MAIL2_REQUEST_MONEY);
outMsg.writeInt64(mailId, "mail id");
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
}
-void Mail2Handler::requestItems(const int openType,
+void Mail2Handler::requestItems(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20140326 ||
@@ -188,10 +188,10 @@ void Mail2Handler::requestItems(const int openType,
}
createOutPacket(CMSG_MAIL2_REQUEST_ITEMS);
outMsg.writeInt64(mailId, "mail id");
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
}
-void Mail2Handler::refreshMailList(const int openType,
+void Mail2Handler::refreshMailList(const MailOpenTypeT openType,
const int64_t mailId) const
{
if (packetVersion < 20131218 ||
@@ -200,11 +200,11 @@ void Mail2Handler::refreshMailList(const int openType,
return;
}
createOutPacket(CMSG_MAIL2_REFRESH_MAIL_LIST);
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
outMsg.writeInt64(mailId, "mail id");
}
-void Mail2Handler::openMailBox(const int openType) const
+void Mail2Handler::openMailBox(const MailOpenTypeT openType) const
{
if (packetVersion < 20140212 ||
(serverVersion < 19 && serverVersion != 0))
@@ -212,7 +212,7 @@ void Mail2Handler::openMailBox(const int openType) const
return;
}
createOutPacket(CMSG_MAIL2_OPEN_MAILBOX);
- outMsg.writeInt8(openType, "open type");
+ outMsg.writeInt8(toInt(openType, int8_t), "open type");
outMsg.writeInt64(0, "mail id");
}
diff --git a/src/net/eathena/mail2handler.h b/src/net/eathena/mail2handler.h
index 7525851d8..de4a26d12 100644
--- a/src/net/eathena/mail2handler.h
+++ b/src/net/eathena/mail2handler.h
@@ -48,25 +48,25 @@ class Mail2Handler final : public Net::Mail2Handler
const std::string &body,
const int64_t &money) const override final;
- void nextPage(const int openType,
+ void nextPage(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void readMail(const int openType,
+ void readMail(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void deleteMail(const int openType,
+ void deleteMail(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void requestMoney(const int openType,
+ void requestMoney(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void requestItems(const int openType,
+ void requestItems(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void refreshMailList(const int openType,
+ void refreshMailList(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void openMailBox(const int openType) const override final;
+ void openMailBox(const MailOpenTypeT openType) const override final;
void closeMailBox() const override final;
diff --git a/src/net/mail2handler.h b/src/net/mail2handler.h
index 9381838fb..baff5576e 100644
--- a/src/net/mail2handler.h
+++ b/src/net/mail2handler.h
@@ -21,6 +21,8 @@
#ifndef NET_MAIL2HANDLER_H
#define NET_MAIL2HANDLER_H
+#include "enums/net/mailopentype.h"
+
#include <string>
#include "localconsts.h"
@@ -54,25 +56,25 @@ class Mail2Handler notfinal
const std::string &body,
const int64_t &money) const = 0;
- virtual void nextPage(const int openType,
+ virtual void nextPage(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void readMail(const int openType,
+ virtual void readMail(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void deleteMail(const int openType,
+ virtual void deleteMail(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void requestMoney(const int openType,
+ virtual void requestMoney(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void requestItems(const int openType,
+ virtual void requestItems(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void refreshMailList(const int openType,
+ virtual void refreshMailList(const MailOpenTypeT openType,
const int64_t mailId) const = 0;
- virtual void openMailBox(const int openType) const = 0;
+ virtual void openMailBox(const MailOpenTypeT openType) const = 0;
virtual void closeMailBox() const = 0;
diff --git a/src/net/tmwa/mail2handler.cpp b/src/net/tmwa/mail2handler.cpp
index 1ab43b038..c96506ce8 100644
--- a/src/net/tmwa/mail2handler.cpp
+++ b/src/net/tmwa/mail2handler.cpp
@@ -56,37 +56,37 @@ void Mail2Handler::sendMail(const std::string &to A_UNUSED,
{
}
-void Mail2Handler::nextPage(const int openType A_UNUSED,
+void Mail2Handler::nextPage(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::readMail(const int openType A_UNUSED,
+void Mail2Handler::readMail(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::deleteMail(const int openType A_UNUSED,
+void Mail2Handler::deleteMail(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::requestMoney(const int openType A_UNUSED,
+void Mail2Handler::requestMoney(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::requestItems(const int openType A_UNUSED,
+void Mail2Handler::requestItems(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::refreshMailList(const int openType A_UNUSED,
+void Mail2Handler::refreshMailList(const MailOpenTypeT openType A_UNUSED,
const int64_t mailId A_UNUSED) const
{
}
-void Mail2Handler::openMailBox(const int openType A_UNUSED) const
+void Mail2Handler::openMailBox(const MailOpenTypeT openType A_UNUSED) const
{
}
diff --git a/src/net/tmwa/mail2handler.h b/src/net/tmwa/mail2handler.h
index 62b6c570b..ce01bd180 100644
--- a/src/net/tmwa/mail2handler.h
+++ b/src/net/tmwa/mail2handler.h
@@ -48,25 +48,25 @@ class Mail2Handler final : public Net::Mail2Handler
const std::string &body,
const int64_t &money) const override final;
- void nextPage(const int openType,
+ void nextPage(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void readMail(const int openType,
+ void readMail(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void deleteMail(const int openType,
+ void deleteMail(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void requestMoney(const int openType,
+ void requestMoney(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void requestItems(const int openType,
+ void requestItems(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void refreshMailList(const int openType,
+ void refreshMailList(const MailOpenTypeT openType,
const int64_t mailId) const override final;
- void openMailBox(const int openType) const override final;
+ void openMailBox(const MailOpenTypeT openType) const override final;
void closeMailBox() const override final;