示例#1
0
//---------------------------------------------------------------------------
long Gate::update (void)
{
	if (getFlag(OBJECT_FLAG_JUSTCREATED)) 
	{
		setFlag(OBJECT_FLAG_JUSTCREATED, false);

		//--------------------------------------------------------
		// Figure out what the box should be for the tBuilding.
		appearance->update();
		appearance->recalcBounds();
		appearance->setHighlightColor(0x00000000);
		
		//-----------------------------------------------------
		// Check if ParentId is NOT 0xffffffff.
		// if not, find parent in ObjMgr and get its pointer.
		if ((parentId != 0xffffffff) && (parentId != 0))
		{
			parent = ObjectManager->findByCellPosition((parentId>>16),(parentId & 0x0000ffff))->getWatchID();
			ObjectManager->getByWatchID(parent)->setFlag(OBJECT_FLAG_CAPTURABLE, true);

			gosASSERT(parent != 0);
		}
	}
示例#2
0
//---------------------------------------------------------------------------
int32_t Building::update(void)
{
	if(getFlag(OBJECT_FLAG_JUSTCREATED))
	{
		setFlag(OBJECT_FLAG_JUSTCREATED, false);
		BuildingTypePtr type = (BuildingTypePtr)ObjectManager->getObjectType(typeHandle);
		//-------------------------------------------------------
		// OK, now use the sprite Bounds to calculate the extent
		// Radius so that nobody has to enter it!
		if(type->getExtentRadius() < 0.0)
		{
			Stuff::Vector4D diagonalSize;
			diagonalSize.Subtract(appearance->upperLeft, appearance->lowerRight);
			float actualSize = diagonalSize.GetLength();
			actualSize /= worldUnitsPerMeter;
			actualSize *= 1.25;
			type->setExtentRadius(actualSize);
		}
		if(type->getExtentRadius() != 0.0)
			setTangible(true);
		//-----------------------------------------------------
		// Check if ParentId is NOT 0xffffffff.
		// if not, find parent in ObjMgr and get its pointer.
		if((parentId != 0xffffffff) && (parentId != 0))
		{
			parent = ObjectManager->findByCellPosition((parentId >> 16), (parentId & 0x0000ffff))->getWatchID();
			if(ObjectManager->getByWatchID(parent)->canBeCaptured())
				ObjectManager->getByWatchID(parent)->setFlag(OBJECT_FLAG_CAPTURABLE, true);
			gosASSERT(parent != 0);
		}
	}