]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/player.h
end-of-day.
[dragonfireclient.git] / src / player.h
index fc87a5edd33a750804746bff0dac017b94717814..30df1db8b6fd2e50973ceebcb7f0968ea902af3c 100644 (file)
@@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #define PLAYERNAME_SIZE 20
 
+#define PLAYERNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,"
+
 class Map;
 
 class Player
@@ -37,6 +39,8 @@ class Player
        Player();
        virtual ~Player();
 
+       void resetInventory();
+
        //void move(f32 dtime, Map &map);
        virtual void move(f32 dtime, Map &map) = 0;
 
@@ -96,12 +100,22 @@ class Player
        virtual bool isLocal() const = 0;
 
        virtual void updateLight(u8 light_at_pos) {};
-
-       virtual bool isClientConnected() { return false; }
-       virtual void setClientConnected(bool) {}
+       
+       // NOTE: Use peer_id == 0 for disconnected
+       /*virtual bool isClientConnected() { return false; }
+       virtual void setClientConnected(bool) {}*/
+       
+       /*
+               serialize() writes a bunch of text that can contain
+               any characters except a '\0', and such an ending that
+               deSerialize stops reading exactly at the right point.
+       */
+       void serialize(std::ostream &os);
+       void deSerialize(std::istream &is);
 
        bool touching_ground;
        bool in_water;
+       bool swimming_up;
        
        Inventory inventory;
 
@@ -118,8 +132,7 @@ class Player
 class ServerRemotePlayer : public Player
 {
 public:
-       ServerRemotePlayer(bool client_connected):
-               m_client_connected(client_connected)
+       ServerRemotePlayer()
        {
        }
        virtual ~ServerRemotePlayer()
@@ -135,18 +148,6 @@ class ServerRemotePlayer : public Player
        {
        }
 
-       virtual bool isClientConnected()
-       {
-               return m_client_connected;
-       }
-       virtual void setClientConnected(bool client_connected)
-       {
-               m_client_connected = client_connected;
-       }
-
-       // This 
-       bool m_client_connected;
-
 private:
 };
 
@@ -250,7 +251,7 @@ class RemotePlayer : public Player, public scene::ISceneNode
        v3f m_showpos;
 };
 
-#endif
+#endif // !SERVER
 
 #ifndef SERVER
 struct PlayerControl