1 /******************************************************************************
2  *  Warmux is a convivial mass murder game.
3  *  Copyright (C) 2001-2011 Warmux Team.
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18  ******************************************************************************
19  * Describes which left or right movement the user wants to do with a character.
20  *****************************************************************************/
21 
22 #ifndef _MOVE_INTENTION_H
23 #define _MOVE_INTENTION_H
24 
25 #include <WARMUX_types.h>
26 
27 template<typename T>
28 class MoveIntention
29 {
30   T direction;
31   bool slowly;
32 public:
MoveIntention(T direction,bool slowly)33   MoveIntention(T direction, bool slowly):
34     direction(direction),
35     slowly(slowly)
36   {
37     /* see initializer list */
38   }
GetDirection()39   T GetDirection() const { return direction; }
IsToDoItSlowly()40   bool IsToDoItSlowly() const { return slowly; }
41 };
42 
43 
44 typedef MoveIntention<LRDirection> LRMoveIntention;
45 typedef MoveIntention<UDDirection> UDMoveIntention;
46 
47 extern const LRMoveIntention * const INTENTION_MOVE_LEFT_SLOWLY;
48 extern const LRMoveIntention * const INTENTION_MOVE_LEFT;
49 extern const LRMoveIntention * const INTENTION_MOVE_RIGHT;
50 extern const LRMoveIntention * const INTENTION_MOVE_RIGHT_SLOWLY;
51 extern const UDMoveIntention * const INTENTION_MOVE_UP_SLOWLY;
52 extern const UDMoveIntention * const INTENTION_MOVE_UP;
53 extern const UDMoveIntention * const INTENTION_MOVE_DOWN;
54 extern const UDMoveIntention * const INTENTION_MOVE_DOWN_SLOWLY;
55 
56 
57 #endif
58