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 * Base class for objects which can be moved by the user. 20 *****************************************************************************/ 21 22 #ifndef MOVABLE_BY_USER_H 23 #define MOVABLE_BY_USER_H 24 25 #include <list> 26 #include "interface/move_intention.h" 27 28 class MovableByUser 29 { 30 protected: 31 std::list<const LRMoveIntention *> lr_move_intentions; 32 std::list<const UDMoveIntention *> ud_move_intentions; 33 public: GetLastLRMoveIntention()34 const LRMoveIntention * GetLastLRMoveIntention() const 35 { 36 return (lr_move_intentions.empty()) ? NULL : lr_move_intentions.back(); 37 } AddLRMoveIntention(const LRMoveIntention * intention)38 void AddLRMoveIntention(const LRMoveIntention * intention) 39 { 40 lr_move_intentions.push_back(intention); 41 } RemoveLRMoveIntention(const LRMoveIntention * intention)42 void RemoveLRMoveIntention(const LRMoveIntention * intention) 43 { 44 lr_move_intentions.remove(intention); 45 } 46 GetLastUDMoveIntention()47 const UDMoveIntention * GetLastUDMoveIntention() const 48 { 49 return (ud_move_intentions.empty()) ? NULL : ud_move_intentions.back(); 50 } AddUDMoveIntention(const UDMoveIntention * intention)51 void AddUDMoveIntention(const UDMoveIntention * intention) 52 { 53 ud_move_intentions.push_back(intention); 54 } RemoveUDMoveIntention(const UDMoveIntention * intention)55 void RemoveUDMoveIntention(const UDMoveIntention * intention) 56 { 57 ud_move_intentions.remove(intention); 58 } 59 }; 60 61 #endif 62