• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GfParmSetNum函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GfParmSetNum函数的典型用法代码示例。如果您正苦于以下问题:C++ GfParmSetNum函数的具体用法?C++ GfParmSetNum怎么用?C++ GfParmSetNum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GfParmSetNum函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ReInitResults

void
ReInitResults(void)
{
	struct tm *stm;
	time_t t;
	void *results;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];
	
	t = time(NULL);
	stm = localtime(&t);
	snprintf(buf, BUFSIZE, "%sresults/%s/results-%4d-%02d-%02d-%02d-%02d-%02d.xml",
		GetLocalDir(),
		ReInfo->_reFilename,
		stm->tm_year+1900,
		stm->tm_mon+1,
		stm->tm_mday,
		stm->tm_hour,
		stm->tm_min,
		stm->tm_sec
	);
	
	ReInfo->results = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
	results = ReInfo->results;
	GfParmSetNum(results, RE_SECT_HEADER, RE_ATTR_DATE, NULL, (tdble)t);
	GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1);
	GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_RACE, NULL, 1);
	GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);	
}
开发者ID:andypassion,项目名称:torcs,代码行数:29,代码来源:raceresults.cpp


示例2: sprintf

// Write parameter data to xml file
int TGeneticParameter::SetVal(void* SetupHandle, int Index)
{
	char ParamSection[64];
	if (Index > 0)
	  sprintf(ParamSection,"%s/%d",Section,Index);
	else
	  sprintf(ParamSection,"%s",Section);

	if (LeftRight)
	{
		char SideParam[64];

		sprintf(SideParam,ParamSection,SECT_PH_LEFT);
		GfParmSetNum(SetupHandle, SideParam, Parameter, Unit, Val, Min, Max);

		sprintf(SideParam,ParamSection,SECT_PH_RGHT);

		if(SameSign)
			return GfParmSetNum(SetupHandle, SideParam, Parameter, Unit, Val, Min, Max);
		else
			return GfParmSetNum(SetupHandle, SideParam, Parameter, Unit, -Val, Min, Max);
	}
	else
		return GfParmSetNum(SetupHandle, ParamSection, Parameter, Unit, Val, Min, Max);
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:26,代码来源:genetic.cpp


示例3: saveSoundOption

// Save the choosen values in the corresponding parameter file.
static void saveSoundOption(void *)
{
	// Force current edit to loose focus (if one has it) and update associated variable.
	GfuiUnSelectCurrent();

	char buf[1024];
	sprintf(buf, "%s%s", GfLocalDir(), SND_PARAM_FILE);
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	GfParmSetStr(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_STATE, soundOptionList[curOption]);
	GfParmSetNum(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_VOLUME, "%", VolumeValue);
	GfParmSetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[curMusicState]);
	GfParmSetNum(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_VOLUME, "%", MusicVolumeValue);

	GfParmWriteFile(NULL, paramHandle, "sound");
	GfParmReleaseHandle(paramHandle);

	 // Shutdown the user interface.
	LegacyMenu::self().shutdown();

    // Restart the game.
    GfuiApp().restart();

	// Return to previous screen.
	GfuiScreenActivate(prevHandle);
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:26,代码来源:soundconfig.cpp


示例4: RePostRace

int
RePostRace(void)
{
	int curRaceIdx;
	void *results = ReInfo->results;
	void *params = ReInfo->params;

	//ReUpdateStandings();

	curRaceIdx = (int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_RACE, NULL, 1);
	if (curRaceIdx < GfParmGetEltNb(params, RM_SECT_RACES)) {
		curRaceIdx++;
		GfOut("Race Nb %d\n", curRaceIdx);
		GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_RACE, NULL, curRaceIdx);
		ReUpdateStandings();
		return RM_SYNC | RM_NEXT_RACE;
	}

	ReUpdateStandings();
	GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_RACE, NULL, 1);

	taManager->RaceEnd(); // End of race for TA Manager

	return RM_SYNC | RM_NEXT_STEP;
}
开发者ID:hkeeble,项目名称:torcs-adaptive,代码行数:25,代码来源:racemain.cpp


