Ejemplo n.º 1
0
        void fill_guard_tasks_basic(Statement stmt) 
        {
			struct IsOmpTask : public Predicate<AST_t>
			{
				ScopeLink _sl;
				IsOmpTask(ScopeLink sl)
					:_sl(sl)
					{
					}

				bool do_(IsOmpTask::ArgType a) const
				{
					return is_pragma_custom_construct("omp", "task", a, _sl);
				}
			};

            ObjectList<AST_t> tasks = stmt.get_ast().depth_subtrees(IsOmpTask(stmt.get_scope_link()));

            for (ObjectList<AST_t>::iterator it = tasks.begin();
                    it != tasks.end();
                    it++)
            {
                PragmaCustomConstruct task_construct(*it, stmt.get_scope_link());

                GuardedTask guarded_task(task_construct);
                _guarded_task_list.append(guarded_task);
                _num_tasks++;
            }
        }
Ejemplo n.º 2
0
void CGroupObject::GroupObjects(ObjectList& lst)
{
	R_ASSERT(lst.size());
	for (ObjectIt it=lst.begin(); it!=lst.end(); it++)
    	LL_AppendObject(*it,true);
    UpdatePivot(0,false);
}
Ejemplo n.º 3
0
bool Tutorial::isContainerEmpty(uint64 containerId)
{
    bool empty = false;
    if (containerId == mContainerEventId)
    {
        Container* container = dynamic_cast<Container*>(gWorldManager->getObjectById(containerId));
        if (container)
        {
            uint32 objectCount = 0;
            ObjectList* objList = container->getObjects();
            ObjectList::iterator it = objList->begin();

            ObjectList::iterator cEnd = objList->end();

            while(it != cEnd)
            {
                if((*it)->getPrivateOwner() == this->getPlayer())
                    ++objectCount;

                ++it;
            }

            empty = (objectCount == 0);
        }
    }
    return empty;
}
Ejemplo n.º 4
0
//=========================================================================================
//
// removes all structures items for a player
// call this when destroying a building
//
void SpatialIndexManager::removeStructureItemsForPlayer(PlayerObject* player, BuildingObject* building)
{
    DLOG(info) << "SpatialIndexManager::removeStructureItemsForPlayer:: : " << player->getId();

    ObjectList cellObjects		= building->getAllCellChilds();
    ObjectList::iterator objIt	= cellObjects.begin();

    while(objIt != cellObjects.end())	{
        Object* object = (*objIt);

        if(PlayerObject* otherPlayer = dynamic_cast<PlayerObject*>(object))	{
            //do nothing players and creatures are always in the grid
        }
        else if(CreatureObject* pet = dynamic_cast<CreatureObject*>(object))	{
            //do nothing players and creatures are always in the grid
        }
        else	{
            if((object) && (object->checkRegisteredWatchers(player)))	{
                gContainerManager->unRegisterPlayerFromContainer(object,player);
				gMessageLib->sendDestroyObject(object->getId(), player);
            }
        }
        objIt++;
    }


}
Ejemplo n.º 5
0
void SpatialIndexManager::initObjectsInRange(PlayerObject* player) {
    uint64_t player_id = player->getParentId();
    if (player_id == 0) {
        return;
    }

    Object* tmp = gWorldManager->getObjectById(player_id);
    if (tmp->getType() != ObjType_Cell) {
        return;
    }

    CellObject* cell = static_cast<CellObject*>(tmp);

    tmp = gWorldManager->getObjectById(cell->getParentId());
    if (tmp->getType() != ObjType_Building) {
        return;
    }

    BuildingObject* building = static_cast<BuildingObject*>(tmp);

    ObjectList children = building->getAllCellChilds();

    std::for_each(children.begin(), children.end(), [this, player] (Object* cell_child) {
        if (cell_child->getType() != ObjType_Tangible) {
            return;
        }

        sendCreateObject(cell_child, player, true);
    });
}
Ejemplo n.º 6
0
void __fastcall TfraGroup::MultiSelByRefObject ( bool clear_prev )
{
    ObjectList 	objlist;
    LPU32Vec 	sellist;
    if (Scene->GetQueryObjects(objlist,OBJCLASS_GROUP,1,1,-1)){
    	for (ObjectIt it=objlist.begin(); it!=objlist.end(); it++){
	        LPCSTR N = ((CGroupObject*)*it)->RefName();
            ObjectIt _F = Scene->FirstObj(OBJCLASS_GROUP);
            ObjectIt _E = Scene->LastObj(OBJCLASS_GROUP);
            for(;_F!=_E;_F++){
	            CGroupObject *_O = (CGroupObject *)(*_F);
                if((*_F)->Visible()&&_O->RefCompare(N)){
                	if (clear_prev){
                    	_O->Select( false );
	                    sellist.push_back((u32*)_O);
                    }else{
                    	if (!_O->Selected())
                        	sellist.push_back((u32*)_O);
                    }
                }
            }
        }
        std::sort			(sellist.begin(),sellist.end());
        sellist.erase		(std::unique(sellist.begin(),sellist.end()),sellist.end());
        std::random_shuffle	(sellist.begin(),sellist.end());
        int max_k		= iFloor(float(sellist.size())/100.f*float(seSelPercent->Value)+0.5f);
        int k			= 0;
        for (LPU32It o_it=sellist.begin(); k<max_k; o_it++,k++){
            CGroupObject *_O = (CGroupObject *)(*o_it);
            _O->Select( true );
        }
    }
}
Ejemplo n.º 7
0
 void propagate_argument_rec( Node* current, RenameVisitor* v )
 {
     if( !current->is_visited( ) )
     {
         current->set_visited( true );
         
         if( current->is_entry_node( ) || current->is_exit_node( ) )
             return;
         
         if( current->is_graph_node( ) )
         {
             propagate_argument_rec( current->get_graph_entry_node( ), v );
         }
         else
         {
             ObjectList<Nodecl::NodeclBase> stmts = current->get_statements( );
             ObjectList<Nodecl::NodeclBase> new_stmts;
             for( ObjectList<Nodecl::NodeclBase>::iterator it = stmts.begin( ); it != stmts.end( ); ++it )
             {
                 Nodecl::NodeclBase it_copy = Nodecl::Utils::deep_copy( *it, *it );
                 v->walk( *it );
                 new_stmts.insert( it_copy );
             }
             current->set_statements( new_stmts );
         }
             
         ObjectList<Node*> children = current->get_children( );
         for( ObjectList<Node*>::iterator it = children.begin( ); it != children.end( ); ++it )
         {
             propagate_argument_rec( *it, v );
         }
     }
 }
