Esempio n. 1
0
void TerrainLarge::load(TheEarth* earth)
{
    if (!image)
    {
        image = TheGame::getInstance()->getDriver()->createImage(irr::video::ECF_A8R8G8B8, irr::core::dimension2du(TILE_LARGE_POINTS_NUM, TILE_LARGE_POINTS_NUM));
    }
    terrain->loadHeightMap(this, earth, offsetX, offsetY, TILE_LARGE_POINTS_NUM+1, image);
    /*
    if (!image)
    {
        image = TheGame::getInstance()->getDriver()->createImage(irr::video::ECF_A8R8G8B8, irr::core::dimension2du(TILE_FINE_POINTS_NUM, TILE_FINE_POINTS_NUM));
        int offsetXFine = offsetX * TILE_FINE_RATE;
        int offsetYFine = offsetY * TILE_FINE_RATE;
        dprintf(MY_DEBUG_NOTE, "===============================\n%d %d\n===============================\n", offsetXFine, offsetYFine);
        for (int x = 0; x < TILE_FINE_POINTS_NUM; x++)
        {
            for (int z = 0; z < TILE_FINE_POINTS_NUM; z++)
            {
                image->setPixel(TILE_FINE_POINTS_NUM - x - 1, z, earth->getTileFineTexture((unsigned int)abs(offsetXFine+x), (unsigned int)abs(offsetYFine+z)));
            }
        }
    }
    */
    postLoad();
}
Esempio n. 2
0
bool FileLoader::loadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName)
{
	bool ret = false;
// 	newReplacement = false;
	m_ReplacedFonts = currDoc->AllFonts->getSubstitutions();
// 	dummyScFaces.clear();
	QList<FileFormat>::const_iterator it;
	if (findFormat(m_fileType, it))
	{
		if (m_fileType == FORMATID_SLA12XIMPORT)
		{
			it->plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(m_prefsManager->appPrefs.fontPrefs.AvailFonts));
			ret = it->plug->loadPage(m_fileName, PageToLoad, Mpage, renamedPageName);
// 			if (ret)
// 				it->plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
		}
		if (m_fileType == FORMATID_SLA13XIMPORT || m_fileType == FORMATID_SLA134IMPORT || m_fileType == FORMATID_SLA150IMPORT)
		{
			it->plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(m_prefsManager->appPrefs.fontPrefs.AvailFonts));
			ret = it->plug->loadPage(m_fileName, PageToLoad, Mpage, renamedPageName);
// 			if (ret)
// 				it->plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
		}
	}
	if (ret)
		ret = postLoad(currDoc);  // FIXME: return false if user doesn't want to replace fonts??

	return ret;
}
Esempio n. 3
0
Settings::Settings()
    : schemaValidationOption(0)
{
	(void)initValues();
	(void)load(kSettingsFile);
	(void)load(kSettingsFilePlatform);
	(void)createNeededFolders();
	(void)postLoad();
}
Esempio n. 4
0
void PlaylistContainer::load()
{
    done_loading = false;
    active_playlist = new Playlist();
    active_playlist->setParent(this);

    backup_playlist = new Playlist();
    backup_playlist->setParent(this);

    stream_playlist = new Playlist();
    stream_playlist->setParent(this);

    all_other_playlists = new QList<Playlist*>;

    cd_playlist.clear();

    active_playlist->loadPlaylist("default_playlist_storage", my_host);

    backup_playlist->loadPlaylist("backup_playlist_storage", my_host);

    stream_playlist->loadPlaylist("stream_playlist", my_host);

    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare("SELECT playlist_id FROM music_playlists "
                  "WHERE playlist_name != :DEFAULT"
                  " AND playlist_name != :BACKUP "
                  " AND (hostname = '' OR hostname = :HOST) "
                  "ORDER BY playlist_name;");
    query.bindValue(":DEFAULT", "default_playlist_storage");
    query.bindValue(":BACKUP", "backup_playlist_storage");
    query.bindValue(":HOST", my_host);

    if (!query.exec())
    {
        MythDB::DBError("Querying playlists", query);
    }
    else
    {
        while (query.next())
        {
            Playlist *temp_playlist = new Playlist();
            //  No, we don't destruct this ...
            temp_playlist->setParent(this);
            temp_playlist->loadPlaylistByID(query.value(0).toInt(), my_host);
            all_other_playlists->push_back(temp_playlist);
            //  ... cause it's sitting on this PtrList
        }
    }
    postLoad();

    pending_writeback_index = 0;

    int x = gCoreContext->GetNumSetting("LastMusicPlaylistPush");
    setPending(x);
    done_loading = true;
}
void PhysicsActor::setup(){

    if (!bInit)
        postLoad();

    if (bJointedToBase){
        makeJoint();
    }

    angleDamp=0.9;
    linearDamp=0.2;

}
Esempio n. 6
0
LayoutSettings::LayoutSettings()
:
  launcherSizePctScreenRelative(QSizeF(1.0,1.0))
