1 #ifndef COMMANDS_H
2 #define COMMANDS_H
3 
4 #include <boost/signals2.hpp>
5 #include <boost/shared_ptr.hpp>
6 #include <boost/format.hpp>
7 #include <boost/typeof/typeof.hpp>
8 #include <string>
9 #include <sstream>
10 #include <assert.h>
11 #include <iostream>
12 #include <lsl/networking/commands.h>
13 
14 struct ServerEvents {
15     typedef boost::signals2::signal<void ()> BattleSigType;
16     static BattleSigType battleSig;
17 };
18 
19 struct User
20 {
UserUser21     User()
22     {
23         ServerEvents::battleSig.connect( *this );
24     }
operatorUser25   void operator()() const
26   {
27     std::cout << "I was called" << std::endl;
28   }
29 };
30 
31 struct Server {
32     Server();
33     void ExecuteCommand( const std::string& cmd, const std::string& inparams, int replyid );
34     void OnNewUser(const std::string& nick, const std::string& country, const int &cpu, const int &id ) ;
35 
36 };
37 
Server()38 Server::Server()
39 {}
40 
ExecuteCommand(const std::string & cmd,const std::string & inparams,int replyid)41 void Server::ExecuteCommand(const std::string &cmd, const std::string &inparams, int replyid)
42 {
43     std::string params = inparams;
44     int pos, cpu, id, nat, port, maxplayers, rank, specs, units, top, left, right, bottom, ally, type;
45     bool haspass,lanmode = false;
46     std::string hash;
47     std::string nick, contry, host, map, title, mod, channel, error, msg, owner, ai, supported_spring_version, topic;
48     //NatType ntype;
49 //    UserStatus cstatus;
50 //    UTASClientStatus tasstatus;
51 //    UTASBattleStatus tasbstatus;
52 //    UserBattleStatus bstatus;
53 //    UTASColor color;
54 
55 
56 }
57 
OnNewUser(const std::string & nick,const std::string & country,const int & cpu,const int & id)58 void Server::OnNewUser( const std::string& nick, const std::string& country, const int& cpu, const int& id )
59 {
60     std::cerr << boost::format("I'm being called bro!\n nick %s -- country %s -- cpu %i -- id %i\n")
61                  % nick % country % cpu % id;
62 
63 }
64 
65 #endif // COMMANDS_H
66