Planeshift
psattackqueue.h
Go to the documentation of this file.
1  /*
2  * psattackqueue.cpp creator hartra344@gmail.com
3  *
4  * Copyright (C) 2001-2011 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
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  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef psAttackQueue_HEADER
20 #define psAttackQueue_HEADER
21 
22 
23 //====================================================================================
24 // Crystal Space Includes
25 //====================================================================================
26 #include <csutil/csstring.h>
27 #include <csutil/list.h>
28 
29 //====================================================================================
30 // Project Includes
31 //====================================================================================
32 #include <idal.h>
33 #include "psattack.h"
34 
41 class psAttackQueue : public csRefCount
42 {
43 public:
44 
45  /*
46  * Constructor
47  */
48  psAttackQueue(psCharacter* pschar);
49 
50  /*
51  * Pushes attack into the last slot of the queue.
52  * @param attack the attack to push into the last slot of the queue
53  */
54  bool Push(psAttack* attack);
55 
56  /*
57  * Removes the first slot in the queue.
58  */
59  bool Pop();
60 
61  /*
62  * Returns the first slot in the queue without removing it.
63  */
64  psAttack* First();
65 
66  /*
67  * Discards all items in the queue.
68  */
69  void Purge();
70 
71  /*
72  * Returns the list of special attacks in the queue.
73  */
74  csList< csRef<psAttack> >& getAttackList();
75 
76  /*
77  * Returns the number of special attacks in the queue.
78  */
79  size_t getAttackListCount();
80 
81 private:
82  csList< csRef<psAttack> > attackList;
83  psCharacter* character;
84 };
85 #endif
bool Push(psAttack *attack)
A queue to hold attacks in order of execution.
Definition: psattackqueue.h:41
psAttack * First()
Represents an Attack.
Definition: psattack.h:82
psAttackQueue(psCharacter *pschar)
csList< csRef< psAttack > > & getAttackList()
size_t getAttackListCount()