Re: [CODE] The Mapsnippet

From: Christoffer Lundberg (avatar@orion.boden.se)
Date: 11/12/98


Ok. I tried out the code, not that I can get much out of how
and where to put it at the right place. I did like this, and
it feel awfully wrong.

(act.movement.c: in perform_simple_move)

+ if (IS_IMPL(ch))
+   show_map(ch);

  if (ch->desc != NULL)
    look_at_room(ch, 0);




And then, I did a void function with the code you
sent.

#define MAP_WIDTH 5
#define MAP_HEIGHT 5
#define MAP_ROOMS (MAP_WIDTH * MAP_HEIGHT)

void show_map(struct char_data *ch)
{
  char map_chars[MAP_ROOMS][5];  /* So I can have color */
  int map_rnum[MAP_ROOMS], i;
  const char *sector_symbols[] = {
   "&c#&n",     /* Inside      */
   "&w.&n",     /* City        */
   "&gT&n",     /* Forest      */
   "&y^&n",     /* Hills       */
   "&K^&n",     /* Mountain    */
   "&c~&n",     /* Water:swim  */
   "&B~&n",     /* Water:!swim */
   "&b~&n",     /* Underwater  */
   "&K.&n",     /* Flight      */
   "&R*&n"      /* Lava        */
  };
  for (i = 0; i < MAP_ROOMS; i++) {
     map_rnum[i] = 0;
     *map_chars[i] = '\0';
  }
  map_rnum[17] = IN_ROOM(ch);
  sprintf(map_chars[17], sector_symbols[SECT(map_rnum[17])]);
  map_rnum[17 - MAP_WIDTH] = EXIT(ch, 0)->to_room;
  map_rnum[17 + 1] = EXIT(ch, 1)->to_room;
  map_rnum[17 + MAP_WIDTH] = EXIT(ch, 2)->to_room;
  map_rnum[17 - 1] = EXIT(ch, 3)->to_room;
}


I must have done it by the wrong way, and I didn't really
figure out how and where to put this so it might work. I want it
to look like this, as an example:


 ##
  # # #
 ###&###
 #  #  #
    #
    #

Centre Square
  This is the centre square. Blah, blah, blah, blah
blah blah blah.
[ Exit(s): n e s w ]
A white marble fountain is placed here.
A trustworthy cityguard stands here.

>Christoffer


     +------------------------------------------------------------+
     | 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