0ad/source/simulation/BaseFormation.h
pyrolink f2e867e239 #Bar borders and angle penalty
-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.
2006-04-08 22:34:54 +00:00

79 lines
No EOL
1.8 KiB
C++

//Andrew aka pyrolink
//ajdecker1022@msn.com
//This class loads all the formation data needs to create an instance of a particular formation.
#ifndef BASEFORMATION_INCLUDED
#define BASEFORMATION_INCLUDED
#include <vector>
#include <map>
#include "XML/Xeromyces.h"
class CStr;
class CBaseFormation
{
friend class CFormationManager;
friend class CBaseFormationCollection;
friend class CEntityFormation;
struct FormationSlot
{
float fileOff; //Distance between files of this slot and the formation's center
float rankOff;
std::vector<CStr> category;
};
public:
CBaseFormation();
~CBaseFormation(){}
CStr GetBonus(){ return m_bonus; }
CStr GetBonusType(){ return m_bonusType; }
float GetBonusVal(){ return m_bonusVal; }
CStr GetPenalty(){ return m_penalty; }
CStr GetPenaltyType(){ return m_penaltyType; }
float GetPenaltyVal(){ return m_penaltyVal; }
CStr GetAnglePenalty(){ return m_anglePenalty; }
CStr GetAnglePenaltyType(){ return m_anglePenaltyType; }
int GetAnglePenaltyDivs(){ return m_anglePenaltyDivs; }
float GetAnglePenaltyVal(){ return m_anglePenaltyVal; }
private:
CStr m_tag;
CStr m_bonus;
CStr m_bonusType;
float m_bonusVal;
CStr m_penalty;
CStr m_penaltyType;
float m_penaltyVal;
CStr m_anglePenalty;
int m_anglePenaltyDivs;
CStr m_anglePenaltyType;
float m_anglePenaltyVal;
int m_required;
CStr m_next;
CStr m_prior;
CStr m_movement;
float m_fileSpacing;
float m_rankSpacing;
int m_numSlots; //how many possible slots in this formation
int m_numRanks;
int m_numFiles;
//The key is the "order" of the slot
std::map<int, FormationSlot> m_slots;
std::vector<float> m_angleValues; //cosine of angle divisions
bool loadXML(CStr filename);
void AssignCategory(int order, CStr category); //takes care of formatting strings
};
#endif