SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Team.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 #include "CommonNetStructures.h"
10 
11 class Entity;
12 
13 class Team
14 {
15 public:
16  Team()
17  : m_team_idx( ++m_team_idx_counter )
18  { }
19 virtual ~Team() = default;
20 
21  struct TeamMember {
22  uint32_t tm_idx;
23  QString tm_name; // stored here for quick lookup.
24  };
25 
26  // Member Vars
27  std::vector<TeamMember> m_team_members;
28 
29 const uint32_t m_team_idx;
30  uint32_t m_max_team_size = 8; // max is always 8
32  bool m_team_has_mission = false; // it's possible that this belongs to entity or char instead
33 
34  // Methods
35  void dump();
36  void listTeamMembers();
37  void addTeamMember(Entity *e);
38  void removeTeamMember(Entity *e);
39  bool isTeamLeader(Entity *e);
40 
41 private:
42 static uint32_t m_team_idx_counter;
43 };
44 
45 
46 /*
47  * Team Methods
48  */
49 bool sameTeam(Entity &src, Entity &tgt);
50 bool makeTeamLeader(Entity &src, Entity &tgt);
51 bool inviteTeam(Entity &src, Entity &tgt);
52 bool kickTeam(Entity &tgt);
53 void leaveTeam(Entity &e);
54 
55 /*
56  * Sidekick Methods -- Sidekick system requires teaming.
57  */
58 bool isSidekickMentor(const Entity &e);
59 void inviteSidekick(Entity &src, Entity &tgt);
60 void addSidekick(Entity &tgt, Entity &src);
61 void removeSidekick(Entity &src);
bool kickTeam(Entity &tgt)
Definition: Team.cpp:171
std::vector< TeamMember > m_team_members
Definition: Team.h:27
void dump()
Definition: Team.cpp:95
const uint32_t m_team_idx
Definition: Team.h:29
void addTeamMember(Entity *e)
Definition: Team.cpp:26
int m_team_leader_idx
Definition: Team.h:31
Definition: Team.h:13
void leaveTeam(Entity &e)
Definition: Team.cpp:180
bool sameTeam(Entity &src, Entity &tgt)
Definition: Team.cpp:122
bool isSidekickMentor(const Entity &e)
Definition: Team.cpp:198
void addSidekick(Entity &tgt, Entity &src)
Definition: Team.cpp:247
uint32_t m_max_team_size
Definition: Team.h:30
Definition: Team.h:21
bool isTeamLeader(Entity *e)
Definition: Team.cpp:117
void removeSidekick(Entity &src)
Definition: Team.cpp:274
virtual ~Team()=default
Definition: Entity.h:221
bool makeTeamLeader(Entity &src, Entity &tgt)
Definition: Team.cpp:127
bool m_team_has_mission
Definition: Team.h:32
bool inviteTeam(Entity &src, Entity &tgt)
Definition: Team.cpp:138
QString tm_name
Definition: Team.h:23
void listTeamMembers()
Definition: Team.cpp:107
Team()
Definition: Team.h:16
uint32_t tm_idx
Definition: Team.h:22
void inviteSidekick(Entity &src, Entity &tgt)
Definition: Team.cpp:203
void removeTeamMember(Entity *e)
Definition: Team.cpp:49