SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
Friend.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 #include "CommonNetStructures.h"
10 
11 class Entity;
12 // Max number of friends on friendslist -- client caps at 25 entries
13 static const int g_max_friends = 25;
14 
15 struct Friend
16 {
17  enum : uint32_t { class_version=1 };
18 
20  uint32_t m_db_id; // m_db_id
21  QString m_name;
22  uint8_t m_class_idx;
23  uint8_t m_origin_idx;
24  int m_map_idx; // if online, then these Packed Bits
25  QString m_mapname; // field_18, probably mapname
26  template<class Archive>
27  void serialize(Archive &archive, uint32_t const version);
28 };
29 
31 {
32 static const constexpr uint32_t class_version = 1;
34  int m_friends_count = 0; // v12
35  std::vector<Friend> m_friends;
36 };
37 template<class Archive>
38 void serialize(Archive &archive, FriendsList &fl, uint32_t const version);
39 
41 {
46 };
47 
48 /*
49  * Friend Methods
50  */
51 void toggleFriendList(Entity &src);
52 void dumpFriends(const Entity &src);
53 void dumpFriendsList(const Friend &f);
54 
55 FriendListChangeStatus addFriend(Entity &src, const Entity &tgt, const QString &mapname);
56 FriendListChangeStatus removeFriend(Entity &src, const QString& friendName);
57 
58 const QString &getFriendDisplayMapName(const Friend &f);
FriendsList & fl
Definition: Friend.cpp:159
const QString & getFriendDisplayMapName(const Friend &f)
uint8_t m_class_idx
Definition: Friend.h:22
FriendListChangeStatus removeFriend(Entity &src, const QString &friendName)
Definition: Friend.cpp:99
FriendListChangeStatus addFriend(Entity &src, const Entity &tgt, const QString &mapname)
Definition: Friend.cpp:68
void dumpFriendsList(const Friend &f)
Definition: Friend.cpp:57
archive(cereal::make_nvp("OriginIdx", ed.m_origin_idx))
void dumpFriends(const Entity &src)
Definition: Friend.cpp:44
void toggleFriendList(Entity &src)
Definition: Friend.cpp:28
uint32_t m_db_id
Definition: Friend.h:20
Definition: Friend.h:15
Definition: Entity.h:134
uint8_t m_origin_idx
Definition: Friend.h:23
QString m_mapname
Definition: Friend.h:25
void serialize(Archive &archive, uint32_t const version)
Definition: Friend.cpp:138
Definition: Friend.h:17
std::vector< Friend > m_friends
Definition: Friend.h:35
FriendListChangeStatus
Definition: Friend.h:40
Definition: Friend.h:30
bool m_has_friends
Definition: Friend.h:33
bool m_online_status
Definition: Friend.h:19
EntityData uint32_t const version
Definition: entitydata_serializers.cpp:25
QString m_name
Definition: Friend.h:21
int m_map_idx
Definition: Friend.h:24