Note from Samson: This is the corrected version of Sadiq's snippet and includes
all the necessary changes, including the corrections posted to the list after
the initial release.

Okies, here it is. This snippet will enable your mud to have a MUCH broader range
of vnums to build with. Specifically, it ups the range from roughly 32,700 to 2 billion.
The meat of the whole thing is simply to change the type cast of the relevant variables
from sh_int to int, and change the many places where the number 32,767 is actually coded
in, to 2,000,000,000.

I know some may question the fact that I decided to define MAX_VNUMS, and use that, through-
out the code, but I did it, to save on the finger-leather in the event that someone would
want to (although I couldn't begin to fathom why) 'upgrade' to a still larger range of
vnums. (With additional coding, it's possible to bump the limit to 4 billion, or even more)

A small word of warning here: Changing the cast of a variable to a larger type *will* cause
your mud to use a bit more memory. If you are on a quota'd system, keep an eye on the 
memory you are using. The changes advocated herein won't bump your memory usage by earth-
shaking proportions, but it is a good thing to keep track of :)

Finally.....I don't consider this a snippet, per se, and so I don't require any credit, if
you happen to use it, on your mud. Feel free to pass this around, as you see fit. I've tried
to catch everything I could, but this is a formal statement that there is no guarantees
that this is complete, will work on your system, or is even worth adding, at all. I *did*,
however add this stuff to a stock smaug release, and got a pristine clean compile on a 
RedHat 5.2 system, and tested the code lightly, in-game, with no problems, whatsoever.

Enjoy,

Sadiq

P.S. Be aware, also, that if you have added any new code to your mud, which involves the
vnums, you may have to alter it, to acommodate these code changes. The same basic rule
apply...change the cast of any variable that is to hold a vnum value to int, and change
any occurances of '32,767' (where relevant to vnums) to MAX_VNUMS.

****************************************************************************************
MUD.H
-----

immediately AFTER:

#define MAX_NPC_RACE               91

add:

#define MAX_VNUMS                  2000000000

---

in struct mob_index_data

   find:
	  sh_int		vnum;

   change to:
	  int			vnum;

---

in struct killed_data

   find:
	  sh_int		vnum;

   change to:
	  int			vnum;

---

in struct pc_data

   find:

    sh_int              r_range_lo;     /* room range */
    sh_int              r_range_hi;
    sh_int              m_range_lo;     /* mob range  */
    sh_int              m_range_hi;
    sh_int              o_range_lo;     /* obj range  */
    sh_int              o_range_hi;

   change to:

    int                 r_range_lo;     /* room range */
    int                 r_range_hi;
    int                 m_range_lo;     /* mob range  */
    int                 m_range_hi;
    int                 o_range_lo;     /* obj range  */
    int                 o_range_hi;

---

in struct area_data

   find:

    sh_int              low_m_vnum;
    sh_int              hi_m_vnum;

   change to:

    int                 low_m_vnum;
    int                 hi_m_vnum;

---

in struct godlist_data

   find:

    sh_int              low_m_vnum;
    sh_int              hi_m_vnum;

   change to:

    int                 low_m_vnum;
    int                 hi_m_vnum;

---

in struct system_data

   find:

    sh_int      imc_mail_vnum;          /* Board vnum for IMC mail     */

   change to:

    int         imc_mail_vnum;          /* Board vnum for IMC mail     */

---

in function declarations (near bottom of file), in act_move.c's group

   find:

void    teleport        args( ( CHAR_DATA *ch, sh_int room, int flags ) );

   change to:

void    teleport        args( ( CHAR_DATA *ch, int room, int flags ) );

---

and in db.c's declarations

   find:

MID *   get_mob_index   args( ( sh_int vnum ) );

   change to:

MID *   get_mob_index   args( ( int vnum ) );


   find:

MID *   make_mobile     args( ( sh_int vnum, sh_int cvnum, char *name ) );

   change to:

MID *   make_mobile     args( ( int vnum, int cvnum, char *name ) );

---

*****************************************************************************************
ACT_MOVE.C
----------

in void teleport

   find:

void teleport( CHAR_DATA *ch, sh_int room, int flags )

   change to:

void teleport( CHAR_DATA *ch, int room, int flags )

---

in ROOM_INDEX_DATA *generate_exit

   find:

if ( in_room->vnum > 32767 )   /* room is virtual */    
    {
        serial = in_room->vnum;
        roomnum = in_room->tele_vnum;
        if ( (serial & 65535) == orig_exit->vnum )
        {
          brvnum = serial >> 16;
          --roomnum;
          distance = roomnum;
        }
        else
        {
          brvnum = serial & 65535;
          ++roomnum;
          distance = orig_exit->distance - 1;
        }
        backroom = get_room_index( brvnum );
    }

   change to:

if ( in_room->vnum > MAX_VNUMS )   /* room is virtual */    
    {
        serial = in_room->vnum;
        roomnum = in_room->tele_vnum;
        if ( (serial & MAX_VNUMS) == orig_exit->vnum )
        {
          brvnum = serial >> 16;
          --roomnum;
          distance = roomnum;
        }
        else
        {
          brvnum = serial & MAX_VNUMS;
          ++roomnum;
          distance = orig_exit->distance - 1;
        }
        backroom = get_room_index( brvnum );
    }


   find:

if ( !found )    
    {
        bxit = make_exit(room, backroom, rev_dir[vdir]);
        bxit->keyword           = STRALLOC( "" );
        bxit->description       = STRALLOC( "" );
        bxit->key               = -1;
        if ( (serial & 65535) != orig_exit->vnum )
          bxit->distance = roomnum;
        else

   change to:

if ( !found )    
    {
        bxit = make_exit(room, backroom, rev_dir[vdir]);
        bxit->keyword           = STRALLOC( "" );
        bxit->description       = STRALLOC( "" );
        bxit->key               = -1;
        if ( (serial & MAX_VNUMS) != orig_exit->vnum )
          bxit->distance = roomnum;
        else

---

*********************************************************************************
ACT_WIZ.C
---------

in do_minvoke

   find:

    sh_int vnum;

   change to:

    int vnum;

---

in do_oinvoke

   find:

    sh_int vnum;

   change to:

    int vnum;

---

in do_rassign

   find:

    sh_int  r_lo, r_hi;

   change to:

    int  r_lo, r_hi;

---

in do_oassign

   find:

    sh_int  o_lo, o_hi;

   change to:

    int  o_lo, o_hi;

---

in do_massign

   find:

    sh_int  m_lo, m_hi;

   change to:

    int  m_lo, m_hi;

---

in do_rat

   find:

    if ( Start < 1 || End < Start || Start > End || Start == End || End > 32767 )  

   change to:

    if ( Start < 1 || End < Start || Start > End || Start == End || End > MAX_VNUMS )  

---

in do_scatter

   find:

      pRoomIndex = get_room_index( number_range( 0, 32767 ) ); 

   change to:

      pRoomIndex = get_room_index( number_range( 0, MAX_VNUMS ) ); 

---

in do_strew

   find:

      pRoomIndex = get_room_index( number_range( 0, 32767 ) );

   change to:

      pRoomIndex = get_room_index( number_range( 0, MAX_VNUMS ) );

************************************************************************************************
BUILD.C
-------

in bool can_rmodify

   find:

        sh_int vnum = room->vnum;

   change to:

        int vnum = room->vnum;

---

in bool can_omodify

   find:

        sh_int vnum = obj->pIndexData->vnum;

   change to:

        int vnum = obj->pIndexData->vnum;

---

in bool can_oedit

   find:

        sh_int vnum = obj->vnum;

   change to:

        int vnum = obj->vnum;

---

in bool can_mmodify

   find:

        sh_int vnum;   

   change to:

        int vnum;   

---

in bool can_medit

   find:

        sh_int vnum = mob->vnum;

   change to:

        int vnum = mob->vnum;

---

in do_goto

   find:

    sh_int vnum;

   change to:

    int vnum;

---


in do_ocreate

   find:

    if ( vnum < 1 || vnum > 32767 )

   change to:

    if ( vnum < 1 || vnum > MAX_VNUMS )

---

in do_mcreate

   find:

    if ( vnum < 1 || vnum > 32767 )

   change to:

    if ( vnum < 1 || vnum > MAX_VNUMS )

---

in function parse_reset

   find:

        if ( val1 < 1 || val1 > 32767 ) 

   change to:

        if ( val1 < 1 || val1 > MAX_VNUMS ) 

---

in do_redit

   find:

        evnum = atoi(arg2);
        if ( evnum < 1 || evnum > 32766 )

   change to:

        evnum = atoi(arg2);
        if ( evnum < 1 || evnum > (MAX_VNUMS -1) )

   find:

        }
        if ( evnum < 1 || evnum > 32766 )
        {
            send_to_char( "Invalid room number.\n\r", ch );

   change to:

        }
        if ( evnum < 1 || evnum > (MAX_VNUMS - 1) )
        {
            send_to_char( "Invalid room number.\n\r", ch );

**********************************************************************************************
DB.C
----

in load_mobiles

   find:

        sh_int vnum;

   change to:

        int vnum;

---

in get_mob_index

   find:

MOB_INDEX_DATA *get_mob_index( sh_int vnum ) 

   change to:

MOB_INDEX_DATA *get_mob_index( int vnum ) 

---

in make_mobile

   find:

MOB_INDEX_DATA *make_mobile( sh_int vnum, sh_int cvnum, char *name )

   change to :

MOB_INDEX_DATA *make_mobile( int vnum, int cvnum, char *name )

---

in do_checkvnums

   find:

    if (low_range < 1 || low_range > 32767 )
    {
      send_to_char("Invalid argument for bottom of range.\n\r", ch);
      return;
    }
 
    if (high_range < 1 || high_range > 32767 )
    {
      send_to_char("Invalid argument for top of range.\n\r", ch);
      return;
    }

   change to:

    if (low_range < 1 || low_range > MAX_VNUMS )
    {
      send_to_char("Invalid argument for bottom of range.\n\r", ch);
      return;
    }
 
    if (high_range < 1 || high_range > MAX_VNUMS )
    {
      send_to_char("Invalid argument for top of range.\n\r", ch);
      return;
    }

---

in do_vnums

   find:

    low = 0;    high = 32766;

   change to:

    low = 0;    high = MAX_VNUMS;

---

in do_zones

   find:

    low = 0;    high = 32766;

   change to:

    low = 0;    high = MAX_VNUMS;

---

in do_newzones

   find:

    low = 0;    high = 32766;

   change to:

    low = 0;    high = MAX_VNUMS;


****************************************************************************************
GRUB.B
------

in do_diagnose

   find:

if (!str_cmp(arg1, "mrc"))
{
   MOB_INDEX_DATA *pm;
   sh_int cou, race, class, dis_num, vnum1, vnum2, dis_cou = 0;

   change to:

if (!str_cmp(arg1, "mrc"))
{
   MOB_INDEX_DATA *pm;
   sh_int cou, race, class, dis_num, dis_cou = 0;
   int vnum1, vnum2;

  find:

   hi = (*arg4) ? atoi (arg4) : 32767;

  change to:

   hi = (*arg4) ? atoi (arg4) : MAX_VNUMS;

---

in do_opfind

   find:

   int                 lo_vnum=1, hi_vnum=32767;

   change to:

   int                 lo_vnum=1, hi_vnum=MAX_VNUMS;

   find:

         lo_vnum = URANGE(1, atoi(arg2), 32767);
         hi_vnum = URANGE(1, atoi(arg3), 32767);

   change to:

         lo_vnum = URANGE(1, atoi(arg2), MAX_VNUMS);
         hi_vnum = URANGE(1, atoi(arg3), MAX_VNUMS);

---

in do_mpfind

  find:

   int                 lo_vnum=1, hi_vnum=32767;

  change to:

   int                 lo_vnum=1, hi_vnum=MAX_VNUMS;

  find:

         lo_vnum = URANGE(1, atoi(arg2), 32767);
         hi_vnum = URANGE(1, atoi(arg3), 32767);

  change to:

         lo_vnum = URANGE(1, atoi(arg2), MAX_VNUMS);
         hi_vnum = URANGE(1, atoi(arg3), MAX_VNUMS);

---

in do_rpfind

  find:

   int                 lo_vnum=1, hi_vnum=32767;

  change to:

   int                 lo_vnum=1, hi_vnum=MAX_VNUMS;

  find:

         lo_vnum = URANGE(1, atoi(arg2), 32767);
         hi_vnum = URANGE(1, atoi(arg3), 32767);

  change to:

         lo_vnum = URANGE(1, atoi(arg2), MAX_VNUMS);
         hi_vnum = URANGE(1, atoi(arg3), MAX_VNUMS);

---

in do_rgrub

  find:

   hi = (*arg4) ? atoi (arg4) : 32767;

  change to:

   hi = (*arg4) ? atoi (arg4) : MAX_VNUMS;

---

*******************************************************************************************
HANDLER.C
---------

in add_kill

  find:

    sh_int vnum, track;

  change to:

    sh_int track;
    int vnum;

---

in times_killed

  find:

    sh_int vnum, track;

  change to:

    sh_int track;
    int vnum;

---

***********************************************************************************************
MAGIC.C
-------

in spell_animate_dead

  find:

    if ( (pMobIndex = get_mob_index((sh_int) abs(corpse->cost) )) == NULL )   

  change to:

    if ( (pMobIndex = get_mob_index((int) abs(corpse->cost) )) == NULL )

---

in spell_teleport

  find:

        pRoomIndex = get_room_index( number_range( 0, 32767 ) );

  change to:

        pRoomIndex = get_room_index( number_range( 0, MAX_VNUMS ) );

************************************************************************************************
MUD_COMM.C
----------

in do_mpstrew

  find:

    if ( low_vnum < 1 || high_vnum < low_vnum || low_vnum > high_vnum || low_vnum == high_vnum || high_vnum > 32767 ) {

  change to:

    if ( low_vnum < 1 || high_vnum < low_vnum || low_vnum > high_vnum || low_vnum == high_vnum || high_vnum > MAX_VNUMS ) {

---

in do_mpscatter

  find:

    if ( low_vnum < 1 || high_vnum < low_vnum || low_vnum > high_vnum || low_vnum == high_vnum || high_vnum > 32767 ) {

  change to:

    if ( low_vnum < 1 || high_vnum < low_vnum || low_vnum > high_vnum || low_vnum == high_vnum || high_vnum > MAX_VNUMS ) {

*************************************************************************************************
MUD_PROG.C
----------

in mprog_do_ifcheck

  find:

        if (vnum < 1 || vnum > 32767)
        {
            progbug("Bad vnum to 'mobinarea'", mob);
            return BERR;
        }

  change to:

        if (vnum < 1 || vnum > MAX_VNUMS)
        {
            progbug("Bad vnum to 'mobinarea'", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug( "Bad vnum to 'mobinroom'", mob );
            return BERR;
        }

  change to:

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug( "Bad vnum to 'mobinroom'", mob );
            return BERR;
        }

  find:

        if(vnum < 1 || vnum > 32767)
        {
            progbug("Bad vnum to 'mobinworld'", mob);
            return BERR;
        }

  change to:

        if(vnum < 1 || vnum > MAX_VNUMS)
        {
            progbug("Bad vnum to 'mobinworld'", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug("OvnumHere: bad vnum", mob);
            return BERR;
        }

  change to :

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug("OvnumHere: bad vnum", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug("OvnumRoom: bad vnum", mob);
            return BERR;
        }

  change to:

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug("OvnumRoom: bad vnum", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug("OvnumCarry: bad vnum", mob);
            return BERR;
        }

  change to:

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug("OvnumCarry: bad vnum", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug("OvnumWear: bad vnum", mob);
            return BERR;
        }

  change to:

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug("OvnumWear: bad vnum", mob);
            return BERR;
        }

  find:

        if ( vnum < 1 || vnum > 32767 )
        {
            progbug("OvnumInv: bad vnum", mob);
            return BERR;
        }

  change to:

        if ( vnum < 1 || vnum > MAX_VNUMS )
        {
            progbug("OvnumInv: bad vnum", mob);
            return BERR;
        }

***********************************************************************************************
SHOPS.C
-------

in do_makeshop

  find:

    sh_int vnum;

  change to:

    int vnum;

---

in do_shopset

  find:

    sh_int vnum;

  change to:

    int vnum;

---

in do_shopstat

  find:

    sh_int vnum;

  change to:

    int vnum;

---

in do_makerepair

  find:

    sh_int vnum;

  change to:

    int vnum;

---

in do_repairset

  find:

    sh_int vnum;

  change to:

    int vnum;

---

in do_repairstat

  find:

    sh_int vnum;

  change to:

    int vnum;

************************************************************************************************
SKILLS.C
--------

in do_slice

  find:

  if ( (pMobIndex = get_mob_index((sh_int) -(corpse->value[2]) )) == NULL ) 

  change to:

  if ( (pMobIndex = get_mob_index((int) -(corpse->value[2]) )) == NULL ) 

***********************************************************************************************
TRACK.C
-------

  find:

extern sh_int   top_room;

  change to:

extern int      top_room;

************************************************************************************************

Do a clean make, and reboot.