void CLanguageResource::OnPostInstall(bool update, bool modal) { if (!g_SkinInfo) return; if (IsInUse() || (!update && !modal && (HELPERS::ShowYesNoDialogText(CVariant{Name()}, CVariant{24132}) == DialogResponse::YES))) { if (IsInUse()) g_langInfo.SetLanguage(ID()); else CServiceBroker::GetSettings().SetString(CSettings::SETTING_LOCALE_LANGUAGE, ID()); } }
void Turret::Activate( HOBJECT hSender ) { if( IsInUse( ) || m_Damage.IsDead( )) return; if( m_swtDestroyedDeactivationDelay.IsStarted( )) { g_pLTServer->CPrint( "Activated with deactivation delay" ); } // Activating turret... m_hOperatingObject = hSender; CreateSpecialFX( true ); if( IsPlayer( m_hOperatingObject )) { // Change the players weapon to the turret weapon... CPlayerObj *pPlayer = dynamic_cast<CPlayerObj*>(g_pLTServer->HandleToObject( m_hOperatingObject )); pPlayer->SetOperatingTurret( *this, true ); } // Process any activation command we may have... if( !m_sActivateCommand.empty( )) { g_pCmdMgr->QueueCommand( m_sActivateCommand.c_str( ), hSender, m_hObject ); } SetNextUpdate( UPDATE_NEXT_FRAME ); }
void Turret::HandleDeactivateMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg ) { if( IsInUse( )) { Deactivate( ); } }
void FixedAlloc::Destroy() { // Free all of the blocks while (m_firstBlock) { #ifdef MMGC_MEMORY_PROFILER if(m_firstBlock->numAlloc > 0 && m_heap->GetStatus() != kMemAbort) { union { char* mem_c; uint32_t* mem; }; mem_c = m_firstBlock->items; unsigned int itemNum = 0; while(itemNum++ < m_itemsPerBlock) { if(IsInUse(m_firstBlock, mem)) { GCLog("Leaked %d byte item. Addr: 0x%p\n", GetItemSize(), GetUserPointer(mem)); PrintAllocStackTrace(GetUserPointer(mem)); } mem_c += m_itemSize; } } #ifdef MMGC_MEMORY_INFO //check for writes on deleted memory VerifyFreeBlockIntegrity(m_firstBlock->firstFree, m_firstBlock->size); #endif #endif FreeChunk(m_firstBlock); } m_firstBlock = NULL; }
bool Game_Vehicle::IsMovable() { if (!IsInUse()) return false; if (type == Airship && (IsAscending() || IsDescending())) return false; return !IsMoving(); }
void EQStreamProxy::ReleaseFromUse() { m_stream->ReleaseFromUse(); //this is so ugly, but I cant think of a better way to deal with //it right now... if(!IsInUse()) { delete this; } }
void CLanguageResource::OnPostInstall(bool update, bool modal) { if (IsInUse() || (!update && !modal && CGUIDialogYesNo::ShowAndGetInput(Name(), 24132))) { CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST); if (toast) { toast->ResetTimer(); toast->Close(true); } if (IsInUse()) g_langInfo.SetLanguage(ID()); else CSettings::Get().SetString(LANGUAGE_SETTING, ID()); } }
void CLanguageResource::OnPostInstall(bool update, bool modal) { if (IsInUse() || (!update && !modal && (HELPERS::ShowYesNoDialogText(CVariant{Name()}, CVariant{24132}) == DialogResponse::YES))) { CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST); if (toast) { toast->ResetTimer(); toast->Close(true); } if (IsInUse()) g_langInfo.SetLanguage(ID()); else CServiceBroker::GetSettings().SetString(CSettings::SETTING_LOCALE_LANGUAGE, ID()); } }
int CreateKey(pthread_key_t* result, void (*key_destructor)(void*)) { // Take the first unallocated key. for (int key = 0; key < BIONIC_TLS_SLOTS; ++key) { if (!IsInUse(key)) { SetInUse(key, key_destructor); *result = key; return 0; } } // We hit PTHREAD_KEYS_MAX. POSIX says EAGAIN for this case. return EAGAIN; }
/* * UseListGetObjects: Return a newly allocated list, which contains pointers * into given list inv. This new list contains those elements of inv that * are being used. */ list_type UseListGetObjects(list_type inv) { list_type l, new_list = NULL; object_node *obj; for (l = inv; l != NULL; l = l->next) { obj = (object_node *) l->data; if (IsInUse(obj->id)) new_list = list_add_item(new_list, l->data); } return new_list; }
void Turret::HandleActivateMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg ) { if( IsInUse( ) ) { if( m_hOperatingObject == hSender ) { Deactivate( ); } else { // Can't activate an occupied turret... return; } } else { Activate( hSender ); } }
void Game_Vehicle::Refresh() { if (IsInUse()) { SetMapId(Game_Map::GetMapId()); } else if (IsInCurrentMap()) { SetProcessed(true); // RPG_RT compatibility MoveTo(GetX(), GetY()); } switch (type) { case None: break; case Boat: case Ship: SetMoveSpeed(RPG::EventPage::MoveSpeed_normal); break; case Airship: SetMoveSpeed(RPG::EventPage::MoveSpeed_double); break; } }
void FixedAlloc::Destroy() { // Free all of the blocks while (m_firstBlock) { #ifdef MMGC_MEMORY_PROFILER if(m_firstBlock->numAlloc > 0 && m_heap->GetStatus() != kMemAbort) { union { char* mem_c; uint32_t* mem; }; mem_c = m_firstBlock->items; unsigned int itemNum = 0; while(itemNum++ < m_itemsPerBlock) { if(IsInUse(m_firstBlock, mem)) { // supress output in release build UNLESS the profiler is on #ifndef GCDEBUG if(m_heap->GetProfiler() != NULL) #endif { GCLog("Leaked %d byte item. Addr: 0x%p\n", GetItemSize(), GetUserPointer(mem)); PrintAllocStackTrace(GetUserPointer(mem)); } } mem_c += m_itemSize; } } #ifdef MMGC_MEMORY_INFO //check for writes on deleted memory VerifyFreeBlockIntegrity(m_firstBlock->firstFree, m_firstBlock->size); #endif #endif // Note, don't cache any state across this call; FreeChunk may temporarily // release locks held if the true type of this allocator is FixedAllocSafe. FreeChunk(m_firstBlock); } m_firstBlock = NULL; }
// Called from pthread_exit() to remove all TLS key data // from this thread's TLS area. This must call the destructor of all keys // that have a non-NULL data value and a non-NULL destructor. void CleanAll() { void** tls = __get_tls(); // Because destructors can do funky things like deleting/creating other // keys, we need to implement this in a loop. for (int rounds = PTHREAD_DESTRUCTOR_ITERATIONS; rounds > 0; --rounds) { size_t called_destructor_count = 0; for (int key = 0; key < BIONIC_TLS_SLOTS; ++key) { if (IsInUse(key)) { void* data = tls[key]; void (*key_destructor)(void*) = s_tls_map_.key_destructors[key]; if (data != NULL && key_destructor != NULL) { // we need to clear the key data now, this will prevent the // destructor (or a later one) from seeing the old value if // it calls pthread_getspecific() for some odd reason // we do not do this if 'key_destructor == NULL' just in case another // destructor function might be responsible for manually // releasing the corresponding data. tls[key] = NULL; // because the destructor is free to call pthread_key_create // and/or pthread_key_delete, we need to temporarily unlock // the TLS map Unlock(); (*key_destructor)(data); Lock(); ++called_destructor_count; } } } // If we didn't call any destructors, there is no need to check the TLS data again. if (called_destructor_count == 0) { break; } } }
void Turret::Deactivate( ) { if( !IsInUse( )) { DebugCPrint(1, "Deactivation failed!"); return; } CAutoMessage cMsg; cMsg.Writeuint8( MID_SFX_MESSAGE ); cMsg.Writeuint8( SFX_TURRET_ID ); cMsg.WriteObject( m_hObject ); cMsg.Writeuint8( kTurretFXMsg_Deactivate ); g_pLTServer->SendToClient( cMsg.Read( ), NULL, MESSAGE_GUARANTEED ); if( IsPlayer( m_hOperatingObject )) { // Change the players weapon to the turret weapon... CPlayerObj *pPlayer = dynamic_cast<CPlayerObj*>(g_pLTServer->HandleToObject( m_hOperatingObject )); pPlayer->SetOperatingTurret( *this, false ); } // Process any deactivation command we may have... if( !m_sDeactivateCommand.empty( )) { g_pCmdMgr->QueueCommand( m_sDeactivateCommand.c_str( ), m_hOperatingObject, m_hObject ); } m_hOperatingObject = NULL; CreateSpecialFX( false ); // [RP] NOTE: We still need to continually update to manually keep accurate positions. // Using attachments was causing issues of not being able to activate. Need to look // further into this. Once this issue is resolved we should not need to update if // the turret is deactivates. SetNextUpdate( /*UPDATE_NEVER*/ UPDATE_NEXT_FRAME ); }
//------------------------------------------------------------------------------ int CPosumStream::_fclose_nolock() { int result = EOF; if( this == 0 ) { errno = EINVAL; return EOF; } if( IsInUse() ) { // Stream is in use: //(1) flush stream //(2) free the buffer //(3) close the file //(4) delete the file if temporary result = _flush(); _freebuf(); if( _close( _fileno() ) < 0 ) { result = EOF; } else if( _tmpfname != NULL ) { //temporary file (i.e., one created by tmpfile() call). //delete, if necessary (don't have to on Windows NT because it was done by the system when the handle was closed). also, free up the heap block holding the pathname. free( _tmpfname ); _tmpfname = NULL; } } _flag = 0; return result; }
void Program::setUniformMatrix3(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) { assert(IsInUse()); glUniformMatrix3fv(uniform(name), count, transpose, v); }
void backlash::Program::Stop() const { assert(IsInUse()); glUseProgram(0); }
void backlash::Program::SetUniform(const GLchar* name, const glm::mat4& m, GLboolean transpose) { assert(IsInUse()); glUniformMatrix4fv(Uniform(name), 1, transpose, glm::value_ptr(m)); }
void backlash::Program::SetUniformMatrix4(const GLchar*name, const GLfloat* v, GLsizei count, GLboolean transpose) { assert(IsInUse()); glUniformMatrix4fv(Uniform(name), count, transpose, v); }
bool Game_Vehicle::IsAboard() const { return IsInUse() && Main_Data::game_player->IsAboard(); }
void Program::StopUsing() const { assert(IsInUse()); glUseProgram(0); }
void CUISoundsResource::OnPostInstall(bool update, bool modal) { if (IsInUse()) g_audioManager.Load(); }
void Program::setUniform(const GLchar* name, const glm::mat3& m, GLboolean transpose) { assert(IsInUse()); glUniformMatrix3fv(uniform(name), 1, transpose, glm::value_ptr(m)); }