| 1 | /*************************************************************************** |
| 2 | movementmanager.h - description |
| 3 | ------------------- |
| 4 | begin : may 16th, 2004 |
| 5 | copyright : (C) 2004-2007 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: movementmanager.h 375 2008-10-28 14:47:15Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #ifndef _OPENCITY_MOVEMENTMANAGER_H_ |
| 21 | #define _OPENCITY_MOVEMENTMANAGER_H_ 1 |
| 22 | |
| 23 | #include "main.h" |
| 24 | |
| 25 | #define OC_MOVEMENT_MAX 100 |
| 26 | |
| 27 | |
| 28 | class Movement; |
| 29 | class GraphicManager; |
| 30 | class Map; |
| 31 | |
| 32 | |
| 33 | //======================================================================== |
| 34 | /** Offer a simple way to handle all the moving stuff |
| 35 | */ |
| 36 | class MovementManager { |
| 37 | public: |
| 38 | MovementManager( |
| 39 | const GraphicManager* gm, |
| 40 | const Map* map |
| 41 | ); |
| 42 | ~MovementManager(); |
| 43 | |
| 44 | const int Add( Movement* const pNew ); |
| 45 | |
| 46 | const bool IsFull(); |
| 47 | |
| 48 | |
| 49 | //======================================================================== |
| 50 | /** Explicitly remove the specified or all the movement object from the |
| 51 | manager. The removed objects are destroyed by calling "delete" on them. |
| 52 | */ |
| 53 | void Remove( const int ciIndex = -1 ); |
| 54 | |
| 55 | |
| 56 | //======================================================================== |
| 57 | /** Send the move order to the specified or all the movement object. |
| 58 | The object which can not move anymore is removed from the manager and |
| 59 | destroyed automatically by calling "delete" on it. |
| 60 | */ |
| 61 | void Move( const int ciIndex = -1 ); |
| 62 | |
| 63 | void Display( const int ciIndex = - 1 ); |
| 64 | |
| 65 | |
| 66 | private: |
| 67 | uint _uiCount; ///< The current number of elements |
| 68 | Movement* tabmvt [OC_MOVEMENT_MAX]; |
| 69 | const GraphicManager* pcGraphicMgr; |
| 70 | const Map* pcMap; |
| 71 | }; |
| 72 | #endif |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 |