Пример #1
0
/* Delete Nth Node from list */
void DeleteNodeNth(Node **top, int n) {
    // ここに解答を書き加える
    // nが1ならはじめの要素を消す
    if (n == 1) {
        DeleteNode(top);
        return;
    }
    Node *ptr = *top;
    int count = 1;
    while (ptr->next != NULL) {
        ptr = ptr->next;
        count++;
    }
    // nが要素数より大きい時
    if (n > count)
        return;

    if (ptr == NULL)
        return;

    ptr = *top;

    Node backup = *ptr;
    Node temp;
    int i;
    for (i = 0; i < n - 1; i++) {
        ptr = ptr->next;

        SetNode(&temp, ptr->no, ptr->name, NULL);
        SetNode(ptr, backup.no, backup.name, ptr->next);
        SetNode(&backup, temp.no, temp.name, NULL);
    }

    DeleteNode(top);
}
Пример #2
0
BOOL CCustomXpdl::UploadFileAndReplacePath()
{
	for ( map< CString, CXpdlNode* >::iterator Iter = m_mapNode.begin(); Iter != m_mapNode.end(); Iter++ )
	{
		if ( Iter->second->m_dwNodeType >= CXpdl::XPDL_NODE_COMPONENTNODE || Iter->second->m_dwNodeType >= CXpdl::XPDL_NODE_SUBFLOWNODE || Iter->second->m_dwNodeType >= CXpdl::XPDL_NODE_ROOT )
		{
			CXpdlNode* pNode = (CXpdlNode *)Iter->second;

			if ( !pNode->m_sPaths.IsEmpty() )
			{
				pNode->m_sPaths = UploadFileToDMS(pNode->m_sPaths);
			}
			if ( !pNode->m_sPrePaths.IsEmpty() )
			{
				pNode->m_sPrePaths = UploadFileToDMS(pNode->m_sPrePaths);
			}
			if ( !pNode->m_sPostPaths.IsEmpty() )
			{
				pNode->m_sPostPaths = UploadFileToDMS(pNode->m_sPostPaths);
			}
			if ( pNode->m_dwNodeType == CXpdl::XPDL_NODE_COMPONENTNODE )
			{
				CXpdlNodeComponent* pComponent = (CXpdlNodeComponent*)pNode;
				CString sManifest = pComponent->m_cManifestPath;
				if ( !sManifest.IsEmpty() )
				{
					sManifest = UploadFileToDMS(sManifest);
					StringCbCopy( pComponent->m_cManifestPath, MAX_PATH*2, sManifest );
				}
			}

			if ( !SetNode( pNode ) ) return FALSE;
		}
	}

	for ( map< CString, CXpdlNode* >::iterator It = m_mapParam.begin(); It != m_mapParam.end(); It++ )
	{
		CXpdlNodeParam* pNode = ( CXpdlNodeParam* )It->second;

		if ( pNode->m_sDataType == "REFERENCE" && !pNode->m_sValue.IsEmpty() )
		{
			pNode->m_sValue = UploadParamFileToDMS(pNode->m_sValue);

			if ( !SetNode( pNode ) ) return FALSE;
		}
	}
	return TRUE;
}
Пример #3
0
void MGADSMTrajectory::SetNodes(int n, const std::vector<TrajectoryNodePtr>& nodes)
{
   OTL_ASSERT(n >= 0, "Invalid node index");
   for (std::size_t i = 0; i < nodes.size(); ++i)
   {
      SetNode(n + i, nodes[i]);
   }
}
Пример #4
0
int main(void) {
    Queue  que;
    char op[5];
                
    QueueInit(&que); /* キューの初期化 */
    //キューの中身を確認
    if(!QueueIsEmpty(&que)){
        printf("初期化失敗\n");
        return (-1);
    }

    while (1) {
        int  m, no;
        char name[NAMELEN];
        Node *data;

        printf("Operation:");
        printf("(1)データの追加(enqueue),(2)データの削除(dequeue), (0) 終了:");
        scanf("%s", op);

        m=atoi(op);

        if (m == 0)
            break;

        switch(m) {
            case 1: data = AllocNode();
                printf("追加するデータを入力してください。\n");
                printf("番号:");scanf("%d", &no);
                printf("名前:");scanf("%s", name);
                SetNode(data,no,name,NULL);
                QueueEnque(&que, data);

                //キューの中身を確認
                if(QueueIsEmpty(&que)){
                    printf("エンキュー失敗\n");
                    return (-1);
                }
                break;    
            case 2: if(data = QueueDeque(&que)) {
                        puts("デキューしたデータ:");
                        printf("番号:%d,名前:%s\n", data->no, data->name);
 //                           free(data);
                        }
                    else {
                        puts("デキューできません。");
                    }
                    break;
        }
        printf("キューの一覧<%d>:\n", QueueNo(&que));
        PrintQueue(&que);
    }

    QueueFree(&que);

    return(0);

}
Пример #5
0
/* Insert Nth Node to list */
void InsertNodeNth(Node **top, int n, int no, char *name) {
    // ここに解答を書き加える
    Node *ptr = *top;

    // n = 1では必ずInsertNode
    if (n == 1) {
        InsertNode(top, no, name);
        return;
    }

    int i;
    // ptr(カーソル)をnまで移動
    for (i = 0; i < n - 1; i++) {
        ptr = ptr->next;

        // 3つしかないリストにn=8など無茶されたとき
        if (ptr == NULL)
            return;

    }

    // バックアップ的なもの
    Node backup = *ptr;

    // ここでn個目に追加する
    SetNode(ptr, no, name, ptr->next);

    // 残った要素を1つずつずらす
    // backupとリストの中の要素を交換するためのtemp
    Node temp;
    while (ptr->next != NULL) {
        ptr = ptr->next;
//printf("address of ptr: %p\n", ptr);
//printf("*ptr->no: %d\n", ptr->no);

        SetNode(&temp, ptr->no, ptr->name, NULL);
        SetNode(ptr, backup.no, backup.name, ptr->next);
        SetNode(&backup, temp.no, temp.name, NULL);

    }

    // 要素がひとつ増えるのでAppend
    AppendNode(top, backup.no, backup.name);
}
Пример #6
0
unsigned Cylindrical2dMesh::AddNode(Node<2>* pNewNode)
{
    unsigned node_index = MutableMesh<2,2>::AddNode(pNewNode);

    // If necessary move it to be back on the cylinder
    ChastePoint<2> new_node_point = pNewNode->GetPoint();
    SetNode(node_index, new_node_point, false);

    return node_index;
}
void	MorphByBone::fnSetExternalNode(INode *node, const TCHAR *name,INode *exnode)
{
		int whichBone = this->GetBoneIndex(node); 
		int whichMorph = this->GetMorphIndex(node,name);
		SetNode(exnode,whichBone,whichMorph);
		NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
		GetCOREInterface()->RedrawViews(GetCOREInterface()->GetTime());
		UpdateLocalUI();

}
Пример #8
0
Projectile::Projectile(Node *pNode)
{
	Node *pNewNode			= new Node();
	pNewNode->SetVisual(pNode->GetVisual());
	pNewNode->m_vScale.x	= pNode->m_vScale.x;
	pNewNode->m_vScale.y	= pNode->m_vScale.y;
	pNewNode->m_vScale.z	= pNode->m_vScale.z;
	SetNode(pNewNode);
	pNewNode->Release();

	Init();
}
Пример #9
0
rc_t CC KMain(int argc, char* argv[]) {
    rc_t rc = 0;

    Params prm;
    KConfig* cfg = NULL;

    if (rc == 0)
    {   rc = ParamsConstruct(argc, argv, &prm); }

    if (rc == 0) {
        rc = KConfigMake(&cfg, NULL);
        DISP_RC(rc, "while calling KConfigMake");
    }

    if (rc == 0) {
        if (prm.modeSetNode)
        {   rc = SetNode(cfg, &prm); }
        if (prm.modeShowCfg)
        {   rc = ShowConfig(cfg, &prm); }
        if (prm.modeShowFiles) {
            rc_t rc3 = ShowFiles(cfg, &prm);
            if (rc3 != 0 && rc == 0)
            {   rc = rc3; }
        }
        if (prm.modeShowModules) {
            rc_t rc3 = ShowModules(cfg, &prm);
            if (rc3 != 0 && rc == 0)
            {   rc = rc3; }
        }
        if (prm.modeShowLoadPath) {
            const char* path = NULL;
            rc_t rc3 = KConfigGetLoadPath(cfg, &path);
            if (rc3 == 0) {
                if (path != NULL && path[0])
                {   OUTMSG(("%s\n", path)); }
            }
            else if (rc == 0)
            {   rc = rc3; }
        }
    }

    if (prm.modeShowEnv)
    {   ShowEnv(&prm); }

    RELEASE(KConfig, cfg);

    if (rc == 0 && prm.modeCreate)
    {   rc = CreateConfig(argv[0]); }

    ParamsDestruct(&prm);
    return rc;
}
Пример #10
0
void InsertRear(List *list, Data x)
{
  if (list->head == NULL){
    InsertFront(list, x);
  }else{
    Node *ptr = list->head;
    while (ptr->next != NULL){
      ptr = ptr->next;
    }
    ptr->next = list->crnt = AllocNode();
    SetNode(ptr->next, x, NULL);
  }
}
Пример #11
0
void Background::Init()
{
	SetObjectType(Object::eTYPE_BACKGROUND);

	m_pGameCamera			= 0;
	m_bRecalculate			= false;
	m_fScrollSpeed			= 5.75f;

	//setup background node
	BackgroundNode *pNode	= new BackgroundNode();
	pNode->SetVisual("data\\visuals\\test_background.3ds");
	SetNode(pNode);
	pNode->Release();
}
Пример #12
0
_tstring CXmlConfig::GetAttributeValue(const TCHAR* attributeName,const TCHAR* attributeDefaultValue,bool* pResult){
	
	LockToRead();
	xml_node<TCHAR>* node = FindChild(attributeName);
	bool bNodeExists = node? true:false;
	if(pResult)
		(*pResult) = bNodeExists;
	_tstring strRetValue = bNodeExists? DECODE(node->value()):attributeDefaultValue;
	UnLock();

	if(!bNodeExists)
		SetNode(attributeName,attributeDefaultValue);

	return strRetValue;
}
Пример #13
0
void Projectile::Init()
{
	SetPhysicalObjectType(PhysicalObject::ePROJECTILE);

	m_pCreator			= 0;
	m_pWeapon			= 0;

	if (!GetNode())
	{ //set some default node if none exists...
		Node *pNode			= new Node();
		pNode->SetVisual("data\\visuals\\laser.3ds");
		pNode->m_vScale.x	= 0.5f;
		pNode->m_vScale.y	= 0.5f;
		pNode->m_vScale.z	= 0.5f;
		SetNode(pNode);
		pNode->Release();
	}
}
Пример #14
0
void Weapon::Init()
{
	m_fAcceleration			= 0.0f;
	float fCooldown			= 45.0f / 1000.0f;
	SetCooldown(fCooldown);
	m_fSpeed				= 17.0f;
	m_fFiringSpread			= PI / 16.0f;

	m_Damage.m_fEnergyDamage	= 0.0f;
	m_Damage.m_fPhysicalDamage	= 1.0f;

	Node *pNode			= new Node();
	switch (GenerateRandomInt(3))
	{
		case 0:
			pNode->SetVisual("data\\visuals\\p_blue.3ds");
			pNode->m_vScale.x	= 0.20f;
			pNode->m_vScale.y	= 0.20f;
			pNode->m_vScale.z	= 0.20f;
			break;
		case 1:
			pNode->SetVisual("data\\visuals\\p_green.3ds");
			pNode->m_vScale.x	= 0.25f;
			pNode->m_vScale.y	= 0.25f;
			pNode->m_vScale.z	= 0.25f;
			break;
		case 2:
			pNode->SetVisual("data\\visuals\\p_orng.3ds");
			pNode->m_vScale.x	= 0.30f;
			pNode->m_vScale.y	= 0.30f;
			pNode->m_vScale.z	= 0.30f;
			break;
		case 3:
			pNode->SetVisual("data\\visuals\\p_red.3ds");
			pNode->m_vScale.x	= 0.15f;
			pNode->m_vScale.y	= 0.15f;
			pNode->m_vScale.z	= 0.15f;
			break;

	}

	SetNode(pNode);
	pNode->Release();
}
Пример #15
0
/*--- キューにデータをエンキュー ---*/
int QueueEnque(Queue *q, Node *x) {

    if(q->front == NULL) {
        q->front = x;
        q->rear = x;
    }
    else {
 //       Node *ptr = q->front;
 //       while(q->rear != ptr->next) {
 //           ptr = ptr->next;
 //       }
      
        Node *ptr = q->rear;   // jump to last pointer
        SetNode(ptr, ptr->no, ptr->name, x);
        q->rear = x;
    }
    q->num++;
    return(0);

}
Пример #16
0
void GPath::FindTile(GNode* gnode, int x, int y, int dir) {
  if(TileInBounds(x, y)) {
    //check whether we already have it
    GNode* node = GetNode(x, y);
    if (NULL == node) {     
      int type = GetTileType(x, y);
      if (!IsWrongType(type)) {
	GNode* node = new GNode(x, y);
	node->SetParent(gnode);
	node->CalcF(DestX, DestY, dir);
  	App->Log << "**********\n";
  	App->Log << "Open tile:\n";
	App->Log << "x: " << node->GetX();
	App->Log << " y: " << node->GetY();
	App->Log << " G: " << node->GetG();
	App->Log << " H: " << node->GetH();
	App->Log << " F: " << node->GetF() << std::endl;
	SetNode(node);
	Open.push(node);
      }
    } // null == node
    else if (node->IsOpen()) {      
      //check if this path is better
      int pts;
      if (DIR_HV == dir) 
	pts = PTS_HV;
      else
	pts = PTS_DIAG; 

      if (gnode->GetG() + pts < node->GetG()) {
	node->SetParent(gnode);
	node->CalcF(DestX, DestY, dir);	
      }	
    } //IsOpen()
  } // in bounds
}
Пример #17
0
void CJsonNode::SetNumber(const string& key, CJsonNode::TNumber value)
{
    SetNode(key, new SJsonFixedSizeNodeImpl(value));
}
Пример #18
0
void CJsonNode::SetString(const string& key, const string& value)
{
    SetNode(key, new SJsonStringNodeImpl(value));
}
Пример #19
0
xml_node<TCHAR>* CXmlConfig::SetAttribute(const TCHAR* attributeName,const TCHAR* attributeValue){
	return SetNode(attributeName,attributeValue);
}
Пример #20
0
void InsertFront(List *list, Data x)
{
  Node *ptr = list->head;
  list->head = list->crnt = AllocNode();
  SetNode(list->head, x, ptr);
}
Пример #21
0
Shield::Shield(Node *pNode)
{
	Init();

	SetNode(pNode);
}
Пример #22
0
Shield::~Shield()
{
	SetNode(0);
}
Пример #23
0
bool GPath::FindPath(int sx, int sy, int destx, int desty) {
  Path.clear();
  App->Log << "Pathfinding session started" << std::endl;
  App->Log << "sx : " << sx << std::endl;
  App->Log << "sy : " << sy << std::endl;
  App->Log << "destx : " << destx << std::endl;
  App->Log << "desty : " << desty << std::endl;
  DestX = destx; 
  DestY = desty;
  GetAreaBounds();

  if (destx == sx && desty == sy) //path found
    return true;  

  for(int y = 0; y < MaxY; y++) {
    for(int x = 0; x < MaxX; x++) {
      Nodes.push_back(NULL);      
    }
  }

  //App->Log << "Empty nodes ready\n";
      
  GNode* start = new GNode(sx, sy);  
  GNode* end = NULL;
  int type = GetTileType(sx, sy);
  start->SetType(type);
  start->CalcPoints();
  SetNode(start);
  Open.push(start);

  // App->Log << "start->GetX(): " << start->GetX() << std::endl;
  // App->Log << "start->GetY(): " << start->GetY() << std::endl;
  // App->Log << "Open.top(): " << Open.top() << std::endl;
  // App->Log << "Nodes.size(): " << Nodes.size() << std::endl;
  // App->Log << "Open.empty(): " << Open.empty() << std::endl;

  bool found = false;
 
  while (!Open.empty()) {
    //take the node with lowest F value
    GNode* node = Open.top();   
    
    //remove from open list
    node->Close();
    Open.pop();

    
    
    App->Log << "||||Chosen one X: " << node->GetX() << " Y: " << node->GetY() << std::endl;
    App->Log << "--------------------\n";
   
    
    if (node->GetX() == DestX &&
	node->GetY() == DestY) {
      // App->Log << "found\n";
      found = true;
      end = node;
      // break; doesn't work here, damn it!
      while (!Open.empty()) Open.pop();
    }
    
    if (!found)
      FindAdjacent(node);
  }
  
  if (found) {
    GNode* node = end;
    GPoint point;
    point.x = node->GetX();
    point.y = node->GetY();
    // App->Log << "point.x: " << point.x << std::endl;
    // App->Log << "point.y: " << point.y << std::endl;
    Path.push_back(point);
    while (true) {
      GPoint point;
      GNode* parent = node->GetParent();

      if (NULL == parent) {
	
	break;
      }

      if (*parent == *start)
	break;

      point.x = parent->GetX();
      point.y = parent->GetY();
      // App->Log << "point.x: " << point.x << std::endl;
      // App->Log << "point.y: " << point.y << std::endl;
      Path.push_back(point);
     
      //App->Log << "Parent: " << parent << std::endl;   
      node = node->GetParent();   
      //App->Log << "new node: " << node << std::endl;   
      
    }   
    // App->Log << "X:\n"; 
    // std::vector<GPoint>::iterator it = Path.begin();
    // while (it != Path.end()) {
    //   App->Log << "X: " << it->x << std::endl;
    //   App->Log << "Y: " << it->y << std::endl;
    //   it++;
    // }
    App->Log << "done\n";
    
  }
  
  Cleanup();
  
  return found;
}
// creates nodes, this is called automatically when we need to go a node deeper
void HydraOctree::CreateNode(std::vector<BaseGameEntity*>& entities,int numEntities,DragonXVector3& center, real diameter)
{
	m_vCenter=center;
	m_rDiameter=diameter;

	//now for some important notes on recursion
	// one it means it calls itself
	// this is great for automated type stuff makes our lives easier
	// only one minor issue it usually doesn't know anything about the outside world or what we tell it and passing in a limit might get messy
	// so the hydra solution is a static variable the current node level tells the tree where it is as far as levels
	// now that is not its limit however
	int iMaxNodes = 50;
	// that is change it for different results
	// ill experiment around with it but that is where we set the number of levels
	// for examples sake 1 is 8 subdivisions of the original entities list 2 is 64 yes its a lot but that just means a lot less checks in
	// collision detection which those can get fairly cpu intensive even with just sphere sphere
	// now to avoid unnecessary recursion we need  a certain number of objects to exist before the system will bother with recursion
	// that number is set below
	int iMinNumberOfObjects = 64;//64 gives me a decent frame rate with friction and looks smoothest

	// now lets see what we are going to do
	if((numEntities<iMinNumberOfObjects)||(g_iCurrentNodeLevel >= iMaxNodes))//if its a node
	{
		SetNode(entities,numEntities);
		m_bIsNode=true;
	}
	else//not a node its a leaf or branch or head of hydra point is it holds more data
	{
		//oh umm this is where we sorta sort the entities just telling ya
		m_bIsNode=false;//obviously not a node its a leaf or whatever you wanna call it
		// ok now this is the clever soring bit
		// we are going to make 8 bool pointer arrays these are the same size numbers wise as the number of entities
		//we have going into this node ok well its a leaf now but the point is we are going to check
		//where each entity needs to go and use bools to say yes you go there or no you don't
		// now why bools and then later
		// its easy really sometimes you might have entities that are going to be needing
		// to be in two or more umm sub division thingys because we are dealing with things
		// not particles which means they have radii which could cross the arbitrary divisions
		// of the octree system so
		// to eliminate the possibility of not detecting
		// collisions that should be detected we use bools and pool the entities based on bools and possible collisions
		bool* pBoolArray1 = new bool[numEntities];
		bool* pBoolArray2 = new bool[numEntities];
		bool* pBoolArray3 = new bool[numEntities];
		bool* pBoolArray4 = new bool[numEntities];
		bool* pBoolArray5 = new bool[numEntities];
		bool* pBoolArray6 = new bool[numEntities];
		bool* pBoolArray7 = new bool[numEntities];
		bool* pBoolArray8 = new bool[numEntities];
		//gotta make sure theres nothing in these arrays
		// also side not sets all to null
		// or zero which when read as a boolean is false
		// so this sets these arrays to being full of falses
		ZeroMemory(pBoolArray1, numEntities);
		ZeroMemory(pBoolArray2, numEntities);
		ZeroMemory(pBoolArray3, numEntities);
		ZeroMemory(pBoolArray4, numEntities);
		ZeroMemory(pBoolArray5, numEntities);
		ZeroMemory(pBoolArray6, numEntities);
		ZeroMemory(pBoolArray7, numEntities);
		ZeroMemory(pBoolArray8, numEntities);

		// Loop through all our entities, and allocate to the appropriate
		// cube area.
		int i=0;
		for(const auto BaseGameEntity : entities)
		{
			if(BaseGameEntity->GetPhysicsPointer()->mI_PhysicsType==COT_World&&BaseGameEntity->GetPhysicsPointer()->mI_PrimitiveType==PT_Plane)
			{
				if((m_vCenter*BaseGameEntity->GetPhysicsPointer()->GetNormal())-m_rDiameter<BaseGameEntity->GetPhysicsPointer()->GetDistFromOrigin())
				{
					pBoolArray1[i] = true;
					pBoolArray2[i] = true;
					pBoolArray3[i] = true;
					pBoolArray4[i] = true;
					pBoolArray5[i] = true;
					pBoolArray6[i] = true;
					pBoolArray7[i] = true;
					pBoolArray8[i] = true;
				}
			}
			else if (BaseGameEntity->GetPhysicsPointer()->mI_PrimitiveType==PT_Ray)
			{
				pBoolArray1[i] = true;
				pBoolArray2[i] = true;
				pBoolArray3[i] = true;
				pBoolArray4[i] = true;
				pBoolArray5[i] = true;
				pBoolArray6[i] = true;
				pBoolArray7[i] = true;
				pBoolArray8[i] = true;
			}
			else
			{
				// TOP_FRONT_LEFT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.z) )
				{
					pBoolArray1[i] = true;
				}
				// TOP_FRONT_RIGHT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y+BaseGameEntity->GetPhysicsPointer()->GetRadius()>= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.z) )
				{
					pBoolArray2[i] = true;
				}
				// TOP_BACK_LEFT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.z) )
				{
					pBoolArray3[i] = true;
				}
				// TOP_BACK_RIGHT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.z) )
				{
					pBoolArray4[i] = true;
				}

				// BOTTOM_FRONT_LEFT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.z) )
				{
					pBoolArray5[i] = true;
				}
				// BOTTOM_FRONT_RIGHT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.z) )
				{
					pBoolArray6[i] = true;
				}
				// BOTTOM_BACK_LEFT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.z) )
				{
					pBoolArray7[i] = true;
				}
				// BOTTOM_BACK_RIGHT
				if( (BaseGameEntity->GetPhysicsPointer()->getPosition().y-BaseGameEntity->GetPhysicsPointer()->GetRadius() <= m_vCenter.y) && (BaseGameEntity->GetPhysicsPointer()->getPosition().x+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.x) && (BaseGameEntity->GetPhysicsPointer()->getPosition().z+BaseGameEntity->GetPhysicsPointer()->GetRadius() >= m_vCenter.z) )
				{
					pBoolArray8[i] = true;
				}
			}
			i++;
		}
		// now we need 2 count how many entities are in each partition this is used for early outs in this recursive process
		int iCount1 = 0;
		int iCount2 = 0;
		int iCount3 = 0;
		int iCount4 = 0;
		int iCount5 = 0;
		int iCount6 = 0;
		int iCount7 = 0;
		int iCount8 = 0;

		for(int i=0; i<numEntities; i++)
		{
			if(pBoolArray1[i]==true)
			{
				iCount1++;
			}
			if(pBoolArray2[i]==true)
			{
				iCount2++;
			}
			if(pBoolArray3[i]==true)
			{
				iCount3++;
			}
			if(pBoolArray4[i]==true)
			{
				iCount4++;
			}
			if(pBoolArray5[i]==true)
			{
				iCount5++;
			}
			if(pBoolArray6[i]==true)
			{
				iCount6++;
			}
			if(pBoolArray7[i]==true)
			{
				iCount7++;
			}
			if(pBoolArray8[i]==true)
			{
				iCount8++;
			}
		}
		// now we make each of the nodes or leafy bits or oh whatever this is where you split up the data
		CreateNodeEnd(entities, numEntities, pBoolArray1, m_vCenter, m_rDiameter, iCount1,Top_Front_Left);
		CreateNodeEnd(entities, numEntities, pBoolArray2, m_vCenter, m_rDiameter, iCount2,Top_Front_Right);
		CreateNodeEnd(entities, numEntities, pBoolArray3, m_vCenter, m_rDiameter, iCount3,Top_Back_Left);
		CreateNodeEnd(entities, numEntities, pBoolArray4, m_vCenter, m_rDiameter, iCount4,Top_Back_Right);

		CreateNodeEnd(entities, numEntities, pBoolArray5, m_vCenter, m_rDiameter, iCount5,Bottom_Front_Left);
		CreateNodeEnd(entities, numEntities, pBoolArray6, m_vCenter, m_rDiameter, iCount6,Bottom_Front_Right);
		CreateNodeEnd(entities, numEntities, pBoolArray7, m_vCenter, m_rDiameter, iCount7,Bottom_Back_Left);
		CreateNodeEnd(entities, numEntities, pBoolArray8, m_vCenter, m_rDiameter, iCount8,Bottom_Back_Right);
		delete pBoolArray1;
		delete pBoolArray2;
		delete pBoolArray3;
		delete pBoolArray4;
		delete pBoolArray5;
		delete pBoolArray6;
		delete pBoolArray7;
		delete pBoolArray8;
	}
}
Пример #25
0
void MGADSMTrajectory::SetInsertion(int n, const InsertionNode& insertionNode)
{
   int index = GetInsertionIndex(n);
   SetNode(index, TrajectoryNodePtr(new InsertionNode(insertionNode)));
}
Пример #26
0
ccMaxNode::ccMaxNode(INode* node)  : MaxINode(node), MaxNodeObjectTM(true), ScaledIsUnified(true), ShapeType(NX_SHAPE_MESH)
{
	SetNode(node);
}
Пример #27
0
void CJsonNode::SetBoolean(const string& key, bool value)
{
    SetNode(key, new SJsonFixedSizeNodeImpl(value));
}
Пример #28
0
void MGADSMTrajectory::SetRendezvous(int n, const RendezvousNode& rendezvousNode)
{
   int index = GetRendezvousIndex(n);
   SetNode(index, TrajectoryNodePtr(new RendezvousNode(rendezvousNode)));
}
Пример #29
0
void CJsonNode::SetNull(const string& key)
{
    SetNode(key, new SJsonFixedSizeNodeImpl);
}
Пример #30
0
void MGADSMTrajectory::SetFlyby(int n, const FlybyNode& flybyNode)
{
   int index = GetFlybyIndex(n);
   SetNode(index, TrajectoryNodePtr(new FlybyNode(flybyNode)));
}