Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, DotBot

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Multiple issues with se...
Forum Rules | Mark all | Recent Posts

[Bug] Multiple issues with setweather and showweather commands
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 May 21, 2008, 6:01 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Multiple issues with setweather and showweather commands
Danger: Critical - Game crash, in addition to other minor problems
Found by: Various
Fixed by: Kayle

---

weather.c

Locate the functions do_setweather and do_showweather and replace them with the following new ones:
void do_setweather( CHAR_DATA *ch, char *argument )
{
   char arg[MIL], arg2[MIL], arg3[MIL], arg4[MIL];
   int value, x, y;

   argument = one_argument( argument, arg );
   argument = one_argument( argument, arg2 );
   argument = one_argument( argument, arg3 );
   argument = one_argument( argument, arg4 );

   if( IS_NPC( ch ) )
   {
      send_to_char( "Mob's can't setweather.\r\n", ch );
      return;
   }

   if( !ch->desc )
   {
      send_to_char( "Nice try, but You have no descriptor.\r\n", ch );
      return;
   }
	
   if( !arg || arg[0] == '\0' || !arg2 || arg2[0] == '\0' || !arg3 || arg3[0] == '\0' )
   {
      send_to_char( "Syntax: setweather <x> <y> <field> <value>\r\n", ch );
      send_to_char( "\r\n", ch );
      send_to_char( "Field being one of:\r\n", ch );
      send_to_char( "  climate hemisphere\r\n", ch );
      send_to_char( "Climate value being:\r\n", ch );
      send_to_char( "  rainforest savanna desert steppe chapparal arctic\r\n", ch );
      send_to_char( "  grasslands deciduous_forest taiga tundra alpine\r\n", ch );
      send_to_char( " See Help Climates for information on each.\r\n", ch );
      send_to_char( "Hemisphere value being:\r\n", ch );
      send_to_char( "  northern southern\r\n", ch );
      return;
   }

   x = atoi( arg );
   y = atoi( arg2 );

   if( x < 0 || x > WEATHER_SIZE_X )
   {
      ch_printf( ch, "X value must be between 0 and %d.\r\n", WEATHER_SIZE_X );
      return;
   }

   if( y < 0 || y > WEATHER_SIZE_Y )
   {
      ch_printf( ch, "Y value must be between 0 and %d.\r\n", WEATHER_SIZE_Y );
      return;
   }

   struct WeatherCell *cell = &weatherMap[x][y];

   if( !str_cmp( arg3, "climate" ) )
   {
      if( !arg4 || arg4[0] == '\0' )
      {
         send_to_char( "Usage: setweather <x> <y> climate <flag>\r\n", ch );
         return;
      }

      value = get_climate( arg4 );
      if( value < 0 || value > MAX_CLIMATE )
         ch_printf( ch, "Unknown flag: %s\r\n", arg4 );
      else
      {
         cell->climate = 0;
         SET_BIT( cell->climate, 1 << value );
         send_to_char( "Cell Climate set.\r\n", ch );
      }
      return;
   }

   if( !str_cmp( arg3, "hemisphere" ) )
   {
      if( !arg4 || arg4[0] == '\0' )
      {
         send_to_char( "Usage: setweather <x> <y> hemisphere <flag>\r\n", ch );
         return;
      }

      value = get_hemisphere( arg4 );
      if( value < 0 || value > HEMISPHERE_MAX )
         ch_printf( ch, "Unknown flag: %s\r\n", arg4 );
      else
      {
         cell->hemisphere = 0;
         SET_BIT( cell->hemisphere, 1 << value );
         send_to_char( "Cell Hemisphere set.\r\n", ch );
      }
      return;
   }
   else
   {
      send_to_char( "Syntax: setweather <x> <y> <field> <value>\r\n", ch );
      send_to_char( "\r\n", ch );
      send_to_char( "Field being one of:\r\n", ch );
      send_to_char( "  climate hemisphere\r\n", ch );
      send_to_char( "Climate value being:\r\n", ch );
      send_to_char( "  rainforest savanna desert steppe chapparal arctic\r\n", ch );
      send_to_char( "  grasslands deciduous_forest taiga tundra alpine\r\n", ch );
      send_to_char( " See Help Climates for information on each.\r\n", ch );
      send_to_char( "Hemisphere value being:\r\n", ch );
      send_to_char( "  northern southern\r\n", ch );
      return;
   }
}

void do_showweather( CHAR_DATA *ch, char *argument )
{
   char arg[MIL], arg2[MIL];
   int x, y;

   argument = one_argument( argument, arg );
   argument = one_argument( argument, arg2 );

   if( IS_NPC( ch ) )
   {
      send_to_char( "Mob's can't showweather.\r\n", ch );
      return;
   }

   if( !ch->desc )
   {
      send_to_char( "Nice try, but You have no descriptor.\r\n", ch );
      return;
   }
	
   if( !arg || arg[0] == '\0' || !arg2 || arg2[0] == '\0'  )
   {
      send_to_char( "Syntax: showweather <x> <y>\r\n", ch );
      return;
   }

   x = atoi( arg );
   y = atoi( arg2 );

   if( x < 0 || x > WEATHER_SIZE_X - 1 )
   {
      ch_printf( ch, "X value must be between 0 and %d.\r\n", WEATHER_SIZE_X - 1);
      return;
   }	

   if( y < 0 || y > WEATHER_SIZE_Y - 1 )
   {
      ch_printf( ch, "Y value must be between 0 and %d.\r\n", WEATHER_SIZE_Y - 1 );
      return;
   }

   struct WeatherCell *cell = &weatherMap[x][y];

   ch_printf_color( ch, "Current Weather State for:\r\n" );
   ch_printf_color( ch, "&WCell (&w%d&W, &w%d&W)&D\r\n", x, y );
   ch_printf_color( ch, "&WClimate:           &w%s&D\r\n", flag_string( cell->climate, climate_names ) );
   ch_printf_color( ch, "&WHemispere:         &w%s&D\r\n", flag_string( cell->hemisphere, hemisphere_name ) );
   ch_printf_color( ch, "&WCloud Cover:       &w%d&D\r\n", cell->cloudcover );
   ch_printf_color( ch, "&WEnergy:            &w%d&D\r\n", cell->energy );
   ch_printf_color( ch, "&WTemperature:       &w%d&D\r\n", cell->temperature );
   ch_printf_color( ch, "&WPressure:          &w%d&D\r\n", cell->pressure );
   ch_printf_color( ch, "&WHumidity:          &w%d&D\r\n", cell->humidity );
   ch_printf_color( ch, "&WPrecipitation:     &w%d&D\r\n", cell->precipitation );
   ch_printf_color( ch, "&WWind Speed XAxis:  &w%d&D\r\n", cell->windSpeedX );
   ch_printf_color( ch, "&WWind Speed YAxis:  &w%d&D\r\n", cell->windSpeedY );
}


Kayle can comment on the specifics, this one has been sitting around for awhile.
       
Pages:<< prev 1 next >>