• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IsDead函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IsDead函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDead函数的具体用法?C++ IsDead怎么用?C++ IsDead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IsDead函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: UpdateGauge

void Game_Battler::UpdateGauge(int multiplier) {
	if (!Exists()) {
		if (IsDead()) {
			SetGauge(0);
		}
		return;
	}

	if (gauge > GetMaxGauge()) {
		return;
	}
	gauge += GetAgi() * multiplier;

	//printf("%s: %.2f\n", GetName().c_str(), ((float)gauge / EASYRPG_GAUGE_MAX_VALUE) * 100);
}
开发者ID:carstene1ns,项目名称:easyrpg-player,代码行数:15,代码来源:game_battler.cpp


示例2: GetStates

void Game_Battler::RemoveBattleStates() {
	std::vector<int16_t>& states = GetStates();

	// If death is non-permanent change HP to 1
	if (IsDead() &&
		non_permanent(1)) {
		ChangeHp(1);
	}

	for (size_t i = 0; i < states.size(); ++i) {
		if (non_permanent(i + 1)) {
			states[i] = 0;
		}
	}
}
开发者ID:Souigetsu,项目名称:Player,代码行数:15,代码来源:game_battler.cpp


示例3: tossSingleReduceStates

static void tossSingleReduceStates( a_state *state )
{
    a_shift_action *saction;
    a_sym *shift_sym;

    if( IsDead( state ) ) {
        return;
    }
    /* iterate over all shifts in the state */
    for( saction = state->trans; (shift_sym = saction->sym) != NULL; ++saction ) {
        if( saction->units_checked )
            continue;
        shiftToSingleReduce( state, saction );
    }
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:15,代码来源:elimunit.c


示例4: assert

bool Cell::ReadyToDivide()
{
    assert(!IsDead());
    if (mUndergoingApoptosis || HasCellProperty<ApoptoticCellProperty>())
    {
        return false;
    }

    // NOTE - we run the SRN model here first before the CCM
    mpSrnModel->SimulateToCurrentTime();
    // This in turn runs any simulations within the CCM through ReadyToDivide();
    mCanDivide = mpCellCycleModel->ReadyToDivide();

    return mCanDivide;
}
开发者ID:Chaste,项目名称:Old-Chaste-svn-mirror,代码行数:15,代码来源:Cell.cpp


示例5: SetDead

void C4Effect::ClearAll(int32_t iClearFlag)
{
	// simply remove access all effects recursively, and do removal calls
	// this does not regard lower-level effects being added in the removal calls,
	// because this could hang the engine with poorly coded effects
	if (pNext) pNext->ClearAll(iClearFlag);
	if ((Target && !Target->Status) || IsDead()) return;
	int32_t iPrevPrio = iPriority;
	SetDead();
	if (CallStop(iClearFlag, false) == C4Fx_Stop_Deny)
	{
		// this stop-callback might have deleted the object and then denied its own removal
		// must not modify self in this case...
		if (Target && !Target->Status) return;
		// effect denied to be removed: recover it
		iPriority = iPrevPrio;
	}
	// Update OnFire cache
	if (Target && WildcardMatch(C4Fx_AnyFire, GetName()) && IsDead())
		if (!Get(C4Fx_AnyFire))
			Target->SetOnFire(false);
	if (IsDead() && !GetCallbackScript())
		Call(P_Destruction, &C4AulParSet(iClearFlag));
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:24,代码来源:C4Effect.cpp


示例6: HandlePassengerKey

void CLocalPlayer::HandlePassengerKey( void )
{
	// Are we spawned and not dead and not already in a vehicle?
	if( IsSpawned() && !IsDead() && !m_pVehicle )
	{
		//
		CNetworkVehicle * pVehicle = NULL;
		EntityId seat = 0;

		// Get the closest vehicle in range
		GetClosestVehicle( &pVehicle, &seat );

		CLogFile::Printf( "CLocalPlayer::HandlePassengerKey() - Vehicle: 0x%p, Seat: %d", pVehicle, seat );

		// Did we get a closest vehicle and a seat?
		if( pVehicle && seat )
		{
			// Get the old control state
			bOldControlState = AreControlsLocked();

			// Get the old camera lock state
			bOldCameraState = pCore->GetCamera()->IsLocked();

			CLogFile::Printf( "CLocalPlayer::HandlePassengerKey() - bOldControlState: %s, bOldCameraState: %s", (bOldControlState ? "true" : "false"), (bOldCameraState ? "true" : "false") );

			// Lock the player controls
			LockControls( true );

			// Set the player state
			SetState( PLAYERSTATE_PASSENGER );

			CLogFile::Printf( "CLocalPlayer::HandlePassengerKey() - Putting player in passenger seat..." );

			// Get in the vehicle
			PutInVehicle( pVehicle, seat );

			CLogFile::Printf( "CLocalPlayer::HandlePassengerKey() - Done!" );

			// Unlock camera control
			if( !bOldCameraState ) // checking this because after we put in vehicle, it locks control :(
				pCore->GetCamera()->LockControl( false );

			// Reset the controls
			//*(DWORD *)(m_pPlayerPed->GetPed() + 0x310) = 6;
			//LockControls( bState );
		}
	}
}
开发者ID:DarkKlo,项目名称:maf2mp,代码行数:48,代码来源:CLocalPlayer.cpp


示例7: float

void Player::Update(double currentTime, double elapsedTime)
{
    float current = float(currentTime);
    float elapsed = float(elapsedTime);

    if (IsDead())
    {
        TimeUntilRespawn     -= elapsed;
        if (TimeUntilRespawn <= 0.0f)
        {
            // respawn the player.
            Velocity[0]       = 0.0f;
            Velocity[1]       = 0.0f;
            Position[0]       = ViewportWidth  * 0.5f;
            Position[1]       = ViewportHeight * 0.5f;
            TargetPoint[0]    = ViewportWidth  * 0.5f;
            TargetPoint[1]    = ViewportHeight * 0.5f;
            TargetVector[0]   = 0.0f;
            TargetVector[1]   = 0.0f;
            TimeUntilRespawn  = 0.0f;
        }
    }
    else
    {
        Position[0] += Velocity[0];
        Position[1] += Velocity[1];
        Position[0]  = clamp(Position[0], 0, ViewportWidth);
        Position[1]  = clamp(Position[1], 0, ViewportHeight);

        if (CooldownRemaining > 0.0f)
        {
            CooldownRemaining -= elapsed;
        }
        else
        {
            float cos_a = cosf(Orientation);
            float sin_a = sinf(Orientation);
            float vel_x = 11.0f * cos_a;
            float vel_y = 11.0f * sin_a;
            float pos_x = Position[0];
            float pos_y = Position[1];
            Bullet *ent = new Bullet(pos_x, pos_y, vel_x, vel_y);
            EntityManager::GetInstance()->Add(ent);
            CooldownRemaining  = COOLDOWN_TIME;
        }
    }
    UNUSED_LOCAL(current);
}
开发者ID:russellklenk,项目名称:gwbase,代码行数:48,代码来源:player.cpp


示例8: PlayerRunHandler

void Player::PlayerRunHandler(Packet* poPacket)
{
	if (IsDead() || GetScene() == NULL)
	{
		XLog(LEVEL_ERROR, "%s can not run: dead:%d scene:%s\n", m_sName, m_bDead, m_poScene ? "true" : "NULL");
		return;
	}
	uint16_t uPosX = 0;
	uint16_t uPosY = 0;
	int16_t nSpeedX = 0;
	int16_t nSpeedY = 0;
	uint32_t uClientMSTime = 0;
	g_oPKReader.SetPacket(poPacket);
	g_oPKReader >> uPosX >> uPosY >> nSpeedX >> nSpeedY >> uClientMSTime;
	//客户端提供的时间值必须大于起始时间值
	if (uClientMSTime < m_nClientRunStartMSTime)
	{
		XLog(LEVEL_ERROR,  "%s sync pos: start run client time invalid\n", m_sName);
		Actor::SendSyncPosition();
		return;
	}
	MapConf* poMapConf = m_poScene->GetMapConf();
	if (uPosX >= poMapConf->nPixelWidth
		|| uPosY >= poMapConf->nPixelHeight
		|| poMapConf->IsBlockUnit(uPosX/gnUnitWidth, uPosY/gnUnitHeight))
	{
		XLog(LEVEL_ERROR, "%s sync pos: start run pos invalid\n", m_sName);
		Actor::SendSyncPosition();
		return;
	}
	//正在移动则先更新移动后的新位置
	if (m_nRunStartMSTime > 0)
	{
		Actor::UpdateRunState(m_nRunStartMSTime + uClientMSTime - m_nClientRunStartMSTime);
	}
	//客户端与服务器坐标误差在一定范围内,则以客户端坐标为准
	if (!BattleUtil::IsAcceptablePositionFaultBit(m_oPos.x, m_oPos.y, uPosX, uPosY))
	{
		XLog(LEVEL_ERROR, "%s sync pos: start run faultbit srv:(%d, %d) clt:(%d,%d)\n", m_sName, m_oPos.x, m_oPos.y, uPosX, uPosY);
		uPosX = (uint16_t)m_oPos.x;
		uPosY = (uint16_t)m_oPos.y;
		Actor::SendSyncPosition();
	}
	Actor::SetPos(Point(uPosX, uPosY), __FILE__, __LINE__);
	
	m_nClientRunStartMSTime = uClientMSTime;
	Actor::StartRun(nSpeedX, nSpeedY);
}
开发者ID:txal,项目名称:XProject,代码行数:48,代码来源:Player.cpp


示例9: Update

void Player::Update(uint32_t diff)
{
    m_session->Update(diff);

    if (!IsUpdateEnabled())
        return;

    if (IsMoving() && !IsDead())
    {
        float dx = cos(GetMoveAngle())*diff*m_playerSpeed;
        float dy = sin(GetMoveAngle())*diff*m_playerSpeed;

        Position plpos(m_position.x + dx, m_position.y + dy);
        Relocate(plpos, true);
    }
}
开发者ID:MartinUbl,项目名称:kiv-ups-agarserver,代码行数:16,代码来源:Player.cpp


示例10: KillProcess

void PythonInterpCtrl::KillProcess()
{
    if(IsDead())
        return;
    if(m_killlevel==0)
    {
        SendKill();
        m_killlevel=1;
        return;
    }
    if(m_killlevel==1)
    {
        m_pyinterp->KillProcess();
        return;
    }
}
开发者ID:KinKir,项目名称:codeblocks-python,代码行数:16,代码来源:PythonInterpCtrl.cpp


示例11: OnDamage

bool Ship::OnDamage(Object *attacker, float kgDamage)
{
	if (!IsDead()) {
		float dam = kgDamage*0.001f;
		if (m_stats.shield_mass_left > 0.0f) {
			if (m_stats.shield_mass_left > dam) {
				m_stats.shield_mass_left -= dam;
				dam = 0;
			} else {
				dam -= m_stats.shield_mass_left;
				m_stats.shield_mass_left = 0;
			}
		}

		m_stats.hull_mass_left -= dam;
		if (m_stats.hull_mass_left < 0) {
			if (attacker) {
				if (attacker->IsType(Object::BODY)) {
					// XXX remove this call. kill stuff (including elite rating) should be in a script
					static_cast<Body*>(attacker)->OnHaveKilled(this);
					LuaEvent::Queue("onShipDestroyed", this, dynamic_cast<Body*>(attacker));
				}

				if (attacker->IsType(Object::SHIP))
					Polit::NotifyOfCrime(static_cast<Ship*>(attacker), Polit::CRIME_MURDER);
			}

			Explode();
		}

		else {
			if (attacker && attacker->IsType(Object::SHIP))
				Polit::NotifyOfCrime(static_cast<Ship*>(attacker), Polit::CRIME_PIRACY);

			if (Pi::rng.Double() < kgDamage)
				Sfx::Add(this, Sfx::TYPE_DAMAGE);

			if (dam < 0.01 * float(GetShipType().hullMass))
				Sound::BodyMakeNoise(this, "Hull_hit_Small", 1.0f);
			else
				Sound::BodyMakeNoise(this, "Hull_Hit_Medium", 1.0f);
		}
	}

	//printf("Ouch! %s took %.1f kilos of damage from %s! (%.1f t hull left)\n", GetLabel().c_str(), kgDamage, attacker->GetLabel().c_str(), m_stats.hull_mass_left);
	return true;
}
开发者ID:Metamartian,项目名称:pioneer,代码行数:47,代码来源:Ship.cpp


示例12: Warning

bool CHL2MP_Player::HandleCommand_JoinTeam( int team )
{
#ifndef GE_DLL
    if ( !GetGlobalTeam( team ) || team == 0 )
    {
        Warning( "HandleCommand_JoinTeam( %d ) - invalid team index.\n", team );
        return false;
    }

    if ( team == TEAM_SPECTATOR )
    {
        // Prevent this is the cvar is set
        if ( !mp_allowspectators.GetInt() )
        {
            ClientPrint( this, HUD_PRINTCENTER, "#Cannot_Be_Spectator" );
            return false;
        }

        if ( GetTeamNumber() != TEAM_UNASSIGNED && !IsDead() )
        {
            m_fNextSuicideTime = gpGlobals->curtime;	// allow the suicide to work

            CommitSuicide();

            // add 1 to frags to balance out the 1 subtracted for killing yourself
            IncrementFragCount( 1 );
        }

        ChangeTeam( TEAM_SPECTATOR );

        return true;
    }
    else
    {
        StopObserverMode();
        State_Transition(STATE_ACTIVE);
    }

    // Switch their actual team...
    ChangeTeam( team );

    return true;
#else
    return false;
#endif
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:46,代码来源:hl2mp_player.cpp


示例13: AddState

void Game_Battler::AddState(int state_id) {
	const RPG::State* state = ReaderUtil::GetElement(Data::states, state_id);
	if (!state) {
		Output::Warning("AddState: Can't add state with invalid ID %d", state_id);
		return;
	}

	if (IsDead()) {
		return;
	}
	if (state_id == 1) {
		SetGauge(0);
		RemoveAllStates();
		SetCharged(false);
		SetHp(0);
		SetAtkModifier(0);
		SetDefModifier(0);
		SetSpiModifier(0);
		SetAgiModifier(0);
		SetIsDefending(false);
		SetCharged(false);
		attribute_shift.clear();
		attribute_shift.resize(Data::attributes.size());
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= static_cast<int>(states.size())) {
		states.resize(state_id);
	}

	states[state_id - 1] = 1;

	// Clear states that are more than 10 priority points below the
	// significant state
	const RPG::State* sig_state = GetSignificantState();

	for (size_t i = 0; i < states.size(); ++i) {
		if (Data::states[i].priority <= sig_state->priority - 10) {
			states[i] = 0;
		}
	}

	if (IsDefending() && GetSignificantRestriction() != RPG::State::Restriction_normal) {
		SetIsDefending(false);
	}
}
开发者ID:carstene1ns,项目名称:easyrpg-player,代码行数:46,代码来源:game_battler.cpp


示例14: server_dopacket

/** Handle received data from a directly connected server.
 * @param[in] cptr Peer server that sent us data.
 * @param[in] buffer Input buffer.
 * @param[in] length Number of bytes in input buffer.
 * @return 1 on success or CPTR_KILLED if the client is squit.
 */
int server_dopacket(struct Client* cptr, const char* buffer, int length)
{
  const char* src;
  char*       endp;
  char*       client_buffer;

  assert(0 != cptr);

  update_bytes_received(cptr, length);

  client_buffer = cli_buffer(cptr);
  endp = client_buffer + cli_count(cptr);
  src = buffer;

  while (length-- > 0) {
    *endp = *src++;
    /*
     * Yuck.  Stuck.  To make sure we stay backward compatible,
     * we must assume that either CR or LF terminates the message
     * and not CR-LF.  By allowing CR or LF (alone) into the body
     * of messages, backward compatibility is lost and major
     * problems will arise. - Avalon
     */
    if (IsEol(*endp)) {
      if (endp == client_buffer)
        continue;               /* Skip extra LF/CR's */
      *endp = '\0';

      update_messages_received(cptr);

      if (parse_server(cptr, cli_buffer(cptr), endp) == CPTR_KILLED)
        return CPTR_KILLED;
      /*
       *  Socket is dead so exit
       */
      if (IsDead(cptr))
        return exit_client(cptr, cptr, &me, cli_info(cptr));
      endp = client_buffer;
    }
    else if (endp < client_buffer + BUFSIZE)
      ++endp;                   /* There is always room for the null */
  }
  cli_count(cptr) = endp - cli_buffer(cptr);
  return 1;
}
开发者ID:Niichan,项目名称:snircd,代码行数:51,代码来源:packet.c


示例15: wxWidgets

long PythonInterpCtrl::LaunchProcess(const wxString &processcmd, const wxArrayString &options) // bool ParseLinks, bool LinkClicks, const wxString &LinkRegex
{
    if(!IsDead())
        return -1;
//TODO: Option to use XMLRPC over localhost or pipe, currently always use pipe
//    m_port=m_portalloc.RequestPort(); //TODO: Request port limited to 3 ports
//    if(m_port<0)
//        return -1;
    m_port = -1; //Use XmlRpc over pipe
    //TODO: get the command and working dir from config
#ifdef __WXMSW__
//    wxString cmd=_T("cmd /c interp.py ")+wxString::Format(_T(" %i"),m_port); //TODO: this could have process destruction issues on earlier version of wxWidgets (kills cmd, but not python)
    wxString cmd=_T("python -u interp.py ")+wxString::Format(_T(" %i"),m_port); //TODO: this could have process destruction issues on earlier version of wxWidgets (kills cmd, but not python)
    wxString python=_T("\\python");
    wxString interp=_T("\\interp.py");
#else
    wxString cmd=_T("python -u interp.py ")+wxString::Format(_T(" %i"),m_port);
    wxString python=_T("/python");
    wxString interp=_T("/interp.py");
#endif
    wxString gpath = ConfigManager::GetDataFolder(true)+python;
    wxString lpath = ConfigManager::GetDataFolder(false)+python;
    bool global=false,local=false;
    if(wxFileName::FileExists(gpath+interp))
    {
        wxSetWorkingDirectory(gpath);
        global=true;
    }
    if(wxFileName::FileExists(lpath+interp))
    {
        wxSetWorkingDirectory(lpath);
        local=true;
    }
    if(!global&&!local) //No interpreter script found, return failure.
        return -2; //TODO: Return meaningful messages (or at least use the codeblocks logger)

    m_pyinterp = new XmlRpcInstance(cmd,m_port,_T("localhost"),this);
    if(m_pyinterp->IsDead())
    {
        Manager::Get()->GetLogManager()->Log(_("Error Starting Interpreter"));
        return -1;
    }
    //TODO: Perform any initial communication with the running python process...
    return 1;
}
开发者ID:KinKir,项目名称:codeblocks-python,代码行数:45,代码来源:PythonInterpCtrl.cpp


示例16: Update

VOID CPlayer::Update(float nLoopTime)
{
    static float nStarttime=0;
	static int nOldState=STAND;
    nStarttime+=nLoopTime;

	if (IsDead())
	{
		m_nState=DEAD;
	}
	if (nOldState!=m_nState)
	{
		m_pPlayerMesh->SetAnimationNum(m_nState);
		nStarttime=0;
		nOldState=m_nState;
	}

	if (m_nState==DEAD)
	{
		if (nStarttime>m_fAnimPeriod[m_nState]-0.1)
		{
			return;
		}
	}


	if (m_bControl)
	{
		if (nStarttime>m_fAnimPeriod[m_nState])
		{
			nStarttime=0;
			m_bControl=false;
		}
	}
	else
	{
		if (m_bGTarget)
		{
			m_nState=READYATTACK;
		}
		else
			m_nState=STAND;
	}
		m_pPlayerMesh->Update(nLoopTime); 	
}
开发者ID:wang35666,项目名称:3dgame,代码行数:45,代码来源:Player.cpp


示例17: GetStates

void Game_Battler::RemoveState(int state_id) {
	const RPG::State* state = ReaderUtil::GetElement(Data::states, state_id);
	if (!state) {
		Output::Warning("RemoveState: Can't delete state with invalid ID %d", state_id);
		return;
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= static_cast<int>(states.size())) {
		return;
	}

	if (state_id == 1 && IsDead()) {
		SetHp(1);
	}

	states[state_id - 1] = 0;
}
开发者ID:carstene1ns,项目名称:easyrpg-player,代码行数:18,代码来源:game_battler.cpp


示例18: get_def_use_mgr

bool AggressiveDCEPass::IsTargetDead(Instruction* inst) {
  const uint32_t tId = inst->GetSingleWordInOperand(0);
  Instruction* tInst = get_def_use_mgr()->GetDef(tId);
  if (IsAnnotationInst(tInst->opcode())) {
    // This must be a decoration group. We go through annotations in a specific
    // order. So if this is not used by any group or group member decorates, it
    // is dead.
    assert(tInst->opcode() == SpvOpDecorationGroup);
    bool dead = true;
    get_def_use_mgr()->ForEachUser(tInst, [&dead](Instruction* user) {
      if (user->opcode() == SpvOpGroupDecorate ||
          user->opcode() == SpvOpGroupMemberDecorate)
        dead = false;
    });
    return dead;
  }
  return IsDead(tInst);
}
开发者ID:MikePopoloski,项目名称:bgfx,代码行数:18,代码来源:aggressive_dead_code_elim_pass.cpp


示例19:

/**
 * 如果当前线程存在 Isolate 对象, 表示已经初始化过了
 */
bool V8::Initialize() {
    Isolate *isolate = Isolate::UncheckedCurrent();
    if (isolate != NULL && isolate->IsInitialized()) {
        return true;
    }

    Isolate::EnterDefaultIsolate();

    if (IsDead()) return false;

    isolate = Isolate::Current();
    if (isolate->IsInitialized()) return true;

    is_running_ = true;
    has_been_set_up_ = true;

    return isolate->Init();
}
开发者ID:jianglu,项目名称:dukv8,代码行数:21,代码来源:utility.cpp


示例20: Update

void CEnemy::Update(float fElapsedTime)
{
	// DANIEL CODE BEGIN
	if(IsDead())
	{
		if((timeGetTime() - m_dwDeadTimeStamp) > (m_fRespawnTime * 1000))
		{
			Ressurect();

			SetPosX(m_ptRespawnPosition.x);
			SetPosY(m_ptRespawnPosition.y);
		}
	}
	// DANIEL CODE END
	else
	{
		CBaseCharacter::Update(fElapsedTime);
	}
}
开发者ID:namlunthkl,项目名称:team4-trynity,代码行数:19,代码来源:CEnemy.cpp



注:本文中的IsDead函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsDebuggerPresent函数代码示例发布时间:2022-05-30
下一篇:
C++ IsDBCSLeadByte函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap