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, Google, Sogou

Members: 0
Guests: 15
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 » [Enh] Color code allows the c...
Forum Rules | Mark all | Recent Posts

[Enh] Color code allows the creation of an alternate default
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 5, 2005, 1:03 pm   Last edited Sep 5, 2005, 1:04 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Enhancement: Color code allows the creation of an alternate default
Purpose: To allow people to specify a default other than what's been hardcoded
Provided by: Samson
Applies to: SmaugFUSS, SWRFUSS, SWFOTEFUSS

---

color.c

Locate the reset_colors function, and replace it with:
/*
 * If the color directory has a file named "default" this will be used if possible.
 * The fallback will go to the hardcoded table in color.h if the "default" file is not available.
 */
void reset_colors( CHAR_DATA * ch )
{
   FILE *fp;
   int max_colors = 0;
   char filename[256];

   snprintf( filename, 256, "%s%s", COLOR_DIR, "default" );

   if( !( fp = fopen( filename, "r" ) ) )
   {
      memcpy( &ch->colors, &default_set, sizeof( default_set ) );
      return;
   }

   while( !feof( fp ) )
   {
      char *word = fread_word( fp );
      if( !str_cmp( word, "MaxColors" ) )
      {
         max_colors = fread_number( fp );
         continue;
      }
      if( !str_cmp( word, "Colors" ) )
      {
         int x;

         for( x = 0; x < max_colors; ++x )
            ch->colors[x] = fread_number( fp );
         continue;
      }
      if( !str_cmp( word, "End" ) )
      {
         fclose( fp );
         fp = NULL;
         return;
      }
   }
   fclose( fp );
   fp = NULL;
   return;
}


When this enhancement is applied, immortals on the mud can then setup a color theme they like with all the defaults they want. Using the "color savetheme" option and specifying a file named "default" this will cause reset_colors to use the information in that file to do the initial color setup for new players, and for when someone does a color reset. If this file is not available or is unreadable for some reason, the code will fall back on the hardcoded table in the color.h file.
       
Pages:<< prev 1 next >>