Ejemplo n.º 8
0
void ESceneGroupTool::UngroupObjects(bool bUndo)
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty())
    {
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
        {
            if ((*it)->Selected())
            {
            	sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); 
                VERIFY(obj);
                if (obj->CanUngroup(true))
                {
                    obj->UngroupObjects	();
                    Scene->RemoveObject	(obj,false,true);
                    xr_delete			(obj);
                    bModif				= true;
                }else
                    ELog.DlgMsg			(mtError,"Can't ungroup object: '%s'.",obj->Name);
            }
        }
        if (bUndo&&bModif) 
            Scene->UndoSave();
    }
    if (0==sel_cnt)
        ELog.Msg		(mtError,"Nothing selected.");
}
Ejemplo n.º 9
0
bool SmartAI::IsEscortInvokerInRange()
{
    ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
    if (targets)
    {
        if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
        {
            Player* player = (*targets->begin())->ToPlayer();
            if (me->GetDistance(player) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;

            if (Group* group = player->GetGroup())
            {
                for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
                {
                    Player* groupGuy = groupRef->getSource();

                    if (me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;
                }
            }
        }else
        {
            for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
            {
                if (GetScript()->IsPlayer((*iter)))
                {
                    if (me->GetDistance((*iter)->ToPlayer()) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;
                }
            }
        }
    }
    return true;//escort targets were not set, ignore range check
}
Ejemplo n.º 10
0
void dtSelectObject(DtObjectRef object) {
  ObjectList::iterator i = objectList.find(object);
  if (i != objectList.end()) {
    move();
    currentObject = (*i).second;
  }
}
Ejemplo n.º 11
0
void World::Update(const ObjectList& objList)
{
	// Works each bodies' physics
	for (auto it1 = objList.begin(); it1 != objList.end(); ++it1)
	{
		// 1. If sprite has body and activated body to work.
		if (it1->second->HasRigidBody() && 
			it1->second->GetRigidBody()->GetMoveToggle())
		{
			// Work basic motion
			BodyPipeline(it1->second);
			
			// 2. if 2st sprite's colliders to be worked, check colliders
			if (it1->second->GetRigidBody()->GetColliderToggle())
			{
				// Refresh collision-with info
				it1->second->GetRigidBody()->CheckCollided(false);
				it1->second->GetRigidBody()->SetCollisionWith(nullptr);

				auto new_begin = it1;
				for (auto it2 = new_begin; it2 != objList.end(); ++it2)
				{
					// 3. If both objs are differenct and both bodies has own body, 
					// activated body and collider body,
					if (it1 != it2 && it2->second->HasRigidBody() &&
						it2->second->GetRigidBody()->GetColliderToggle())
					{					
						// 4. then check the colliders.
						// Check two sprites' collision status
						bool collisionIntersect = CollisionIntersect(it1->second, it2->second);
						if (collisionIntersect)
						{
							// Collision response
							if (it1->second->GetRigidBody()->GetResponseToggle() ||
								it2->second->GetRigidBody()->GetResponseToggle())
									CollisionResponse(it1->second, it2->second);

							// Refresh the collision with info
							CollisionRelation(it1->second, it2->second);

						}// 4. Check the colliders
					}// 3. Has Rigid Body, 2 toggles to work
				}
			}// 2. Collider Toggle
		}// 1. Body Toggle
	}
}
void SectorManager::RunSectorEventThread()
{
	m_SectorThreadRunning = true;
	unsigned long current_tick;
	long sleep_time;
	unsigned long check_tick = m_SectorID;
    ObjectList stations;
    ObjectList::iterator itrOList;

	if (m_ObjectMgr == (0)) return;

    ObjectList * mob_list;
    long mob_index = 0;

	//TODO: don't need an object manager for stations, but we do need an event thread.

	if (m_SectorID < 9999)
	{
		mob_list = m_ObjectMgr->GetMOBList();
		m_ObjectMgr->SectorSetup(stations);
		m_ObjectMgr->SetSectorManager(this);
	}

	do
	{
		current_tick = GetNet7TickCount();

		if (m_SectorID < 9999) //only MOBs and object effects for space & planet sectors
		{
			ProcessMOBs(current_tick, check_tick, true);

			//send station broadcasts
			for (itrOList = stations.begin(); itrOList != stations.end(); ++itrOList)
			{
				(*itrOList)->SendSoundBroadcast(check_tick);
			}
		}

        if (m_PlayerCount > 0) //only need to process timeslots if there are players present (for now - interacting MOBs will require time slots)
        {
            //first make the event calls for this node
            CallSlotEvents(m_EventSlotIndex);
			CallLongTermEvents(m_EventSlotIndex);

            //increment the slot index
            m_EventSlotIndex++;
            if (m_EventSlotIndex == (TIMESLOT_DURATION*10)) m_EventSlotIndex = 0;
        }

		check_tick++;
		sleep_time = current_tick - GetNet7TickCount() + SECTOR_THREAD_INTERVAL;
        if (check_tick > 128) check_tick = 0;
		if (sleep_time < 0) sleep_time = 0;
		Sleep(sleep_time);

    } while (!g_ServerShutdown);

	m_SectorThreadRunning = false;
}
Ejemplo n.º 13
0
void excludeByType( ObjectList& list, const Set& set )
{
  for( auto it=list.begin(); it != list.end(); )
  {
    if( set.count( (*it)->type() ) > 0 ) { it=list.erase( it ); }
    else { ++it; }
  }
}
Ejemplo n.º 14
0
void dtProceed() {
  for (ComplexList::iterator i = complexList.begin(); 
       i != complexList.end(); ++i) 
    (*i)->proceed();
  for (ObjectList::const_iterator j = objectList.begin(); 
       j != objectList.end(); ++j)
    (*j).second->proceed();
}
Ejemplo n.º 15
0
void SmartAI::EndPath(bool fail)
{
    GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mLastWP->id, GetScript()->GetPathId());

    RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
    mWayPoints = NULL;
    mCurrentWPID = 0;
    mWPPauseTimer = 0;
    mLastWP = NULL;
    
    if (mCanRepeatPath)
        StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath);
    else
        GetScript()->SetPathId(0);


    ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
    if (targets && mEscortQuestID)
    {
        if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
        {
            Player* plr = (*targets->begin())->ToPlayer();
            if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                plr->GroupEventHappens(mEscortQuestID, me);

            if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                plr->FailQuest(mEscortQuestID);

            if (Group *pGroup = plr->GetGroup())
            {
                for (GroupReference *gr = pGroup->GetFirstMember(); gr != NULL; gr = gr->next())
                {
                    Player *pGroupGuy = gr->getSource();

                    if(!fail && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse())
                        pGroupGuy->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && pGroupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        pGroupGuy->FailQuest(mEscortQuestID);
                }
            }
        }else
        {
            for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); iter++)
            {
                if (GetScript()->IsPlayer((*iter)))
                {
                    Player* plr = (*iter)->ToPlayer();
                    if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                        plr->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        plr->FailQuest(mEscortQuestID);
                }
            }
        }
    }
    if (mDespawnState == 1)
        StartDespawn();
}
Ejemplo n.º 16
0
//------------------------------------------------------------------------------------
// moving
//------------------------------------------------------------------------------------
bool __fastcall TUI_CustomControl::MovingStart(TShiftState Shift)
{
	ObjClassID cls = LTools->CurrentClassID();

    if(Shift==ssRBOnly){ ExecCommand(COMMAND_SHOWCONTEXTMENU,parent_tool->ClassID); return false;}
    if(Scene->SelectionCount(true,cls)==0) return false;

    if (Shift.Contains(ssCtrl)){
        ObjectList lst;
        if (Scene->GetQueryObjects(lst,LTools->CurrentClassID(),1,1,0)){
        	if (lst.size()==1){
                Fvector p,n;
                UI->IR_GetMousePosReal(Device.m_hRenderWnd, UI->m_CurrentCp);
                Device.m_Camera.MouseRayFromPoint(UI->m_CurrentRStart,UI->m_CurrentRNorm,UI->m_CurrentCp);
                if (LUI->PickGround(p,UI->m_CurrentRStart,UI->m_CurrentRNorm,1,&n)){
                    for(ObjectIt _F = lst.begin();_F!=lst.end();_F++) (*_F)->MoveTo(p,n);
                    Scene->UndoSave();
                }
            }else{
                Fvector p,n;
                Fvector D={0,-1,0};
                for(ObjectIt _F = lst.begin();_F!=lst.end();_F++){ 
                	if (LUI->PickGround(p,(*_F)->PPosition,D,1,&n)){
	                	(*_F)->MoveTo(p,n);
                    }
                }
            }
        }
        return false;
    }else{
        if (etAxisY==Tools->GetAxis()){
            m_MovingXVector.set(0,0,0);
            m_MovingYVector.set(0,1,0);
        }else{
            m_MovingXVector.set( Device.m_Camera.GetRight() );
            m_MovingXVector.y = 0;
            m_MovingYVector.set( Device.m_Camera.GetDirection() );
            m_MovingYVector.y = 0;
            m_MovingXVector.normalize_safe();
            m_MovingYVector.normalize_safe();
        }
        m_MovingReminder.set(0,0,0);
    }
    return true;
}
Ejemplo n.º 17
0
 int SuitableAlignmentVisitor::join_list( ObjectList<int>& list ) 
 {
     int result = 0;
     for( ObjectList<int>::iterator it = list.begin( ); it != list.end( ); ++it )
     {
         result = result + ( *it );
     }
     return result;
 }
