diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-25 03:49:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-25 03:49:54 +0300 |
commit | d11a1f693cd1c43c4d1977f65ef16eba11d872b1 (patch) | |
tree | 8b03625817f2ecc09b4145f321d63845a12d6fa3 /src | |
parent | b68c40d34eecf9da09a00101286b046d93927161 (diff) | |
download | plus-d11a1f693cd1c43c4d1977f65ef16eba11d872b1.tar.gz plus-d11a1f693cd1c43c4d1977f65ef16eba11d872b1.tar.bz2 plus-d11a1f693cd1c43c4d1977f65ef16eba11d872b1.tar.xz plus-d11a1f693cd1c43c4d1977f65ef16eba11d872b1.zip |
Show message information in mail list.
Show signs for item and money.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/net/mailmessagetype.h | 39 | ||||
-rw-r--r-- | src/gui/mailmessage.h | 6 | ||||
-rw-r--r-- | src/gui/windows/mailwindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/mailwindow.h | 3 | ||||
-rw-r--r-- | src/net/eathena/mail2recv.cpp | 3 |
7 files changed, 60 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71ab89d2b..da2fc507f 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/mailmessagetype.h enums/net/mailopentype.h enums/net/npcaction.h enums/net/packettype.h diff --git a/src/Makefile.am b/src/Makefile.am index 455274823..2ac321fda 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/mailmessagetype.h \ enums/net/mailopentype.h \ enums/net/npcaction.h \ enums/net/packettype.h \ diff --git a/src/enums/net/mailmessagetype.h b/src/enums/net/mailmessagetype.h new file mode 100644 index 000000000..8679c31ee --- /dev/null +++ b/src/enums/net/mailmessagetype.h @@ -0,0 +1,39 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-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 ENUMS_NET_MAILMESSAGETYPE_H +#define ENUMS_NET_MAILMESSAGETYPE_H + +#include "localconsts.h" + +namespace MailMessageType +{ + enum Type + { + Text = 0, + Money = 2, + Item = 4, + Npc = 8 + }; +} // namespace MailMessageType + +#endif // ENUMS_NET_MAILMESSAGETYPE_H diff --git a/src/gui/mailmessage.h b/src/gui/mailmessage.h index b5ce75612..0f6d4f6b5 100644 --- a/src/gui/mailmessage.h +++ b/src/gui/mailmessage.h @@ -23,6 +23,8 @@ #include "const/resources/item/cards.h" +#include "enums/net/mailmessagetype.h" + #include <string> #include "localconsts.h" @@ -41,9 +43,9 @@ struct MailMessage final itemAmount(0), itemId(0), itemType(0), + type(MailMessageType::Text), itemAttribute(0U), itemRefine(0U), - type(0U), read(false), itemIdentify(false) { @@ -65,9 +67,9 @@ struct MailMessage final int itemAmount; int itemId; int itemType; + MailMessageType::Type type; uint8_t itemAttribute; uint8_t itemRefine; - uint8_t type; bool read; bool itemIdentify; }; diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index ec107f3a6..647eb17f5 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -169,7 +169,7 @@ void MailWindow::clear() mListBox->setSelected(-1); } -std::string MailWindow::getMailHeader(MailMessage *const message) +std::string MailWindow::getMailHeader(MailMessage *const message) const { if (mUseMail2) { @@ -178,6 +178,16 @@ std::string MailWindow::getMailHeader(MailMessage *const message) header.append(" "); else header.append("U"); + const MailMessageType::Type type = message->type; + if ((type & MailMessageType::Money) != 0) + header.append("M"); + else + header.append(" "); + if ((type & MailMessageType::Item) != 0) + header.append("I"); + else + header.append(" "); + header.append(" ").append(message->title); return STD_MOVE(header); } else diff --git a/src/gui/windows/mailwindow.h b/src/gui/windows/mailwindow.h index b356b0666..7c808379d 100644 --- a/src/gui/windows/mailwindow.h +++ b/src/gui/windows/mailwindow.h @@ -75,7 +75,8 @@ class MailWindow final : public Window, private: void refreshMails(); - std::string getMailHeader(MailMessage *const message) A_NONNULL(2); + std::string getMailHeader(MailMessage *const message) const + A_WARN_UNUSED A_NONNULL(2); STD_VECTOR<MailMessage*> mMessages; std::map<int, MailMessage*> mMessagesMap; diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index eb4c8d6b6..b3ffae6c0 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -297,7 +297,8 @@ void Mail2Recv::processMailListPage(Net::MessageIn &msg) MailMessage *const mail = new MailMessage; mail->id = msg.readInt64("mail id"); mail->read = msg.readUInt8("is read") != 0U ? true : false; - mail->type = msg.readUInt8("type"); + mail->type = static_cast<MailMessageType::Type>( + msg.readUInt8("type")); mail->sender = msg.readString(24, "sender name"); mail->time = msg.readInt32("reg time"); mail->strTime = timeToStr(mail->time); |