SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt 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  typedef std::vector<NetCommand *> vNetCommand;
51  QHash<QString,NetCommand *> m_name_to_command;
52  vNetCommand m_commands_level0;
53  void serializeto(BitStream &tgt,
54  const vNetCommand &commands,
55  const vNetCommand &commands2);
56 public:
58  BitStream &tgt,
59  const std::vector<NetCommand *> &commands2);
60  NetCommand * getCommandByName(const QString &name);
61  void addCommand(NetCommand *cmd);
62 };
63 typedef ACE_Singleton<NetCommandManager,ACE_Thread_Mutex> NetCommandManagerSingleton; // AdminServer Interface
Definition: MapClientSession.h:32
int type
Definition: NetCommandManager.h:32
Definition: BitStream.h:30
int m_required_access_level
Definition: NetCommandManager.h:42
NetCommand * getCommandByName(const QString &name)
Definition: NetCommandManager.cpp:119
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:63
void SendCommandShortcuts(MapClientSession *client, BitStream &tgt, const std::vector< NetCommand * > &commands2)
Definition: NetCommandManager.cpp:149
QString m_name
Definition: NetCommandManager.h:43
void addCommand(NetCommand *cmd)
Definition: NetCommandManager.cpp:112
void * targetvar
Definition: NetCommandManager.h:33
Definition: NetCommandManager.h:30
NetCommand(int acl, const QString &name, std::vector< Argument > &args)
Definition: NetCommandManager.h:35