Months

Posted by Zeno on Mon 08 Nov 2004 08:02 PM — 7 posts, 25,837 views.

USA #0
I am thinking about removing some months in the game, but I'm not sure if it will screw up, or un-balance time or dates. Does anyone know?

char *  const   month_name      [] =
{
    "January", "February", "March", "April",
    "May", "June", "July", "August", "September",
    "October", "November", "December", "(remove)", "(remove)",
    "(remove)", "(remove)", "(remove)"
};
Amended on Mon 08 Nov 2004 08:07 PM by Zeno
Australia #1
I did this eome time ago, if i remember right there is something in mud.h or in sysdata.dat that you have to chane from the default 17 back to 12 months and how many hors per day etc. I had no trouble making the times and dates simular to 12-7-24 time format.
USA #2
Looked through mud.h and sysdata.dat for "17", found nothing relating to dates/time. Can anyone else remember where this is?

[EDIT]

This is in db.c:

        lhour           = (current_time - 650336715)
                        / (PULSE_TICK / PULSE_PER_SECOND);
        time_info.hour  = lhour  % 24;
        lday            = lhour  / 24;
        time_info.day   = lday   % 35;
        lmonth          = lday   / 35;
        time_info.month = lmonth % 17;
        time_info.year  = lmonth / 17;

             if ( time_info.hour <  5 ) time_info.sunlight = SUN_DARK;
        else if ( time_info.hour <  6 ) time_info.sunlight = SUN_RISE;
        else if ( time_info.hour < 19 ) time_info.sunlight = SUN_LIGHT;
        else if ( time_info.hour < 20 ) time_info.sunlight = SUN_SET;
        else                            time_info.sunlight = SUN_DARK;



That may be it. Would I just change both 17 to 12?
Amended on Wed 10 Nov 2004 04:11 AM by Zeno
Australia #3
yes, thats the stuff, i just changed those and all was well from what i can recall.


{
	long lhour, lday, lmonth;

	log_string("Setting time and weather");

	lhour		= (current_time - 650336715)
			/ (PULSE_TICK / PULSE_PER_SECOND);
	time_info.hour	= lhour  % 24;
	lday		= lhour  / 24;
	time_info.day	= lday   % 30;
	lmonth		= lday   / 30;
	time_info.month	= lmonth % 12;
	time_info.year	= lmonth / 12;

	     if ( time_info.hour <  5 ) time_info.sunlight = SUN_DARK;
	else if ( time_info.hour <  6 ) time_info.sunlight = SUN_RISE;
	else if ( time_info.hour < 19 ) time_info.sunlight = SUN_LIGHT;
	else if ( time_info.hour < 20 ) time_info.sunlight = SUN_SET;
	else                            time_info.sunlight = SUN_DARK;



After looking at that i think i should change my sunrise and sunset times to be closer to what i would like.
Amended on Thu 11 Nov 2004 05:46 AM by Robert Powell
USA #4
Hmm, it was fine until I noticed this:
Today is Monday the 22nd of Ç…d»ÿ[Ƀ섣‹…h»ÿ .


This is what I have...
    {
        long lhour, lday, lmonth;

        log_string("Setting time and weather");

        lhour           = (current_time - 650336715)
                        / (PULSE_TICK / PULSE_PER_SECOND);
        time_info.hour  = lhour  % 24;
        lday            = lhour  / 24;
        time_info.day   = lday   % 35;
        lmonth          = lday   / 35;
        time_info.month = lmonth % 12;
        time_info.year  = lmonth / 12;

             if ( time_info.hour <  5 ) time_info.sunlight = SUN_DARK;
        else if ( time_info.hour <  6 ) time_info.sunlight = SUN_RISE;
        else if ( time_info.hour < 19 ) time_info.sunlight = SUN_LIGHT;
        else if ( time_info.hour < 20 ) time_info.sunlight = SUN_SET;
        else                            time_info.sunlight = SUN_DARK;

        /*
        weather_info.change     = 0;
        weather_info.mmhg       = 960;
        if ( time_info.month >= 7 && time_info.month <=12 )
            weather_info.mmhg += number_range( 1, 50 );
        else
            weather_info.mmhg += number_range( 1, 80 );

             if ( weather_info.mmhg <=  980 ) weather_info.sky = SKY_LIGHTNING;
        else if ( weather_info.mmhg <= 1000 ) weather_info.sky = SKY_RAINING;
        else if ( weather_info.mmhg <= 1020 ) weather_info.sky = SKY_CLOUDY;
        else                                  weather_info.sky = SKY_CLOUDLESS;
        */
    }
Canada #5
Ok, so thats whats setting it, what is your function to print it look like? I assume that the problem is there as well, and that your using "time"? Either way, can you paste what is printing section of code is producing that error? It may be the array that you have defined for the month names is missing something.
USA #6
Well here's the whole function, may save time later.

void do_time( CHAR_DATA *ch, char *argument )
{
    extern char str_boot_time[];
    extern char reboot_time[];
    int day;
    bool has_clock=FALSE;
    OBJ_DATA *obj;
    char *suf;

    day     = time_info.day + 1;

    for ( obj = ch->first_carrying; obj; obj = obj->next_content )
    {
        if (obj->item_type == ITEM_CLOCK)
          has_clock=TRUE;
    }

    day     = time_info.day + 1;

         if ( day > 4 && day <  20 ) suf = "th";
    else if ( day % 10 ==  1       ) suf = "st";
    else if ( day % 10 ==  2       ) suf = "nd";
    else if ( day % 10 ==  3       ) suf = "rd";
    else                             suf = "th";

    set_char_color( AT_YELLOW, ch );
    if ( has_clock || IS_IMMORTAL(ch) )
      ch_printf( ch, "It is %d o'clock %s.\n\r", (time_info.hour % 12 == 0) ? 12 : time_info.hour % 12, time_info.hour >= 12$
      ch_printf( ch, "You do not have a clock.\n\r" );
    ch_printf( ch, "Today is %s the %d%s of %s.\n\r", day_name[day % 7], day, suf, month_name[time_info.month] );
    ch_printf( ch,
        "\n\rThe mud started up at:    %s\r"
        "The system time (PST):    %s\r"
        "Next Reboot is set for:   %s\r",

        str_boot_time,
        (char *) ctime( &current_time ),
        reboot_time
        );

    return;
}


Some of it is cut off, but what you need should be there.