| 1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
| 2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
| 3 | #ifndef ENGINE_FRIENDS_H |
| 4 | #define ENGINE_FRIENDS_H |
| 5 | |
| 6 | #include "kernel.h" |
| 7 | |
| 8 | #include <engine/shared/protocol.h> |
| 9 | |
| 10 | struct CFriendInfo |
| 11 | { |
| 12 | char m_aName[MAX_NAME_LENGTH]; |
| 13 | char m_aClan[MAX_CLAN_LENGTH]; |
| 14 | unsigned m_NameHash; |
| 15 | unsigned m_ClanHash; |
| 16 | }; |
| 17 | |
| 18 | class IFriends : public IInterface |
| 19 | { |
| 20 | MACRO_INTERFACE("friends" ) |
| 21 | public: |
| 22 | enum |
| 23 | { |
| 24 | FRIEND_NO = 0, |
| 25 | FRIEND_CLAN, |
| 26 | FRIEND_PLAYER, |
| 27 | }; |
| 28 | static constexpr auto MAX_FRIENDS = 4096; |
| 29 | |
| 30 | virtual void Init(bool Foes = false) = 0; |
| 31 | |
| 32 | virtual int NumFriends() const = 0; |
| 33 | virtual const CFriendInfo *GetFriend(int Index) const = 0; |
| 34 | virtual int GetFriendState(const char *pName, const char *pClan) const = 0; |
| 35 | virtual bool IsFriend(const char *pName, const char *pClan, bool PlayersOnly) const = 0; |
| 36 | |
| 37 | virtual void AddFriend(const char *pName, const char *pClan) = 0; |
| 38 | virtual void RemoveFriend(const char *pName, const char *pClan) = 0; |
| 39 | }; |
| 40 | |
| 41 | #endif |
| 42 | |