示例5: switch

void SDScreens::splitScreen(long p){
    switch (p) {
        case SD_SPLIT_ADD:
            if (m_NbActiveScreens < SD_NB_MAX_SCREEN)
                m_NbActiveScreens++;
                if (m_SpanSplit)
                    m_NbArrangeScreens=1;
                else
                    m_NbArrangeScreens=0;
            break;
        case SD_SPLIT_REM:
            if (m_NbActiveScreens > 1)
                m_NbActiveScreens--;
                if (m_SpanSplit)
                    m_NbArrangeScreens=1;
                else
                    m_NbArrangeScreens=0;
            break;
        case SD_SPLIT_ARR:
            m_NbArrangeScreens++;
    }

    // Ensure current screen index stays in the righ range.
    if (m_CurrentScreenIndex >= m_NbActiveScreens)
        m_CurrentScreenIndex = m_NbActiveScreens - 1;

    // Save nb of active screens to user settings.
    GfParmSetNum(grHandle, GR_SCT_DISPMODE, GR_ATT_NB_SCREENS, NULL, m_NbActiveScreens);
    GfParmSetNum(grHandle, GR_SCT_DISPMODE, GR_ATT_ARR_SCREENS, NULL, m_NbArrangeScreens);
    GfParmWriteFile(NULL, grHandle, "Graph");
    AdaptScreenSize();
}
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:32,代码来源:OsgScreens.cpp


示例6: GfParmGetNum

/** 
 * SetFuelAtRaceStart
 * 
 * @param t the track
 * @param carParmHandle handle for car parameters
 * @param s current situation, provided by TORCS
 * @param index index of car in the team
 */
void KStrategy::SetFuelAtRaceStart(const tTrack * const t,
                                    void ** const carParmHandle,
                                    const tSituation * const s,
                                    const int index) {
  // Load and set parameters.
  const tdble fuel_cons_factor =
    GfParmGetNum(*carParmHandle, SECT_ENGINE, PRM_FUELCONS, NULL, 1.0f);
  const double fuel =
    GfParmGetNum(*carParmHandle, KILO_SECT_PRIV, KILO_ATT_FUELPERLAP,
         NULL, t->length * MAX_FUEL_PER_METER * fuel_cons_factor);
  expected_fuel_per_lap_ = fuel;
  // Pittime is pittime without refuel.
  pittime_ = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
                            KILO_ATT_PITTIME, NULL, 25.0);
  best_lap_ = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
                            KILO_ATT_BESTLAP, NULL, 87.0);
  worst_lap_ = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
                            KILO_ATT_WORSTLAP, NULL, 87.0);
  // Fuel tank capacity
  const double maxfuel = GfParmGetNum(*carParmHandle, SECT_CAR,
                                      PRM_TANK, NULL, 100.0);

  // Fuel for the whole race. A race needs one more lap - why???
  const double fuelForRace = (s->_raceType == RM_TYPE_RACE)
    ? (s->_totLaps + 1.0) * fuel
    : s->_totLaps * fuel;

  // Compute race times for min to min + 9 pit stops.
  ComputeBestNumberOfPits(maxfuel, fuelForRace, s->_totLaps, true);
  last_fuel_ = fuel_per_stint_;

  // If the setup defines initial fuel amount, use that value in races.
  // Otherwise use computed amount.
  const double initial_fuel = GfParmGetNum(*carParmHandle, SECT_CAR,
                                            PRM_FUEL, NULL, 0.0);
  if (s->_raceType == RM_TYPE_RACE) {
    if (initial_fuel) {
      GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, NULL, initial_fuel);
    } else {
      // Add fuel dependent on index to avoid fuel stop in the same lap.
      GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, NULL,
                    last_fuel_ + index * expected_fuel_per_lap_);
    }
  } else {
    // Use fuel for whole 'race', ie qualy or practice N laps.
      GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, NULL, fuelForRace);
  }
}   // SetFuelAtRaceStart
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:56,代码来源:strategy.cpp


