From 55cbf74cbe2c40b4592e72621e40f8858fc376d9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Jan 2016 18:36:21 +0300 Subject: Move cards constants into separate file. --- src/gui/mailmessage.h | 4 +++- src/gui/widgets/browserbox.cpp | 4 +++- src/gui/widgets/itemlinkhandler.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/mailmessage.h b/src/gui/mailmessage.h index c4e61b49b..099cc2e34 100644 --- a/src/gui/mailmessage.h +++ b/src/gui/mailmessage.h @@ -21,6 +21,8 @@ #ifndef GUI_MAILMESSAGE_H #define GUI_MAILMESSAGE_H +#include "const/resources/item/cards.h" + #include #include "localconsts.h" @@ -53,7 +55,7 @@ struct MailMessage final std::string sender; std::string strTime; std::string text; - uint16_t card[4]; + uint16_t card[maxMailCards]; int id; int time; int money; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 9ffead378..9c5dcc77c 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -26,6 +26,8 @@ #include "itemcolormanager.h" #include "settings.h" +#include "const/resources/item/cards.h" + #include "input/inputmanager.h" #include "gui/gui.h" @@ -246,7 +248,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) { std::vector parts; splitToIntVector(parts, bLink.link.substr(idx), ','); - while (parts.size() < 4) + while (parts.size() < maxCards) parts.push_back(0); const ItemColor itemColor = ItemColorManager::getColorFromCards(&parts[0]); diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 1f30c5da6..e363fe671 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -24,6 +24,8 @@ #include "itemcolormanager.h" +#include "const/resources/item/cards.h" + #include "gui/viewport.h" #include "gui/popups/itempopup.h" @@ -119,7 +121,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) if (id > 0) { str.erase(str.begin()); - while (str.size() < 4) + while (str.size() < maxCards) str.push_back(0); const ItemColor color = ItemColorManager::getColorFromCards(&str[0]); -- cgit v1.2.3-70-g09d2