m_sectorValues should be per-entity, not a property of BaseEntity.
This was SVN commit r4084.
This commit is contained in:
parent
ca4a4613f1
commit
bd3a188cf9
@ -84,9 +84,6 @@ CBaseEntity::CBaseEntity( CPlayer* player )
|
||||
m_socket = CStrW();
|
||||
m_passThroughAllies = false;
|
||||
m_sectorDivs = 4;
|
||||
m_sectorValues.resize(m_sectorDivs);
|
||||
for ( int i=0; i<m_sectorDivs; ++i )
|
||||
m_sectorValues[i] = false;
|
||||
|
||||
// Sentinel values for stamina and health (so scripts can check if an entity has no stamina or no HP).
|
||||
m_speed=0;
|
||||
|
@ -128,7 +128,6 @@ public:
|
||||
SEntityAction m_run;
|
||||
SEntityAction m_generic;
|
||||
|
||||
std::vector<bool> m_sectorValues;
|
||||
int m_sectorDivs;
|
||||
int m_pitchDivs;
|
||||
float m_anchorConformX;
|
||||
|
@ -251,6 +251,11 @@ void CEntity::loadBase()
|
||||
{
|
||||
(*it)->Remove( this );
|
||||
}
|
||||
|
||||
// Resize sectors array
|
||||
m_sectorValues.resize(m_base->m_sectorDivs);
|
||||
for ( int i=0; i<m_base->m_sectorDivs; ++i )
|
||||
m_sectorValues[i] = false;
|
||||
}
|
||||
|
||||
void CEntity::initAttributes(const CEntity* _this)
|
||||
@ -2183,7 +2188,7 @@ jsval CEntity::RegisterDamage( JSContext* cx, uintN argc, jsval* argv )
|
||||
float angle = acosf( up.dot(posDelta) );
|
||||
//Find what section it is between and "activate" it
|
||||
int sector = findSector(m_base->m_sectorDivs, angle, DEGTORAD(360.0f))-1;
|
||||
m_base->m_sectorValues[sector]=true;
|
||||
m_sectorValues[sector]=true;
|
||||
return JS_TRUE;
|
||||
}
|
||||
jsval CEntity::RegisterOrderChange( JSContext* cx, uintN argc, jsval* argv )
|
||||
@ -2202,14 +2207,14 @@ jsval CEntity::RegisterOrderChange( JSContext* cx, uintN argc, jsval* argv )
|
||||
float angle = acosf( up.dot(posDelta) );
|
||||
//Find what section it is between and "deactivate" it
|
||||
int sector = MAX( 0.0, findSector(m_base->m_sectorDivs, angle, DEGTORAD(360.0f)) );
|
||||
m_base->m_sectorValues[sector]=false;
|
||||
m_sectorValues[sector]=false;
|
||||
return JS_TRUE;
|
||||
}
|
||||
jsval CEntity::GetAttackDirections( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) )
|
||||
{
|
||||
int directions=0;
|
||||
|
||||
for ( std::vector<bool>::iterator it=m_base->m_sectorValues.begin(); it != m_base->m_sectorValues.end(); it++ )
|
||||
for ( std::vector<bool>::iterator it=m_sectorValues.begin(); it != m_sectorValues.end(); it++ )
|
||||
{
|
||||
if ( *it )
|
||||
++directions;
|
||||
|
@ -234,9 +234,10 @@ public:
|
||||
int m_currentNotification; //Current order in the form of a notification code
|
||||
int m_currentRequest; //Notification we our notifiers are sending
|
||||
|
||||
std::vector<bool> m_sectorValues;
|
||||
|
||||
/* JW: these have all been 'moved' (1) into BaseEntity:
|
||||
1: were already present there, just removed from here
|
||||
std::vector<bool> m_sectorValues;
|
||||
int m_sectorDivs;
|
||||
|
||||
int m_pitchDivs;
|
||||
|
Loading…
Reference in New Issue
Block a user