Re: [CODE] The Mapsnippet

From: Francis Hotchkiss (fhotch@buffnet.net)
Date: 11/12/98


> From: Christoffer Lundberg <avatar@orion.boden.se>
> To: CIRCLE@post.queensu.ca
> Subject: Re:  [CODE] The Mapsnippet
> Date: Thursday, November 12, 1998 7:30 AM
>
> 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.

Well it was only pseudo-code, not really meant for use, just as
an example of what to do.

> (act.movement.c: in perform_simple_move)

If you put it here, the players will only see the map when they change
rooms. Try act.informative.c look_at_room()

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

As I already said, the code was not complete, just an example....

>   char map_chars[MAP_ROOMS][5];  /* So I can have color */
You only need 4 not 5

>   const char *sector_symbols[] = {
>    "&c#&n",     /* Inside      */
  (sectors snipped)
>    "&K.&n",     /* Flight      */
>    "&R*&n"      /* Lava        */
>   };
if the "&n" is at the end of all of them, why put it there?
why not just initalize all the values of the map array to "&n"?
ex:
  char *sect_sym[] = { "&R*" };
  for (i = 0; i < MAP_ROOMS; i++) {
     map_rnum[i] = 0;
     sprintf(map_chars[i], "&n");
  }
  sprintf(map_char[whatever_room], sect_sym[ROOM_SECTOR]);

This way, no matter what, every room will have a color code preceding
it's symbol, and no symbol will have the wrong color.

>   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;
> }

  Like i said, this really should be put into a separate function that has
this inside of a for() loop(check for doors, etc). Then this function calls
that function from another for() loop(go through all exits of a room). Then
this function should be called from another function that calls this one in
a specific order from a for() loop( ie: run this function first on the
center
room, then the room to the north of the center, then the room to the east,
the room south, then west, the the rooms to the north, east, and west of
the room to the north.)

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

Easy enough, it can be put anywhere, just make sure you declare
the main function before you call it.

> =========
>  ##
>   # # #
>  ###&###
>  #  #  #
>     #
>     #
> =========
Use a buffer and a few sprintf's.

Oh, on a side note, if your mapping a city, you may want to work
with more detailed maps, like 3 chars by 3 chars on the map per
room, that way you can designate open/closed doors, and the map
doesn't look so clutered.

-Astaroth


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