本文整理汇总了C++中IsDead函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDead函数的具体用法?C++ IsDead怎么用?C++ IsDead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsDead函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
}
}
示例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 );
}
}
示例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;
}
示例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));
}
示例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 );
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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
}
示例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);
}
}
示例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;
}
示例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;
}