Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vsnet_cmd.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  */
16 
17 #include "vsnet_cmd.h"
18 
19 std::ostream&operator<<( std::ostream &ostr, Cmd cmd )
20 {
21  ostr<<displayCmd( cmd );
22  return ostr;
23 }
24 
25 #define CASE( a ) \
26 case a: \
27  return #a; break;
28 
29 const char * displayCmd( Cmd cmd )
30 {
31  switch (cmd)
32  {
33  CASE( CMD_LOGIN )
34  CASE( CMD_LOGOUT )
37  CASE( CMD_PING )
40 
43  CASE( LOGIN_ERROR )
45  CASE( LOGIN_DATA )
47  CASE( LOGIN_NEW )
48  CASE( CMD_RESPAWN )
51 
54  CASE( CMD_CREDITS )
57  CASE( CMD_TARGET )
58  CASE( CMD_SCAN )
59  CASE( CMD_DAMAGE )
61  CASE( CMD_KILL )
62  CASE( CMD_JUMP )
63  CASE( CMD_ASKFILE )
71  CASE( CMD_DOCK )
72  CASE( CMD_UNDOCK )
73 
75 
80  CASE( CMD_CONNECT )
82 
84  CASE( CMD_MISSION )
85  CASE( CMD_CUSTOM )
87  CASE( CMD_COMM )
88  //CASE( CMD_ACK )
89  default:
90  return "CMD_UNKNOWN";
91 
92  break;
93  }
94 }
95 
96 #undef CASE
97