SEGS  0.6.1-develop [3e741b81]
Super Entity Game Server
NetCommandManager.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 "BitStream.h"
10 
11 #include <ace/Singleton.h>
12 #include <ace/Thread_Mutex.h>
13 #include <QtCore/QString>
14 #include <QtCore/QHash>
15 #include <map>
16 #include <vector>
17 
18 struct MapClientSession;
19 
21 {
22  float normalizedCircumferenceToFloat(int number,int numbits)
23  {
24  // something like this : ((number*3.141592)/(1<<numbits))-3.141592
25  float f=((float(number)*3.141592f)/(1<<numbits))-3.141592f;
26  return f;
27  }
28 public:
29 
30  struct Argument
31  {
32  int type;
33  void *targetvar;
34  };
35  NetCommand(int acl,const QString &name,std::vector<Argument> &args):m_arguments(args)
36  {
38  m_name=name;
39  }
40  int serializefrom(BitStream &bs);
43  QString m_name;
44  std::vector<Argument> m_arguments;
45 
46 };
47 
49 {
50 using vNetCommand = std::vector<NetCommand *>;
51 
52  QHash<QString, NetCommand *> m_name_to_command;
53  vNetCommand m_commands_level0;
54  void serializeto(BitStream &tgt, const vNetCommand &commands);
55 
56 public:
57  void UpdateCommandShortcuts(MapClientSession *client, std::vector<QString> &commands);
58  NetCommand *getCommandByName(const QString &name);
59  void addCommand(NetCommand *cmd);
60 };
61 typedef ACE_Singleton<NetCommandManager,ACE_Thread_Mutex> NetCommandManagerSingleton; // AdminServer Interface
Definition: MapClientSession.h:32
int type
Definition: NetCommandManager.h:32
Definition: BitStream.h:34
int m_required_access_level
Definition: NetCommandManager.h:42
int clientside_idx
Definition: NetCommandManager.h:41
std::vector< Argument > m_arguments
Definition: NetCommandManager.h:44
Definition: NetCommandManager.h:48
int serializefrom(BitStream &bs)
Definition: NetCommandManager.cpp:63
Definition: NetCommandManager.h:20
ACE_Singleton< NetCommandManager, ACE_Thread_Mutex > NetCommandManagerSingleton
Definition: NetCommandManager.h:61
QString m_name
Definition: NetCommandManager.h:43
void * targetvar
Definition: NetCommandManager.h:33
void serializeto(const CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext)
Definition: Costume.cpp:42
Definition: NetCommandManager.h:30
NetCommand(int acl, const QString &name, std::vector< Argument > &args)
Definition: NetCommandManager.h:35