Beispiel #1
0
// this method is called when no players remains in battleground
void BattleGround::Reset()
{
    SetWinner(TEAM_NONE);
    SetStatus(STATUS_WAIT_QUEUE);
    SetStartTime(0);
    SetEndTime(0);

    m_Events = 0;

    // door-event2 is always 0
    m_ActiveEvents[BG_EVENT_DOOR] = 0;

    if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
        sLog.outError("BattleGround system: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde);

    m_InvitedAlliance = 0;
    m_InvitedHorde = 0;
    m_InBGFreeSlotQueue = false;

    m_Players.clear();

    for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
        delete itr->second;
    m_PlayerScores.clear();
}
Beispiel #2
0
int xmain(int argc, char **argv)
	{
    MuscleContext *ctx = getMuscleContext();
#if	WIN32
// Multi-tasking does not work well in CPU-bound
// console apps running under Win32.
// Reducing the process priority allows GUI apps
// to run responsively in parallel.
	SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
	ctx->muscle.g_argc = argc;
	ctx->muscle.g_argv = argv;

	SetNewHandler();
	SetStartTime();
	ProcessArgVect(argc - 1, argv + 1);
	SetParams();
	SetLogFile();

	//extern void TestSubFams(const char *);
	//TestSubFams(g_pstrInFileName);
	//return 0;

	if (ctx->params.g_bVersion)
		{
		printf(MUSCLE_LONG_VERSION "\n");
		exit(EXIT_SUCCESS);
		}

	if (!ctx->params.g_bQuiet)
		//Credits();

	if (MissingCommand() && isatty(0))
		{
		Usage();
		exit(EXIT_SUCCESS);
		}

	if (ctx->params.g_bCatchExceptions)
		{
		try
			{
			Run();
			}
		catch (...)
			{
			OnException();
			exit(EXIT_Except);
			}
		}
	else
		Run();

#ifdef _CRTDBG_MAP_ALLOC
    delete ctx;
    _CrtDumpMemoryLeaks(); //to Output window of MSVC
#endif

	exit(EXIT_Success);
	}
Beispiel #3
0
void DoMakeTree()
	{
	if (g_pstrInFileName.get() == 0 || g_pstrOutFileName.get() == 0)
		Quit("-maketree requires -in <msa> and -out <treefile>");

	SetStartTime();

	SetSeqWeightMethod(g_SeqWeight1.get());

	TextFile MSAFile(g_pstrInFileName.get());

	MSA msa;
	msa.FromFile(MSAFile);

	unsigned uSeqCount = msa.GetSeqCount();
	MSA::SetIdCount(uSeqCount);

// Initialize sequence ids.
// From this point on, ids must somehow propogate from here.
	for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
		msa.SetSeqId(uSeqIndex, uSeqIndex);
	SetMuscleInputMSA(msa);

	Progress("%u sequences", uSeqCount);

	Tree tree;
	TreeFromMSA(msa, tree, g_Cluster2.get(), g_Distance2.get(), g_Root2.get());

	TextFile TreeFile(g_pstrOutFileName.get(), true);
	tree.ToFile(TreeFile);

	Progress("Tree created");
	}
void FCurveSequence::PlayReverse( const float StartAtTime )
{
	bInReverse = true;

	// We start reversing NOW.
	SetStartTime(FSlateApplicationBase::Get().GetCurrentTime() - StartAtTime);
}
void FCurveSequence::JumpToEnd( )
{
	bInReverse = false;
	bIsLooping = false;
	bIsPaused = false;
	SetStartTime(FSlateApplicationBase::Get().GetCurrentTime() - TotalDuration);
}
Beispiel #6
0
void BattleGround::StartBattleGround()
{
    ///this method should spawn spirit guides and so on
    SetStartTime(0);

    SetLastResurrectTime(0);
}
Beispiel #7
0
void BattleGroundSA::ResetBattle(uint32 winner, Team teamDefending)
{
    Phase = SA_ROUND_TWO;
    shipsTimer = BG_SA_BOAT_START;
    shipsStarted = false;

    for (int32 i = 0; i < BG_SA_GATE_MAX; ++i)
        GateStatus[i] = BG_SA_GO_GATES_NORMAL;

    SetStartTime(0);
    defender = (teamDefending  == ALLIANCE) ?  HORDE : ALLIANCE;
    relicGateDestroyed = false;
    ToggleTimer();

    SetupShips();

    for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
    {
        Player *plr = sObjectMgr.GetPlayer(itr->first);

        if (!plr)
            continue;

        TeleportPlayerToCorrectLoc(plr, true);

        if (plr->GetBGTeam() == defender && plr->GetItemByEntry(39213) != NULL)
            plr->DestroyItemCount(39213, 1, true);
    }

    UpdatePhase();
    ResetWorldStates();
}
Beispiel #8
0
void ContrastDialog::OnGetBackgroundDB( wxCommandEvent & WXUNUSED(event))
{
   SetStartTime(mBackgroundStartT->GetTimeValue());
   SetEndTime(mBackgroundEndT->GetTimeValue());
   backgrounddB = GetDB();
   m_pButton_UseCurrentB->SetFocus();
   results();
}
void FCurveSequence::Play( const float StartAtTime )
{
	// Playing forward
	bInReverse = false;

	// We start playing NOW.
	SetStartTime(FSlateApplicationBase::Get().GetCurrentTime() - StartAtTime);
}
Beispiel #10
0
void ContrastDialog::OnGetForegroundDB( wxCommandEvent &event )
{
   SetStartTime(mForegroundStartT->GetTimeValue());
   SetEndTime(mForegroundEndT->GetTimeValue());
   foregrounddB = GetDB();
   m_pButton_UseCurrentF->SetFocus();
   results();
}
Beispiel #11
0
BOOL CObjectCommand_Action::Init(UINT uStartTime, INT nLogicCount, INT nActionID)
{
	SetStartTime(uStartTime);
	SetLogicCount(nLogicCount);
	m_nActionID		= INVALID_ID;

	SetCommandID(OBJECT_COMMAND_ACTION);
	return TRUE;
}
void Run()
	{
	SetStartTime();
	Log("Started %s\n", GetTimeAsStr());
	for (int i = 0; i < g_argc; ++i)
		Log("%s ", g_argv[i]);
	Log("\n");

#if	TIMING
	TICKS t1 = GetClockTicks();
#endif
	if (g_bRefine)
		Refine();
	else if (g_bRefineW)
		{
		extern void DoRefineW();
		DoRefineW();
		}
	else if (g_bProfDB)
		ProfDB();
	else if (g_bSW)
		Local();
	else if (0 != g_pstrSPFileName)
		DoSP();
	else if (g_bProfile)
		Profile();
	else if (g_bPPScore)
		PPScore();
	else if (g_bPAS)
		ProgAlignSubFams();
	else
		DoMuscle();

#if	TIMING
	extern TICKS g_ticksDP;
	extern TICKS g_ticksObjScore;
	TICKS t2 = GetClockTicks();
	TICKS TotalTicks = t2 - t1;
	TICKS ticksOther = TotalTicks - g_ticksDP - g_ticksObjScore;
	double dSecs = TicksToSecs(TotalTicks);
	double PctDP = (double) g_ticksDP*100.0/(double) TotalTicks;
	double PctOS = (double) g_ticksObjScore*100.0/(double) TotalTicks;
	double PctOther = (double) ticksOther*100.0/(double) TotalTicks;
	Log("                 Ticks     Secs    Pct\n");
	Log("          ============  =======  =====\n");
	Log("DP        %12ld  %7.2f  %5.1f%%\n",
	  (long) g_ticksDP, TicksToSecs(g_ticksDP), PctDP);
	Log("OS        %12ld  %7.2f  %5.1f%%\n",
	  (long) g_ticksObjScore, TicksToSecs(g_ticksObjScore), PctOS);
	Log("Other     %12ld  %7.2f  %5.1f%%\n",
	  (long) ticksOther, TicksToSecs(ticksOther), PctOther);
	Log("Total     %12ld  %7.2f  100.0%%\n", (long) TotalTicks, dSecs);
#endif

	ListDiagSavings();
	Log("Finished %s\n", GetTimeAsStr());
	}
Beispiel #13
0
BOOL CObjectCommand_Ability::Init(UINT uStartTime, INT nLogicCount, INT nAbilityID, INT nPrescriptionID, ObjID_t nTargetObjID)
{
	SetStartTime(uStartTime);
	SetLogicCount(nLogicCount);
	m_nAbilityID		= nAbilityID;
	m_nPrescriptionID	= nPrescriptionID;
	m_nTargetObjID		= nTargetObjID;
	m_uEndTime			= UINT_MAX;
	SetCommandID(OBJECT_COMMAND_ABILITY);
	return TRUE;
}
void FCurveSequence::PlayReverse( const TSharedRef<SWidget>& InOwnerWidget, bool bPlayLooped, const float StartAtTime )
{
	RegisterActiveTimerIfNeeded(InOwnerWidget);
	bIsLooping = bPlayLooped;
	bIsPaused = false;

	bInReverse = true;

	// We start reversing NOW.
	SetStartTime(FSlateApplicationBase::Get().GetCurrentTime() - StartAtTime);
}
Beispiel #15
0
void BattleGround::StartBattleGround()
{
    SetStartTime(0);

    // add BG to free slot queue
    AddToBGFreeSlotQueue();

    // add bg to update list
    // This must be done here, because we need to have already invited some players when first BG::Update() method is executed
    // and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes
    sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this);
}
Beispiel #16
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *phoneme - 
//-----------------------------------------------------------------------------
CPhonemeTag::CPhonemeTag( const char *phoneme )
{
	SetStartAndEndBytes( 0, 0 );

	SetStartTime( 0.0f );
	SetEndTime( 0.0f );

	SetSelected( false );

	SetPhonemeCode( 0 );

	m_szPhoneme = NULL;
	SetTag( phoneme );
}
Beispiel #17
0
MuscleParamsHelper::MuscleParamsHelper(TaskStateInfo& ti, MuscleContext *_ctx)
: ctx(_ctx), ugeneFileStub(ti)
{
    SetParams();

    //override some params. TODO: recheck possible conflict with SetPPScore() !
    ctx->progressPercent = &ti.progress;
    ctx->cancelFlag = &ti.cancelFlag;
    ctx->progress.g_fProgress = &ugeneFileStub; //log context
    ctx->progress.pr_printf = ugene_printf; //overriding logging
    ctx->params.g_uMaxMB = 0; //unlimited memory

    SetMaxIters(ctx->params.g_uMaxIters);
    SetStartTime();
}
Beispiel #18
0
bool
Instance::Move(short chan_id, const Time &t, const Time &d, bool display)
{
	if (startTime != t) {
		SetStartTime(t, display);
	}
	if (duration != d) {
		SetDuration(d, display);
	}
	if (chan_id >= 0 && chan_id < uberQua->nChannel) {
		Channel	*c = uberQua->channel[chan_id];
		SetChannel(c, display);
	}
	return true;
}
Beispiel #19
0
BOOL CObjectCommand_MagicSend::Init(UINT uStartTime,
									INT nLogicCount,
									INT nMagicID,
									ObjID_t nTargetID,
									const WORLD_POS *pTargetPos,
									FLOAT fTargetDir)
{
	SetStartTime(uStartTime);
	SetLogicCount(nLogicCount);
	m_nMagicID			= nMagicID;
	m_nTargetObjID		= nTargetID;
	m_posTarget			= *pTargetPos;
	m_fTargetDir		= fTargetDir;
	SetCommandID(OBJECT_COMMAND_MAGIC_SEND);
	return TRUE;
}
void FCurveSequence::Resume()
{
	if ( bIsPaused )
	{
		// Make sure the widget that owns the sequence is still valid
		auto PinnedOwner = OwnerWidget.Pin();
		if ( PinnedOwner.IsValid() )
		{
			bIsPaused = false;
			RegisterActiveTimerIfNeeded( PinnedOwner.ToSharedRef() );

			// Update the start time to be the same relative to the current time as it was when paused
			const double NewStartTime = FSlateApplicationBase::Get().GetCurrentTime() - ( PauseTime - StartTime );
			SetStartTime( NewStartTime );
		}
	}
}
void FCurveSequence::Reverse( )
{	
	// We've played this far into the animation.
	const float FractionCompleted = FMath::Clamp(GetSequenceTime() / TotalDuration, 0.0f, 1.0f);

	// We're going the other way now.
	bInReverse = !bInReverse;

	// CurTime is now; we cannot change that, so everything happens relative to CurTime.
	const double CurTime = FSlateApplicationBase::Get().GetCurrentTime();

	// Assume CurTime is constant (now).
	// Figure out when the animation would need to have started in order to keep
	// its place if playing in reverse.
	const double NewStartTime = CurTime - TotalDuration * (1 - FractionCompleted);
	SetStartTime(NewStartTime);
}
void UMovieSceneSection::TrimSection(float TrimTime, bool bTrimLeft)
{
	if (IsTimeWithinSection(TrimTime))
	{
		SetFlags(RF_Transactional);
		if (TryModify())
		{
			if (bTrimLeft)
			{
				SetStartTime(TrimTime);
			}
			else
			{
				SetEndTime(TrimTime);
			}
		}
	}
}
Beispiel #23
0
static void ThisAgentInit(EvalContext *ctx)
{
    umask(077);
    sprintf(VPREFIX, "cf-monitord");

    SetReferenceTime(ctx, false);
    SetStartTime();

    signal(SIGINT, HandleSignalsForDaemon);
    signal(SIGTERM, HandleSignalsForDaemon);
    signal(SIGHUP, SIG_IGN);
    signal(SIGPIPE, SIG_IGN);
    signal(SIGUSR1, HandleSignalsForDaemon);
    signal(SIGUSR2, HandleSignalsForDaemon);

    FORGETRATE = 0.6;

    MonitorInitialize();
}
Beispiel #24
0
BOOL CObjectCommand_MagicChannel::Init(UINT uStartTime,
									  INT nLogicCount,
									  INT nMagicID,
									  ObjID_t nTargetID,
									  const WORLD_POS *pTargetPos,
									  FLOAT fTargetDir,
									  UINT uTotalTime)
{
	SetStartTime(uStartTime);
	SetLogicCount(nLogicCount);
	m_nMagicID			= nMagicID;
	m_nTargetObjID		= nTargetID;
	m_posTarget			= *pTargetPos;
	m_fTargetDir		= fTargetDir;
	m_uTotalTime		= uTotalTime;
	m_uEndTime			= 0;
	SetCommandID(OBJECT_COMMAND_MAGIC_CHANNEL);
	return TRUE;
}
Beispiel #25
0
BOOL CObjectCommand_Move::Init(UINT uStartTime, INT nLogicCount, INT nNodeCount, const WORLD_POS *paposNode)
{
	Assert(m_paposNode == NULL);
	SetStartTime(uStartTime);
	SetLogicCount(nLogicCount);
	m_nNodeCount	= nNodeCount;
	if(m_nNodeCount > 0)
	{
		m_paposNode	= new WORLD_POS[m_nNodeCount];
		memcpy(m_paposNode, paposNode, m_nNodeCount * sizeof(WORLD_POS));
	}
	else
	{
		m_paposNode	= NULL;
	}

	SetCommandID(OBJECT_COMMAND_MOVE);
	return TRUE;
}
Beispiel #26
0
/*===================================================================*/
engine::engine(){
  net_comm = new MPIComm;
  mailbox = new MailBox(net_comm);
  SetStartTime();
  initComm();
  last_task_handle = 0;
  term_ok = TERMINATE_INIT;
  memory_policy = ENGINE_ALLOCATION;
  runMultiThread=true;
  dlb.initDLB();
  thread_model = 0;
  task_submission_finished=false;
  data_memory = NULL;
  thread_manager = NULL;
  LOG_INFO(LOG_MULTI_THREAD,"mpi tick :%f\n",MPI_Wtick());
  char fn[20];
  sprintf(fn,"comm_log_%02d.txt",me);
  comm_log=fopen(fn,"w");
  terminate_barrier = MPI_REQUEST_NULL;
  user_ctx = NULL;
  LOG_INFO(LOG_DATA,"Comm Log file : %s opened %p",fn,comm_log);
}
Beispiel #27
0
// this method is called when no players remains in battleground
void BattleGround::Reset()
{
    SetQueueType(MAX_BATTLEGROUND_QUEUES);
    SetWinner(WINNER_NONE);
    SetStatus(STATUS_WAIT_QUEUE);
    SetStartTime(0);
    SetEndTime(0);
    SetLastResurrectTime(0);

    m_Events = 0;

    if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
        sLog.outError("BattleGround system ERROR: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde);

    m_InvitedAlliance = 0;
    m_InvitedHorde = 0;

    m_Players.clear();
    m_PlayerScores.clear();

    // reset BGSubclass
    this->ResetBGSubclass();
}
OMX_ERRORTYPE Clock::SetConfig(
        OMX_INDEXTYPE nParamIndex, 
        OMX_PTR pStructure)
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;

    switch ((int)nParamIndex) {
        case OMX_IndexConfigTimeScale:
            ret = SetTimeScale((OMX_TIME_CONFIG_SCALETYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeClockState:
            ret = SetState((OMX_TIME_CONFIG_CLOCKSTATETYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeActiveRefClock:
            ret = SetRefClock((OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeCurrentAudioReference:
            ret = SetRefTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure, OMX_TIME_RefClockAudio);
            break;
        case OMX_IndexConfigTimeCurrentVideoReference:
            ret = SetRefTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure, OMX_TIME_RefClockVideo);
            break;
        case OMX_IndexConfigTimeMediaTimeRequest:
            ret = MediaTimeRequest((OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeClientStartTime:
            ret = SetStartTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeVideoLate:
            ret = SetVideoLate((OMX_TIME_CONFIG_TIMEVIDEOLATE*)pStructure);
        default :
            ret = OMX_ErrorUnsupportedIndex;
            break;
    }

    return ret;
}
void CDmeTimeFrame::SetTimeScale( float flScale, DmeTime_t scaleCenter, bool bChangeDuration )
{
#ifdef _DEBUG
    DmeTime_t preCenterTime = ToChildMediaTime( scaleCenter, false );
#endif

    float ratio = m_Scale / flScale;
    int t = scaleCenter.GetTenthsOfMS() - m_Start;

    if ( bChangeDuration )
    {
        int newDuration = int( m_Duration * ratio );

        if ( scaleCenter.GetTenthsOfMS() != m_Start )
        {
            int newStart = int( ( m_Start - scaleCenter.GetTenthsOfMS() ) * ratio + scaleCenter.GetTenthsOfMS() );
            SetStartTime( DmeTime_t( newStart ) );
        }

        int newStart = m_Start;
        int newOffset = int( ( t + m_Offset ) * ratio + newStart - scaleCenter.GetTenthsOfMS() );
        SetTimeOffset( DmeTime_t( newOffset ) );
        SetDuration( DmeTime_t( newDuration ) );
    }
    else
    {
        int newOffset = int( ( t + m_Offset ) * ratio - t );
        SetTimeOffset( DmeTime_t( newOffset ) );
    }

    SetTimeScale( flScale );

#ifdef _DEBUG
    DmeTime_t postCenterTime = ToChildMediaTime( scaleCenter, false );
    Assert( abs( preCenterTime - postCenterTime ) <= DMETIME_MINDELTA );
#endif
}
Beispiel #30
0
void BattleGroundSA::ResetBattle(uint32 winner, Team teamDefending)
{
    Phase = SA_ROUND_TWO;
    shipsTimer = 60000;
    shipsStarted = false;
  
    for (int32 i = 0; i <= BG_SA_GATE_MAX; ++i)
        GateStatus[i] = 1;

    SetStartTime(0);
    defender = (teamDefending  == ALLIANCE) ?  HORDE : ALLIANCE;
	relicGateDestroyed = false;
    ToggleTimer();

    SetupShips();

    for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
    {
        if (Player *plr = sObjectMgr.GetPlayer(itr->first))
            TeleportPlayerToCorrectLoc(plr, true);
    }

    UpdatePhase();
}