mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Save and remove player by pointer
Why doing things simple ? Use pointer instead of strings to save players and remove them. Saving players by name does a lookup to find pointer we already have ! Idem with removePlayer Also remove unused removePlayer(peer_id), it's never called
This commit is contained in:
@@ -52,6 +52,7 @@ class ServerMap;
|
||||
class ClientMap;
|
||||
class GameScripting;
|
||||
class Player;
|
||||
class RemotePlayer;
|
||||
|
||||
class Environment
|
||||
{
|
||||
@@ -71,8 +72,7 @@ public:
|
||||
virtual Map & getMap() = 0;
|
||||
|
||||
virtual void addPlayer(Player *player);
|
||||
void removePlayer(u16 peer_id);
|
||||
void removePlayer(const char *name);
|
||||
void removePlayer(Player *player);
|
||||
Player * getPlayer(u16 peer_id);
|
||||
Player * getPlayer(const char *name);
|
||||
Player * getRandomConnectedPlayer();
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
const std::string &str_reason, bool reconnect);
|
||||
// Save players
|
||||
void saveLoadedPlayers();
|
||||
void savePlayer(const std::string &playername);
|
||||
void savePlayer(RemotePlayer *player);
|
||||
Player *loadPlayer(const std::string &playername);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user