Ejemplo n.º 18
0
void __fastcall TUI_CustomControl::MovingProcess(TShiftState _Shift)
{
	Fvector amount;
	if (DefaultMovingProcess(_Shift,amount)){
        ObjectList lst;
        if (Scene->GetQueryObjects(lst,LTools->CurrentClassID(),1,1,0))
            for(ObjectIt _F = lst.begin();_F!=lst.end();_F++) (*_F)->Move(amount);
    }
}
Ejemplo n.º 19
0
 //! Method that inserts the PCFG corresponding to a function call
 void ExtensibleGraph::nest_pcfgs_rec( Node* current, ObjectList<ExtensibleGraph*>* pcfgs, unsigned int& min_id )
 {
     if( !current->is_visited( ) )
     {
         current->set_visited( true );
         if( current->is_exit_node( ) )
             return;
         
         if( current->is_graph_node( ) )
         {
             // Inline inner nodes, if there is any inner function call
             nest_pcfgs_rec( current->get_graph_entry_node( ), pcfgs, min_id );
         }
         else if( current->is_function_call_node( ) )
         {
             // Look for the graph in the list of created pcfgs
             ExtensibleGraph* pcfg = NULL;
             Nodecl::FunctionCall called_func = current->get_statements( )[0].as<Nodecl::FunctionCall>( );
             Symbol called_sym( called_func.get_called( ).get_symbol( ) );
             std::cerr << "Called function: " << called_func.prettyprint( ) << std::endl;
             for( ObjectList<ExtensibleGraph*>::iterator it = pcfgs->begin( ); it != pcfgs->end( ) && pcfg == NULL; ++it )
             {
                 Symbol pcfg_sym( ( *it )->get_function_symbol( ) );
                 if( pcfg_sym.is_valid( ) )
                 {
                     if( called_sym == pcfg_sym )
                     {
                         pcfg = *it;
                     }
                 }
             }
             if( pcfg != NULL )
             {
                 // Copy the graph we want to embed, since we don't want to change the original 
                 ExtensibleGraph* new_nested_graph = pcfg->copy_graph( );
                 
                 // Rename the id of the nodes to avoid having nodes with the same id
                 new_nested_graph->rename_nodes_id( min_id );
                 
                 // Create nodes containing temporary variables with the return values
                 new_nested_graph->store_returns_in_temporary_vars( );
                 
                 // Rename the parameters used in the copied graph with the corresponding arguments used in the call
                 new_nested_graph->propagate_arguments_in_function_graph( called_func.get_arguments( ) );
                 
                 Node* function_code_node = new_nested_graph->get_graph( )->get_graph_entry_node( )->get_children( )[0];
                 replace_node( current, function_code_node );
             }
         }
         
         ObjectList<Node*> children = current->get_children( );
         for( ObjectList<Node*>::iterator it = children.begin( ); it != children.end( ); ++it )
         {
             nest_pcfgs_rec( *it, pcfgs, min_id );
         }
     }
 }
