diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-06 21:04:00 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-06 21:04:15 +0100 |
commit | 1624b37bf4ce632a486d6729dc90724241417868 (patch) | |
tree | 4596c7bbabd65dc95fe9b781f044d2dd035e534e /common | |
parent | 121387bfccc0ca2e35d39a8c1c92471f24e4848a (diff) |
Changed format of Message::Login and Message::LoginResponse to accomodate reconnection.
Diffstat (limited to 'common')
-rw-r--r-- | common/message.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/common/message.h b/common/message.h index 2be68c0..76ebf95 100644 --- a/common/message.h +++ b/common/message.h @@ -62,13 +62,16 @@ namespace Message { public: typedef boost::shared_ptr<Login> p; - Login(const std::string& n = "") : Base(Types::Login), nick(n) {} + Login(const std::string& n = "", uint64_t c = 0) : Base(Types::Login), nick(n), cookie(c) {} std::string nick; + uint64_t cookie; + template<class Archive> void serialize(Archive & ar, const unsigned int v) { ar & nick; + ar & cookie; } }; @@ -76,13 +79,26 @@ namespace Message { public: typedef boost::shared_ptr<LoginResponse> p; - LoginResponse(bool ok = false) : Base(Types::LoginResponse), login_ok(ok) {} + //! Response type. + enum Type { + //! Invalid login attempt. + Invalid, + //! Login to lobby. + Lobby, + //! Login to resume ongoing game. + Resume + }; + + LoginResponse(Type t = Invalid, uint64_t c = 0) : Base(Types::LoginResponse), type(t), cookie(c) {} + + Type type; - bool login_ok; + uint64_t cookie; template<class Archive> void serialize(Archive & ar, const unsigned int v) { - ar & login_ok; + ar & type; + ar & cookie; } }; |