Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 05-11-2018, 09:58 PM   #1
Borsk
New Member
 
Join Date: Sep 2011
Posts: 11
Borsk is on a distinguished road
Weather for Circle Mud

Looking to add a desert (hot) and snow (cold) weather effect to the code and would like some guidance on how to do it in Circle Mud code
weather.c looks like this:

Code:
void weather_change(int change)
{
  int diff;
  if (change==-1) {
    if ((time_info.month >= 9) && (time_info.month <= 16))
      diff = (weather_info.pressure > 985 ? -2 : 2);
    else
      diff = (weather_info.pressure > 1015 ? -2 : 2);
    weather_info.change += (dice(1, 4) * diff + dice(2, 6) - dice(2, 6));
    weather_info.change = MIN(weather_info.change, 12);
    weather_info.change = MAX(weather_info.change, -12);
    weather_info.pressure += weather_info.change;
    weather_info.pressure = MIN(weather_info.pressure, 1040);
    weather_info.pressure = MAX(weather_info.pressure, 960);
    switch (weather_info.sky) {
    case SKY_CLOUDLESS:
      if (weather_info.pressure < 990) change = 1;
      else if ((weather_info.pressure < 1010) && (dice(1, 4) == 1)) change = 1;
      break;
    case SKY_CLOUDY:
      if (weather_info.pressure < 970) change = 2;
      else if (weather_info.pressure < 990) {
        if (dice(1, 4) == 1) change = 2;
        else change = 0;
      }
      else if ((weather_info.pressure > 1030) && (dice(1, 4) == 1)) change = 3;
      break;
    case SKY_RAINING:
      if (weather_info.pressure < 970) {
        if (dice(1, 4) == 1) change = 4;
      else change = 0;
      }
      else if (weather_info.pressure > 1030) change = 5;
      else if ((weather_info.pressure > 1010) && (dice(1, 4) == 1)) change = 5;
      break;
    case SKY_LIGHTNING:
      if (weather_info.pressure > 1010) change = 6;
      else if ((weather_info.pressure > 990) && (dice(1, 4) == 1)) change = 6;
      break;
    default:
      change = 0;
      weather_info.sky = SKY_CLOUDLESS;
      break;
    }
  }
  switch (change) {
  case 0:
    break;
  case 1:
    send_to_outdoor("The sky starts to get cloudy.\r\n");
    weather_info.sky = SKY_CLOUDY;
    break;
  case 2:
    send_to_outdoor("It starts to rain.\r\n");
    weather_info.sky = SKY_RAINING;
    break;
  case 3:
    send_to_outdoor("The clouds disappear.\r\n");
    weather_info.sky = SKY_CLOUDLESS;
    break;
  case 4:
    send_to_outdoor("Lightning starts to show in the sky.\r\n");
    weather_info.sky = SKY_LIGHTNING;
    break;
  case 5:
    send_to_outdoor("The rain stops.\r\n");
    weather_info.sky = SKY_CLOUDY;
    break;
  case 6:
    send_to_outdoor("The lightning stops.\r\n");
    weather_info.sky = SKY_RAINING;
    break;
  default:
    break;
  }
}
Borsk is offline   Reply With Quote
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 12:06 PM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014