I thought, well, the real world has windows as well as doors, and this concept can be used
to create "optical gateways" to other parts of the world (Or the next room!) Allowing
players to look out the window (or into the dark pool of water... whatever) and see
what is going on else where in the world.

It's quite simple to implement...  Add the function look_window to act_info.c

void look_window( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 1998 */
   {
    char 			 buf[MAX_STRING_LENGTH];
    ROOM_INDEX_DATA *window_room;   

	if ( obj->value[0] == 0 )
       {
	   sprintf(buf, "%s\n\r", obj->description );
	   send_to_char(buf, ch);
	   return;
	   }

	window_room = get_room_index( obj->value[0] );

	if ( window_room == NULL )
	   {
	   send_to_char( "!!BUG!! Window looks into a NULL room! Please report!\n\r", ch );
	   bug( "Window %d looks into a null room!!!", obj->pIndexData->vnum );
	   return;
	   }
		 
	if ( !IS_NPC(ch) )
	  {
	  send_to_char( "Looking through the window you can see ",ch);
	  send_to_char( window_room->name, ch );
	  send_to_char( "\n\r", ch);
	  show_list_to_char( window_room->contents, ch, FALSE, FALSE );
	  show_char_to_char( window_room->people,   ch );
	  return;
	  }
   }
   
add the following to the top of act_info.c just after the DECLARE_DO_FUN lines
   
void look_window( CHAR_DATA *ch, OBJ_DATA *obj );

in the function do_look() at some point find the following code...

    for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
	{
	
and add this bit...

	    if (obj->item_type == ITEM_WINDOW)    /* Voltecs Window code */
	       {
		   look_window(ch, obj);
           return;
		   }
		   
add the following line to the "item type list" in const.c
after the     {   ITEM_JUKEBOX,	"jukebox"	}, line

	{   ITEM_WINDOW,    "window"    },  /* Voltec Window Code */   

And in the flag_type type_flags[] table declaration in tables.c add the following line, 
(After the jukebox line...)

	{   "window",       ITEM_WINDOW,        TRUE    },

Then in olc_act.c add the following to the case statement in set_obj_values()

    case ITEM_WINDOW:
	    switch ( value_num )
	    {
	        default:
		    send_to_char( "set v0 to the destination window, or to zero if you wish to use the windows description \n\r",ch);
	            return FALSE;
	        case 0:
	            send_to_char( "VIEWING ROOM SET.\n\r\n\r", ch );
	            pObj->value[0] = atoi( argument );
	            break;       
        }
		break;

and in the function show_obj_values() add the following clause to teh case statement...

	    case ITEM_WINDOW:   /* Voltecs Window code! */
	    sprintf( buf, 
		"[v0] Room to view: [%d]\n\r"
		"[v1]             : Reserved\n\r"
		"[v2]             : Reserved\n\r"
		"[v3]             : Reserved\n\r"
		"[v4]             : Reserved\n\r",
		obj->value[0] );
		send_to_char( buf, ch );
		break;	
Then in db.c find the create_object() function, and in the case statemnt find the following
and add the ITEM_WINDOW line (Minus the ++ doh!)

   case ITEM_GEM:
   case ITEM_JEWELRY:
++ case ITEM_WINDOW:   /* Voltecs Window Code */

Then finally in Merc.h find the object types section and add an entry for the window under the 
jukebox line like so...

#define ITEM_JUKEBOX		 34
#define ITEM_WINDOW			 35 /* Voltecs Window Code */


______________________________________________ E.O.SNIPPET____________________________________

I think thats about it, but if you have any problems getting this one to work
or have any sugestions as to how I can improve it, let me know!  (At the moment the object
has to be a "window", ie if you call it a portal, then looking at it still calls it a window..
easy enough to fix, but I don't have the time at the moment...  Watch this space for an update...)

Basically, grep your code for any referances to ITEM_JUKE_BOX and add a similar line for the window...
(thats what I did!!!)

If you use it, send me an e-mail so I know it was worth the effort...

voltec@cyberdude.com