, autoPageSize(true)
, pageSizePctLauncherRelative(QSizeF(1.0,0.95))
, pageVerticalBorderActivationAreaSizePx(QSize(20,20))
, pageHorizontalBorderActivationAreaSizePx(QSize(50,50))
, pageTopBorderActivationTimeoutMs(1000)
, pageBottomBorderActivationTimeoutMs(1000)
, pageLeftBorderActivationTimeoutMs(1000)
, pageRightBorderActivationTimeoutMs(1000)

, tabBarUseAbsoluteSize(true)
, tabBarSizePctLauncherRelative(QSizeF(1.0,0.05))
, tabBarHeightAbsolute(50)
, tabBarTabFontSizePx(16)
, tabBarTabFontEmbolden(true)
, tabBarSelectedTabFontColor(Qt::white)
, tabBarUnSelectedTabFontColor(QColor("#C8C8C8"))
, tabTextVerticalPosAdjust(0)

, doneButtonFontSizePx(15)
, doneButtonFontEmbolden(true)
, doneButtonFontColor(Qt::white)
, doneButtonTextVerticalPosAdjust(0)
, doneButtonPositionAdjust(QPoint(12,0))

, quickLaunchBarUseAbsoluteSize(true)
, quickLaunchBarSizePctScreenRelative(QSizeF(1.0,0.15))
, quickLaunchBarHeightAbsolute(100)
, quickLaunchBarLauncherAccessButtonOffsetPx(0,20) // for now, only the Y of this offset is being used
, quickLaunchItemAreaOffsetPx(0,65)
, quickLaunchMaxItems(5)

, centerUiVerticalOffset(0)

, searchPillWidth(588)
, searchPillInnerIconRightOffset(15)
, searchPillTopOffsetFromStatusBar(9)
, searchPillInnerTextAdjust(QPoint(0,-1))

, iconVisibleLocationOffsetPx(QPoint(0,-10))

, openglHatesOddNumbers(false)
{
	load(kSettingsFile);
	load(kSettingsFilePlatform);
	postLoad();

}
Esempio n. 7
0
void CProjectItem::loadGame(int slotId) {
    CompressedFile file;

    // Clear any existing project contents and call preload code
    preLoad();
    clear();

    // Open either an existing savegame slot or the new game template
    if (slotId >= 0) {
        Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(
                                           g_vm->generateSaveName(slotId));
        file.open(saveFile);
    } else {
        Common::File *newFile = new Common::File();
        if (!newFile->open("newgame.st"))
            error("Could not open newgame.st");
        file.open(newFile);
    }

    // Load the savegame header in
    TitanicSavegameHeader header;
    readSavegameHeader(&file, header);
    delete header._thumbnail;

    // Load the contents in
    CProjectItem *newProject = loadData(&file);
    file.IsClassStart();
    getGameManager()->load(&file);

    file.close();

    // Clear existing project
    clear();

    // Detach each item under the loaded project, and re-attach them
    // to the existing project instance (this)
    CTreeItem *item;
    while ((item = newProject->getFirstChild()) != nullptr) {
        item->detach();
        item->addUnder(this);
    }

    // Loaded project instance is no longer needed
    newProject->destroyAll();

    // Post-load processing
    postLoad();
}
Esempio n. 8
0
bool Doc::loadXML(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCEngine)
    {
        qWarning() << Q_FUNC_INFO << "Engine node not found";
        return false;
    }

    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();

        if (tag.tagName() == KXMLFixture)
        {
            Fixture::loader(tag, this);
        }
        else if (tag.tagName() == KXMLQLCFunction)
        {
            Function::loader(tag, this);
        }
        else if (tag.tagName() == KXMLQLCBus)
        {
            /* LEGACY */
            Bus::instance()->loadXML(tag);
        }
        else if (tag.tagName() == KXMLQLCFixtureGroup)
        {
            FixtureGroup::loader(tag, this);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown engine tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    postLoad();

    return true;
}
void Law2_ScGeom_CapillaryPhys_Capillarity::action()
{
	if (!scene) cerr << "scene not defined!";
	if (!capillary) postLoad(*this);//when the script does not define arguments, postLoad is never called
	shared_ptr<BodyContainer>& bodies = scene->bodies;
	int sphereIndex = Sphere::getClassIndexStatic();
	
	//check for contact model once (assuming that contact model does not change)
	if (!hertzInitialized){//NOTE: We are assuming that only one type is used in one simulation here
		FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
			if (I->isReal()) {
				if (CapillaryPhys::getClassIndexStatic()==I->phys->getClassIndex()) hertzOn=false;
				else if (MindlinCapillaryPhys::getClassIndexStatic()==I->phys->getClassIndex()) hertzOn=true;
				else LOG_ERROR("The capillary law is not implemented for interactions using "<<I->phys->getClassName());
				bodiesMenisciiList.initialized = false;//must be re-initialized after creation of first real contact in the model
				hertzInitialized = true;
				break;
			}
		}
	}
Esempio n. 10
0
//TODO: Time to start getting rid of "luna" in visible pathnames
Settings::Settings()
	: lunaAppsPath( "/var/luna/applications/" )
	, pendingAppsPath( "/var/palm/data/com.palm.appInstallService" )
	, appInstallBase( "/media/cryptofs/apps" )
	, appInstallRelative( "usr/palm/applications" )
	, packageInstallBase( "/media/cryptofs/apps" )
	, packageInstallRelative( "usr/palm/packages" )
	, serviceInstallBase( "/media/cryptofs/apps" )
	, serviceInstallRelative( "usr/palm/services" )
	, packageManifestsPath("/media/cryptofs/apps/usr/lib/ipkg/info")
	, downloadPathMedia("/media/internal/downloads")
	, appInstallerTmp("/media/cryptofs/tmp")
	, lunaPresetLaunchPointsPath("/usr/luna/launchpoints/")
	, lunaLaunchPointsPath( "/var/luna/launchpoints/" )
	, lunaSystemPath( "/usr/lib/luna/system/luna-systemui/" )
	, lunaAppLauncherPath( "/usr/lib/luna/system/luna-applauncher/" )
	, lunaSystemResourcesPath( "/usr/palm/sysmgr/images/" )
	, lunaSystemLocalePath( "/usr/palm/sysmgr/localization" )
	, lunaCustomizationLocalePath( "/usr/palm/sysmgr-cust/localization")
	, lunaPrefsPath("/var/luna/preferences/")
	, lunaCmdHandlerPath("/usr/palm/command-resource-handlers.json")
	, lunaCmdHandlerSavedPath("/var/usr/palm/command-resource-handlers-active.json")
	, lunaQmlUiComponentsPath("/usr/palm/sysmgr/uiComponents/")
	, cardLimit(16)
	, showReticle(true)
	, lunaSystemSoundsPath("/usr/palm/sounds")
	, lunaDefaultAlertSound("alert.wav")
	, lunaDefaultRingtoneSound("phone.wav")
	, lunaSystemSoundAppClose("appclose")
	, lunaSystemSoundScreenCapture("shutter")
	, notificationSoundDuration(5000)
	, lightbarEnabled (false)
	, coreNaviScaler (75)
	, gestureAnimationSpeed (1000)
        , backlightOutdoorScale (250)
        , backlightDimScale (30)
        , backlightDarkScale (10)
	, displayWidth(320)
	, displayHeight(320)
	, displayNumBuffers(3)
	, ledPulseMaxBrightness (100)
	, ledPulseDarkBrightness (50)
	, enableAls(true)
	, disableLocking(false)
	, lockScreenTimeout(5000)
	, maxPenMoveFreq(30)
	, maxPaintLoad(6)				       // number of ms for paint routine
	, maxGestureChangeFreq(30)
	, maxTouchChangeFreq(30)
	, debug_trackInputEvents(false)
	, debug_enabled(false)
	, debug_piranhaDrawColoredOutlines(false)
	, debug_piranhaDisplayFps(false)
	, debug_showGestures(false)
	, debug_doVerboseCrashLogging(false)
    , debug_loopInCrashHandler(false)
	, tapRadius(12)
	, tapRadiusMin(5)
	, tapRadiusSquared(144)
	, tapRadiusShrinkPercent(10)
	, tapRadiusShrinkGranMs(50)
	, tapDoubleClickDuration(300)
    , enableTouchEventsForWebApps(false)
    , homeDoubleClickDuration(70)
	, dragRadiusSquared(64)
	, h_trackball_pixels_per_move(30)
	, v_trackball_pixels_per_move(40)
	, h_accel_rate1(200)
	, v_accel_rate1(200)
	, h_accel_const1(2)
	, v_accel_const1(1)
	, h_accel_rate2(500)
	, v_accel_rate2(500)
	, h_accel_const2(3)
	, v_accel_const2(2)
	, accelFastPollFreq (33)
	, turnOffAccelWhenDimmed(true)
    , logger_useSyslog(true)
	, logger_useTerminal(false)
	, logger_useColor(false)
    , logger_level(G_LOG_LEVEL_WARNING)
	, defaultLanguage("en_US")
	, launcherDefaultPositions("/etc/palm/default-launcher-page-layout.json")
	, launcherCustomPositions("/usr/lib/luna/customization/default-launcher-page-layout.json")
	, quicklaunchDefaultPositions("/usr/palm/default-dock-positions.json")
	, quicklaunchCustomPositions("/usr/lib/luna/customization/default-dock-positions.json")
	, quicklaunchUserPositions("/var/palm/user-dock-positions.json")
	, launcherScrim("/usr/lib/luna/system/luna-applauncher/images/launcher_scrim.png")
        , firstCardLaunch("/var/luna/preferences/used-first-card")
	, atlasEnabled(false)
	, emulatedCardWidth(320)
	, emulatedCardHeight(480)
	, cardGroupingXDistanceFactor(1.0)
	, atlasMemThreshold(0)
	, launcherAtlasStatistics(false)
	, launcherDumpAtlas(false)
	, launcherSideSwipeThreshold(1.2)
	, launcherUsesHwAA(false)
	, launcherRowSpacingAdjust(0)
	, launcherLabelWidthAdjust(0)
	, launcherLabelXPadding(12)
	, launcherIconReorderPositionThreshold(36.0)
	, statusBarTitleMaxWidth(140)
	, dockModePrelaunchAllApps(false)
	, dockModeCloseOnMinimize(true)
	, dockModeCloseOnExit(true)
	, dockModeMaxApps(3)
	, dockModeNightBrightness(1)
	, dockModeDefaultPositions("/etc/palm/default-exhibition-apps.json")
	, dockModeCustomPositions("/usr/lib/luna/customization/default-exhibition-apps.json")
	, dockModeUserPositions("/var/palm/user-exhibition-apps.json")
	, dockModeMenuHeight (400)
	, virtualKeyboardEnabled(false)
	, virtualCoreNaviEnabled(false)
	, virtualCoreNaviHeight(0)
	, uiType(UI_LUNA)
	, fontBanner("Prelude")
	, fontActiveBanner("Prelude")
	, fontLockWindow("Prelude")
	, fontDockMode("Prelude")
	, fontQuicklaunch("Prelude")
	, fontBootupAnimation("/usr/share/fonts/Prelude-Bold.ttf")
	, fontProgressAnimationBold("/usr/share/fonts/Prelude-Bold.ttf")
	, fontProgressAnimation("Prelude")
	, fontKeyboardKeys("Prelude")
	, fontStatusBar("Prelude")
	, displayUiRotates(false)
	, tabletUi(false)
	, homeButtonOrientationAngle(0)
	, emuModeOrientationAngle(0)
	, positiveSpaceTopPadding(24)
	, positiveSpaceBottomPadding(24)
	, maximumNegativeSpaceHeightRatio(0.55)
	, activeCardWindowRatio(0.659)
	, nonActiveCardWindowRatio(0.61)
    , ghostCardFinalRatio(0.85)
	, cardGroupRotFactor(90)
	, gapBetweenCardGroups(10)
	, overlayNotificationsHeight(83)
	, splashIconSize(128)
    , enableSplashBackgrounds(true)
	, maxDownloadManagerQueueLength(128)
	, maxDownloadManagerConcurrent(2)
	, maxDownloadManagerRecvSpeed(64 * 1024)
	, cesDemoBuild(false)
	, cesGestureRepeaterIp("10.0.0.204")
	, cesGestureRepeaterPort(5001)
	, enableGestureRepeater(false)
	, showAppStats(false)
	, collectUseStats(true)
	, usePartialKeywordAppSearch(true)
	, scanCalculatesAppSizes(false)
	, uiMainCpuShareLow(512)
	, uiOtherCpuShareLow(128)
	, javaCpuShareLow(128)
	, webCpuShareLow(64)
	, gameCpuShareLow(32)
	, cpuShareDefault(1024)
	, cpuShareDefaultLow(512)
	, allowTurboMode(true)
	, wifiInterfaceName("eth0")
	, wanInterfaceName("ppp0")
	, canRestartHeadlessApps(true)
	, forceSoftwareRendering(false)
	, perfTesting(false)
	, debug_appInstallerCleaner(3)
	, modalWindowWidth(320)
	, modalWindowHeight(480)
	, demoMode(false)
    , cardDimmPercentage(0.8f)
    , schemaValidationOption(0)
{

#if !defined(TARGET_DESKTOP)
	// CES -->
	// See if we're running on Nova-Demo.
    // The property to check is "com.palm.properties.buildName".
    char *build = NULL;
    LPErr e = LPSystemCopyStringValue ("com.palm.properties.buildName", &build);
    if (LP_ERR_NONE == e && NULL != build)
    {
        if (0 == strcmp ("Nova-Demo", build))
        {
			cesDemoBuild = true;
            enableGestureRepeater = true;
        }
    }
	// <-- CES
#endif

#if defined(TARGET_DESKTOP)
    {
    	//redirect the manifests dir
    	packageManifestsPath = "/tmp";
	}
#endif

	load(kSettingsFile);
	load(kSettingsFilePlatform);

	postLoad();

}
Esempio n. 11
0
	// set box shape of the cell
	void setBox(const Vector3r& size){ setHSize(size.asDiagonal()); trsf=Matrix3r::Identity(); postLoad(*this,NULL); }
