1 /*=============================================================================
2 Blobby Volley 2
3 Copyright (C) 2006 Jonathan Sieber (jonathan_sieber@yahoo.de)
4 Copyright (C) 2006 Daniel Knobe (daniel-knobe@web.de)
5 
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 =============================================================================*/
20 
21 /* header include */
22 #include "InputSource.h"
23 
24 /* includes */
25 #include <cassert>
26 
27 /* implementation */
28 
29 /* InputSource */
30 
InputSource()31 InputSource::InputSource() : mInput(), mMatch(0)
32 {
33 }
34 
~InputSource()35 InputSource::~InputSource()
36 {
37 }
38 
getInput() const39 PlayerInput InputSource::getInput() const
40 {
41 	return mInput.toPlayerInput( this->getMatch() );;
42 }
43 
updateInput()44 PlayerInput InputSource::updateInput()
45 {
46 	mInput = getNextInput();
47 	return getInput();
48 }
49 
setInput(PlayerInput ip)50 void InputSource::setInput(PlayerInput ip)
51 {
52 	mInput = PlayerInputAbs(ip.left, ip.right, ip.up);
53 }
54 
setInput(PlayerInputAbs ip)55 void InputSource::setInput(PlayerInputAbs ip)
56 {
57 	mInput = ip;
58 }
59 
60 
getRealInput() const61 PlayerInputAbs InputSource::getRealInput() const
62 {
63 	return mInput;
64 }
65 
getNextInput()66 PlayerInputAbs InputSource::getNextInput()
67 {
68 	return mInput;
69 }
70 
getMatch() const71 const DuelMatch* InputSource::getMatch() const
72 {
73 	return mMatch;
74 }
75 
setMatch(const DuelMatch * match)76 void InputSource::setMatch(const DuelMatch* match)
77 {
78 	assert(mMatch == 0);
79 	mMatch = match;
80 }
81 
82