mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-09-28 18:57:35 +00:00
faster player distance check
This commit is contained in:
@@ -79,12 +79,10 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
|
||||
int diffX = abs(pair.second.plr.x - X); // the map is like a grid, X and Y are your position on the map, Z is the height. very different from other games...
|
||||
int diffY = abs(pair.second.plr.y - Y);
|
||||
|
||||
double dist = sqrt(pow(diffX, 2) + pow(diffY, 2));
|
||||
|
||||
if (dist > settings::VIEWDISTANCE) {
|
||||
noView.push_back(pair.first);
|
||||
} else {
|
||||
if (diffX < settings::VIEWDISTANCE && diffY < settings::VIEWDISTANCE) {
|
||||
yesView.push_back(pair.first);
|
||||
} else {
|
||||
noView.push_back(pair.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user