Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
15b86a6b
Commit
15b86a6b
authored
12 years ago
by
MirceaKitsune
Committed by
Perttu Ahola
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't send player position from client to server if the player hasn't moved
parent
eeb09002
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/client.cpp
+16
-2
16 additions, 2 deletions
src/client.cpp
src/localplayer.cpp
+5
-0
5 additions, 0 deletions
src/localplayer.cpp
src/localplayer.h
+8
-0
8 additions, 0 deletions
src/localplayer.h
src/player.h
+1
-1
1 addition, 1 deletion
src/player.h
with
30 additions
and
3 deletions
src/client.cpp
+
16
−
2
View file @
15b86a6b
...
...
@@ -1976,10 +1976,24 @@ void Client::sendPlayerPos()
{
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
Player
*
myplayer
=
m_env
.
getLocalPlayer
();
Local
Player
*
myplayer
=
m_env
.
getLocalPlayer
();
if
(
myplayer
==
NULL
)
return
;
// Save bandwidth by only updating position when something changed
if
(
myplayer
->
last_position
==
myplayer
->
getPosition
()
&&
myplayer
->
last_speed
==
myplayer
->
getSpeed
()
&&
myplayer
->
last_pitch
==
myplayer
->
getPitch
()
&&
myplayer
->
last_yaw
==
myplayer
->
getYaw
()
&&
myplayer
->
last_keyPressed
==
myplayer
->
keyPressed
)
return
;
myplayer
->
last_position
=
myplayer
->
getPosition
();
myplayer
->
last_speed
=
myplayer
->
getSpeed
();
myplayer
->
last_pitch
=
myplayer
->
getPitch
();
myplayer
->
last_yaw
=
myplayer
->
getYaw
();
myplayer
->
last_keyPressed
=
myplayer
->
keyPressed
;
u16
our_peer_id
;
{
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
...
...
This diff is collapsed.
Click to expand it.
src/localplayer.cpp
+
5
−
0
View file @
15b86a6b
...
...
@@ -36,6 +36,11 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef):
Player
(
gamedef
),
isAttached
(
false
),
overridePosition
(
v3f
(
0
,
0
,
0
)),
last_position
(
v3f
(
0
,
0
,
0
)),
last_speed
(
v3f
(
0
,
0
,
0
)),
last_pitch
(
0
),
last_yaw
(
0
),
last_keyPressed
(
0
),
m_sneak_node
(
32767
,
32767
,
32767
),
m_sneak_node_exists
(
false
),
m_old_node_below
(
32767
,
32767
,
32767
),
...
...
This diff is collapsed.
Click to expand it.
src/localplayer.h
+
8
−
0
View file @
15b86a6b
...
...
@@ -44,6 +44,14 @@ class LocalPlayer : public Player
void
applyControl
(
float
dtime
);
v3s16
getStandingNodePos
();
// Used to check if anything changed and prevent sending packets if not
v3f
last_position
;
v3f
last_speed
;
float
last_pitch
;
float
last_yaw
;
unsigned
int
last_keyPressed
;
private
:
// This is used for determining the sneaking range
v3s16
m_sneak_node
;
...
...
This diff is collapsed.
Click to expand it.
src/player.h
+
1
−
1
View file @
15b86a6b
...
...
@@ -220,7 +220,7 @@ class Player
}
u32
keyPressed
;
protected
:
IGameDef
*
m_gamedef
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment