mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02: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:
13
src/server.h
13
src/server.h
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "environment.h"
|
||||
#include "chat_interface.h"
|
||||
#include "clientiface.h"
|
||||
#include "player.h"
|
||||
#include "network/networkpacket.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
@@ -48,7 +49,6 @@ class IWritableCraftDefManager;
|
||||
class BanManager;
|
||||
class EventManager;
|
||||
class Inventory;
|
||||
class Player;
|
||||
class PlayerSAO;
|
||||
class IRollbackManager;
|
||||
struct RollbackAction;
|
||||
@@ -336,9 +336,10 @@ public:
|
||||
u32 hudAdd(Player *player, HudElement *element);
|
||||
bool hudRemove(Player *player, u32 id);
|
||||
bool hudChange(Player *player, u32 id, HudElementStat stat, void *value);
|
||||
bool hudSetFlags(Player *player, u32 flags, u32 mask);
|
||||
bool hudSetHotbarItemcount(Player *player, s32 hotbar_itemcount);
|
||||
s32 hudGetHotbarItemcount(Player *player);
|
||||
bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
|
||||
bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
|
||||
s32 hudGetHotbarItemcount(RemotePlayer *player) const
|
||||
{ return player->getHotbarItemcount(); }
|
||||
void hudSetHotbarImage(Player *player, std::string name);
|
||||
std::string hudGetHotbarImage(Player *player);
|
||||
void hudSetHotbarSelectedImage(Player *player, std::string name);
|
||||
@@ -353,7 +354,7 @@ public:
|
||||
bool setSky(Player *player, const video::SColor &bgcolor,
|
||||
const std::string &type, const std::vector<std::string> ¶ms);
|
||||
|
||||
bool overrideDayNightRatio(Player *player, bool do_override, float brightness);
|
||||
bool overrideDayNightRatio(RemotePlayer *player, bool do_override, float brightness);
|
||||
|
||||
/* con::PeerHandler implementation. */
|
||||
void peerAdded(con::Peer *peer);
|
||||
@@ -475,7 +476,7 @@ private:
|
||||
void DiePlayer(u16 peer_id);
|
||||
void RespawnPlayer(u16 peer_id);
|
||||
void DeleteClient(u16 peer_id, ClientDeletionReason reason);
|
||||
void UpdateCrafting(Player *player);
|
||||
void UpdateCrafting(RemotePlayer *player);
|
||||
|
||||
void handleChatInterfaceEvent(ChatEvent *evt);
|
||||
|
||||
|
Reference in New Issue
Block a user