int main()
{
	int i;
	jobs(i) { env[i].seq = i + 1; }

again:	jobs(i) { hail(); }
	jobs(i) { if (1 != *seq) goto again; }

	printf("COUNTS:\n");
	jobs(i) { printf("% 4d", *cnt); }

	return 0;
}
Ejemplo n.º 2
0
/*
 * Update the weather.
 */
void weather_update( void )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;

    buf[0] = '\0';

    switch ( ++time_info.hour )
    {
    case  5:
	weather_info.sunlight = SUN_LIGHT;
	strcat( buf, "The {yday{x has begun.\n\r" );
	break;

    case  6:
	weather_info.sunlight = SUN_RISE;
	strcat( buf, "The {Ysun{x rises in the east.\n\r" );
	break;

    case 19:
	weather_info.sunlight = SUN_SET;
	strcat( buf, "The {Ysun{x slowly disappears in the west.\n\r" );
	break;

    case 20:
	weather_info.sunlight = SUN_DARK;
	strcat( buf, "The {Dnight{x has begun.\n\r" );
	break;

    case 24:
	time_info.hour = 0;
	time_info.day++;
	break;

    }

    if ( time_info.day   >= 35 )
    {
	time_info.day = 0;
	time_info.month++;
    }

    if ( time_info.month >= 12 )
    {
	time_info.month = 0;
	time_info.year++;
    }

    /*
     * Weather change.
     */
    switch ( weather_info.sky )
    {
    default: 
	    weather_info.sky = SKY_CLOUDLESS;
	break;

    case SKY_CLOUDLESS:
if ((number_chance(10))&&  (time_info.hour <= 6) )
      {
	    weather_info.sky = SKY_FOGGY;
     }
      else  if (number_chance(15))
      {
	    weather_info.sky = SKY_CLOUDY;
     }
      else   if (number_chance(30))
      {
	    weather_info.sky = SKY_RAINING;
     }
else
      if (number_chance(45))
      {
            weather_info.sky = SKY_CLOUDLESS;
     }


	break;

    case SKY_CLOUDY:
      if (number_chance(15))
	{
	    weather_info.sky = SKY_SNOWING;
	}
	else
      if (number_chance(15))
	{
	    weather_info.sky = SKY_HAILSTORM;
	}
	else
      if (number_chance(15))
	{
	    weather_info.sky = SKY_THUNDERSTORM;
	}
	else
      if (number_chance(15))
	{
	    weather_info.sky = SKY_ICESTORM;
	}      
else      if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDLESS;
	}
else if (number_chance(25))
	{
	    weather_info.sky = SKY_CLOUDY;
	}
    case SKY_RAINING:
      if (number_chance(15))
        {
            weather_info.sky = SKY_LIGHTNING;
            lightning       ( );
        }
      else
      if (number_chance(10))
        {
            weather_info.sky = SKY_HAILSTORM;
	    hail();
        }
      else
      if (number_chance(10))
        {
            weather_info.sky = SKY_THUNDERSTORM;
        }
      else
      if (number_chance(10))
        {
            weather_info.sky = SKY_CLOUDY;
        }
else  if (number_chance(55))
        {
            weather_info.sky = SKY_RAINING;
        }
        break;

    case SKY_SNOWING:
if (number_chance(15))
	{
	    weather_info.sky = SKY_BLIZZARD;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDY;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_RAINING;
	}
	else 
 if (number_chance(55))
	{
	    weather_info.sky = SKY_SNOWING;
	}

	break;
    case SKY_LIGHTNING:
if (number_chance(15))
	{
	    weather_info.sky = SKY_THUNDERSTORM;
          }
else if (number_chance(15))
	{
	    weather_info.sky = SKY_RAINING;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDY;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_HAILSTORM;
          }
else if (number_chance(40))
	{
	    weather_info.sky = SKY_LIGHTNING;
          }
	break;
    case SKY_FOGGY:
 if (number_chance(45))
	{
 weather_info.sky = SKY_CLOUDY;
	}
else if (number_chance(55))
	{
        fog();
  weather_info.sky = SKY_FOGGY;
	break;
	}

    case SKY_THUNDERSTORM:
if (number_chance(15))
	{
	    weather_info.sky = SKY_RAINING;
          }
else if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDY;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_LIGHTNING;
	}
else if (number_chance(15))
	{
	    weather_info.sky = SKY_HAILSTORM;
hail ();          }
else if (number_chance(40))
	{
	    weather_info.sky = SKY_THUNDERSTORM;
          }
	break;

    case SKY_HAILSTORM:
 if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDY;
	}
 else
if (number_chance(30))
	{
	    weather_info.sky = SKY_RAINING;
          }
      else
 if (number_chance(55))
	{
	    weather_info.sky = SKY_HAILSTORM;
	hail();
	}
	break;

    case SKY_ICESTORM:
 if (number_chance(15))
	{
	    weather_info.sky = SKY_CLOUDY;
          }
      else
 if (number_chance(15))
	{
	    weather_info.sky = SKY_BLIZZARD;
          }
else
 if (number_chance(15))
	{
	    weather_info.sky = SKY_SNOWING;
	}
      else
 if (number_chance(55))
	{
ice();
   weather_info.sky = SKY_ICESTORM;
  }
	break;


    case SKY_BLIZZARD:
 if (number_chance(15))
	{
	    weather_info.sky = SKY_SNOWING;
	}
else if (number_chance(15))
	{
           blizzard();
	    weather_info.sky = SKY_ICESTORM;
ice();
	}
else if (number_chance(15))
	{
           blizzard();
	    weather_info.sky = SKY_CLOUDY;
	}
else
 if (number_chance(55))
	{
           blizzard();
	    weather_info.sky = SKY_BLIZZARD;
	}
break;

    }

    if ( buf[0] != '\0' )
    {
	for ( d = descriptor_list; d != NULL; d = d->next )
	{
	    if ( d->connected == CON_PLAYING
	    &&   IS_OUTDOORS(d->character)
	    &&   IS_AWAKE(d->character) )
		send_to_char( buf, d->character );
	}
    }

    return;
}