当前位置: 首页>>代码示例>>C++>>正文


C++ GfParmGetStr函数代码示例

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


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

示例1: simplixEntryPoint

//==========================================================================*
// Module entry point (Torcs backward compatibility scheme).
//--------------------------------------------------------------------------*
int simplixEntryPoint(tModInfo *ModInfo, void *RobotSettings)
{
    LogSimplix.debug("\n#Torcs backward compatibility scheme used\n");
    NBBOTS = MIN(10,NBBOTS);

    memset(ModInfo, 0, NBBOTS*sizeof(tModInfo));
	DriverNames = (char *) calloc(10,DRIVERLEN);
	DriverDescs = (char *) calloc(10,DESCRPLEN);
    memset(DriverNames, 0, 10*DRIVERLEN);
    memset(DriverDescs, 0, 10*DESCRPLEN);

    char SectionBuf[BUFSIZE];
	char *Section = SectionBuf;

	snprintf( SectionBuf, BUFSIZE, "%s/%s/%d", 
		ROB_SECT_ROBOTS, ROB_LIST_INDEX, 0);

    int I;
    for (I = 0; I < NBBOTS; I++) 
    {
	  snprintf( SectionBuf, BUFSIZE, "%s/%s/%d", 
		  ROB_SECT_ROBOTS, ROB_LIST_INDEX, I + IndexOffset );
	  const char *DriverName = GfParmGetStr( RobotSettings, 
		  Section, (char *) ROB_ATTR_NAME, defaultBotName[I]);
	  strncpy(&DriverNames[I*DRIVERLEN], DriverName, DRIVERLEN-1);
      const char *DriverDesc = GfParmGetStr( RobotSettings, 
		  Section, (char *) ROB_ATTR_DESC, defaultBotDesc[I]);
	  strncpy(&DriverDescs[I*DESCRPLEN], DriverDesc, DESCRPLEN-1);
    }

    return moduleInitialize(ModInfo);
}
开发者ID:yutao1989,项目名称:SpeedDreams,代码行数:35,代码来源:unitmain.cpp

示例2: usr

// Module entry point (Torcs backward compatibility scheme).
extern "C" int usr(tModInfo *modInfo)
{
  NBBOTS = 10;
  memset(DriverNames, 0, NBBOTS * DRIVERLEN);
  memset(DriverDescs, 0, NBBOTS * DRIVERLEN);

  // Filehandle for robot's xml-file
  void *robot_settings = getFileHandle();

  // Let's look what we have to provide here
  if (robot_settings)
  {
    char SectionBuf[BUFSIZE];
    char *Section = SectionBuf;

    snprintf(SectionBuf, BUFSIZE, "%s/%s/%d",
              ROB_SECT_ROBOTS, ROB_LIST_INDEX, 0);

    for (int i = 0; i < NBBOTS; ++i)
    {
      const char *DriverName = GfParmGetStr(robot_settings, Section,
                              ROB_ATTR_NAME, defaultBotName[i]);
      strncpy(&DriverNames[i * DRIVERLEN], DriverName, DRIVERLEN - 1);
      const char *DriverDesc = GfParmGetStr(robot_settings, Section,
                              ROB_ATTR_DESC, defaultBotDesc[i]);
      strncpy(&DriverDescs[i * DRIVERLEN], DriverDesc, DRIVERLEN - 1);
    }
  }
  return moduleInitialize(modInfo);
}
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:31,代码来源:usr.cpp

示例3: ReTrackInit

/** Initialize the track for a race manager.
    @return <tt>0 ... </tt>Ok<br>
    <tt>-1 .. </tt>Error
*/
int
ReTrackInit(void)
{
	char buf[256];
	
	const char  *trackName;
	const char  *catName;

	const int curTrkIdx =
		(int)GfParmGetNum(ReInfo->results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1);
	snprintf(buf, sizeof(buf), "%s/%d", RM_SECT_TRACKS, curTrkIdx);
	trackName = GfParmGetStr(ReInfo->params, buf, RM_ATTR_NAME, 0);
	if (!trackName)
		return -1;

	catName = GfParmGetStr(ReInfo->params, buf, RM_ATTR_CATEGORY, 0);
	if (!catName) 
		return -1;

	snprintf(buf, sizeof(buf), "tracks/%s/%s/%s.%s", catName, trackName, trackName, TRKEXT);
	ReInfo->track = ReTrackLoader().load(buf);

	snprintf(buf, sizeof(buf), "Loading %s track", ReInfo->track->name);
	ReUI().addLoadingMessage(buf);

	reTrackInitTimeOfDay();
	reTrackInitWeather();

	reTrackDump(ReInfo->track, 0);

	return 0;
}//ReTrackInit
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:36,代码来源:racetrack.cpp