Esempio n. 12
0
		MatchMaker(std::string _algo): algo(_algo){ postLoad(*this); }
Esempio n. 13
0
		MatchMaker(Real _val): algo("val"), val(_val){ postLoad(*this); }
Esempio n. 14
0
void Scene::pyEnginesSet(const vector<shared_ptr<Engine> >& e){
	if(subStep<0) engines=e;
	else _nextEngines=e;
	postLoad(*this,(void*)&engines);
}
Esempio n. 15
0
	void setTrsf(const Matrix3r& m){ trsf=m; postLoad(*this,NULL); }
Esempio n. 16
0
/*!
  Reboot the server.
  Returns non zero on errors.
 */
int Server::reboot ()
{
  int ret;
  string msg ("reboot-server");
  vector<Multicast<string, void*, int>*>* handlers;

  handlers = getHandlers (msg);

  if (handlers)
    {
      for (size_t i = 0; i < handlers->size (); i++)
        (*handlers)[i]->updateMulticast (this, msg, 0);
    }

  serverReady = false;
  /* Reset the toReboot flag.  */
  toReboot = false;

  rebooting = true;

  /* Do nothing if the reboot is disabled.  */
  if (!autoRebootEnabled)
    return 0;

  /* Do a beep if outputting to console.  */
  if (logLocation.find ("console://") != string::npos)
    {
      char beep[] = { static_cast<char>(0x7), '\0' };
      string beepStr (beep);
      logManager->log (this, "MAINLOG", logLocation, beepStr);
    }

  log (MYSERVER_LOG_MSG_INFO, _("Rebooting"));

  if (mustEndServer)
    return 0;

  mustEndServer = true;

  ret = terminate ();
  if (ret)
    return ret;

  mustEndServer = false;


  rebooting = false;

  ret = initialize () || postLoad ();

  if (ret)
    {
      log (MYSERVER_LOG_MSG_INFO, _("The server could not be restarted"));
      return ret;
    }

  serverReady = true;

  log (MYSERVER_LOG_MSG_INFO, _("Restarted"));

  return 0;
}
Esempio n. 17
0
void Scene::doOneStep(){
	#ifdef WOO_LOOP_MUTEX_HELP
		// add some daly to help the other thread locking the mutex; will be removed once 
		if(engineLoopMutexWaiting){
				boost::this_thread::sleep(boost::posix_time::milliseconds(100));
		}
	#endif
	boost::timed_mutex::scoped_lock lock(engineLoopMutex);

	if(runInternalConsistencyChecks){
		runInternalConsistencyChecks=false;
		// checkStateTypes();
	}
	// check and automatically set timestep
	if(isnan(dt)||isinf(dt)||dt<0){
		#if 0
			throw std::runtime_error("Scene::dt is NaN, Inf or negative");
		#else
			dt=Inf;
			for(const auto& e: engines){
				e->scene=this;
				if(!e->field && e->needsField())  throw std::runtime_error(e->pyStr()+" has no field to run on, but requires one.");
				if(e->dead) continue; // skip completely dead engines, but not those who are not isActivated()
				Real crDt=e->critDt();
				LOG_INFO("Critical dt from "+e->pyStr()+": "<<crDt);
				dt=min(dt,crDt);
			}
			for(const auto& f: fields){
				f->scene=this;
				Real crDt=f->critDt();
				LOG_INFO("Critical dt from "+f->pyStr()+": "<<crDt);
				dt=min(dt,crDt);
			}
			if(isinf(dt)) throw std::runtime_error("Failed to obtain meaningful dt from engines and fields automatically.");
			dt=dtSafety*dt;
		#endif
	}
	// substepping or not, update engines from _nextEngines, if defined, at the beginning of step
	// subStep can be 0, which happens if simulations is saved in the middle of step (without substepping)
	// this assumes that prologue will not set _nextEngines, which is safe hopefully
	if(!_nextEngines.empty() && (subStep<0 || (subStep<=0 && !subStepping))){
		engines=_nextEngines;
		_nextEngines.clear();
		postLoad(*this,NULL); // setup labels, check fields etc
		// hopefully this will not break in some margin cases (subStepping with setting _nextEngines and such)
		subStep=-1;
	}
	for(const shared_ptr<Field>& f: fields) if(f->scene!=this) f->scene=this;
	if(likely(!subStepping && subStep<0)){
		/* set substep to 0 during the loop, so that engines/nextEngines handler know whether we are inside the loop currently */
		subStep=0;
		// ** 1. ** prologue
		selfTest_maybe();
		if(isPeriodic) cell->integrateAndUpdate(dt);
		if(trackEnergy) energy->resetResettables();
		const bool TimingInfo_enabled=TimingInfo::enabled; // cache the value, so that when it is changed inside the step, the engine that was just running doesn't get bogus values
		TimingInfo::delta last=TimingInfo::getNow(); // actually does something only if TimingInfo::enabled, no need to put the condition here
		// ** 2. ** engines
		for(const shared_ptr<Engine>& e: engines){
			e->scene=this;
			if(!e->field && e->needsField()) throw std::runtime_error(e->pyStr()+" has no field to run on, but requires one.");
			if(e->dead || !e->isActivated()) continue;
			e->run();
			if(unlikely(TimingInfo_enabled)) {TimingInfo::delta now=TimingInfo::getNow(); e->timingInfo.nsec+=now-last; e->timingInfo.nExec+=1; last=now;}
		}
		// ** 3. ** epilogue
		if(isPeriodic) cell->setNextGradV();
		step++;
		time+=dt;
		subStep=-1;
		if(!isnan(nextDt)){ dt=nextDt; nextDt=NaN; }
	} else {
		/* IMPORTANT: take care to copy EXACTLY the same sequence as is in the block above !! */
		if(TimingInfo::enabled){ TimingInfo::enabled=false; LOG_INFO("Master.timingEnabled disabled, since Master.subStepping is used."); }
		if(subStep<-1 || subStep>(int)engines.size()){ LOG_ERROR("Invalid value of Scene::subStep ("<<subStep<<"), setting to -1 (prologue will be run)."); subStep=-1; }
		// if subStepping is disabled, it means we have not yet finished last step completely; in that case, do that here by running all remaining substeps at once
		// if subStepping is enabled, just run the step we need (the loop is traversed only once, with subs==subStep)
		int maxSubStep=subStep;
		if(!subStepping){ maxSubStep=engines.size(); LOG_INFO("Running remaining sub-steps ("<<subStep<<"…"<<maxSubStep<<") before disabling sub-stepping."); }
		for(int subs=subStep; subs<=maxSubStep; subs++){
			assert(subs>=-1 && subs<=(int)engines.size());
			// ** 1. ** prologue
			if(subs==-1){
				selfTest_maybe();
				if(isPeriodic) cell->integrateAndUpdate(dt);
				if(trackEnergy) energy->resetResettables();
			}
			// ** 2. ** engines
			else if(subs>=0 && subs<(int)engines.size()){
				const shared_ptr<Engine>& e(engines[subs]);
				e->scene=this;
				if(!e->field && e->needsField()) throw std::runtime_error((getClassName()+" has no field to run on, but requires one.").c_str());
				if(!e->dead && e->isActivated()) e->run();
			}
			// ** 3. ** epilogue
			else if(subs==(int)engines.size()){
				if(isPeriodic) cell->setNextGradV();
				step++; time+=dt; /* gives -1 along with the increment afterwards */ subStep=-2;
				if(!isnan(nextDt)){ dt=nextDt; nextDt=NaN; }
			}
			// (?!)
			else { /* never reached */ assert(false); }
		}
		subStep++; // if not substepping, this will make subStep=-2+1=-1, which is what we want
	}
}
Esempio n. 18
0
/*
==============
SpawnEntities

Creates a server's entity / program execution context by
parsing textual entity definitions out of an ent file.
==============
*/
void Level::SpawnEntities( const char *themapname, const char *entities, int levelTime )
{
	int			inhibit,count=0;
	const char	*value;
	SpawnArgs   args;
	char        *spawnpos;
	
	// Init the level variables
	Init();
	
	spawnpos = const_cast<char*>(strchr( themapname, '$' ));
	if ( spawnpos )
	{
		mapname = str( themapname, 0, spawnpos - themapname );
		spawnpoint = spawnpos + 1;
	}
	else
	{
		mapname = themapname;
		spawnpoint = "";
	}
	
	// set up time so functions still have valid times
	setTime( levelTime, 1000 / 20 );
	
	if ( !LoadingServer )
	{
		// Get rid of anything left over from the last level
		//CleanUp( false );
		
		// Set up for a new map
		thePathManager.Init( mapname );
		
	}
	
	
	setSkill( skill->integer );
	
	// reset out count of the number of game traces
	sv_numtraces = 0;
	
	// parse world
	entities = args.Parse( entities );
	spawn_entnum = ENTITYNUM_WORLD;
	args.Spawn();
	
	if ( !world )
		Com_Error( ERR_FATAL, "No world\n" );
	
	if ( g_gametype->integer == GT_MULTIPLAYER || g_gametype->integer == GT_BOT_SINGLE_PLAYER )
	{
		multiplayerManager.initMultiplayerGame();
	}
	
	// parse ents
	inhibit = 0;
	for( entities = args.Parse( entities ); entities != NULL; entities = args.Parse( entities ) )
	{
		// remove things (except the world) from different skill levels or deathmatch
		spawnflags = 0;
		value = args.getArg( "spawnflags" );
		if ( value )
		{
			spawnflags = atoi( value );
			if ( inhibitEntity( spawnflags ) )
            {
				inhibit++;
				continue;
			}
		}
		
		args.Spawn();
		count++;

		gi.ProcessLoadingScreen( "$$SpawningEntities$$" );
	}
	
	gi.DPrintf( "%i entities spawned\n", count );
	gi.DPrintf( "%i entities inhibited\n", inhibit );
	
	// Process the spawn events
	L_ProcessPendingEvents();
	
	if ( multiplayerManager.inMultiplayer() )
	{
		multiplayerManager.initItems();
	}

	// Setup bots

	if ( gi.Cvar_VariableIntegerValue( "bot_enable" ) && multiplayerManager.inMultiplayer() ) 
	{
		BotAIShutdown( 0 );

		BotAISetup( 0 );
		BotAILoadMap( 0 );
		G_InitBots( 0 );
	}
	
	if ( !LoadingServer || game.autosaved )
	{
		Start();
	}
	
	postLoad();
   	
	
	//-------------------------------------------------------------------------------
    //
    // Deletion Note:
    // Since hNodeController is an Entity, it is deleted
    // when all the other entities are deleted in the clean up function
    // specifically the line
    //
	//
   	//	if ( active_edicts.next->entity )
	//		{
	//		delete active_edicts.next->entity;
	//		}
    //
	//
    // Since it is already being deleted like this
    // We do not need to explcitily delete the controller... In fact
    // you will error out if you try to.
	//--------------------------------------------------------------------------------
	hNodeController = new HelperNodeController;
	if ( hNodeController )
		hNodeController->SetTargetName( "HelperNodeController" );
	
	
	
	//
	// if this is a single player game, spawn the single player in now
	// this allows us to read persistant data into the player before the client
	// is completely ready
	//
	if ( game.maxclients == 1 )
	{
		spawn_entnum = 0;
		new Player;
	}
}
Esempio n. 19
0
/*
static void replaceFonts(ScribusDoc* currDoc, PageItem *it, QMap<QString, int> UsedFonts, QMap<QString, QString> ReplacedFonts)
{	
	if ((it->asTextFrame()) || (it->asPathText()))
	{
		CharStyle newFontStyle;
		for (uint e = 0; e < it->itemText.nrOfRuns(); ++e)
		{
			int start = it->itemText.startOfRun(e);
			ScFace oldFont = it->itemText.charStyle(start).font();
			if (!UsedFonts.contains(oldFont.scName())) {
				newFontStyle.setFont((*currDoc->AllFonts)[ReplacedFonts[oldFont.scName()]]);
				it->itemText.applyCharStyle(start, it->itemText.endOfRun(e) - start, newFontStyle );
			}
		}
	}
}

*/
bool FileLoader::LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName)
{
	bool ret = false;
// 	newReplacement = false;
	ReplacedFonts = currDoc->AllFonts->getSubstitutions();
// 	dummyScFaces.clear();
	QList<FileFormat>::const_iterator it;
	if (findFormat(FileType, it))
	{
		if (FileType==FORMATID_SLA12XIMPORT)
		{
			(*it).plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
			ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
// 			if (ret)
// 				(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
		}
		if (FileType==FORMATID_SLA13XIMPORT || FileType==FORMATID_SLA134IMPORT)
		{
			(*it).plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
			ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
// 			if (ret)
// 				(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
		}
	}
	if (ret)
		ret = postLoad(currDoc);  // FIXME: return false if user doesnt want to replace fonts??
	
	/*
	//FIXME: this goes into scribusdoc and should work with substitutes
	if (ReplacedFonts.count() != 0)
	{
		if ((prefsManager->appPrefs.askBeforeSubstituite) || (newReplacement))
		{
			qApp->setOverrideCursor(QCursor(Qt::arrowCursor), true);
			FontReplaceDialog dia(0, &ReplacedFonts);
			if (dia.exec())
			{
				QMap<QString,QString>::Iterator itfsu;
				for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
				{
					if (dia.stickyReplacements->isChecked())
						prefsManager->appPrefs.GFontSub[itfsu.key()] = itfsu.data();
				}
			}
			else
			{
				return false;
			}
		}
		for (uint d = 0; d < currDoc->MasterItems.count(); ++d)
		{
			replaceFonts(currDoc, currDoc->MasterItems.at(d), currDoc->UsedFonts, ReplacedFonts);
		}
		for (uint d = 0; d < currDoc->DocItems.count(); ++d)
		{
			replaceFonts(currDoc, currDoc->DocItems.at(d), currDoc->UsedFonts, ReplacedFonts);
		}
		for (uint d = 0; d < currDoc->FrameItems.count(); ++d)
		{
			replaceFonts(currDoc, currDoc->FrameItems.at(d), currDoc->UsedFonts, ReplacedFonts);
		}
		for (uint a = 0; a < currDoc->paragraphStyles().count(); ++a)
		{
//			if ( !currDoc->paragraphStyles()[a].charStyle().font().isNone() && !currDoc->UsedFonts.contains(currDoc->paragraphStyles()[a].charStyle().font().scName()))
//				currDoc->paragraphStyles()[a].charStyle().setFont
//					((*currDoc->AllFonts)[ReplacedFonts[currDoc->paragraphStyles()[a].charStyle().font().scName()]]);
		}
		QMap<QString,QString>::Iterator itfsu;
		for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
		{
			if (!currDoc->UsedFonts.contains(itfsu.data()))
			{
//				QFont fo = prefsManager->appPrefs.AvailFonts[itfsu.data()]->Font;
//				fo.setPointSize(qRound(ScMW->doc->toolSettings.defSize / 10.0));
				currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.defSize / 10.0));
			}
		}
		if (prefsManager->appPrefs.askBeforeSubstituite)
			ReplacedFonts.clear();
// 		dummyScFaces.clear();
	}
	*/
	return ret;
}
Esempio n. 20
0
	void setSize(const Vector3r& s){for (int k=0;k<3;k++) hSize.col(k)*=s[k]/hSize.col(k).norm(); refHSize=hSize;  postLoad(*this);}
