Re: Using in handler.c...

From: Welcor (
Date: 01/21/02

----- Original Message -----
From: "Vladimir Nano" <nano.vladimir@SLSP.SK>

> Hallo:-)
> I'm using bpl18 and now i'm adding masks.
> When player wears mask, he is masked and nobody knows his name. (only
> Now i want to change functions in handler.c: get_char_room(),
> get_player_room(), ....
> In these functions is used i-> Why? I think GET_NAME() macro
> usable.
> What do You think about it?
From utils.h:

#define GET_NAME(ch)    (IS_NPC(ch) ? \
    (ch)->player.short_descr : GET_PC_NAME(ch))

In other words; if you were checking on GET_NAME() instead, you'd find
mobs based on their shortdesc instead of their alias list.

I'd suggest you use a slightly different approach, adding a 'orig_name'
variable to the player struct, and using that whenever you output the
name to someone who is high enough level, etc.

in char_data (player_data):
char *orig_name;

in utils.h redefine:
#define GET_PC_NAME(ch, viewer) (((viewer) && \
     (GET_LEVEL(viewer)>LVL_IMMORT || viewer==ch)) ? \
     (ch)->player.orig_name : (ch)->

#define GET_NAME(ch, viewer) (IS_NPC(ch) ? \
    (ch)->player.short_descr : GET_PC_NAME(ch, viewer))

Change all of the occurrences of GET_NAME(blah) to GET_NAME(blah, blah)

Setup orig_name in interpreter.c:

(ch)->player.orig_name = str_dup((ch)->;
  (ch)-> = str_dup("Some masked name");

Remember to free() the memory when removing/wearing the mask,
and in free_char()


I hope this helps a bit.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

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