示例7: saveSoundOption

// Save the choosen values in the corresponding parameter file.
static void saveSoundOption(void *)
{
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];

	snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), GR_SOUND_PARM_CFG);
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	GfParmSetStr(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_STATE, soundOptionList[curOption]);
	GfParmSetNum(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_VOLUME, "%", VolumeValue);
	GfParmWriteFile(NULL, paramHandle, "sound");
	GfParmReleaseHandle(paramHandle);

	// Write Menu music optons
	snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), MM_SOUND_PARM_CFG);
	paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	GfParmSetStr(paramHandle, MM_SCT_SOUND, MM_ATT_SOUND_ENABLE, menuMusicList[curOptionMenuMusic]);
	GfParmWriteFile(NULL, paramHandle, "sound");
	GfParmReleaseHandle(paramHandle);
	
	if (curOptionMenuMusic == 1) {
		startMenuMusic();
	} else {
		stopMenuMusic();
	}
	
	// Return to previous screen.
	GfuiScreenActivate(prevHandle);
	return;
}
开发者ID:COHRINT,项目名称:cuTORCS,代码行数:30,代码来源:soundconfig.cpp


示例8: rmrpValidate

static void
rmrpValidate(void * /* dummy */)
{
	if (rp->confMask & RM_CONF_RACE_LEN) {
		rmrpUpdDist(0);
		rmrpUpdLaps(0);
		GfParmSetNum(rp->param, rp->title, RM_ATTR_DISTANCE, "km", rmrpDistance);
		GfParmSetNum(rp->param, rp->title, RM_ATTR_LAPS, (char*)NULL, rmrpLaps);
	}

	if (rp->confMask & RM_CONF_DISP_MODE) {
		GfParmSetStr(rp->param, rp->title, RM_ATTR_DISPMODE, rmCurDispModeList[rmCurDispMode]);
	}

	rmrpDeactivate(rp->nextScreen);
}
开发者ID:COHRINT,项目名称:cuTORCS,代码行数:16,代码来源:racemenu.cpp


示例9: strrchr

/* Called for every track change or new race. */
void Driver::initTrack(tTrack* t, void *carHandle, void **carParmHandle, tSituation *s)
{
	track = t;

	char buffer[256];
	/* get a pointer to the first char of the track filename */
	char* trackname = strrchr(track->filename, '/') + 1;

	switch (s->_raceType) {
		case RM_TYPE_PRACTICE:
			sprintf(buffer, "drivers/sparkle/%d/practice/%s", INDEX, trackname);
			break;
		case RM_TYPE_QUALIF:
			sprintf(buffer, "drivers/sparkle/%d/qualifying/%s", INDEX, trackname);
			break;
		case RM_TYPE_RACE:
			sprintf(buffer, "drivers/sparkle/%d/race/%s", INDEX, trackname);
			break;
		default:
			break;
	}

	*carParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
	if (*carParmHandle == NULL) {
		sprintf(buffer, "drivers/sparkle/%d/default.xml", INDEX);
		*carParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
    }

	float fuel = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_FUELPERLAP, (char*)NULL, 5.0);
	fuel *= (s->_totLaps + 1.0);
	GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, (char*)NULL, MIN(fuel, 100.0));

	MU_FACTOR = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_MUFACTOR, (char*)NULL, 0.69);
}
开发者ID:702nADOS-archive,项目名称:AutoPlug-3.0,代码行数:35,代码来源:driver.cpp


示例10: initTrack

