Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
enums.cpp
1
2
/***************************************************************************
3
* enums.cpp - World Info Transceiver Enums
4
*
5
* Created: Wed Apr 09 17:05:15 2008
6
* Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <netcomm/worldinfo/enums.h>
25
26
#define CASE_STRING(x) case x: return #x
27
28
namespace
fawkes {
29
30
/** Convert MSL gamestate to a string.
31
* @param gamestate game state to translate into a string
32
* @return string representation of the given state.
33
*/
34
const
char
*
35
worldinfo_msl_gamestate_tostring
(
worldinfo_msl_gamestate_t
gamestate)
36
{
37
switch
(gamestate) {
38
CASE_STRING(
GS_FROZEN
);
39
CASE_STRING(
GS_PLAY
);
40
CASE_STRING(
GS_KICK_OFF
);
41
CASE_STRING(
GS_DROP_BALL
);
42
CASE_STRING(
GS_PENALTY
);
43
CASE_STRING(
GS_CORNER_KICK
);
44
CASE_STRING(
GS_THROW_IN
);
45
CASE_STRING(
GS_FREE_KICK
);
46
CASE_STRING(
GS_GOAL_KICK
);
47
CASE_STRING(
GS_HALF_TIME
);
48
default
:
return
"Unknown MSL Gamestate"
;
49
}
50
}
51
52
/** Convert MSL gamestate to a string.
53
* @param gamestate game state to translate into a string
54
* @return string representation of the given state.
55
*/
56
const
char
*
57
worldinfo_spl_gamestate_tostring
(
worldinfo_spl_gamestate_t
gamestate)
58
{
59
switch
(gamestate) {
60
CASE_STRING(
GS_SPL_INITIAL
);
61
CASE_STRING(
GS_SPL_READY
);
62
CASE_STRING(
GS_SPL_SET
);
63
CASE_STRING(
GS_SPL_PLAY
);
64
CASE_STRING(
GS_SPL_FINISHED
);
65
default
:
return
"Unknown SPL Gamestate"
;
66
}
67
}
68
69
70
/** Convert gamestate team to a string.
71
* @param team game state team to translate into a string
72
* @return string representation of the given team.
73
*/
74
const
char
*
75
worldinfo_gamestate_team_tostring
(
worldinfo_gamestate_team_t
team)
76
{
77
switch
(team) {
78
CASE_STRING(
TEAM_CYAN
);
79
CASE_STRING(
TEAM_MAGENTA
);
80
CASE_STRING(
TEAM_NONE
);
81
CASE_STRING(
TEAM_BOTH
);
82
default
:
return
"Unknown Team"
;
83
}
84
}
85
86
87
/** Convert goal color to a string.
88
* @param goal_color goal color
89
* @return string representation of the given goal color.
90
*/
91
const
char
*
92
worldinfo_gamestate_goalcolor_tostring
(
worldinfo_gamestate_goalcolor_t
goal_color)
93
{
94
switch
(goal_color) {
95
CASE_STRING(
GOAL_BLUE
);
96
CASE_STRING(
GOAL_YELLOW
);
97
default
:
return
"Unknown Goal Color"
;
98
}
99
100
}
101
102
103
/** Convert half time to a string.
104
* @param half half time
105
* @return string representation of the given half time.
106
*/
107
const
char
*
108
worldinfo_gamestate_half_tostring
(
worldinfo_gamestate_half_t
half)
109
{
110
switch
(half) {
111
CASE_STRING(
HALF_FIRST
);
112
CASE_STRING(
HALF_SECOND
);
113
default
:
return
"Unknown Half"
;
114
}
115
}
116
117
118
/** Convert penalty to a string.
119
* @param penalty penalty to translate into a string
120
* @return string representation of the penalty
121
*/
122
const
char
*
123
worldinfo_penalty_tostring
(
worldinfo_penalty_t
penalty)
124
{
125
switch
(penalty) {
126
CASE_STRING(
PENALTY_NONE
);
127
CASE_STRING(
PENALTY_BALL_HOLDING
);
128
CASE_STRING(
PENALTY_GOALIE_PUSHING
);
129
CASE_STRING(
PENALTY_PLAYER_PUSHING
);
130
CASE_STRING(
PENALTY_ILLEGAL_DEFENDER
);
131
CASE_STRING(
PENALTY_ILLEGAL_DEFENSE
);
132
CASE_STRING(
PENALTY_OBSTRUCTION
);
133
CASE_STRING(
PENALTY_REQ_FOR_PICKUP
);
134
CASE_STRING(
PENALTY_LEAVING
);
135
CASE_STRING(
PENALTY_DAMAGE
);
136
CASE_STRING(
PENALTY_MANUAL
);
137
default
:
return
"Unknown Penalty"
;
138
}
139
}
140
141
}
// end namespace fawkes
src
libs
netcomm
worldinfo
enums.cpp
Generated by
1.8.1.1