mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-19 14:53:56 -07:00
-Changes to notifications. They take different parameters now-see template_entity_script.js. You can choose to destroy the notifiers yourself in the script (useful for idle) -Added "idle" event with registerIdle and registerDamage to assist with the angle penalty. -Bar border stuff -Angle penalty is set up but untested-it just needs to use this.getAttackDirections() to find the number of directions the entity is being attacked from. The penalty is specified in template_unit There is a problem when the game exits-it attempts to destroy the notifiers in entity.cpp's constructor, where it calls DestroyAllNotifiers(). The problem is that the notifiers don't exist any longer because they've been destroyed. I would fix it but I'm leaving for vacation (Jason told me it was OK to comitt). Hope it isn't too much of a problem. This was SVN commit r3732.
44 lines
No EOL
1.2 KiB
C++
44 lines
No EOL
1.2 KiB
C++
//Andrew aka pyrolink
|
|
//ajdecker1022@msn.com
|
|
//This keeps track of all the formations exisisting in the game.
|
|
|
|
#include "ps/Singleton.h"
|
|
#include "BaseFormationCollection.h"
|
|
#include "scripting/DOMEvent.h"
|
|
|
|
#define g_FormationManager CFormationManager::GetSingleton()
|
|
|
|
class CEntity;
|
|
class CStr;
|
|
class CBaseFormation;
|
|
class CVector2D;
|
|
class CEntityFormation;
|
|
|
|
struct CEntityList;
|
|
|
|
class CFormationManager : public Singleton<CFormationManager>
|
|
{
|
|
#define FormIterator std::vector<CEntityFormation*>::iterator
|
|
|
|
public:
|
|
CFormationManager() {}
|
|
~CFormationManager();
|
|
void CreateFormation( CEntityList& entities, CStrW& name );
|
|
//entity is any unit in the formation
|
|
void DestroyFormation( size_t form );
|
|
inline bool IsValidFormation( int index )
|
|
{
|
|
return ((size_t)index < m_formations.size() && index >= 0);
|
|
}
|
|
bool AddUnit( CEntity*& entity, int& form );
|
|
CEntityList AddUnitList( CEntityList& entities, int form );
|
|
|
|
//Returns false if the formation is destroyed
|
|
bool RemoveUnit( CEntity*& entity );
|
|
bool RemoveUnitList( CEntityList& entities );
|
|
CEntityFormation* GetFormation(int form);
|
|
void UpdateIndexes( size_t update );
|
|
|
|
private:
|
|
std::vector<CEntityFormation*> m_formations;
|
|
}; |