/*
 * Function
 *
 *
 * Description
 *	search under drivers/human/tracks/<trackname>/car-<model>-<index>.xml
 *		     drivers/human/car-<model>-<index>.xml
 *		     drivers/human/tracks/<trackname>/car-<model>.xml
 *		     drivers/human/car-<model>.xml
 *
 * Parameters
 *
 *
 * Return
 *
 *
 * Remarks
 *
 */
static void initTrack(int index, tTrack* track, void *carHandle, void **carParmHandle, tSituation *s)
{
	const char *carname;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];
	char sstring[BUFSIZE];
	tdble fuel;
	int idx = index - 1;

	curTrack = track;

	snprintf(sstring, BUFSIZE, "Robots/index/%d", index);
	snprintf(buf, BUFSIZE, "%sdrivers/human/human.xml", GetLocalDir());
	void *DrvInfo = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	carname = "";
	if (DrvInfo != NULL) {
		carname = GfParmGetStr(DrvInfo, sstring, "car name", "");
	}

	*carParmHandle = NULL;
	// If session type is "race" and we have a race setup use it
	if (s->_raceType == RM_TYPE_RACE) {
		*carParmHandle = RtParmReadSetup(RACE, "human", index, track->internalname, carname);
	}

	// If session type is "qualifying" and we have a qualifying setup use it, use qualifying setup as 
	// fallback if not race setup is available
	if (s->_raceType == RM_TYPE_QUALIF || (*carParmHandle == NULL && s->_raceType == RM_TYPE_RACE)) {
		*carParmHandle = RtParmReadSetup(QUALIFYING, "human", index, track->internalname, carname);
	}

	// If we have not yet loaded a setup we have not found a fitting one or want to use the practice setup,
	// so try to load this
	if (*carParmHandle == NULL) {
		*carParmHandle = RtParmReadSetup(PRACTICE, "human", index, track->internalname, carname);
	}

	// Absolute fallback, nothing found
	if (*carParmHandle == NULL) {
		snprintf(sstring, BUFSIZE, "%sdrivers/human/car.xml", GetLocalDir ());
		*carParmHandle = GfParmReadFile(sstring, GFPARM_RMODE_REREAD);
	}


	if (curTrack->pits.type != TR_PIT_NONE) {
		snprintf(sstring, BUFSIZE, "%s/%s/%d", HM_SECT_PREF, HM_LIST_DRV, index);
		HCtx[idx]->NbPitStopProg = (int)GfParmGetNum(PrefHdle, sstring, HM_ATT_NBPITS, (char*)NULL, 0);
		GfOut("Player: index %d , Pits stops %d\n", index, HCtx[idx]->NbPitStopProg);
	} else {
		HCtx[idx]->NbPitStopProg = 0;
	}
	fuel = 0.0008 * curTrack->length * (s->_totLaps + 1) / (1.0 + ((tdble)HCtx[idx]->NbPitStopProg)) + 20.0;
	if (*carParmHandle) {
		GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, (char*)NULL, fuel);
	}
	Vtarget = curTrack->pits.speedLimit;
	if (DrvInfo != NULL) {
		GfParmReleaseHandle(DrvInfo);
	}
}
开发者ID:COHRINT,项目名称:cuTORCS,代码行数:79,代码来源:human.cpp


示例11: SaveGraphicOptions

static void
SaveGraphicOptions(void *prevMenu)
{
	sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
	void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);

	GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", FovFactorValue);
	GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, SmokeValue);
	GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, SkidValue);
	GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, LodFactorValue);
	GfParmWriteFile(NULL, grHandle, "graph");

	GfParmReleaseHandle(grHandle);

	ExitGraphicOptions(prevMenu);
}
开发者ID:702nADOS-archive,项目名称:AutoPlug-3.0,代码行数:16,代码来源:graphconfig.cpp


示例12: reConfigureMenu

