summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/flooritem.cpp13
-rw-r--r--src/being/localplayer.cpp13
-rw-r--r--src/gui/popups/itempopup.cpp21
-rw-r--r--src/net/eathena/serverfeatures.cpp5
-rw-r--r--src/net/eathena/serverfeatures.h2
-rw-r--r--src/net/serverfeatures.h2
-rw-r--r--src/net/tmwa/serverfeatures.cpp5
-rw-r--r--src/net/tmwa/serverfeatures.h2
-rw-r--r--src/resources/item/item.cpp15
-rw-r--r--src/resources/item/shopitem.cpp9
10 files changed, 50 insertions, 37 deletions
diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp
index 04be493f0..bc60c5e2a 100644
--- a/src/being/flooritem.cpp
+++ b/src/being/flooritem.cpp
@@ -37,6 +37,7 @@
#include "resources/map/map.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "debug.h"
@@ -142,10 +143,16 @@ const ItemInfo &FloorItem::getInfo() const
std::string FloorItem::getName() const
{
const ItemInfo &info = ItemDB::get(mItemId);
- if (serverFeatures->haveItemColors())
- return info.getName(mColor);
- else
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
+ {
return info.getName();
+ }
+ else
+#endif // TMWA_SUPPORT
+ {
+ return info.getName(mColor);
+ }
}
void FloorItem::draw(Graphics *const graphics,
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 730421b70..3f31a7c15 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -67,6 +67,7 @@
#include "net/beinghandler.h"
#include "net/chathandler.h"
#include "net/inventoryhandler.h"
+#include "net/net.h"
#include "net/packetlimiter.h"
#include "net/playerhandler.h"
#include "net/serverfeatures.h"
@@ -931,10 +932,16 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo,
else
{
std::string str;
- if (serverFeatures->haveItemColors())
- str = itemInfo.getName(color);
- else
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
+ {
str = itemInfo.getName();
+ }
+ else
+#endif // TMWA_SUPPORT
+ {
+ str = itemInfo.getName(color);
+ }
if (config.getBoolValue("showpickupchat") && localChatTab)
{
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 7d58161c3..7947934b7 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -50,6 +50,7 @@
#include "resources/loaders/imageloader.h"
#include "net/beinghandler.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "utils/translation/podict.h"
@@ -151,17 +152,19 @@ void ItemPopup::setItem(const Item *const item,
mLastName = ii.getName();
mLastColor = item->getColor();
mLastId = item->getId();
- if (serverFeatures->haveItemColors())
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
{
mItemName->setCaption(strprintf("%s (+%u), %d",
- ii.getName(item->getColor()).c_str(),
+ ii.getName().c_str(),
CAST_U32(item->getRefine()),
ii.getId()));
}
else
+#endif // TMWA_SUPPORT
{
mItemName->setCaption(strprintf("%s (+%u), %d",
- ii.getName().c_str(),
+ ii.getName(item->getColor()).c_str(),
CAST_U32(item->getRefine()),
ii.getId()));
}
@@ -219,17 +222,19 @@ void ItemPopup::setItem(const ItemInfo &item,
mLastColor = color;
mLastId = id;
- if (serverFeatures->haveItemColors())
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
{
mItemName->setCaption(strprintf("%s, %d",
- item.getName(color).c_str(), id));
- mItemDesc->setTextWrapped(item.getDescription(color), 196);
+ item.getName().c_str(), id));
+ mItemDesc->setTextWrapped(item.getDescription(), 196);
}
else
+#endif // TMWA_SUPPORT
{
mItemName->setCaption(strprintf("%s, %d",
- item.getName().c_str(), id));
- mItemDesc->setTextWrapped(item.getDescription(), 196);
+ item.getName(color).c_str(), id));
+ mItemDesc->setTextWrapped(item.getDescription(color), 196);
}
mItemName->adjustSize();
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index c305fafcf..09e1cbb05 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -71,11 +71,6 @@ bool ServerFeatures::haveMove3() const
return serverVersion > 0;
}
-bool ServerFeatures::haveItemColors() const
-{
- return true;
-}
-
bool ServerFeatures::haveAccountOtherGender() const
{
return false;
diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h
index 97ceef268..dc057c35b 100644
--- a/src/net/eathena/serverfeatures.h
+++ b/src/net/eathena/serverfeatures.h
@@ -48,8 +48,6 @@ class ServerFeatures final : public Net::ServerFeatures
bool haveMove3() const override final;
- bool haveItemColors() const override final A_CONST;
-
bool haveAccountOtherGender() const override final A_CONST;
bool haveCharOtherGender() const override final;
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index 83739b85f..7fdaccbcd 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -50,8 +50,6 @@ class ServerFeatures notfinal
virtual bool haveMove3() const = 0;
- virtual bool haveItemColors() const = 0;
-
virtual bool haveAccountOtherGender() const = 0;
virtual bool haveCharOtherGender() const = 0;
diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp
index 72841b374..c56b2f31b 100644
--- a/src/net/tmwa/serverfeatures.cpp
+++ b/src/net/tmwa/serverfeatures.cpp
@@ -69,11 +69,6 @@ bool ServerFeatures::haveMove3() const
return tmwServerVersion >= 0x0f0512 && tmwServerVersion <= 0xf0706;
}
-bool ServerFeatures::haveItemColors() const
-{
- return false;
-}
-
bool ServerFeatures::haveAccountOtherGender() const
{
return false;
diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h
index c23b45f11..fbe89e505 100644
--- a/src/net/tmwa/serverfeatures.h
+++ b/src/net/tmwa/serverfeatures.h
@@ -48,8 +48,6 @@ class ServerFeatures final : public Net::ServerFeatures
bool haveMove3() const override final;
- bool haveItemColors() const override final A_CONST;
-
bool haveAccountOtherGender() const override final A_CONST;
bool haveCharOtherGender() const override final;
diff --git a/src/resources/item/item.cpp b/src/resources/item/item.cpp
index bc6614e52..6b1f02ecf 100644
--- a/src/resources/item/item.cpp
+++ b/src/resources/item/item.cpp
@@ -34,6 +34,7 @@
#include "resources/loaders/imageloader.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "utils/delete2.h"
@@ -139,10 +140,16 @@ Image *Item::getImage(const int id,
std::string Item::getName() const
{
const ItemInfo &info = ItemDB::get(mId);
- if (serverFeatures->haveItemColors())
- return info.getName(mColor);
- else
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
+ {
return info.getName();
+ }
+ else
+#endif // TWMA_SUPPORT
+ {
+ return info.getName(mColor);
+ }
}
void Item::setCard(const int index, const int id)
@@ -189,6 +196,6 @@ void Item::setOptions(const ItemOptionsList *const options)
void Item::updateColor()
{
- if (serverFeatures && serverFeatures->haveItemColors())
+ if (Net::getNetworkType() == ServerType::EATHENA)
setId(mId, ItemColorManager::getColorFromCards(&mCards[0]));
}
diff --git a/src/resources/item/shopitem.cpp b/src/resources/item/shopitem.cpp
index 27a496814..55926c46d 100644
--- a/src/resources/item/shopitem.cpp
+++ b/src/resources/item/shopitem.cpp
@@ -26,6 +26,7 @@
#include "utils/stringutils.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "resources/db/unitsdb.h"
@@ -96,10 +97,12 @@ ShopItem::~ShopItem()
void ShopItem::updateDisplayName(const int quantity)
{
- if (serverFeatures->haveItemColors())
- mDisplayName = std::string(getInfo().getName(mColor));
- else
+#ifdef TMWA_SUPPORT
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
mDisplayName = std::string(getInfo().getName());
+ else
+#endif // TMWA_SUPPORT
+ mDisplayName = std::string(getInfo().getName(mColor));
if (mPrice)
{
mDisplayName.append(" (").append(