示例4: createStaticImage

static int 
createStaticImage(void* hscr, void* hparm, const char* pszName)
{
	const char* pszImage = GfParmGetStr(hparm, pszName, GFMNU_ATTR_IMAGE, "");

	const int x = (int)GfParmGetNum(hparm, pszName, GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm, pszName, GFMNU_ATTR_Y, NULL, 0.0);
	const int w = (int)GfParmGetNum(hparm, pszName, GFMNU_ATTR_WIDTH, NULL, 100.0);
	const int h = (int)GfParmGetNum(hparm, pszName, GFMNU_ATTR_HEIGHT, NULL, 100.0);

	const bool canDeform = getControlBoolean(hparm, pszName, GFMNU_ATTR_CAN_DEFORM, true);

	int id = GfuiStaticImageCreate(hscr, x, y, w, h, pszImage, canDeform);

	char pszImageFieldName[32];
	for (int i = 1; i < GFUI_MAXSTATICIMAGES;i++)
	{
		sprintf(pszImageFieldName, GFMNU_ATTR_IMAGE" %d", i);
		const char* pszFileName = GfParmGetStr(hparm, pszName, pszImageFieldName, 0);
		if (pszFileName)
			GfuiStaticImageSet(hscr, id, pszFileName, i);
		else
			break; // Assumes an indexed image list, with no hole inside.
	}

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

示例5: GfParmGetStr

// Read table of content from configuration file 
int TGeneticParameterTOC::Get() 
{
	char* Value = (char*) GfParmGetStr(Handle, 
		SECT_TOC, PRM_AUTHOR, "Wolf-Dieter Beelitz");
	if (Author)
		free(Author);
	if (Value)
		Author = strdup(Value);
	else
		Author = NULL;

	Value = (char*) GfParmGetStr(Handle, 
		SECT_TOC, PRM_PRIVATE, "simplix private");
	if (Private)
		free(Private);
	if (Value)
		Private = strdup(Value);
	else
		Private = NULL;

	OptimisationLoops = (int) GfParmGetNum(Handle, 
		SECT_TOC, PRM_LOOPS, 0, (float) OptimisationLoops);
	WeightOfDamages = GfParmGetNum(Handle, 
		SECT_TOC, PRM_DAMAGES, 0, (float) WeightOfDamages);
	GetInitialVal = 0 < GfParmGetNum(Handle, 
		SECT_TOC, PRM_INITIAL, 0, 1);

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

示例6: gfuiLoadFonts

void gfuiLoadFonts(void)
{
	void *param;
	int	size;
	int	i;
	int nFontId;

	snprintf(buf, sizeof(buf), "%s%s", GfLocalDir(), GFSCR_CONF_FILE);
	param = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);

	snprintf(buf, sizeof(buf), "%sdata/fonts/%s", GfDataDir(),
			 GfParmGetStr(param, "Menu Font", "name", "b5.glf"));
	GfLogTrace("Loading font 'Menu Font' from %s : Sizes", buf);
	nFontId = GFUI_FONT_BIG;
	for(i = 0; i < 4; i++, nFontId++) {
		size = (int)GfParmGetNum(param, "Menu Font", keySize[i], (char*)NULL, 10.0);
		GfLogTrace(" %d,", size);
		gfuiFont[nFontId] = new GfuiFontClass(buf);
		gfuiFont[nFontId]->create(size);
	}
	GfLogTrace("\n");

	snprintf(buf, sizeof(buf), "%sdata/fonts/%s", GfDataDir(),
			 GfParmGetStr(param, "Console Font", "name", "b7.glf"));
	GfLogTrace("Loading font 'Console Font' from %s : Sizes", buf);
	nFontId = GFUI_FONT_BIG_C;
	for(i = 0; i < 4; i++, nFontId++) {
		size = (int)GfParmGetNum(param, "Console Font", keySize[i], (char*)NULL, 10.0);
		GfLogTrace(" %d,", size);
		gfuiFont[nFontId] = new GfuiFontClass(buf);
		gfuiFont[nFontId]->create(size);
	}
	GfLogTrace("\n");

	snprintf(buf, sizeof(buf), "%sdata/fonts/%s", GfDataDir(),
			 GfParmGetStr(param, "Text Font", "name", "b6.glf"));
	GfLogTrace("Loading font 'Text Font' from %s : Sizes", buf);
	nFontId = GFUI_FONT_BIG_T;
	for(i = 0; i < 4; i++, nFontId++) {
		size = (int)GfParmGetNum(param, "Text Font", keySize[i], (char*)NULL, 10.0);
		GfLogTrace(" %d,", size);
		gfuiFont[nFontId] = new GfuiFontClass(buf);
		gfuiFont[nFontId]->create(size);
	}
	GfLogTrace("\n");

	snprintf(buf, sizeof(buf), "%sdata/fonts/%s", GfDataDir(),
			 GfParmGetStr(param, "Digital Font", "name", "digital.glf"));
	GfLogTrace("Loading font 'Digital Font' from %s : Sizes", buf);
	nFontId = GFUI_FONT_DIGIT;
	size = (int)GfParmGetNum(param, "Digital Font", keySize[0], (char*)NULL, 8.0);
	GfLogTrace(" %d\n", size);
	gfuiFont[nFontId] = new GfuiFontClass(buf);
	gfuiFont[nFontId]->create(size);

	GfParmReleaseHandle(param);
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:57,代码来源:guifont.cpp

示例7: readSoundCfg

// Read sound configuration.
static void readSoundCfg(void)
{
	const char *optionName;
	int	i;
	char buf[1024];

	// Sound interface.
	sprintf(buf, "%s%s", GfLocalDir(), SND_PARAM_FILE);
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	optionName = GfParmGetStr(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_STATE, soundOptionList[0]);

	for (i = 0; i < nbOptions; i++) {
		if (strcmp(optionName, soundOptionList[i]) == 0) {
			curOption = i;
			break;
		}
	}

	GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);

	// Sound volume.
	VolumeValue = GfParmGetNum(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_VOLUME, "%", 100.0f);
	if (VolumeValue>100.0f) {
		VolumeValue = 100.0f;
	} 
	else if (VolumeValue < 0.0f) {
		VolumeValue = 0.0f;
	}

	sprintf(buf, "%g", VolumeValue);
	GfuiEditboxSetString(scrHandle, VolumeValueId, buf);

	optionName = GfParmGetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[0]);

	for (i = 0; i < nbMusicStates; i++) {
		if (strcmp(optionName, musicStateList[i]) == 0) {
			curMusicState = i;
			break;
		}
	}

	GfuiLabelSetText(scrHandle, MusicStateId, musicStateList[curMusicState]);

	// Music volume.
	MusicVolumeValue = GfParmGetNum(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_VOLUME, "%", 100.0f);
	if (MusicVolumeValue>100.0f) {
		MusicVolumeValue = 100.0f;
	} 
	else if (MusicVolumeValue < 0.0f) {
		MusicVolumeValue = 0.0f;
	}

		sprintf(buf, "%g", MusicVolumeValue);
	GfuiEditboxSetString(scrHandle, MusicVolumeValueId, buf);

	GfParmReleaseHandle(paramHandle);
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:58,代码来源:soundconfig.cpp

示例8: GfuiMenuCreateEditControl

int 
GfuiMenuCreateEditControl(void* hscr, void* hparm, const char* pszName,
						  void* userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
{
	std::string strControlPath(GFMNU_SECT_DYNAMIC_CONTROLS"/");
	strControlPath += pszName;

	const char* pszType = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TYPE, "");
	if (strcmp(pszType, GFMNU_TYPE_EDIT_BOX))
	{
		GfLogError("Failed to create control '%s' : section not found or not an '%s' \n",
				   pszName, GFMNU_TYPE_EDIT_BOX);
		return -1;
	}

	// TODO : Add real support for tips (the onFocus/onFocusLost system is already used
	//        for user input management)
	//         const char* pszTip = GfParmGetStr(hparm, pszName, GFMNU_ATTR_TIP, "");
	//         if (strlen(pszTip) > 0)
	//         {
	//                 tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
	//                 cbinfo->screen = hscr;
	//                 cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
	//                 GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);
	//
	//                 // TODO: In this case, we simply ignore onFocus/onFocusLost !
	//                 userDataOnFocus = (void*)cbinfo;
	//                 onFocus = onFocusShowTip;
	//                 onFocusLost = onFocusLostHideTip;
	//         }

	const char* pszText = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TEXT, "");
	const int x = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_Y, NULL, 0.0);
	const char* pszFontName = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_FONT, "");
	const int font = gfuiMenuGetFontId(pszFontName);
	const int width = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_WIDTH, NULL, 0.0);
	const int maxlen = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MAX_LEN, NULL, 0.0);
	const char* pszAlignH = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_H_ALIGN, "");
	const int align = gfuiMenuGetAlignment(pszAlignH);

	const GfuiColor c = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR);
	const GfuiColor fc = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR_FOCUSED);
	const GfuiColor dc = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR_DISABLED);
	const GfuiColor bc = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_BG_COLOR);
	const GfuiColor bfc = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_BG_COLOR_FOCUSED);
	const GfuiColor bdc = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_BG_COLOR_DISABLED);

	int id = GfuiEditboxCreate(hscr, pszText, font, x, y, width, maxlen, align,
							   userDataOnFocus, onFocus, onFocusLost);

	GfuiEditboxSetColors(hscr, id, c, fc, dc);
	GfuiEditboxSetBGColors(hscr, id, bc, bfc, bdc);

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