static void
reConfigureMenu(void * /* dummy */)
{
    void *params = ReInfo->params;

    /* Reset configuration automaton */
    GfParmSetNum(params, RM_SECT_CONF, RM_ATTR_CUR_CONF, NULL, 1);
    reConfigRunState();
}
开发者ID:gnuzinho,项目名称:Vehicle-Dynamics-Simulator,代码行数:9,代码来源:racemanmenu.cpp


示例13: GfParmReadFile

void RaceSet::genXML(){
	std::string path = xmlFolder+"quickrace"+std::to_string(carQty)+".xml";
	void *parmHandle = GfParmReadFile(path.c_str(), GFPARM_RMODE_CREAT);
	int ret =mkdir(folder.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);

	if(ret<0&&errno!=EEXIST){
		std::cout<<"Race failed: Unable to access xml directory"<<std::endl;
		throw 1;
	}

	for(int i=0;i<qty;i++){		
		GfParmSetNum(parmHandle, "Quick Race", "laps", NULL, races[i].laps);
		GfParmSetNum(parmHandle, "Quick Race", "distance", NULL, races[i].distance);
		GfParmSetStr(parmHandle, "Tracks/1", "name", races[i].track.c_str());
		GfParmSetStr(parmHandle, "Tracks/1", "category", races[i].category.c_str());
		GfParmWriteFile((folder+"r"+std::to_string(i)+".xml").c_str(), parmHandle, NULL);
	}
}
开发者ID:sergiofsilva,项目名称:tti,代码行数:18,代码来源:RaceSet.cpp


示例14: SimAeroConfig

void 
SimAeroConfig(tCar *car)
{
    void *hdle = car->params;
    tdble Cx, FrntArea;
    
    Cx       = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_CX, (char*)NULL, 0.4);
    FrntArea = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_FRNTAREA, (char*)NULL, 2.5);
    car->aero.Clift[0] = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_FCL, (char*)NULL, 0.0);
    car->aero.Clift[1] = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_RCL, (char*)NULL, 0.0);
    float aero_factor = car->options->aero_factor;

    car->aero.SCx2 = 0.5f * AIR_DENSITY * Cx * FrntArea;
    car->aero.Clift[0] *= aero_factor / 4.0f;
    car->aero.Clift[1] *= aero_factor / 4.0f;
    float max_lift = MaximumLiftGivenDrag (car->aero.SCx2, FrntArea);
    float current_lift = 2.0f * (car->aero.Clift[0] + car->aero.Clift[1]);
    if (current_lift > max_lift) {
        fprintf (stderr, "Warning: car %s, driver %s: lift coefficients (%f, %f), generate a lift of %f, while maximum theoretical value is %f\n",
                 car->carElt->_carName,
                 car->carElt->_name,
                 car->aero.Clift[0],
                 car->aero.Clift[1],
                 current_lift,
                 max_lift);
    }

    GfParmSetNum(hdle, SECT_AERODYNAMICS, PRM_FCL, (char*)NULL, car->aero.Clift[0]);
    GfParmSetNum(hdle, SECT_AERODYNAMICS, PRM_RCL, (char*)NULL, car->aero.Clift[1]);
    //printf ("%f %f\n", GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_FCL, (char*)NULL, 0.0), GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_RCL, (char*)NULL, 0.0));
    //printf ("cl: %f\n", car->aero.Clift[0]+car->aero.Clift[1]);
    car->aero.Cd += car->aero.SCx2;
    car->aero.rot_front[0] = 0.0;
    car->aero.rot_front[1] = 0.0;
    car->aero.rot_front[2] = 0.0;
    car->aero.rot_lateral[0] = 0.0;
    car->aero.rot_lateral[1] = 0.0;
    car->aero.rot_lateral[2] = 0.0;
    car->aero.rot_vertical[0] = 0.0;
    car->aero.rot_vertical[1] = 0.0;
    car->aero.rot_vertical[2] = 0.0;

}
开发者ID:COHRINT,项目名称:cuTORCS,代码行数:43,代码来源:aero.cpp


示例15: GfParmSetStr

