summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-08 10:38:04 +0200
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-08 11:36:28 +0200
commit8bcd10b872bc88c6f474913d6efb8d53c50c5ae1 (patch)
tree39a8af0048ed642eddc43c74ab9f736558663e9d /src/server.h
parent0264e38bff12a3c6b81231ac1f6cd281179df744 (diff)
downloadminetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.tar.gz
minetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.tar.bz2
minetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.zip
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
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/server.h b/src/server.h
index 34427a71a..331a91a52 100644
--- a/src/server.h
+++ b/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> &params);
- 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);