From 596484da4fcd301e597a851a9a54b6dc276a286a Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 23 Sep 2015 18:53:54 +0200 Subject: 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 --- src/environment.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/environment.h') diff --git a/src/environment.h b/src/environment.h index 41295abf2..17d7ff19d 100644 --- a/src/environment.h +++ b/src/environment.h @@ -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); /* -- cgit v1.2.3