예제 #1
0
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());
  }
}
예제 #2
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
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 );
}
예제 #3
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
void Turret::HandleDeactivateMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg )
{
	if( IsInUse( ))
	{
		Deactivate( );
	}
}
예제 #4
0
	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;
	}
예제 #5
0
bool Game_Vehicle::IsMovable() {
	if (!IsInUse())
		return false;
	if (type == Airship && (IsAscending() || IsDescending()))
		return false;
	return !IsMoving();
}
예제 #6
0
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;
	}
}
예제 #7
0
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());
  }
}
예제 #8
0
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());
  }
}
예제 #9
0
  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;
  }
예제 #10
0
/* 
 * 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;
}
예제 #11
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
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 );
	}
}
예제 #12
0
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;
	}
}
예제 #13
0
    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;
    }
예제 #14
0
  // 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;
      }
    }
  }
예제 #15
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
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 );
}
예제 #16
0
	//------------------------------------------------------------------------------
	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;
	}
예제 #17
0
void Program::setUniformMatrix3(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) {
    assert(IsInUse());
    glUniformMatrix3fv(uniform(name), count, transpose, v);
}
예제 #18
0
void backlash::Program::Stop() const {
    assert(IsInUse());
    glUseProgram(0);
}
예제 #19
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));
}
예제 #20
0
void backlash::Program::SetUniformMatrix4(const GLchar*name, const GLfloat* v, GLsizei count, GLboolean transpose) {
    assert(IsInUse());
    glUniformMatrix4fv(Uniform(name), count, transpose, v);
}
예제 #21
0
bool Game_Vehicle::IsAboard() const {
	return IsInUse() && Main_Data::game_player->IsAboard();
}
예제 #22
0
void Program::StopUsing() const
{
    assert(IsInUse());
    glUseProgram(0);
}
예제 #23
0
void CUISoundsResource::OnPostInstall(bool update, bool modal)
{
  if (IsInUse())
    g_audioManager.Load();
}
예제 #24
0
void Program::setUniform(const GLchar* name, const glm::mat3& m, GLboolean transpose) {
    assert(IsInUse());
    glUniformMatrix3fv(uniform(name), 1, transpose, glm::value_ptr(m));
}