Re: Circlemud design issues

From: Luis Pedro Passos Carvalho (lpcarvalho@SONAE.PT)
Date: 04/21/98


James Turner said:
>Luis Pedro Passos Carvalho <lpcarvalho@SONAE.PT> writes:
>

[snip]

>out.  Suppose the decision was made that an array of rooms isn't the
>best way to go.  Right now, all the code that does
>
>for (tch = world[ch->in_room].pepople; tch; tch = tch->next_in_room)
>...
>
>Would need overhauling.  But if it had been done originally like:
>
>CharList *l;
>for (l = chars_in_room(ch); l; l = l->next) {
>  blah(l->ch);
>  ...
>}

Personally i believe that it would be easier and in more accord to the
present code:

struct char_data *l;
for (l= first_char_in_room(ch); l ; l=next_char_in_room(l)) {
  blah(l)
  ...
}

That way you don't need to allocate lists and free them afterwards.
Basically you would only need a first_char_<criteria to meet> and a
next_char_in_<criteria to meet>
Similar to the way to run through the directory tree in MS-DOS (hey, it had
nice things)

>Or another way,
>
>Iterator i;
>
>for (i = chars_in_room_iterator(ch); i; i = next(i)) {
>  tch = iter_to_ch(i);
>  blah(tch);
>  ...
>}

A bit over the edge wouldn't you think?

Hmmm... I think i'll start coding it, right after I code my ROOM_HUGE rooms.
Talk of a major change in code!

See ya!

Luis Carvalho


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