// Write table of content to configuration file 
int TGeneticParameterTOC::Set()
{
	GfParmSetStr(Handle, 
		SECT_TOC, PRM_AUTHOR, Author);
	GfParmSetStr(Handle, 
		SECT_TOC, PRM_PRIVATE, Private);
	GfParmSetNum(Handle, 
		SECT_TOC, PRM_LOOPS, 0, (float) OptimisationLoops);
	GfParmSetNum(Handle, 
		SECT_TOC, PRM_DAMAGES, 0, (float) WeightOfDamages);
	if (GetInitialVal)
	  GfParmSetNum(Handle, 
	  	SECT_TOC, PRM_INITIAL, 0, 1);
	else
	  GfParmSetNum(Handle, 
	  	SECT_TOC, PRM_INITIAL, 0, 0);

	return 0;
}; 
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:20,代码来源:genetic.cpp


示例16: reConfigBack

static void
reConfigBack(void)
{
    void	*params = ReInfo->params;

    /* Go back one step in the conf */
    GfParmSetNum(params, RM_SECT_CONF, RM_ATTR_CUR_CONF, NULL,
                 GfParmGetNum(params, RM_SECT_CONF, RM_ATTR_CUR_CONF, NULL, 1) - 2);

    reConfigRunState();
}
开发者ID:gnuzinho,项目名称:Vehicle-Dynamics-Simulator,代码行数:11,代码来源:racemanmenu.cpp


示例17: sprintf

void
cGrBoard::selectBoard(int val)
{
	sprintf (path, "%s/%d", GR_SCT_DISPMODE, id);
	
	switch (val) {
		case 0:
			boardFlag = (boardFlag + 1) % NB_BOARDS;
			GfParmSetNum(grHandle, path, GR_ATT_BOARD, (char*)NULL, (tdble)boardFlag);
			break;
		case 1:
			counterFlag = (counterFlag + 1) % NB_BOARDS;
			GfParmSetNum(grHandle, path, GR_ATT_COUNTER, (char*)NULL, (tdble)counterFlag);
			break;
		case 2:
			leaderFlag = (leaderFlag + 1) % NB_LBOARDS;
			GfParmSetNum(grHandle, path, GR_ATT_LEADER, (char*)NULL, (tdble)leaderFlag);
			break;
		case 3:
			debugFlag = 1 - debugFlag;
			GfParmSetNum(grHandle, path, GR_ATT_DEBUG, (char*)NULL, (tdble)debugFlag);
			break;	
		case 4:
			GFlag = 1 - GFlag;
			GfParmSetNum(grHandle, path, GR_ATT_GGRAPH, (char*)NULL, (tdble)GFlag);
			break;	
		case 5:
			arcadeFlag = 1 - arcadeFlag;
			GfParmSetNum(grHandle, path, GR_ATT_ARCADE, (char*)NULL, (tdble)arcadeFlag);
			break;	
	}
	GfParmWriteFile(NULL, grHandle, "graph");
}
开发者ID:702nADOS-archive,项目名称:AutoPlug-3.0,代码行数:33,代码来源:grboard.cpp


示例18: rmdsSetFocus

static void
rmdsSetFocus(void * /* dummy */)
{
    char	*name;
    tDrvElt	*curDrv;

    name = GfuiScrollListGetSelectedElement(scrHandle, selectedScrollList, (void**)&curDrv);
    if (name) {
	GfParmSetStr(ds->param, RM_SECT_DRIVERS, RM_ATTR_FOCUSED, curDrv->dname);
	GfParmSetNum(ds->param, RM_SECT_DRIVERS, RM_ATTR_FOCUSEDIDX, (char*)NULL, curDrv->index);
	GfuiLabelSetText(scrHandle, FocDrvLabelId, curDrv->name);
    }
}
开发者ID:chagge,项目名称:gym_torcs,代码行数:13,代码来源:driverselect.cpp


