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ISTRY/
LPMUD/MUDLIB/SECURE/
LPMUD/MUDLIB/SECURE/UDP_CMD_/
LPMUD/MUDLIB/SKILLS/
LPMUD/MUDLIB/SKILLS/FIGHTER/
LPMUD/MUDLIB/SKILLS/THIEF/
LPMUD/MUDLIB/USR/
LPMUD/MUDLIB/USR/CREATORS/
LPMUD/MUDLIB/USR/PLAYERS/
/************************************************************************/
/* weather */

/* I am not keen on this weather, but has to compat with dixies.... 
 * its a little simpler then the old one

   Weather: (How weather effects this room? controlled locally by room)
    0 : default weather (is not really used == 4) old was specific rooms
    1 : absolutely no weather (== 2)
    2 : inside (== 1)
    3 : shelter (is not as severe as full weather(-1 on weather strength))
    4 : full weather

   Weather strength is WEATHER_OBJ, 0 -> 6?, well good -> bad 

   Climate: (weather pattern of room, type set locally,
             pattern controlled by WEATHER_OBJ)

    0 : normal
    1 : bad
    2 : tropic 
    3 : jungle
    4 : desert
    5 : arctic
    6 : sea

    Day-Night cycle is controlled by WEATHER_OBJ 
*/
/* 
   Other Notes: To get the night-day cycles to work put fix_day(); into
   the rooms init() fn.
   adj_light() is a fn in base_obj if you are not using this

#define adj_light set_light
*/


#define WEATHER_OBJ "/obj/weather"

int weather;                  /* weather type of this room */
int climate;                  /* climate type of this room */
int daylight_adj;             /* current light adj, 1 == day, -1 == night */

string query_weather();
string  query_weather_forecast();
void  show_weather(object ob);
void set_weather(int l, int w, int c);
void fix_day();
status query_day();
string query_weather();
string  query_weather_forecast();
void  show_weather(object ob);
void set_weather(int l, int w, int c);
void fix_day();
status query_day();


string query_weather() {  /* returns current weather string */
  string str;
  int current_weather;

  if(weather == 1 || weather == 2) return "";
  current_weather = (int)WEATHER_OBJ->query_weather();
  if(weather == 3) current_weather -= 1; /* slightly less bad */
  return (string)WEATHER_OBJ->query_all_weather(climate,current_weather);
}

string  query_weather_forecast() { /* returns next weather string */
  string str;
  int current_weather;

  if(weather == 1 || weather == 2) return "";
  current_weather = (int)WEATHER_OBJ->query_next_weather();
  if(weather == 3) current_weather -= 1; /* slightly less bad */
  return (string)WEATHER_OBJ->query_all_weather(climate,current_weather);
}

void  show_weather(object ob) { /* called by weather ob to show weather */
  if(!ob) return;
  tell_object(ob, query_weather());
}

void set_weather(int l, int w, int c) { /* day-night cycles only when l = 1 */ 
  if(weather != 1) this_object()->adj_light(l);
  fix_day();
  weather = w; 
  climate = c;
}

void fix_day() { /* switches between night & day */
  int day;

  day = (int)WEATHER_OBJ->query_light_adjustment();
  if(weather == 1) return;   /* no weather, no adjusting light */
  if(!daylight_adj) { /* has not been set yet */
    daylight_adj = day;
    if(daylight_adj == -1) this_object()->adj_light(daylight_adj);
  }
  if(day != daylight_adj) {
    daylight_adj = day;
    this_object()->adj_light(day);
  }
}


string query_time() {
  return((string)WEATHER_OBJ->mud_time()+"");
}


status query_day() {
  if(!daylight_adj) fix_day();
  return (daylight_adj == 1);
}