Ejemplo n.º 20
0
::Aurora::NWScript::ObjectSearch *ObjectContainer::findObjectsByType(ObjectType type) const {
	static const ObjectList kEmptyObjectList;

	ObjectMap::const_iterator l = _objects.find(type);
	if (l == _objects.end())
		return new SearchType(kEmptyObjectList.begin(), kEmptyObjectList.end());

	return new SearchType(l->second);
}
Ejemplo n.º 21
0
void dtDeleteObject(DtObjectRef object) {
  ObjectList::iterator i = objectList.find(object);
  if (i != objectList.end()) {
    if (currentObject == (*i).second) currentObject = 0;
    delete (*i).second;
    objectList.erase(i);
  }
  respTable.cleanObject(object);
}
Ejemplo n.º 22
0
 void ClausesInfo::add_referenced_clause(AST_t directive, const ObjectList<std::string> & clause_names)
 {
      for(ObjectList<std::string>::const_iterator it = clause_names.begin();
         it != clause_names.end();
         ++it)
      {
         _directive_clauses_map[directive].referenced_clauses.append(*it);
      }
 }
Ejemplo n.º 23
0
void __fastcall TfraShape::ebDetachAllShapesClick(TObject *Sender)
{
    ObjectList lst;
    if (Scene->GetQueryObjects(lst,OBJCLASS_SHAPE,1,1,0)){
		Scene->SelectObjects(false,OBJCLASS_SHAPE);
    	for (ObjectIt it=lst.begin(); it!=lst.end(); it++)
        	((CEditShape*)*it)->Detach();
    }
}
Ejemplo n.º 24
0
void __fastcall TfraWayPoint::ebConvert2Click(TObject *Sender)
{
	ObjectList lst;
    int cnt = Scene->GetQueryObjects(lst, OBJCLASS_WAY, 1, 1, 0);
    for (ObjectIt it=lst.begin(); it!=lst.end(); it++)
    	((CWayObject*)(*it))->Convert2Link();
	if (cnt) Scene->UndoSave();
    ExecCommand(COMMAND_UPDATE_PROPERTIES);
}
Ejemplo n.º 25
0
void dtChangeVertexBase(DtShapeRef shape, const Point *base) { 
  if (((Shape *)shape)->getType() == COMPLEX)
    ((Complex *)shape)->changeBase(base);
  for (ObjectList::const_iterator i = objectList.begin(); 
       i != objectList.end(); ++i) {
    if ((*i).second->shapePtr == (Shape *)shape) {
      (*i).second->move();
    }
  }   
}
Ejemplo n.º 26
0
void DestroyPhysicsShells()
{
    ObjectList lst;
    if (Scene->GetQueryObjects(lst,OBJCLASS_SPAWNPOINT,-1,-1,0)){
    	for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
	        CSpawnPoint* O = dynamic_cast<CSpawnPoint*>(*it); R_ASSERT(O);
            O->DeletePhysicsShell();
        }
    }
}
Ejemplo n.º 27
0
void DebugRenderer::renderBalls(unsigned char* image, Vision* vision, const ObjectList& balls, int width, int height) {
	Canvas canvas = Canvas();

	canvas.data = image;
	canvas.width = width;
	canvas.height = height;

	Object* ball = NULL;
    char buf[256];
	//int correctedX, correctedY;

    for (ObjectListItc it = balls.begin(); it != balls.end(); it++) {
        ball = *it;

        canvas.drawBoxCentered(ball->x, ball->y, ball->width, ball->height);
		//canvas.drawLine(ball->x - ball->width / 2, ball->y - ball->height / 2, ball->x + ball->width / 2, ball->y + ball->height / 2);
        //canvas.drawLine(ball->x - ball->width / 2, ball->y + ball->height / 2, ball->x + ball->width / 2, ball->y - ball->height / 2);

		sprintf(buf, "%.2fm x %.2fm  %.1f deg", ball->distanceX, ball->distanceY, Math::radToDeg(ball->angle));
        canvas.drawText(ball->x - ball->width / 2 + 2, ball->y - ball->height / 2 - 22, buf);

		//correctedX = ball->x;
		//correctedY = ball->y + ball->height / 2;

		CameraTranslator::CameraPosition undistortedPos = vision->getCameraTranslator()->undistort(ball->x, ball->y + ball->height / 2);

		//Util::correctCameraPoint(correctedX, correctedY);

		sprintf(buf, "%d x %d - %d x %d", ball->x, ball->y + ball->height / 2, undistortedPos.x, undistortedPos.y);
        canvas.drawText(ball->x - ball->width / 2 + 2, ball->y - ball->height / 2 - 12, buf);

        //int boxArea = ball->width * ball->height;

		/*if (boxArea == 0) {
			continue;
		}

        int density = ball->area * 100 / boxArea;

        sprintf(buf, "%d - %d%%", ball->area, density);
        canvas.drawText(ball->x - ball->width / 2 + 2, ball->y - ball->height / 2 - 9, buf);*/
    }

	// TEMP - draw centerline
	//canvas.drawLine(canvas.width / 2, 0, canvas.width / 2, canvas.height);
	//canvas.fillCircleCentered(Config::cameraWidth / 2, Config::cameraHeight / 2, 100, 0, 0, 255);

    /*Blobber::Blob* blob = blobber->getBlobs("ball");

    while (blob != NULL) {
        image->drawBoxCentered(blob->centerX, blob->centerY, blob->x2 - blob->x1, blob->y2 - blob->y1);

        blob = blob->next;
    }*/
}
Ejemplo n.º 28
0
void   CScenePhyscs::	UseSimulatePoses	()
{
   ObjectList lst;
    if (Scene->GetQueryObjects(lst,OBJCLASS_SPAWNPOINT,1,1,0)){
    	for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
	        CSpawnPoint* O = dynamic_cast<CSpawnPoint*>(*it); R_ASSERT(O);
            if(O->Selected())
            	O->UseSimulatePose();
       }
    }
}
Ejemplo n.º 29
0
void DataManager::removeGridObject(int x, int y, ObjectPtr object) {
	CellData* cd = &GET_GRID_ITEM(grid,x,y);
	ObjectList* objects = &cd->objects;
	for (ObjectList::iterator it = objects->begin(); it != objects->end(); it++) {
		if (*it == object) {
			objects->erase(it);
			gridChanged(x, y, cd);
			break;
		}
	}
}
Ejemplo n.º 30
0
 bool ArrayAccessInfoVisitor::join_list( ObjectList<bool>& list )
 {
     _is_adjacent_access = false;
     
     bool result = true;
     for( ObjectList<bool>::iterator it = list.begin( ); it != list.end( ); ++it )
     {
         result = result && ( *it );
     }
     return result;
 }