Esempio n. 1
0
FUNCTION void Q64G(obj Q4F0, obj Q62D, int Q571)
{
  int Q63U;
  list metal;
  clearList(metal);
  Q4S8(metal, Q62D);
  for(int num = numInList(metal); num > 0x00; num --)
  {
    int Q56Z;
    obj Q5UD = metal[0x00];
    int Q4Q1 = getResource(Q56Z, Q5UD, "metal", 0x03, 0x02);
    if(Q571 >= Q56Z)
    {
      transferResources(Q4F0, Q5UD, Q56Z, "metal");
      deleteObject(Q5UD);
      removeItem(metal, 0x00);
      Q571 = Q571 - Q56Z;
    }
    else
    {
      transferResources(Q4F0, Q5UD, Q571, "metal");
      Q4Q1 = getResource(Q56Z, Q5UD, "metal", 0x03, 0x02);
      if(Q56Z < 0x01)
      {
        deleteObject(Q5UD);
      }
      break;
    }
  }
  clearList(metal);
  return;
}
Esempio n. 2
0
int GUIFontManager::addFont(const TiXmlElement *fontNode)
{
  GUIFont *newFont  = new GUIFont();
  int      index    = -1;

  if(newFont->loadXMLSettings(fontNode))
  {
    index = findFontIndex(newFont);
    if(index >= 0)
    {
      deleteObject(newFont);
    }
    else
    {
      if(!newFont->build())
      {
        deleteObject(newFont);
      }
      else
      {
        if(newFont->build())
        {
          addFont(newFont);
          index = int(guiFontList.size() - 1);
        }
      }
    }
  }
  return index; 
}
void PhysicsSystemImpl::destroy()
{
	m_controller_manager->release();
	m_cooking->release();
	m_physics->release();
	m_foundation->release();
	m_allocator.deleteObject(m_physx_allocator);
	m_allocator.deleteObject(m_error_callback);
}
Esempio n. 4
0
/* Méthode qui permet de créer les connexions entre les différents objets */
void HomeCreator3D::createConnection()
{
    QObject::connect(&window, SIGNAL(itemSelected(QString)), this, SLOT(itemSelected(QString)));
    QObject::connect(window.getUi()->widget, SIGNAL(constructionOK()), this, SLOT(enable3D()));
    QObject::connect(window.getUi()->widget, SIGNAL(objectChangePosition(double, double, double)), this, SLOT(objectMove(double, double, double)));
    QObject::connect(window.getUi()->widget, SIGNAL(objectChangeRotation()), this, SLOT(objectRotate()));
    QObject::connect(window.getUi()->widget, SIGNAL(selection(int)), this, SLOT(selection(int)));
    QObject::connect(window.getUi()->widget, SIGNAL(deleteObject()), this, SLOT(deleteObject()));

    QObject::connect(&window, SIGNAL(newHouse()), this, SLOT(reInit()));
    QObject::connect(&window, SIGNAL(loadHouse(QString)), this, SLOT(loadMaison(QString)));
    QObject::connect(&window, SIGNAL(saveHouse(QString)), this, SLOT(saveMaison(QString)));
}
void GeometryManager::flushUnusedGeometry()
{
  ArrayPtr <GeometryInfo> validGeometry;
  
  for (size_t i = 0; i < geometryCollection.length(); i++)
    if (geometryCollection(i)->getUserCount() > 0)
      validGeometry.append(geometryCollection(i));
    else
    {
      deleteObject(geometryCollection(i)->getMedia());
      deleteObject(geometryCollection(i));
    }
    
  geometryCollection = validGeometry;
}
//---------------------------------------------------------------------------
Services & Services::clear()
{
#if defined(__WIN32__) || defined(__WIN64__)
  for( intptr_t i = sizeof(services_) / sizeof(services_[0]) - 1; i >= 0; i-- ){
/*    try {
      services_[i]->resume();
    }
    catch( ExceptionSP & e ){
      if( e->code() != ENOSYS ) throw;
    }
    services_[i]->stop();*/
    deleteObject(services_[i]);
    services_[i] = NULL;
  }
#else
  for( intptr_t i = services_.count() - 1; i >= 0; i-- ){
    try {
      services_[i].resume();
    }
    catch( ExceptionSP & e ){
      if( e->code() != ENOSYS ) throw;
    }
    if( services_[i].active() ) services_[i].stop();
  }
  services_.clear();
#endif
  return *this;
}
void GeometryManager::flushAllGeometries()
{
  size_t i;
  
  flushUnusedGeometry();
  
  for (i = 0; i < geometryCollection.length(); i++)
  {
    deleteObject(geometryCollection(i)->getMedia());
    deleteObject(geometryCollection(i));
  }
  
  geometryCollection.clear();
  
  if (i) Logger::writeInfoLog(String("Flushed ") + int(i) + String(" active geometries"));
}
void ComponentAIBomber::onMessage(const Message& message)
{
	std::list<GameObject*>::iterator it;
	switch (message.type)
	{
	case Message::NEW_VISION:
		addObject(message.gameObject);
		break;
	case Message::LOST_VISION:
		deleteObject(message.gameObject);
		break;
	case Message::TARGET_REACHED:
		changeTarget(false);
		break;
	case Message::DEATH:
		for (it=defenders.begin(); it!=defenders.end(); ++it)
		{
			(*it)->kill();
		}
		break;
	case Message::START_SHOOTING:
		charging = true;
		break;
	case Message::STOP_SHOOTING:
		charging = false;
		break;
	}
}
Esempio n. 9
0
/**
* CObjectManager::updateAllObjects
* @date Modified Mar 17, 2006
*/
void CObjectManager::updateAllObjects(void)
{
	// Update all items in the object list
	TypedObjectList::iterator itObjectMap = m_mObjects.begin();
	ObjectList::iterator itObjectList;
	while(itObjectMap != m_mObjects.end())
	{
		itObjectList = itObjectMap->second.begin();
		while(itObjectList != itObjectMap->second.end())
		{
			if((*itObjectList)->isDeleted())
			{
				deleteObject(*itObjectList);
				itObjectList = itObjectMap->second.erase(itObjectList);
			}
			else
			{
				(*itObjectList)->update();
				++itObjectList;
			}
		}

		++itObjectMap;
	}
}
Esempio n. 10
0
	void Scene::removeAllObjects()
	{
		for (int i = drawableObjects.size() - 1; i >= 0; --i)
		{
			deleteObject(drawableObjects[i]);
		}
	}
