/*---------------------------------------------------------------------- | PLT_ThreadTask::Run +---------------------------------------------------------------------*/ void PLT_ThreadTask::Run() { m_Started.SetValue(1); // wait before starting task if necessary if ((float)m_Delay > 0.f) { // more than 100ms, loop so we can abort it if ((float)m_Delay > 0.1f) { NPT_TimeStamp start, now; NPT_System::GetCurrentTimeStamp(start); do { NPT_System::GetCurrentTimeStamp(now); if (now >= start + m_Delay) break; } while (!IsAborting(100)); } else { NPT_System::Sleep(m_Delay); } } // loop if (!IsAborting(0)) { DoInit(); DoRun(); } // notify the Task Manager we're done // it will destroy us if m_AutoDestroy is true if (m_TaskManager) { m_TaskManager->RemoveTask(this); } else if (m_AutoDestroy) { // destroy ourselves otherwise delete this; } }
bool FLiveEditorManager::Activate( const FString &Name ) { RealWorld = GWorld; check( LiveEditorWorld != NULL ); GWorld = LiveEditorWorld; bool bSuccess = false; UBlueprint *Blueprint = LoadObject<UBlueprint>( NULL, *Name, NULL, 0, NULL ); if( Blueprint != NULL && Blueprint->GeneratedClass != NULL && Blueprint->GeneratedClass->IsChildOf( ULiveEditorBlueprint::StaticClass() ) ) { FActiveBlueprintRecord Record; Record.Name = Name; auto Instance = NewObject<ULiveEditorBlueprint>(GetTransientPackage(), Blueprint->GeneratedClass, NAME_None, RF_Transient | RF_Public | RF_RootSet | RF_Standalone); Instance->DoInit(); Record.Blueprint = Instance; ActiveBlueprints.Add( Record ); bSuccess = true; } GWorld = RealWorld; RealWorld = NULL; return bSuccess; }
func InitializePlayer(int plr) { // Scenario init if (!g_is_initialized) g_is_initialized = DoInit(plr); // Move clonks to location and give them a shovel. var index = 0, crew; while (crew = GetCrew(plr, index)) { var x = 150 + Random(50); crew->SetPosition(x , 400); crew->CreateContents(Shovel); // one clonk can construct, another can mine. if (index == 1) { crew->CreateContents(Hammer); crew->CreateContents(Wood,4); crew->CreateContents(Metal); } else { crew->CreateContents(Axe); crew->CreateContents(Wood,3); crew->CreateContents(Metal,2); } index++; } return; }
/*---------------------------------------------------------------------- | PLT_ThreadTask::Run +---------------------------------------------------------------------*/ void PLT_ThreadTask::Run() { // NPT_TimeStamp now; // NPT_System::GetCurrentTimeStamp(now); // NPT_System::SetRandomSeed(now.m_NanoSeconds); if (m_Delay) { NPT_TimeStamp start, now; NPT_System::GetCurrentTimeStamp(start); do { NPT_System::GetCurrentTimeStamp(now); if (now >= start + m_Delay) break; } while(!IsAborting(100)); } if (!IsAborting(0)) { DoInit(); DoRun(); } if (m_TaskManager) { m_TaskManager->RemoveTask(this); } }
// NB: this function has (desired) side effect of changing current locale bool wxLocale::Init(const wxString& name, const wxString& shortName, const wxString& locale, bool bLoadDefault #if WXWIN_COMPATIBILITY_2_8 ,bool WXUNUSED_UNLESS_DEBUG(bConvertEncoding) #endif ) { #if WXWIN_COMPATIBILITY_2_8 wxASSERT_MSG( bConvertEncoding, wxS("wxLocale::Init with bConvertEncoding=false is no longer supported, add charset to your catalogs") ); #endif bool ret = DoInit(name, shortName, locale); // NB: don't use 'lang' here, 'language' may be wxLANGUAGE_DEFAULT wxTranslations *t = wxTranslations::Get(); if ( t ) { t->SetLanguage(shortName); if ( bLoadDefault ) t->AddStdCatalog(); } return ret; }
bool C4AbstractApp::Init(int argc, char * argv[]) { // Set locale setlocale(LC_ALL,""); gtk_init(&argc, &argv); GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/org/openclonk/engine/oc.ico", NULL); gtk_window_set_default_icon(icon); g_object_unref(icon); // Try to figure out the location of the executable Priv->argc=argc; Priv->argv=argv; #ifdef GDK_WINDOWING_X11 Display * const dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default()); int xrandr_error_base; if (!XRRQueryExtension(dpy, &Priv->xrandr_event, &xrandr_error_base) || !XRRQueryVersion(dpy, &Priv->xrandr_major_version, &Priv->xrandr_minor_version)) { Priv->xrandr_major_version = -1; Priv->xrandr_minor_version = 0; } if (Priv->xrandr_major_version >= 0) { XRRSelectInput(dpy, DefaultRootWindow(dpy), RRScreenChangeNotifyMask); } else Log("The Xrandr extension is missing. Resolution switching will not work."); #endif // Custom initialization return DoInit (argc, argv); }
// ---------------------------------------------------------------------------- void vHavokConstraintChainRendererBase::CommonInit() { CommonDeinit(); if (!DoInit()) CommonDeinit(); }
void Embperl::Reinit() { in_use = true; PL_perl_destruct_level = 1; perl_destruct(my_perl); DoInit(); in_use = false; }
bool EventWatcher::Init() { if (!DoInit()) { return false; } event_base_set(event_base_, &event_); return true; }
bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) { struct lsdev *p; DoInit(); /* Start the Low Speed Timer */ chMtxLock(&gadcmutex); if (!gtimerIsActive(&LowSpeedGTimer)) gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE); /* Find a slot */ for(p = ls; p < &ls[GADC_MAX_LOWSPEED_DEVICES]; p++) { if (!(p->flags & GADC_FLG_ISACTIVE)) { /* We know we have a slot - this should never wait anyway */ chSemWaitTimeout(&gadcsem, TIME_IMMEDIATE); p->lld.physdev = physdev; p->lld.buffer = buffer; p->fn = fn; p->param = param; p->flags = GADC_FLG_ISACTIVE; chMtxUnlock(); StartADC(FALSE); return TRUE; } } chMtxUnlock(); return FALSE; }
GSourceHandle gadcHighSpeedGetSource(void) { DoInit(); if (!gtimerIsActive(&HighSpeedGTimer)) gtimerStart(&HighSpeedGTimer, HighSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE); hs.flags |= GADC_FLG_GTIMER; return (GSourceHandle)&HighSpeedGTimer; }
TInt TIoConfig::Init() { LtkUtils::CIniFile* iniFile = NULL; TRAPD(ret, iniFile = LtkUtils::CIniFile::NewL(KConfigFileName, KConfigDescriptionFile)); if (ret == KErrNone) ret = DoInit(iniFile); delete iniFile; return ret; }
Embperl::Embperl() { char **argv = (char **)argv_eqemu; char **env = { nullptr }; in_use = true; //in case one of these files generates an event PERL_SYS_INIT3(&argc, &argv, &env); DoInit(); }
bool C4AbstractApp::Init(int argc, char * argv[]) { // Set locale setlocale(LC_ALL,""); // Custom initialization return DoInit (argc, argv); }
void gadcHighSpeedSetBSem(BinarySemaphore *pbsem, GEventADC *pEvent) { DoInit(); /* Use the system lock to ensure they occur atomically */ chSysLock(); hs.pEvent = pEvent; hs.bsem = pbsem; chSysUnlock(); }
EQWParser::EQWParser() { //setup perl... my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) _log(WORLD__PERL_ERR, "Error: perl_alloc failed!"); else DoInit(); }
//--------------------------------------------------------------------------- void TFileMasks::Clear() { DoInit(true); for (intptr_t Index = 0; Index < 4; ++Index) { Clear(FMasks[Index]); } }
EQWParser::EQWParser() { //setup perl... my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) Log.Out(Logs::Detail, Logs::World_Server, "Error: perl_alloc failed!"); else DoInit(); }
virtual void Init( bool isFirstInit ) { // Do nothing here on first init, because we need to use the more complicated version below // to properly init the object if (!isFirstInit) { DoInit(isFirstInit); } }
void SjPlayer::Init() { if( !m_isInitialized ) { m_isInitialized = true; m_queue.Init(); DoInit(); // LoadSettings() should be called by the caller, if needed } }
Embperl::Embperl() { in_use = true; //in case one of these files generates an event //setup perl... my_perl = perl_alloc(); if(!my_perl) throw "Failed to init Perl (perl_alloc)"; DoInit(); }
//--------------------------------------------------------------------------- void TFileMasks::Init() { FForceDirectoryMasks = -1; for (intptr_t Index = 0; Index < 4; ++Index) { FMasksStr[Index] = nullptr; } DoInit(false); }
void gadcHighSpeedStart(void) { DoInit(); /* If its already going we don't need to do anything */ if (hs.flags & GADC_FLG_ISACTIVE) return; gadc_lld_start_timer(hs.lld.physdev, hs.frequency); hs.flags = GADC_FLG_ISACTIVE; StartADC(FALSE); }
void Embperl::Reinit() { in_use = true; PERL_SET_CONTEXT(my_perl); PERL_SET_INTERP(my_perl); PL_perl_destruct_level = 1; perl_destruct(my_perl); perl_free(my_perl); my_perl = NULL; //Now reinit... DoInit(); in_use = false; }
// return true if we have a renderer, false otherwise bool IsOk() { if ( !m_initialized ) { // only try to create the renderer once m_initialized = true; DoInit(); } return get() != NULL; }
RunningSceneController::RunningSceneController(core::IApplication *app_, core::IUserDataModelController *user_datamodel, core::IPercept *perception_module, core::IProd *production_module) : userDataModel(user_datamodel), perception(perception_module), production(production_module), initialized(false), stop_requested(false), presence_detected(false), contentCreationController(NULL), app(app_) { contentCreationController = ContentCreationController::Instance(); pdu.acceleration.x = pdu.acceleration.y = pdu.acceleration.z = 0; pdu.velocity.x = pdu.velocity.y = pdu.velocity.z = 0; pdu.position.x = pdu.position.y = pdu.position.z = 0; space_offset.x = space_offset.y = space_offset.z = 0; if ((perception) && (production)) DoInit(); }
/* static */ bool wxDbgHelpDLL::Init() { // this flag is -1 until Init() is called for the first time, then it's set // to either false or true depending on whether we could load the functions static int s_loaded = -1; if ( s_loaded == -1 ) { s_loaded = DoInit(); } return s_loaded != 0; }
VError CopyHelper::Copy(const PathBuffer& inSrc, const PathBuffer& inDst) { VError verr=DoInit(inSrc, inDst); if(verr==VE_OK && fSrcSize > 0) verr=DoCopy(); if(verr!=VE_OK) DoClean(inDst); return verr; }
void gadcHighSpeedStop(void) { DoInit(); if (hs.flags & GADC_FLG_ISACTIVE) { /* No more from us */ hs.flags = 0; gadc_lld_stop_timer(hs.lld.physdev); /* * We have to pass TRUE to StartADC() as we might have the ADC marked as active when it isn't * due to stopping the timer while it was converting. */ StartADC(TRUE); } }
virtual void Init( EGameObject type, const AUVec3f& spawnPosition ) { assert (type < EGO_COUNT); if (type < EGO_COUNT) { // Initial load, set up some values for the first time m_gameObjectType = type; m_pEntity->SetPosition(spawnPosition); // Now do regular init stuff DoInit(true); } }