Esempio n. 21
0
/*!
  Start the server.
 */
void Server::start (string &mainConf, string &mimeConf, string &vhostConf,
                    string &externPath, MainConfiguration* (*genMainConf)
                    (Server *server, const char *arg))

{
  int err = 0;

  this->genMainConf = genMainConf;

  displayBoot ();

  try
  {
    log (MYSERVER_LOG_MSG_INFO, _("Initializing server configuration..."));

    if (loadLibraries ())
      {
        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
        return;
      }

    if (!resetConfigurationPaths (mainConf, mimeConf, vhostConf, externPath))
      {
        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
        return;
      }

    err = initialize ();
    if (err)
      {
        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
        return;
      }

    log (MYSERVER_LOG_MSG_INFO, _("Loading server configuration from %s..."),
         mainConf.c_str ());

    if (postLoad ())
      {
        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
        return;
      }

    setProcessPermissions ();

    if (getGid ()[0])
      log (MYSERVER_LOG_MSG_INFO, _("Using gid: %s"), gid.c_str ());

    if (getUid ()[0])
      log (MYSERVER_LOG_MSG_INFO, _("Using uid: %s"), uid.c_str ());

    log (MYSERVER_LOG_MSG_INFO, _("Server is ready!"));

    if (logLocation.find ("console://") != string::npos)
      log (MYSERVER_LOG_MSG_INFO, _("Press Ctrl-C to terminate its execution"));

    serverReady = true;

    /* Finally we can give control to the main loop.  */
    mainLoop ();

  }
  catch (bad_alloc &ba)
    {
      log (MYSERVER_LOG_MSG_ERROR, _("Bad alloc: %s"), ba.what ());
    }
  catch (exception &e)
    {
      log (MYSERVER_LOG_MSG_ERROR, _("Error: %s"), e.what ());
    };

  this->terminate ();
  finalCleanup ();

#ifdef WIN32
  WSACleanup ();
#endif

  log (MYSERVER_LOG_MSG_INFO, _("Server terminated"));
}
Esempio n. 22
0
	void setHSize(const Matrix3r& m){ hSize=refHSize=m; pprevHsize=hSize; postLoad(*this,NULL); }