diff --git a/src/libs/raceengineclient/raceconfigstate.cpp b/src/libs/raceengineclient/raceconfigstate.cpp index 4665765d9..8b228e696 100644 --- a/src/libs/raceengineclient/raceconfigstate.cpp +++ b/src/libs/raceengineclient/raceconfigstate.cpp @@ -132,6 +132,7 @@ ReConfigRunState(void) GfLogInfo("%s configuration now in '%s' stage.\n", ReInfo->_reName, conf); if (!strcmp(conf, RM_VAL_TRACKSEL)) { + /* Track Select Menu */ ts.nextScreen = reConfigHookInit(); if (curConf == 1) { @@ -144,6 +145,7 @@ ReConfigRunState(void) RmTrackSelect(&ts); } else if (!strcmp(conf, RM_VAL_DRVSEL)) { + /* Drivers select menu */ ds.nextScreen = reConfigHookInit(); if (curConf == 1) { @@ -155,6 +157,7 @@ ReConfigRunState(void) RmDriversSelect(&ds); } else if (!strcmp(conf, RM_VAL_RACECONF)) { + /* Race Options menu */ rp.nextScreen = reConfigHookInit(); if (curConf == 1) { @@ -164,6 +167,7 @@ ReConfigRunState(void) } rp.param = ReInfo->params; rp.title = GfParmGetStr(params, path, RM_ATTR_RACE, "Race"); + /* Select options to configure */ rp.confMask = 0; snprintf(path, sizeof(path), "%s/%d/%s", RM_SECT_CONF, curConf, RM_SECT_OPTIONS); @@ -174,13 +178,41 @@ ReConfigRunState(void) if (!strcmp(opt, RM_VAL_CONFRACELEN)) { /* Configure race length */ rp.confMask |= RM_CONF_RACE_LEN; - } else { - if (!strcmp(opt, RM_VAL_CONFDISPMODE)) { - /* Configure display mode */ - rp.confMask |= RM_CONF_DISP_MODE; - } + } else if (!strcmp(opt, RM_VAL_CONFDISPMODE)) { + /* Configure display mode */ + rp.confMask |= RM_CONF_DISP_MODE; + } else if (!strcmp(opt, RM_VAL_CONFTIMEOFDAY)) { + /* Configure time of day */ + rp.confMask |= RM_CONF_TIME_OF_DAY; + } else if (!strcmp(opt, RM_VAL_CONFCLOUDCOVER)) { + /* Configure cloud cover */ + rp.confMask |= RM_CONF_CLOUD_COVER; + } else if (!strcmp(opt, RM_VAL_CONFRAINFALL)) { + /* Configure rain fall and dry/wet track */ + rp.confMask |= RM_CONF_RAIN_FALL; } } + + /* Check if really something we can configure (given the graphic options) */ + if ((rp.confMask & (RM_CONF_TIME_OF_DAY | RM_CONF_CLOUD_COVER)) == rp.confMask) { + + snprintf(path, sizeof(path), "%s%s", GetLocalDir(), GR_PARAM_FILE); + void *grHandle = GfParmReadFile(path, GFPARM_RMODE_STD); + const bool bSkyDomeEnabled = + (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SKYDOMEDISTANCE, NULL, 0) != 0; + GfParmReleaseHandle(grHandle); + + if (!bSkyDomeEnabled) + { + GfLogInfo("Skipping Race Params menu because Sky Dome is disabled" + " and is needed for all the configurable options\n"); + GfuiScreenActivate(ReGetRacemanMenuHandle()); /* Back to the race menu */ + return; + } + } + GfLogTrace("Race configuration mask : 0x%02X\n", rp.confMask); + + /* All's right till now : enter the Race Params menu */ RmRaceParamsMenu(&rp); } diff --git a/src/libs/racescreens/raceparamsmenu.cpp b/src/libs/racescreens/raceparamsmenu.cpp index cbfd9449c..8ac5c1836 100644 --- a/src/libs/racescreens/raceparamsmenu.cpp +++ b/src/libs/racescreens/raceparamsmenu.cpp @@ -306,7 +306,9 @@ RmRaceParamsMenu(void *vrp) { char buf[256]; - rp = (tRmRaceParam*)vrp; + GfLogTrace("Entering Race Params menu\n"); + + rp = (tRmRaceParam*)vrp; // Get race features. rmrpFeatures = RmGetFeaturesList(rp->param); @@ -398,7 +400,7 @@ RmRaceParamsMenu(void *vrp) } // Create and initialize Time of day combo box (2 arrow buttons and a variable label). - if (rp->confMask & RM_CONF_TIME_OF_DAY) + if (rp->confMask & RM_CONF_TIME_OF_DAY) { if (rmrpIsSkyDomeEnabled) { @@ -412,7 +414,7 @@ RmRaceParamsMenu(void *vrp) break; } - // Create Display mode label. + // Create Time of day label. CreateLabelControl(scrHandle,menuXMLDescHdle,"timeofdaylabel"); // Create and initialize Time of day combo-box-like control. @@ -443,7 +445,7 @@ RmRaceParamsMenu(void *vrp) break; } - // Create Display mode label. + // Create Cloud cover label. CreateLabelControl(scrHandle,menuXMLDescHdle,"cloudslabel"); // Create and initialize Cloud cover combo-box-like control. @@ -474,7 +476,7 @@ RmRaceParamsMenu(void *vrp) break; } - // Create Display mode label. + // Create Rain label. CreateLabelControl(scrHandle,menuXMLDescHdle,"rainlabel"); // Create and initialize Rain combo-box-like control.