示例9: GfuiMenuCreateProgressbarControl

int 
GfuiMenuCreateProgressbarControl(void* hscr, void* hparm, const char* pszName)
{
	std::string strControlPath(GFMNU_SECT_DYNAMIC_CONTROLS"/");
	strControlPath += pszName;
	
	const std::string strType = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TYPE, "");
	if (strType != GFMNU_TYPE_PROGRESS_BAR)
	{
		GfLogError("Failed to create control '%s' : section not found or not an '%s' \n",
				   pszName, GFMNU_TYPE_PROGRESS_BAR);
		return -1;
	}
	
	const char* pszImage =
		GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_IMAGE, "data/img/progressbar.png");
	const char* pszBgImage =
		GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_BG_IMAGE, "data/img/progressbar-bg.png");
	
	const float* aOutlineColor = 0;
	const GfuiColor color = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR);
	if (color.alpha)
		aOutlineColor = color.toFloatRGBA();

	const int x = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_Y, NULL, 0.0);
	const int w = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_WIDTH, NULL, 100.0);
	const int h = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_HEIGHT, NULL, 20.0);
	
	const float min = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MIN, NULL, 0.0);
	const float max = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MAX, NULL, 100.0);
	const float value = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_VALUE, NULL, 50.0);
	
	const char* pszTip = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TIP, "");
	
	void* userDataOnFocus = 0;
	tfuiCallback onFocus = 0;
	tfuiCallback onFocusLost = 0;
	if (strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);
		
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	int id = GfuiProgressbarCreate(hscr, x, y, w, h, pszBgImage, pszImage, aOutlineColor,
								   min, max, value, userDataOnFocus, onFocus, onFocusLost);
	
	return id;
}
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:55,代码来源:guimenu.cpp

示例10: loadSimuCfg

static void loadSimuCfg(void)
{
	const char *simuVersionName;
	const char *multiThreadSchemeName;
	const char *threadAffinitySchemeName;
	int i;

	char buf[1024];
	snprintf(buf, sizeof(buf), "%s%s", GfLocalDir(), RACE_ENG_CFG);

	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);

	// Simulation engine name.
	simuVersionName = GfParmGetStr(paramHandle, RM_SECT_MODULES, RM_ATTR_MOD_SIMU, SimuVersionList[DefaultSimuVersion]);
	for (i = 0; i < NbSimuVersions; i++) {
		if (strcmp(simuVersionName, SimuVersionList[i]) == 0) {
			CurSimuVersion = i;
			break;
		}
	}

	// Check if the selected simulation module is there, and fall back to the default one if not.
	snprintf(buf, sizeof(buf), "%smodules/simu/%s.%s", GfLibDir(), SimuVersionList[CurSimuVersion], DLLEXT);
	if (!GfFileExists(buf))
	{
		GfLogWarning("User settings %s physics engine module not found ; falling back to %s\n",
					 SimuVersionList[CurSimuVersion], SimuVersionList[DefaultSimuVersion]);
		CurSimuVersion = DefaultSimuVersion;
	}

	// Multi-threading.
	multiThreadSchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_MULTI_THREADING, MultiThreadSchemeList[0]);
	for (i = 0; i < NbMultiThreadSchemes; i++) {
		if (strcmp(multiThreadSchemeName, MultiThreadSchemeList[i]) == 0) {
			CurMultiThreadScheme = i;
			break;
		}
	}

	// Thread affinity.
	threadAffinitySchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_THREAD_AFFINITY, ThreadAffinitySchemeList[0]);
	for (i = 0; i < NbThreadAffinitySchemes; i++) {
		if (strcmp(threadAffinitySchemeName, ThreadAffinitySchemeList[i]) == 0) {
			CurThreadAffinityScheme = i;
			break;
		}
	}

	GfParmReleaseHandle(paramHandle);

	GfuiLabelSetText(ScrHandle, SimuVersionId, SimuVersionDispNameList[CurSimuVersion]);
	GfuiLabelSetText(ScrHandle, MultiThreadSchemeId, MultiThreadSchemeList[CurMultiThreadScheme]);
	GfuiLabelSetText(ScrHandle, ThreadAffinitySchemeId, ThreadAffinitySchemeList[CurThreadAffinityScheme]);
}
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:54,代码来源:simuconfig.cpp

示例11: ReRaceEventInit

int
ReRaceEventInit(void)
{
	void *mainParams = ReInfo->mainParams;
	void *params = ReInfo->params;

	const bool careerMode = strcmp(GfParmGetStr(ReInfo->mainParams, RM_SECT_SUBFILES, RM_ATTR_HASSUBFILES, RM_VAL_NO), RM_VAL_YES) == 0;
	
	/* Career mode : Look if it is necessary to open another file */
	if (strcmp(GfParmGetStr(mainParams, RM_SECT_SUBFILES, RM_ATTR_HASSUBFILES, RM_VAL_NO), RM_VAL_YES) == 0)
	{
		/* Close previous params */
		if (params != mainParams)
			GfParmReleaseHandle(params);

		/* Read the new params */
		ReInfo->params = GfParmReadFile( GfParmGetStr( ReInfo->mainResults, RE_SECT_CURRENT, RE_ATTR_CUR_FILE, "" ), GFPARM_RMODE_STD );
		GfLogTrace("Career : New params file is %s (from main results file)\n",
				   GfParmGetStr( ReInfo->mainResults, RE_SECT_CURRENT, RE_ATTR_CUR_FILE, ""));
		if (!ReInfo->params)
			GfLogWarning( "Career : MainResults params weren't read correctly\n" );

		/* Close previous results */
		if (ReInfo->results != ReInfo->mainResults)
		{
			GfParmWriteFile(NULL, ReInfo->results, NULL);
			GfParmReleaseHandle(ReInfo->results);
		}

		/* Read the new results */
		ReInfo->results = GfParmReadFile( GfParmGetStr( ReInfo->params, RM_SECT_SUBFILES, RM_ATTR_RESULTSUBFILE, ""), GFPARM_RMODE_STD );
		if (!ReInfo->results)
			GfLogWarning( "Career : New results weren't read correctly\n" );
	}

	// Initialize the race session name.
	ReInfo->_reRaceName = ReGetCurrentRaceName();
	GfLogInfo("Starting new event (%s session)\n", ReInfo->_reRaceName);

	ReUI().onRaceEventInitializing();
	
	ReInfo->s->_features = RmGetFeaturesList(ReInfo->params);

	ReTrackInit();
	
	ReEventInitResults();

	NoCleanupNeeded = false;

	const bool bGoOnLooping = ReUI().onRaceEventStarting(careerMode && !ReHumanInGroup());

	return (bGoOnLooping ? RM_SYNC : RM_ASYNC) | RM_NEXT_STEP;
}
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:53,代码来源:racemain.cpp

示例12: ReRacemanMenu

int
ReRacemanMenu(void)
{
    char	*str;
    void	*params = ReInfo->params;

    if (racemanMenuHdle) {
        GfuiScreenRelease(racemanMenuHdle);
    }
    racemanMenuHdle = GfuiScreenCreateEx(NULL,
                                         NULL, (tfuiCallback)NULL,
                                         NULL, (tfuiCallback)NULL,
                                         1);

    str = GfParmGetStr(params, RM_SECT_HEADER, RM_ATTR_BGIMG, 0);
    if (str) {
        GfuiScreenAddBgImg(racemanMenuHdle, str);
    }

    GfuiMenuDefaultKeysAdd(racemanMenuHdle);

    str = GfParmGetStr(params, RM_SECT_HEADER, RM_ATTR_NAME, 0);
    if (str) {
        GfuiTitleCreate(racemanMenuHdle, str, strlen(str));
    }


    GfuiMenuButtonCreate(racemanMenuHdle,
                         "New Race", "Start a New Race",
                         NULL, ReStartNewRace);

    GfuiMenuButtonCreate(racemanMenuHdle,
                         "Configure Race", "Configure The Race",
                         NULL, reConfigureMenu);

    /*     GfuiMenuButtonCreate(racemanMenuHdle, */
    /* 			 "Configure Players", "Players configuration menu", */
    /* 			 TorcsDriverMenuInit(racemanMenuHdle), GfuiScreenActivate); */

    if (GfParmGetEltNb(params, RM_SECT_TRACKS) > 1) {
        GfuiMenuButtonCreate(racemanMenuHdle,
                             "Load", "Load a Previously Saved Game",
                             racemanMenuHdle, reLoadMenu);
    }

    GfuiMenuBackQuitButtonCreate(racemanMenuHdle,
                                 "Back to Main", "Return to previous Menu",
                                 ReInfo->_reMenuScreen, GfuiScreenActivate);

    GfuiScreenActivate(racemanMenuHdle);

    return RM_ASYNC | RM_NEXT_STEP;
}
开发者ID:gnuzinho,项目名称:Vehicle-Dynamics-Simulator,代码行数:53,代码来源:racemanmenu.cpp

示例13: ReNewTrackMenu

int
ReNewTrackMenu(void)
{
	void	*params = ReInfo->params;
	void	*results = ReInfo->results;
	
	if (newTrackMenuHdle) {
		GfuiScreenRelease(newTrackMenuHdle);
	}

	newTrackMenuHdle = GfuiScreenCreateEx(NULL, 
						NULL, (tfuiCallback)NULL, 
						NULL, (tfuiCallback)NULL, 
						1);
	
	const char* str = GfParmGetStr(params, RM_SECT_HEADER, RM_ATTR_BGIMG, 0);
	if (str) {
		GfuiScreenAddBgImg(newTrackMenuHdle, str);
	}

	str = GfParmGetStr(params, RM_SECT_HEADER, RM_ATTR_NAME, "");
	GfuiTitleCreate(newTrackMenuHdle, str, strlen(str));
	
	GfuiMenuDefaultKeysAdd(newTrackMenuHdle);
	
	sprintf(buf, "Race Day #%d/%d on %s",
		(int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1),
		GfParmGetEltNb(params, RM_SECT_TRACKS),
		ReInfo->track->name);
	
	GfuiLabelCreateEx(newTrackMenuHdle,
				buf,
				red,
				GFUI_FONT_MEDIUM_C,
				320, 420,
				GFUI_ALIGN_HC_VB, 50);
	
	GfuiMenuButtonCreate(newTrackMenuHdle,
				"Start Event", "Start The Current Race",
				NULL, reStateManage);
	
	
	GfuiMenuButtonCreate(newTrackMenuHdle, 
				"Abandon", "Abandon The Race",
				ReInfo->_reMenuScreen, GfuiScreenActivate);
	
	GfuiAddKey(newTrackMenuHdle, 27,  "Abandon", ReInfo->_reMenuScreen, GfuiScreenActivate, NULL);
	
	GfuiScreenActivate(newTrackMenuHdle);
	
	return RM_ASYNC | RM_NEXT_STEP;
}
开发者ID:702nADOS-archive,项目名称:AutoPlug-3.0,代码行数:52,代码来源:racemanmenu.cpp

示例14: strcmp

void GfDriver::load(void* hparmRobot)
{
	std::ostringstream ossDrvSecPath;
	ossDrvSecPath << ROB_SECT_ROBOTS << '/' << ROB_LIST_INDEX << '/' << _nItfIndex;

	// Humanity.
	_bIsHuman =
		strcmp(GfParmGetStr(hparmRobot, ossDrvSecPath.str().c_str(), ROB_ATTR_TYPE, ROB_VAL_ROBOT),
			   ROB_VAL_ROBOT) != 0;

	// Skill level.
    const char* pszKillLevel =
		GfParmGetStr(hparmRobot, ossDrvSecPath.str().c_str(), ROB_ATTR_LEVEL, ROB_VAL_SEMI_PRO);
    for(int nLevelInd = 0; nLevelInd < NbSkillLevels; nLevelInd++)
	{
		if (!strcmp(ASkillLevelStrings[nLevelInd], pszKillLevel))
		{
			_fSkillLevel = ASkillLevelValues[nLevelInd];
			break;
		}
    }

	// Supported features.
	if (_bIsHuman)
	{
		_nFeatures = RM_FEATURE_TIMEDSESSION | RM_FEATURE_WETTRACK;
		if (_fSkillLevel <= ASkillLevelValues[3]) // Pro (TODO: Create enum for that !)
			_nFeatures |= RM_FEATURE_PENALTIES;
	}
	else
	{
		_nFeatures = 0;
		char* pszDrvFeatures =
			strdup(GfParmGetStr(hparmRobot, ossDrvSecPath.str().c_str(), ROB_ATTR_FEATURES, ""));
		for (char* pszFeature = strtok(pszDrvFeatures, ";");
			 pszFeature != 0; pszFeature = strtok(NULL, ";"))
		{
			for (int nFeatInd = 0; nFeatInd < NRobotFeatures; nFeatInd++)
				if (!strcmp(pszFeature, RobotFeatures[nFeatInd].pszName))
				{
					_nFeatures |= RobotFeatures[nFeatInd].nValue;
					break;
				}
		}
		free(pszDrvFeatures);
	}

	// Driven car.
	const char* pszCarId = GfParmGetStr(hparmRobot, ossDrvSecPath.str().c_str(), ROB_ATTR_CAR, "");
	_pCar = GfCars::self()->getCar(pszCarId);
}
开发者ID:xinderuila1,项目名称:speed-dream,代码行数:51,代码来源:drivers.cpp

示例15: ReUpdateQualifCurRes

void
ReUpdateQualifCurRes(tCarElt *car)
{
	int i;
	int nCars;
	int printed;
	int maxLines;
	void *carparam;
	char *carName;
	const char *race = ReInfo->_reRaceName;
	void *results = ReInfo->results;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE], path[BUFSIZE];

	ReResEraseScreen();
	maxLines = ReResGetLines();
	
	snprintf(buf, BUFSIZE, "%s on %s - Lap %d", car->_name, ReInfo->track->name, car->_laps);
	ReResScreenSetTitle(buf);
	
	snprintf(buf, BUFSIZE, "cars/%s/%s.xml", car->_carName, car->_carName);
	carparam = GfParmReadFile(buf, GFPARM_RMODE_STD);
	carName = GfParmGetName(carparam);
	
	printed = 0;
	snprintf(path, BUFSIZE, "%s/%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK);
	nCars = GfParmGetEltNb(results, path);
	nCars = MIN(nCars + 1, maxLines);
	for (i = 1; i < nCars; i++) {
		snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i);
		if (!printed) {
			if ((car->_bestLapTime != 0.0) && (car->_bestLapTime < GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0))) {
				snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i, GfTime2Str(car->_bestLapTime, 0), car->_name, carName);
				ReResScreenSetText(buf, i - 1, 1);
				printed = 1;
			}
		}
		snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i + printed, GfTime2Str(GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0), 0),
		GfParmGetStr(results, path, RE_ATTR_NAME, ""), GfParmGetStr(results, path, RE_ATTR_CAR, ""));
		ReResScreenSetText(buf, i - 1 + printed, 0);
	}

	if (!printed) {
		snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i, GfTime2Str(car->_bestLapTime, 0), car->_name, carName);
		ReResScreenSetText(buf, i - 1, 1);
	}

	GfParmReleaseHandle(carparam);
	ReInfo->_refreshDisplay = 1;
}
开发者ID:andypassion,项目名称:torcs,代码行数:50,代码来源:raceresults.cpp


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