2006-04-24 01:14:18 +02:00
|
|
|
//Andrew aka pyrolink
|
|
|
|
//ajdecker1022@msn.com
|
|
|
|
//Instances of this class contain the actual information about in-game formations.
|
2006-06-10 01:07:11 +02:00
|
|
|
//It is based off of Formation.cpp and uses it as a reference as to what can and cannot
|
2006-04-24 01:14:18 +02:00
|
|
|
//be done in this formation. This is represented as m_base.
|
|
|
|
|
|
|
|
#ifndef ENTITYFORMATION_INCLUDED
|
|
|
|
#define ENTITYFORMATION_INCLUDED
|
|
|
|
|
2006-06-02 05:56:24 +02:00
|
|
|
#include "ps/Vector2D.h"
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
class CVector2D;
|
|
|
|
class CEntity;
|
2006-06-09 20:32:00 +02:00
|
|
|
struct CEntityList;
|
2006-07-24 03:33:26 +02:00
|
|
|
class CClassSet;
|
2007-01-24 21:17:28 +01:00
|
|
|
class CFormation;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
class CEntityFormation
|
|
|
|
{
|
|
|
|
friend class CFormationManager;
|
|
|
|
public:
|
2006-06-10 01:07:11 +02:00
|
|
|
CEntityFormation( CFormation*& base, size_t index );
|
2006-04-24 01:14:18 +02:00
|
|
|
~CEntityFormation();
|
|
|
|
|
|
|
|
int GetEntityCount() { return m_numEntities; }
|
|
|
|
float GetSpeed() { return m_speed; }
|
2007-01-24 21:17:28 +01:00
|
|
|
int GetSlotCount();
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
CEntityList GetEntityList();
|
|
|
|
CVector2D GetSlotPosition( int order );
|
|
|
|
CVector2D GetPosition() { return m_position; }
|
2006-06-10 01:07:11 +02:00
|
|
|
CFormation* GetBase() { return m_base; }
|
2006-04-24 01:14:18 +02:00
|
|
|
void BaseToMovement();
|
|
|
|
|
|
|
|
void SelectAllUnits();
|
|
|
|
|
|
|
|
inline void SetDuplication( bool duplicate ) { m_duplication=duplicate; }
|
|
|
|
inline bool IsDuplication() { return m_duplication; }
|
|
|
|
inline void SetLock( bool lock ){ m_locked=lock; }
|
|
|
|
inline bool IsLocked() { return m_locked; }
|
2007-01-24 21:17:28 +01:00
|
|
|
inline bool IsValidOrder(int order) { return ( order >= 0 && order < GetSlotCount() ); }
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_numEntities;
|
|
|
|
int m_index;
|
|
|
|
float m_speed; //speed of slowest unit
|
|
|
|
float m_orientation; //Our orientation angle. Used for rotation.
|
|
|
|
CVector2D m_position;
|
|
|
|
|
|
|
|
bool m_locked;
|
|
|
|
//Prevents other selected units from reordering the formation after one has already done it.
|
|
|
|
bool m_duplication;
|
|
|
|
|
2006-06-10 01:07:11 +02:00
|
|
|
CFormation* m_base;
|
|
|
|
CFormation* m_self; //Keeps track of base (referred to during movement switching)
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
std::vector<CEntity*> m_entities; //number of units currently in this formation
|
|
|
|
std::vector<bool> m_angleDivs; //attack direction penalty-true=being attacked from sector
|
|
|
|
std::vector<float> m_angleVals;
|
|
|
|
|
|
|
|
bool AddUnit( CEntity*& entity );
|
|
|
|
void RemoveUnit( CEntity*& entity );
|
|
|
|
bool IsSlotAppropriate( int order, CEntity* entity ); //If empty, can we use this slot?
|
|
|
|
bool IsBetterUnit( int order, CEntity* entity );
|
|
|
|
|
|
|
|
void UpdateFormation();
|
2006-06-10 01:07:11 +02:00
|
|
|
void SwitchBase( CFormation*& base );
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
void ResetIndex( size_t index );
|
|
|
|
void ResetAllEntities(); //Sets all handles to invalid
|
|
|
|
void ResetAngleDivs();
|
|
|
|
};
|
|
|
|
#endif
|