Re: [CODE/IDEA] Invasion/ElectricFence

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 03/07/98


> static in C++ indicates unchangable variables -- static in a C function
> indicates a variable that does not get deallocated (opposite of automatic,
> a keyword that is never used)

Just a small addon to that. If a static var is declared inside a
function, as you say it means its value will remain constant between
calls to that function.

The addenum is that when a static var is delared globally, meaing _not_
inside any funcion itself, it means that that variable cannot be accessed
in any other c files VIA the 'extern' keyword. Its _scope_ is local to
that C file, and that C file alone

OBCircle:
  Here's something that may be of interest in those playing with that
path thing for mobs to get about. Its an IMM only command I coded to show
you directions to a room from your present location. Can be modified easy
enough to get a list of numbers for perform_move. I use this when in a
good mood and want to answer that age old GOSS, how do i get to Area_X
from Room_B

ACMD(do_path)
{
  int dir, done = FALSE;
  room_num sroom, troom, temp_room;

  if (GET_LEVEL(ch) < LVL_IMMORT) {
    send_to_char("You have no idea how.\r\n", ch);
    return;
  }
  sroom = IN_ROOM(ch);

  one_argument(argument, arg);
  if (!*arg) {
    send_to_char("Where are you trying to find a path to?\r\n", ch);
    return;
  }
  if (!(troom = real_room(atoi(arg)))) {
    send_to_char("No-such target room.\r\n", ch);
    return;
  }
  temp_room = IN_ROOM(ch);
  do {
    done = FALSE;
    dir = find_first_step(sroom, troom);
    switch (dir) {
    case BFS_ERROR:
      send_to_char("[ERR]", ch);
      done = TRUE;
      break;
    case BFS_ALREADY_THERE:
      done = TRUE;
      break;
    case BFS_NO_PATH:
      send_to_char("[ERR]",ch);
      done = TRUE;
      break;
    default:
      sprintf(buf, "%s ", dirs[dir]);
      send_to_char(buf, ch);
      done = FALSE;
      break;
    }
    if (!done && EXITN(temp_room, dir)->to_room != NOWHERE) {
      sroom = EXITN(temp_room, dir)->to_room;
      temp_room = sroom;
    }
  } while (!done);
  send_to_char("\r\n",ch);
}


    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST