Night descriptions for rooms, double fun to area builders :)
BACKUP YOUR CODE AND AREA FILES!!!
So, here's a little code i decided to release, I hope you find it useful.
I belive in freeware solutions, so I ask no credit for it.
merc.h
to struct room_index_data
char * name;
char * description;
char * nightdesc; //add
olc_save.c
in function save_rooms
fprintf (fp, "%s~\n", pRoomIndex->name);
fprintf (fp, "%s~\n", fix_string (pRoomIndex->description));
fprintf (fp, "%s~\n", fix_string (pRoomIndex->nightdesc)); //add
olc.c
to const struct olc_cmd_type redit_table[] = {
{"create", redit_create},
{"desc", redit_desc},
{"nightdesc", redit_desc1}, //add
olc.h
to
/*
* Room Editor Prototypes
*/
DECLARE_OLC_FUN( redit_name );
DECLARE_OLC_FUN( redit_desc );
DECLARE_OLC_FUN( redit_desc1 ); //add
olc_act.c
to function REDIT (redit_show)
sprintf (buf, "Description:\n\r%s\n\r", pRoom->description);
strcat (buf1, buf);
sprintf (buf, "Night Description:\n\r%s\n\r", pRoom->nightdesc); /*add*/
strcat (buf1, buf); /*add*/
after function REDIT (redit_desc)
/*add this code...start*/
REDIT (redit_desc1)
{
ROOM_INDEX_DATA *pRoom;
EDIT_ROOM (ch, pRoom);
if (argument[0] == '\0')
{
string_append (ch, &pRoom->nightdesc);
return TRUE;
}
send_to_char ("Syntax: nightdesc\n\r", ch);
return FALSE;
}
/*end*/
in function REDIT (redit_format)
pRoom->description = format_string (pRoom->description);
pRoom->nightdesc = format_string (pRoom->nightdesc); //add
in function REDIT (redit_copy)
free_string( pRoom->description );
pRoom->description = str_dup( pRoom2->description );
free_string( pRoom->nightdesc ); /*add*/
pRoom->nightdesc = str_dup( pRoom2->nightdesc ); /*add*/
act_info.c
somewhere on the top add:
#define NIGHTMESS
in function do_look
if (arg1[0] == '\0'
|| (!IS_NPC (ch) && !IS_SET (ch->comm, COMM_BRIEF)))
{
//replace your code stuff with this code...start
#ifdef NIGHTMESS
if (weather_info.sunlight == SUN_LIGHT)
{
send_to_char ("", ch);
send_to_char (ch->in_room->description, ch);
send_to_char ("", ch);
}
else if (weather_info.sunlight == SUN_RISE)
{
send_to_char ("", ch);
send_to_char (ch->in_room->description, ch);
send_to_char ("", ch);
}
else if (weather_info.sunlight == SUN_SET)
{
send_to_char ("", ch);
send_to_char (ch->in_room->nightdesc, ch);
send_to_char ("", ch);
}
else if (weather_info.sunlight == SUN_DARK)
{
send_to_char ("", ch);
send_to_char (ch->in_room->nightdesc, ch);
send_to_char ("", ch);
}
else
{
send_to_char ("BUG!!!\n\r", ch);
}
#else
send_to_char ("", ch);
send_to_char (ch->in_room->description, ch);
send_to_char ("", ch);
#endif
//end of this code bit
}
After you are done with previous code, make clean, make, reboot and save your area files.
Then add this code, make, shutdown your mud, and then start it up again. Everything should work fine.
db.c
pRoomIndex->description = fread_string (fp);
pRoomIndex->nightdesc = fread_string (fp); //add
This should be all. I hope i did not forget anything.
If you have any bug fixes, updates, ideas for this code or just hate mail to me, let me know:
surma@hot.ee
BlackLand mud at: kellu.black.pri.ee 4000