forked from speed-dreams/speed-dreams-code
new code for config weather in raceman
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2861 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: b666337c13d176821a550c61e660210a61de8004 Former-commit-id: aa4045bf3082245a9dfdbfcc0fe51482338f9f9e
This commit is contained in:
parent
5a2d325fd3
commit
d9035e8d0a
4 changed files with 58 additions and 7 deletions
|
@ -952,6 +952,7 @@ ReInitTrack(void)
|
|||
const char *trackName;
|
||||
const char *catName;
|
||||
const char *raceName;
|
||||
const char *cloudA;
|
||||
|
||||
//int rain;
|
||||
|
||||
|
@ -977,11 +978,56 @@ ReInitTrack(void)
|
|||
sprintf(buf, "Loading track %s", ReInfo->track->name);
|
||||
RmLoadingScreenSetText(buf);
|
||||
|
||||
int rain = 0;
|
||||
int cloud = 0;
|
||||
int Timeday = GfParmGetNum(params, raceName, RM_ATTR_TIME, NULL, 0);
|
||||
int cloud = GfParmGetNum(params, raceName, RM_ATTR_WEATHER, NULL, 0);
|
||||
//int cloud = GfParmGetNum(params, raceName, RM_ATTR_WEATHER, NULL, 0);
|
||||
int weather_rain = GfParmGetNum(params, raceName, RM_ATTR_WEATHER_RAIN, "l/m2/h", 0 );
|
||||
switch (weather_rain)
|
||||
{
|
||||
case 1:
|
||||
rain = 1;
|
||||
break;
|
||||
case 5:
|
||||
rain = 2;
|
||||
break;
|
||||
case 20:
|
||||
rain = 3;
|
||||
break;
|
||||
default:
|
||||
rain = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
cloudA = GfParmGetStr(params, raceName, RM_ATTR_WEATHER_CLOUDS, RM_VAL_NO_CLOUDS );
|
||||
//printf("CloudA = %s", cloudA);
|
||||
|
||||
if( strcmp( "clear sky", cloudA) == 0)
|
||||
{
|
||||
cloud = 1;
|
||||
//printf(" Cloud type = %d", cloud);
|
||||
}
|
||||
else if( strcmp( "scarce clouds", cloudA) == 0)
|
||||
{
|
||||
cloud = 2;
|
||||
//printf(" Cloud type = %d", cloud);
|
||||
}
|
||||
else if( strcmp( "more clouds", cloudA) == 0)
|
||||
{
|
||||
cloud = 3;
|
||||
//printf(" Cloud type = %d", cloud);
|
||||
}
|
||||
else if( strcmp( "overcast clouds", cloudA) == 0)
|
||||
{
|
||||
cloud = 4;
|
||||
//printf(" Cloud type = %d", cloud);
|
||||
}
|
||||
|
||||
int cloud1 = cloud + rain;
|
||||
//printf (" Cloud init = %d", cloud1);
|
||||
|
||||
ReInfo->track->Timeday = Timeday;
|
||||
ReInfo->track->weather = cloud;
|
||||
ReInfo->track->weather = cloud1;
|
||||
|
||||
reDumpTrack(ReInfo->track, 0.0);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void ReStartWeather(void)
|
|||
track->weather = cloud; // cloud = random cloud
|
||||
|
||||
resul = 1 + (int)(rand()/(float)RAND_MAX * 99); // probability rain, if result < rain, so it rain
|
||||
printf("Result = %d - Rain = %d\n", resul, rain);
|
||||
//printf("Result = %d - Rain = %d\n", resul, rain);
|
||||
if (resul < rain)
|
||||
{
|
||||
problrain = track->rainlprob;
|
||||
|
@ -74,17 +74,17 @@ void ReStartWeather(void)
|
|||
if (resul2 < (problrain + 1)) // if result2 < probability little rain, so rain = little rain
|
||||
{
|
||||
rainbool = RAIN_VAL_LITTLE;
|
||||
printf("RainBool = %d\n", rainbool);
|
||||
//printf("RainBool = %d\n", rainbool);
|
||||
}
|
||||
else if (resul2 < (probrain +1)) // if result2 < probability normal rain, so rain = normal rain
|
||||
{
|
||||
rainbool = RAIN_VAL_NORMAL;
|
||||
printf("RainBool = %d\n", rainbool);
|
||||
//printf("RainBool = %d\n", rainbool);
|
||||
}
|
||||
else // result2 > probability normal rain so rain = Heavy rain
|
||||
{
|
||||
rainbool = RAIN_VAL_HEAVY;
|
||||
printf("RainBool = %d\n", rainbool);
|
||||
//printf("RainBool = %d\n", rainbool);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
<attstr name="display results" val="yes"/>
|
||||
<attnum name="distance" unit="km" val="0"/>
|
||||
<attnum name="sessiontime" unit="s" val="0"/>
|
||||
<attnum name="weather" val="0"/>
|
||||
<attnum name="weather rain" unit="l/m2/h" val="0"/>
|
||||
<attstr name="weather clouds" val="scarce clouds"/>
|
||||
<attnum name="Time" val="0"/>
|
||||
<section name="Starting Grid">
|
||||
<attnum name="rows" val="1"/>
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
<attstr name="type" val="race"/>
|
||||
<attstr name="starting order" val="drivers list"/>
|
||||
<attstr name="restart" val="yes"/>
|
||||
<attnum name="sessiontime" unit="s" val="0"/>
|
||||
<attnum name="weather rain" unit="l/m2/h" val="0"/>
|
||||
<attstr name="weather clouds" val="scarce clouds"/>
|
||||
<attnum name="Time" val="4"/>
|
||||
|
||||
<section name="Starting Grid">
|
||||
<attnum name="rows" val="2.000000"/>
|
||||
|
|
Loading…
Reference in a new issue