mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-30 18:05:29 +01:00
Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)
* LocalPlayer take ownership of maxHudId as it's the only caller * RemotePlayer take ownership of day night ratio as it's the only user * Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call) * getPlayerSAO is now only RemotePlayer call * get/setHotbarItemCount is now RemotePlayer owned * Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type * PlayerSAO now uses RemotePlayer instead of Player because it's only server side * ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
This commit is contained in:
@@ -160,7 +160,7 @@ public:
|
||||
class PlayerSAO : public ServerActiveObject
|
||||
{
|
||||
public:
|
||||
PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
||||
PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id_,
|
||||
const std::set<std::string> &privs, bool is_singleplayer);
|
||||
~PlayerSAO();
|
||||
ActiveObjectType getType() const
|
||||
@@ -231,14 +231,8 @@ public:
|
||||
|
||||
void disconnected();
|
||||
|
||||
Player* getPlayer()
|
||||
{
|
||||
return m_player;
|
||||
}
|
||||
u16 getPeerID() const
|
||||
{
|
||||
return m_peer_id;
|
||||
}
|
||||
RemotePlayer* getPlayer() { return m_player; }
|
||||
u16 getPeerID() const { return m_peer_id; }
|
||||
|
||||
// Cheat prevention
|
||||
|
||||
@@ -291,7 +285,7 @@ public:
|
||||
private:
|
||||
std::string getPropertyPacket();
|
||||
|
||||
Player *m_player;
|
||||
RemotePlayer *m_player;
|
||||
u16 m_peer_id;
|
||||
Inventory *m_inventory;
|
||||
s16 m_damage;
|
||||
|
||||
Reference in New Issue
Block a user