#define PLAYERNAME_SIZE 20
+#define PLAYERNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,"
+
class Map;
class Player
Player();
virtual ~Player();
+ void resetInventory();
+
//void move(f32 dtime, Map &map);
virtual void move(f32 dtime, Map &map) = 0;
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;
class ServerRemotePlayer : public Player
{
public:
- ServerRemotePlayer(bool client_connected):
- m_client_connected(client_connected)
+ ServerRemotePlayer()
{
}
virtual ~ServerRemotePlayer()
{
}
- virtual bool isClientConnected()
- {
- return m_client_connected;
- }
- virtual void setClientConnected(bool client_connected)
- {
- m_client_connected = client_connected;
- }
-
- // This
- bool m_client_connected;
-
private:
};
v3f m_showpos;
};
-#endif
+#endif // !SERVER
#ifndef SERVER
struct PlayerControl