summaryrefslogtreecommitdiff
path: root/src/client/client.cpp
diff options
context:
space:
mode:
authorANAND <ClobberXD@gmail.com>2019-08-04 10:23:59 +0530
committerSmallJoker <mk939@ymail.com>2019-08-07 19:21:14 +0200
commite788ee283fe7eb8151898916f72c2cf803255fa4 (patch)
tree29e03adb9208c5371f969dd2c12535f2fe490e72 /src/client/client.cpp
parente462a9a5ef46776d974203bb44e0b89e8c980b29 (diff)
downloadminetest-e788ee283fe7eb8151898916f72c2cf803255fa4.tar.gz
minetest-e788ee283fe7eb8151898916f72c2cf803255fa4.tar.bz2
minetest-e788ee283fe7eb8151898916f72c2cf803255fa4.zip
Client::Interact: Use InteractAction enum instead of numeric constants
This replaces the magic numbers used as interaction modes both client-side and server-side, primarily for the sake of ease-of-readability.
Diffstat (limited to 'src/client/client.cpp')
-rw-r--r--src/client/client.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 430784b95..cb6b68278 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -908,7 +908,7 @@ void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket *
*pkt << fov << wanted_range;
}
-void Client::interact(u8 action, const PointedThing& pointed)
+void Client::interact(InteractAction action, const PointedThing& pointed)
{
if(m_state != LC_Ready) {
errorstream << "Client::interact() "
@@ -928,18 +928,11 @@ void Client::interact(u8 action, const PointedThing& pointed)
[5] u32 length of the next item (plen)
[9] serialized PointedThing
[9 + plen] player position information
- actions:
- 0: start digging (from undersurface) or use
- 1: stop digging (all parameters ignored)
- 2: digging completed
- 3: place block or item (to abovesurface)
- 4: use item
- 5: perform secondary action of item
*/
NetworkPacket pkt(TOSERVER_INTERACT, 1 + 2 + 0);
- pkt << action;
+ pkt << (u8)action;
pkt << myplayer->getWieldIndex();
std::ostringstream tmp_os(std::ios::binary);
@@ -1203,7 +1196,7 @@ void Client::clearOutChatQueue()
}
void Client::sendChangePassword(const std::string &oldpassword,
- const std::string &newpassword)
+ const std::string &newpassword)
{
LocalPlayer *player = m_env.getLocalPlayer();
if (player == NULL)