Re: Random spin rooms.

From: Welcor (welcor@dune.net)
Date: 04/25/02


----- Original Message -----
From: "Christian Ejlertsen" <chr.ejlertsen@HAS.DK>

> I was wondering if any has made a succesful random spinning rooms.
> If you don't know what I mean, it rooms where you will taken in a random
> direction no matter what direction you choose.
> I'm looking for solution where all you do is set a ROOM_SPIN flag and it
> spins the possible exits.

mailercode: (act.movement.c)
ACMD(do_move) {
  int i, dir;

  if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SPIN) {
    for (i = 0;i<10;i++) { /* if we don't find one in 10 steps, skip it. */
      dir = number(0, NUM_OF_DIRS - 1);
      if (EXIT(ch, dir) && EXIT(ch, dir)->to_room != NOWHERE) {
        perform_move(ch, dir, 0);
        return;
      }
    }
  }
  perform_move(ch, subcmd - 1, 0);
}

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT