summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-17 11:50:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-17 11:50:28 +0300
commit616ab2676cc932ab59152c510d584c429090987a (patch)
tree9184b8836b51a073f67ee60a46043084687207a7 /src/net
parent4b397f4c8e2b0c8d636cc2782d9571567473975b (diff)
downloadmanaplus-616ab2676cc932ab59152c510d584c429090987a.tar.gz
manaplus-616ab2676cc932ab59152c510d584c429090987a.tar.bz2
manaplus-616ab2676cc932ab59152c510d584c429090987a.tar.xz
manaplus-616ab2676cc932ab59152c510d584c429090987a.zip
Remove getter for serverFeatures.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/adminhandler.cpp2
-rw-r--r--src/net/ea/chathandler.cpp2
-rw-r--r--src/net/ea/gui/partytab.cpp4
-rw-r--r--src/net/eathena/inventoryhandler.cpp2
-rw-r--r--src/net/net.cpp6
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/serverfeatures.h2
-rw-r--r--src/net/tmwa/beinghandler.cpp20
-rw-r--r--src/net/tmwa/buysellhandler.cpp4
-rw-r--r--src/net/tmwa/charserverhandler.cpp4
-rw-r--r--src/net/tmwa/chathandler.cpp6
-rw-r--r--src/net/tmwa/guildhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp12
-rw-r--r--src/net/tmwa/loginhandler.cpp2
-rw-r--r--src/net/tmwa/npchandler.cpp2
15 files changed, 34 insertions, 38 deletions
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 550e96065..42c2eb52e 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -73,7 +73,7 @@ void AdminHandler::ipcheckName(const std::string &name) const
void AdminHandler::createItems(const int id, const int color,
const int amount) const
{
- if (!Net::getServerFeatures()->haveItemColors())
+ if (!serverFeatures->haveItemColors())
{
chatHandler->talk(strprintf("@item %d %d",
id, amount), GENERAL_CHANNEL);
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index b1c90ee17..b8f201229 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -302,7 +302,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) const
std::string sender_name = ((pos == std::string::npos)
? "" : chatMsg.substr(0, pos));
- if (Net::getServerFeatures()->haveIncompleteChatMessages())
+ if (serverFeatures->haveIncompleteChatMessages())
{
// work around for "new" tmw server
sender_name = being->getName();
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 937245fc9..afc1c3845 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -197,7 +197,7 @@ bool PartyTab::handleCommand(const std::string &restrict type,
}
}
else if (type == "setleader"
- && Net::getServerFeatures()->haveChangePartyLeader())
+ && serverFeatures->haveChangePartyLeader())
{
partyHandler->changeLeader(args);
}
@@ -228,7 +228,7 @@ void PartyTab::getAutoCompleteCommands(StringVect &names) const
names.push_back("/kick ");
names.push_back("/item");
names.push_back("/exp");
- if (Net::getServerFeatures()->haveChangePartyLeader())
+ if (serverFeatures->haveChangePartyLeader())
names.push_back("/setleader ");
}
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index e2ffe196c..487b22a9f 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -378,7 +378,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
inventory->setItem(index, itemId, amount, refine,
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 14d06bc76..268f41180 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -58,6 +58,7 @@ namespace Net
class PetHandler;
class PlayerHandler;
class QuestHandler;
+ class ServerFeatures;
}
Net::AdminHandler *adminHandler = nullptr;
@@ -94,11 +95,6 @@ Net::TradeHandler *Net::getTradeHandler()
return tradeHandler;
}
-Net::ServerFeatures *Net::getServerFeatures()
-{
- return serverFeatures;
-}
-
namespace Net
{
diff --git a/src/net/net.h b/src/net/net.h
index 7ddfd4364..a289d45df 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -38,11 +38,9 @@ namespace Net
class SkillHandler;
class TradeHandler;
-class ServerFeatures;
SkillHandler *getSkillHandler() A_WARN_UNUSED;
TradeHandler *getTradeHandler() A_WARN_UNUSED;
-ServerFeatures *getServerFeatures() A_WARN_UNUSED;
ServerInfo::Type getNetworkType() A_WARN_UNUSED;
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index d2029d7da..5da521ea2 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -72,4 +72,6 @@ class ServerFeatures notfinal
} // namespace Net
+extern Net::ServerFeatures *serverFeatures;
+
#endif // NET_SERVERFEATURES_H
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index bea17edb6..2a9b31c0f 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -296,7 +296,7 @@ void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg) const
int id2 = 0;
const int16_t id = msg.readInt16("id1");
- if (type == 2 || Net::getServerFeatures()->haveItemColors())
+ if (type == 2 || serverFeatures->haveItemColors())
{
id2 = msg.readInt16("id2");
}
@@ -569,7 +569,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg) const
dstBeing->updateSprite(SPRITE_WEAPON, weapon, "", 1, true);
if (!mHideShield)
dstBeing->updateSprite(SPRITE_SHIELD, shield);
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
{
dstBeing->updateSprite(SPRITE_BOTTOMCLOTHES, headBottom,
"", colors[0]);
@@ -720,7 +720,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg) const
dstBeing->updateSprite(SPRITE_WEAPON, weapon, "", 1, true);
if (!mHideShield)
dstBeing->updateSprite(SPRITE_SHIELD, shield);
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
{
dstBeing->updateSprite(SPRITE_BOTTOMCLOTHES, headBottom,
"", colors[0]);
@@ -871,7 +871,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const
dstBeing->updateSprite(SPRITE_WEAPON, weapon, "", 1, true);
if (!mHideShield)
dstBeing->updateSprite(SPRITE_SHIELD, shield);
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
{
dstBeing->updateSprite(SPRITE_BOTTOMCLOTHES, headBottom,
"", colors[0]);
@@ -947,7 +947,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const
void BeingHandler::processBeingMove3(Net::MessageIn &msg)
{
BLOCK_START("BeingHandler::processBeingMove3")
- if (!Net::getServerFeatures()->haveMove3())
+ if (!serverFeatures->haveMove3())
{
BLOCK_END("BeingHandler::processBeingMove3")
return;
@@ -1103,7 +1103,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
uint16_t gloves;
if (dstBeing->getType() == ActorType::Monster)
{
- if (Net::getServerFeatures()->haveServerHp())
+ if (serverFeatures->haveServerHp())
{
const int hp = msg.readInt32("hp");
const int maxHP = msg.readInt32("max hp");
@@ -1131,7 +1131,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- if (Net::getServerFeatures()->haveMonsterAttackRange()
+ if (serverFeatures->haveMonsterAttackRange()
&& dstBeing->getType() == ActorType::Monster)
{
const int attackRange = static_cast<int>(
@@ -1307,7 +1307,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
uint16_t gloves;
if (dstBeing->getType() == ActorType::Monster)
{
- if (Net::getServerFeatures()->haveServerHp())
+ if (serverFeatures->haveServerHp())
{
const int hp = msg.readInt32("hp");
const int maxHP = msg.readInt32("max hp");
@@ -1335,7 +1335,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- if (Net::getServerFeatures()->haveMonsterAttackRange()
+ if (serverFeatures->haveMonsterAttackRange()
&& dstBeing->getType() == ActorType::Monster)
{
const int attackRange = static_cast<int>(
@@ -1377,7 +1377,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
{
dstBeing->setAction(BeingAction::STAND, 0);
dstBeing->setTileCoords(srcX, srcY);
- if (!Net::getServerFeatures()->haveMove3())
+ if (!serverFeatures->haveMove3())
dstBeing->setDestination(dstX, dstY);
}
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 2b34e0a83..5de7b0556 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -96,7 +96,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
{
msg.readInt16("len");
unsigned int sz = 11;
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
sz += 1;
const unsigned int n_items = (msg.getLength() - 4U) / sz;
mBuyDialog = new BuyDialog(mNpcId);
@@ -109,7 +109,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
msg.readUInt8("type");
const int itemId = msg.readInt16("item id");
uint8_t color = 1;
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
color = msg.readUInt8("item color");
mBuyDialog->addItem(itemId, color, 0, value);
}
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index d386206aa..a6c7ab178 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -280,11 +280,11 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<int8_t>(hairColor), "hair color");
outMsg.writeInt8(0, "unused");
outMsg.writeInt8(static_cast<int8_t>(hairstyle), "hair style");
- if (Net::getServerFeatures()->haveLookSelection())
+ if (serverFeatures->haveLookSelection())
outMsg.writeInt8(look, "look");
else
outMsg.writeInt8(0, "unused");
- if (Net::getServerFeatures()->haveRaceSelection())
+ if (serverFeatures->haveRaceSelection())
outMsg.writeInt8(race, "class");
}
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 099649566..0d0c08d90 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -127,7 +127,7 @@ void ChatHandler::talk(const std::string &restrict text,
const std::string mes = std::string(localPlayer->getName()).append(
" : ").append(text);
- if (Net::getServerFeatures()->haveChatChannels() && channel.size() == 3)
+ if (serverFeatures->haveChatChannels() && channel.size() == 3)
{
MessageOut outMsg(CMSG_CHAT_MESSAGE2);
// Added + 1 in order to let eAthena parse admin commands correctly
@@ -236,7 +236,7 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
void ChatHandler::ignoreAll() const
{
- if (!Net::getServerFeatures()->haveServerIgnore())
+ if (!serverFeatures->haveServerIgnore())
return;
MessageOut outMsg(CMSG_IGNORE_ALL);
outMsg.writeInt8(0, "flag");
@@ -244,7 +244,7 @@ void ChatHandler::ignoreAll() const
void ChatHandler::unIgnoreAll() const
{
- if (!Net::getServerFeatures()->haveServerIgnore())
+ if (!serverFeatures->haveServerIgnore())
return;
MessageOut outMsg(CMSG_IGNORE_ALL);
outMsg.writeInt8(1, "flag");
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 4a7b00147..35b25364b 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -85,7 +85,7 @@ GuildHandler::~GuildHandler()
void GuildHandler::handleMessage(Net::MessageIn &msg)
{
BLOCK_START("GuildHandler::handleMessage")
- if (!Net::getServerFeatures()->haveNativeGuilds())
+ if (!serverFeatures->haveNativeGuilds())
return;
switch (msg.getId())
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index a1eb1b159..359326e31 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -267,7 +267,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
index, itemId, itemType, identified);
}
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
if (inventory)
@@ -338,7 +338,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
inventory->setItem(index, itemId, amount, refine,
@@ -388,7 +388,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
cards[0], cards[1], cards[2], cards[3]);
}
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
// Trick because arrows are not considered equipment
@@ -431,7 +431,7 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
cards[0], cards[1], cards[2], cards[3]);
}
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
@@ -499,7 +499,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
static_cast<unsigned int>(refine));
}
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1U)
+ if (!serverFeatures->haveItemColors() && identified > 1U)
identified = 1U;
mInventoryItems.push_back(Ea::InventoryItem(index,
@@ -530,7 +530,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
{
if (mStorage)
{
- if (!Net::getServerFeatures()->haveItemColors() && identified > 1)
+ if (!serverFeatures->haveItemColors() && identified > 1)
identified = 1;
mStorage->setItem(index, itemId, amount,
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 35321b1b8..bcf0e6c2b 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -267,7 +267,7 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
int LoginHandler::supportedOptionalActions() const
{
- return Net::getServerFeatures()->haveEmailOnRegister()
+ return serverFeatures->haveEmailOnRegister()
? Net::RegistrationOptions::SetEmailOnRegister
| Net::RegistrationOptions::SetGenderOnRegister
: Net::RegistrationOptions::SetGenderOnRegister;
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 0718e9b4f..5437d6920 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -180,7 +180,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId,
const unsigned char color, const int amount) const
{
MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
- if (Net::getServerFeatures()->haveItemColors())
+ if (serverFeatures->haveItemColors())
{
outMsg.writeInt16(10); // One item (length of packet)
outMsg.writeInt16(static_cast<int16_t>(amount));