Dynamically allocate the Player struct in PlayerView.

This way we're not always passing it around by value.
Note that the Player structs in CNSharedData are still
pass-by-reference. Will probably change this later.
This commit is contained in:
2020-08-25 00:02:07 +02:00
parent c5dacb4958
commit 14bc368073
7 changed files with 118 additions and 127 deletions

View File

@@ -11,7 +11,7 @@
struct PlayerView {
std::list<CNSocket*> viewable;
std::list<int32_t> viewableNPCs;
Player plr;
Player *plr;
uint64_t lastHeartbeat;
};
@@ -22,9 +22,8 @@ namespace PlayerManager {
void addPlayer(CNSocket* key, Player plr);
void removePlayer(CNSocket* key);
Player getPlayer(CNSocket* key);
Player *getPlayer(CNSocket* key);
void updatePlayer(CNSocket* key, Player plr);
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z);
std::list<CNSocket*> getNearbyPlayers(int X, int Y, int dist);