示例19: ReRaceEnd

int
ReRaceEnd(void)
{
	int curDrvIdx;
	void *params = ReInfo->params;
	void *results = ReInfo->results;

	ReRaceCleanup();

	if (ReInfo->s->_raceType == RM_TYPE_QUALIF) {
		curDrvIdx = (int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);
		curDrvIdx++;
		if (curDrvIdx > GfParmGetEltNb(params, RM_SECT_DRIVERS)) {
			GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);
			return ReDisplayResults();
		}
		GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, curDrvIdx);
		return RM_SYNC | RM_NEXT_RACE;
	}

	return ReDisplayResults();
}
开发者ID:hkeeble,项目名称:torcs-adaptive,代码行数:22,代码来源:racemain.cpp


示例20: GfParmGetNum

void SimpleStrategy2::setFuelAtRaceStart(tTrack* t, void **carParmHandle, tSituation *s, int index)
{
    // Load and set parameters.
    float consfactor = GfParmGetNum(*carParmHandle, SECT_CAR, PRM_FUELCONS, (char*) NULL, 1.0f);
    float cons2 = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, "FuelCons", (char*) NULL, 1.0f);
    float fuel = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_FUELPERLAP, (char*) NULL, t->length*MAX_FUEL_PER_METER*consfactor*cons2);
    m_expectedfuelperlap = fuel;
    // Pittime is pittime without refuel.
    m_pittime = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_PITTIME, (char*) NULL, 25.0f);
    m_bestlap = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_BESTLAP, (char*) NULL, 87.0f);
    m_worstlap = GfParmGetNum(*carParmHandle, BT_SECT_PRIV, BT_ATT_WORSTLAP, (char*) NULL, 87.0f);
    float maxfuel = GfParmGetNum(*carParmHandle, SECT_CAR, PRM_TANK, (char*) NULL, 100.0f);
    PitDamage = (int) GfParmGetNum(*carParmHandle, "private", "PitDamage", (char *)NULL, 5000.0f);

    // Fuel for the whole race.
    float fuelforrace = (s->_totLaps + 1.0f)*fuel;
    // Estimate minimum number of pit stops, -1 because the tank can be filled at the start.
    int pitstopmin = int(ceil(fuelforrace/maxfuel) - 1.0f);
    // Compute race times for min to min + 9 pit stops.
    int i;
    float mintime = FLT_MAX;
    int beststops = pitstopmin;
    m_lastfuel = maxfuel;
    for (i = 0; i < 10; i++)
    {
        float stintfuel = fuelforrace/(pitstopmin + i + 1);
        float fillratio = stintfuel/maxfuel;
        float avglapest = m_bestlap + (m_worstlap - m_bestlap)*fillratio;
        float racetime = (pitstopmin + i)*(m_pittime + stintfuel/8.0f) + s->_totLaps*avglapest;

        if (mintime > racetime)
        {
            mintime = racetime;
            beststops = i + pitstopmin;
            m_lastfuel = stintfuel;
            m_fuelperstint = stintfuel;
        }
    }

    m_remainingstops = beststops;

    fuel = m_lastfuel + m_expectedfuelperlap;
    float ifuel = GfParmGetNum(*carParmHandle, "private", "MaxFuel", (char *)NULL, 0.0f);
    if (ifuel)
        fuel = ifuel;
    ifuel = GfParmGetNum(*carParmHandle, "private", "InitFuel", (char *)NULL, 0.0f);
    if (ifuel)
        fuel = ifuel;
    // Add fuel dependent on index to avoid fuel stop in the same lap.
    GfParmSetNum(*carParmHandle, SECT_CAR, PRM_FUEL, (char*) NULL, fuel);
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:51,代码来源:strategy.cpp



注:本文中的GfParmSetNum函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GifFreeMapObject函数代码示例发布时间:2022-05-30
下一篇:
C++ GfParmReleaseHandle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap