Exemple #1
0
/*----------------------------------------------------------------------------*/
 RexxReturnCode REXXENTRY rx3270Sleep(PSZ Name, LONG Argc, RXSTRING Argv[],PSZ Queuename, PRXSTRING Retstr)
 {
	time_t end = time(0);

	switch(Argc)
	{
	case 0:
		end++;
		break;

	case 1:
		end += atoi(Argv[0].strptr);
		break;

	default:
		return RXFUNC_BADCALL;
	}

	Trace("Wait from %ld to %ld (CPS %ld)",(long) clock(),(long) end, (long) CLOCKS_PER_SEC);

	while(time(0) < end)
	{
		RunPendingEvents(1);
		if(IsHalted())
			return RetValue(Retstr,ECANCELED);
	}

	Trace("Sleep ended (clock: %ld)",(long) time(0));

	return RetValue(Retstr,0);
 }
/*
 * - Calls the on_update callback and updates the descendants.
 */
void
ParticleSystemParent::Update()
{
    if (IsExtinct() || IsHalted())
        return;

    if (IsDead() && m_Descendants.size() == 0)
    {
        m_Extinct = true;
        return;
    }

    // callback
    if (m_ScriptInterface.HasOnUpdate())
        m_ScriptInterface.OnUpdate();

    // update descendants
    std::list<Descendant>::iterator iter = m_Descendants.begin();

    while (iter != m_Descendants.end())
    {
        Descendant d = *iter;

        // update adopted descendant's body
        if (d.Type == ADOPTED)
            m_Updater(d.System->GetBody());

        // handle death
        if (!d.System->IsDead() && d.System->GetBody().Life <= 0)
            d.System->Kill(this);

        d.System->Update();

        // handle extinction
        if (d.System->IsExtinct())
        {
            if (d.Type == ADOPTED && !IsCursed() && !IsDead())
            {
                m_Initializer(m_Body, d.System->GetBody());
                d.System->Revive(this);
            }
            else
            {
                d.System->Release();
                iter = m_Descendants.erase(iter);
            }
        }

        if (iter != m_Descendants.end())
             ++iter;

    } // end update descendants
}
Exemple #3
0
 RexxReturnCode REXXENTRY rx3270WaitForFTComplete(PSZ Name, LONG Argc, RXSTRING Argv[], PSZ Queuename, PRXSTRING Retstr)
 {
 	if(Argc)
		return RXFUNC_BADCALL;

	while(GetFileTransferState() != FT_NONE)
	{
		RunPendingEvents(1);
		if(IsHalted())
				return RetValue(Retstr,ECANCELED);
	}

	return RetValue(Retstr,0);
 }