Example #1
0
void
ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
{
    bool build_for_all = true;
    Player *pl = NULL;
    if( obj->isType(TYPEMASK_ITEM) )
    {
        Item *item = static_cast<Item *>(obj);
        pl = item->GetOwner();
        build_for_all = false;
    }

    if( pl != NULL )
        _buildPacket(pl, obj, update_players);

    // Capt: okey for all those fools who think its a real fix
    //       THIS IS A TEMP FIX
    if( build_for_all )
    {
        WorldObject * temp = dynamic_cast<WorldObject*>(obj);

        //assert(dynamic_cast<WorldObject*>(obj)!=NULL);
        if (temp)
            _buildChangeObjectForPlayer(temp, update_players);
        else
            sLog.outDebug("ObjectAccessor: Ln 405 Temp bug fix");
    }
}
Example #2
0
/*!
 * Implements the "insertStrux" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::insertStrux(fl_ContainerLayout* sfh,
									const PX_ChangeRecord * pcr,
									pf_Frag_Strux* sdh,
									PL_ListenerId lid,
									void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
															PL_ListenerId lid,
															fl_ContainerLayout* sfhNew))
{
	if(pfnBindHandles)
	{
// Ugly hack for MSVC and GCC comlilant warnings
#ifdef __GNUC__
	#warning not sure
#else
	#pragma message("WARNING: not sure")
#endif

		fl_ContainerLayout* sfhNew = sfh; // WAS static_cast<fl_ContainerLayout*>(this);
		pfnBindHandles(sdh,lid,sfhNew);
	}

	ChangeRecordSessionPacket* newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type
	_handleNewPacket( newPacket, pcr );
	return true;
}
Example #3
0
void
ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
{
    if(obj->isType(TYPEMASK_ITEM))
    {
        if(Player *owner = ((Item*)obj)->GetOwner())
           _buildPacket(owner, obj, update_players);
    }
    else
        _buildChangeObjectForPlayer((WorldObject*)obj, update_players);
}
void
ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
{
    if(obj->isType(TYPEMASK_ITEM))
    {
        Item *item = static_cast<Item *>(obj);
        if (Player* pl = item->GetOwner())
            _buildPacket(pl, obj, update_players);
    }
    else
         _buildChangeObjectForPlayer(static_cast<WorldObject*>(obj), update_players);
}
Example #5
0
/*!
 * Implements the "change" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::change(fl_ContainerLayout* /*sfh*/,
				const PX_ChangeRecord * pcr)
{
	// build new packet
	ChangeRecordSessionPacket * newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type

	// update internal state
	if (pcr->getType() == PX_ChangeRecord::PXT_GlobMarker) 
	{
		const PX_ChangeRecord_Glob * pcrg = static_cast<const PX_ChangeRecord_Glob *>(pcr);
		if (m_pGlobPacket) 
		{
			UT_return_val_if_fail(m_pGlobPacket->getPackets().size() > 0, true);
			UT_return_val_if_fail(m_pGlobPacket->getPackets()[0]->getClassType() == PCT_Glob_ChangeRecordSessionPacket, true);

			Glob_ChangeRecordSessionPacket* m_pOpeningGlobMarker = static_cast<Glob_ChangeRecordSessionPacket*>(m_pGlobPacket->getPackets()[0]);
			if (_isGlobEnd(m_pOpeningGlobMarker->m_iGLOBType, pcrg->getFlags())) 
			{	
				m_pGlobPacket->addPacket( newPacket );
				
				// push packet
				m_pAbiCollab->push( m_pGlobPacket );
				m_pAbiCollab->addChangeAdjust( new ChangeAdjust(
					*m_pGlobPacket, 
					(m_pAbiCollab->getActivePacket() ? m_pAbiCollab->getActivePacket()->getPos() : -1), 
					m_pDoc->getMyUUIDString()) 
					);

				// reset glob state
				DELETEP(m_pGlobPacket);
				m_pGlobPacket = 0;
				return true;
				
			} 
			else 
			{
				// not end of glob? then this must be at least true
				UT_return_val_if_fail(pcrg->getFlags() != PX_ChangeRecord_Glob::PXF_UserAtomicStart, false);
			}
		} 
		else 
		{
			m_pGlobPacket = new GlobSessionPacket( newPacket->getSessionId(), newPacket->getDocUUID() );
		}
	}

	_handleNewPacket( newPacket, pcr );
	return true;
}
Example #6
0
/*!
 * Implements the "insertStrux" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::insertStrux(PL_StruxFmtHandle /*sfh*/,
									const PX_ChangeRecord * pcr,
									PL_StruxDocHandle sdh,
									PL_ListenerId lid,
									void (* pfnBindHandles)(PL_StruxDocHandle sdhNew,
															PL_ListenerId lid,
															PL_StruxFmtHandle sfhNew))
{
	if(pfnBindHandles)
	{
		PL_StruxFmtHandle sfhNew = static_cast<PL_StruxFmtHandle>(this);
		pfnBindHandles(sdh,lid,sfhNew);
	}

	ChangeRecordSessionPacket* newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type
	_handleNewPacket( newPacket, pcr );
	return true;
}