aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-08 16:31:22 +0200
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-08 22:27:44 +0200
commitfd5a130b86c08f0b3190c3d81affd4869c139fb7 (patch)
tree8300ec1e77cfd8c38292f5b81e8e0fb82de0d53d /src/client.cpp
parent067766eec213918b6cb5b2533d0c78eceb3949ec (diff)
downloadminetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.tar.gz
minetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.tar.bz2
minetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.zip
More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects * Use RemotePlayer and LocalPlayer everywhere it's possible * Minor code style fixes * Drop Client::getBreath() unused function
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 392dabde6..cd010e592 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -383,7 +383,7 @@ void Client::step(float dtime)
if(counter <= 0.0) {
counter = 2.0;
- Player *myplayer = m_env.getLocalPlayer();
+ LocalPlayer *myplayer = m_env.getLocalPlayer();
FATAL_ERROR_IF(myplayer == NULL, "Local player not found in environment.");
u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ?
@@ -613,7 +613,7 @@ void Client::step(float dtime)
{
// Do this every <interval> seconds after TOCLIENT_INVENTORY
// Reset the locally changed inventory to the authoritative inventory
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
player->inventory = *m_inventory_from_server;
m_inventory_updated = true;
}
@@ -1191,7 +1191,7 @@ void Client::sendChatMessage(const std::wstring &message)
void Client::sendChangePassword(const std::string &oldpassword,
const std::string &newpassword)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
if (player == NULL)
return;
@@ -1317,7 +1317,7 @@ void Client::sendPlayerPos()
void Client::sendPlayerItem(u16 item)
{
- Player *myplayer = m_env.getLocalPlayer();
+ LocalPlayer *myplayer = m_env.getLocalPlayer();
if(myplayer == NULL)
return;
@@ -1398,7 +1398,7 @@ bool Client::getLocalInventoryUpdated()
// Copies the inventory of the local player to parameter
void Client::getLocalInventory(Inventory &dst)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
dst = player->inventory;
}
@@ -1411,7 +1411,7 @@ Inventory* Client::getInventory(const InventoryLocation &loc)
break;
case InventoryLocation::CURRENT_PLAYER:
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return &player->inventory;
}
@@ -1537,18 +1537,11 @@ void Client::setCrack(int level, v3s16 pos)
u16 Client::getHP()
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return player->hp;
}
-u16 Client::getBreath()
-{
- Player *player = m_env.getLocalPlayer();
- assert(player != NULL);
- return player->getBreath();
-}
-
bool Client::getChatMessage(std::wstring &message)
{
if(m_chat_queue.size() == 0)