Esempio n. 11
0
void NexusFlagItem::dismount(DismountMode dismountMode)
{
    if(isGhost())      // Server only
        return;
    if(getDatabase() == NULL)  // must be in database, switching levels makes database NULL
        return;

    if(dismountMode == DISMOUNT_MOUNT_WAS_KILLED)
    {
        // Should getting shot up count as a flag drop event for statistics purposes?
        if(mMount && mMount->getClientInfo())
            mMount->getClientInfo()->getStatistics()->mFlagDrop += mFlagCount + 1;

        dropFlags(mFlagCount + 1);    // Drop at least one flag plus as many as the ship carries

        // Now delete the flag itself
        removeFromDatabase(false);
        deleteObject();
    }
    else
    {
        GameType *gameType = getGame()->getGameType();
        if(!gameType)        // Crashed here once, don't know why, so I added the check
            return;

        gameType->itemDropped(mMount, this, dismountMode); // Sends messages; no flags actually dropped here; server only method
        dropFlags(mFlagCount);                             // Only dropping the flags we're carrying, not the "extra" one that comes when we die
    }
}
Esempio n. 12
0
void Parse::deleteObject(QString doc)
{
    if (!isReady()) {
        m_deleteQueue.append(doc);
        return;
    }

    ensureEndPointHasPrefix("classes");

    //Get objectId to be deleted
    QString deletedObjectId = getEndPoint();
    int found = deletedObjectId.lastIndexOf('/');
    int length = deletedObjectId.length();
    deletedObjectId = deletedObjectId.right( length - found -1);


    m_conn = connect(this, &BaaS::replyFinished, [=]( QJsonDocument json){
        Q_UNUSED(json);
        disconnect(m_conn);
        if ( isLastRequestSuccessful() ) {
            emit objectDeleted( deletedObjectId );
            if(!m_deleteQueue.isEmpty()) {
                deleteObject(m_deleteQueue.takeFirst());
            }
        }
        else {
            // error, drop the queue
            m_deleteQueue.empty();
        }
    } );

    initHeaders();
    request( BaaS::DELETE, doc.toUtf8() );
}
Esempio n. 13
0
void GUIFontManager::clear()
{
  for(size_t i = 0; i < guiFontList.size(); i++)
    deleteObject(guiFontList[i]); 
  
  guiFontList.clear();
}
/// Updates the life state of all objects.  Newly-spawned objects are promoted to full "alive" status,
/// and objects marked as "dead" are culled from the manager.
void GameObjectManager::updateObjectLifeStates()
{
  // Promote new objects to "fully alive" and cull dead objects
  for(ObjectSetIter it = m_objects.begin(); it != m_objects.end();)
  {
    switch((*it)->m_lifeState)
    {
      case GameObject::LS_DEAD:
      {
        ObjectSetIter murderDeathKill = it;
        ++it;
        deleteObject(*murderDeathKill);
      } break;
      case GameObject::LS_NEW:
      {
        (*it)->m_lifeState = GameObject::LS_ALIVE;
        ++it;
      } break;
      default:
      {
       ++it;
      } break;
    };
  }
}
Esempio n. 15
0
void _Universe::reset(void)
{
	for (int i = 0; i < m_nObj; i++)
	{
		deleteObject(i);
	}
}
Esempio n. 16
0
void refManagerImpl::releaseStrong()
{
	if (m_strongCount.decrement() <= 0)
		deleteObject();

	releaseWeak();
}
Esempio n. 17
0
FUNCTION int Q4WZ(obj Q5AO, obj Q4H5, obj user)
{
  transferAllResources(Q5AO, Q4H5);
  Q59B(Q5AO);
  obj Q5AB = NULL();
  if(hasObjVar(Q5AO, "myhousedoor"))
  {
    Q5AB = getobjvar_obj(Q5AO, "myhousedoor");
  }
  obj Q5AP = NULL();
  if(hasObjVar(Q5AO, "myhousesign"))
  {
    Q5AP = getobjvar_obj(Q5AO, "myhousesign");
  }
  string Q4F8 = getName(user);
  if(Q5AP != NULL())
  {
    setObjVar(Q5AP, "creatorId", user);
    setObjVar(Q5AP, "creatorName", Q4F8);
  }
  else
  {
    setObjVar(Q5AO, "creatorId", user);
    setObjVar(Q5AO, "creatorName", Q4F8);
  }
  int Q5NC = Q4WT(user, Q5AO, Q5AB, Q5AP, 0x00);
  Q5NC = Q4WT(user, Q5AO, Q5AB, Q5AP, 0x01);
  if(Q5AO != NULL())
  {
    deleteObject(Q4H5);
  }
  return(0x01);
}
Esempio n. 18
0
void RMemoryStorage::deleteTransactionsFrom(int transactionId) {
    QSet<int> keysToRemove;

    {
        QHash<int, RTransaction>::iterator it;
        for (it = transactionMap.begin(); it!=transactionMap.end(); ++it) {
            if (it.key()>=transactionId) {
                // delete orphaned objects:
                QList<RObject::Id> affectedObjects =
                    it.value().getAffectedObjects();

                QList<RObject::Id>::iterator it2;
                for (it2=affectedObjects.begin(); it2!=affectedObjects.end(); ++it2) {
                    QSharedPointer<RObject> obj = queryObjectDirect(*it2);
                    if (!obj.isNull() && obj->isUndone()) {
                        deleteObject(*it2);
                    }
                }

                // delete transaction:
                keysToRemove.insert(it.key());
            }
        }
    }

    {
        QSet<int>::iterator it;
        for (it=keysToRemove.begin(); it!=keysToRemove.end(); ++it) {
            transactionMap.remove(*it);
        }
    }
}
Esempio n. 19
0
/*********************************************************************
** Member Function: print
** Description: print the resulting array given for the grid object
 * and use the loop for other loop actions like resetting flags
** Parameters: none
** Pre-Conditions: xMax and yMax must be >= 0
** Post-Conditions: xMax and yMax remain >= 0
*********************************************************************/
void Grid::print() {
    int count = 1;  // used to count how many objects exist
    for (int i = 0; i < yMax; i++){
        for (int j = 0; j < xMax; j++) {
            resetIsMoved(j, i); // reset move flags
            copyObject(j, i);   // check to see if a new object should be created
            deleteObject(j, i); // check to see if an object should be deleted
            if (gridArray[i][j] == NULL)    // prints a background space when NULL
                //std::cout << " - ";         // fill background
                std::cout << "   ";       // no background
            else if (gridArray[i][j]->getType() == 1) {
                std::cout << " * ";         /* Ant object */
                count++;
            }
            else if (gridArray[i][j]->getType() == 2) {
                std::cout << ">X<";         /* Doodlebug object */
                count++;
            }
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;
    if (count == xMax * yMax)   // check to see if the grid is full
        setIsFull();
}
Esempio n. 20
0
void GlRenderbufferObject::createObject(GLint internalFormat,
                                        GLsizei width, GLsizei height) {
  deleteObject();
  glGenRenderbuffersEXT(1, &_handle);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, _handle);
  glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalFormat, width, height);
}
void WebGLObject::onDetached(GraphicsContext3D* context3d)
{
    if (m_attachmentCount)
        --m_attachmentCount;
    if (m_deleted)
        deleteObject(context3d);
}
Esempio n. 22
0
void
FlyingCamera::onDeleteNotify(SimObject* io_pDelete)
{
   if (io_pDelete == watchPacketStream)
      deleteObject();

   Parent::onDeleteNotify(io_pDelete);
}
Esempio n. 23
0
void WebGLObject::setObject(Platform3DObject object)
{
    if (object == m_object)
        return;
        
    deleteObject();
    m_object = object;
}
Esempio n. 24
0
int main(int argc, char **argv) {
	printf("Testing memcpy/memmove with function pointers for array size ");
	printf("%d", ARRAY_SIZE);
#ifdef NO_TAGS
	printf(" (no tags)");
#endif
#ifdef FAKE_TAGS
	printf(" (fake tags)");
#endif
	printf("...\n");
	Object *p = createEvilObject();
	fillArray(p);
	printf("Calling function on original object...\n");
#ifndef NO_TAGS
	printf("Tag on p function pointer is %d\n", (int)load_tag(&(p->fn)));
	assert(load_tag(&(p->fn)) == __RISCV_TAG_CLEAN_FPTR);
#endif
	p->fn();
	Object *q = copyObject(p);
	checkArray(q);
	printf("Calling function on memcpy'ed copy of object...\n");
#ifndef NO_TAGS
	printf("Tag on p function pointer is %d\n", (int)load_tag(&(p->fn)));
	assert(load_tag(&(p->fn)) == __RISCV_TAG_CLEAN_FPTR);
	printf("Tag on q function pointer is %d\n", (int)load_tag(&(q->fn)));
	assert(load_tag(&(q->fn)) == __RISCV_TAG_CLEAN_FPTR);
#endif
	q->fn();
	Object *r = moveObject(p);
	checkArray(r);
	printf("Calling function on memmove'ed copy of object...\n");
#ifndef NO_TAGS
	printf("Tag on p function pointer is %d\n", (int)load_tag(&(p->fn)));
	assert(load_tag(&(p->fn)) == __RISCV_TAG_CLEAN_FPTR);
	printf("Tag on q function pointer is %d\n", (int)load_tag(&(q->fn)));
	assert(load_tag(&(q->fn)) == __RISCV_TAG_CLEAN_FPTR);
	printf("Tag on r function pointer is %d\n", (int)load_tag(&(r->fn)));
	assert(load_tag(&(r->fn)) == __RISCV_TAG_CLEAN_FPTR);
#endif
	r->fn();
	printf("Success!\n");
	deleteObject(p);
	deleteObject(q);
	deleteObject(r);
	return 0;
}
Esempio n. 25
0
bool GUITabbedPanel::loadXMLSettings(XMLElement *element)
{
  if(!element || element->getName() != "TabbedPanel")
  {
     LOG_PRINT("Need a TabbedPanel node in the xml file");
	 return false;
  }

  XMLElement *child                = 0,
             *subChild             = 0;
  D3DXFROMWINEVECTOR3     bordersColor         = upperPanel->getBordersColor();
  D3DXFROMWINEVECTOR4     bgColor              = upperPanel->getBGColor();
  int         count                = 0;

  if(child = element->getChildByName("hScale"))
    fontScales.y = child->getValuef();

  if(child = element->getChildByName("wScale"))
    fontScales.x = child->getValuef();

  if(child = element->getChildByName("TabButtonsBordersColor"))
    XMLElement::loadRX_GY_BZf(*child, tabButtonsBordersColor);

  if(child = element->getChildByName("TabButtonsColor"))
    XMLElement::loadRX_GY_BZf(*child, tabButtonsColor);

  if(child = element->getChildByName("BordersColor"))
    XMLElement::loadRX_GY_BZf(*child, bordersColor);

  if(child = element->getChildByName("BGColor"))
    XMLElement::loadRX_GY_BZ_AWf(*child, bgColor);

  if(child = element->getChildByName("fontIndex"))
    fontIndex =  clampNS(child->getValuei(), 0, 50);

  setFontScales(fontScales);

  for(size_t i = 0; i < element->getChildrenCount(); i++)
  {
    if(!(child = element->getChild(i)))
      continue;

    const NSString &childName = child->getName();

    if(childName == "Panel")
    {
      GUIPanel *panel = new GUIPanel();
      if(!panel->loadXMLSettings(child) || !addPanel(panel))
        deleteObject(panel);
      continue;
    }
  }

  mainPanel->setBordersColor(bordersColor);
  mainPanel->setBGColor(bgColor);

  return GUIRectangle::loadXMLSettings(element) && lowerPanel->getWidgets().size();
}
void WebGLContextObject::detachContext()
{
    detach();
    if (m_context) {
        deleteObject(m_context->contextGL());
        m_context->removeContextObject(this);
        m_context = nullptr;
    }
}
Esempio n. 27
0
void WebGLSharedObject::detachContextGroup()
{
    detach();
    if (m_contextGroup) {
        deleteObject(0);
        m_contextGroup->removeObject(this);
        m_contextGroup = 0;
    }
}
void WebGLContextObject::detachContext()
{
    detach();
    if (m_context) {
        deleteObject(m_context->graphicsContext3D());
        m_context->removeContextObject(this);
        m_context = 0;
    }
}
Esempio n. 29
0
void
sc::gra::Particle::timerUpdate( const sc::phi::Ratio& )
{
  --m_colourIndex;
  if ( 0 == m_colourIndex )
  {
    deleteObject();
  }
}
Esempio n. 30
0
void WebGLObject::detachContext()
{
    m_attachmentCount = 0; // Make sure OpenGL resource is deleted.
    if (m_context) {
        deleteObject();
        m_context->removeObject(this);
        m_context = 0;
    }
}