Re: [CODE] Identifying mobs in spec. procs.

From: George Greer (greerga@circlemud.org)
Date: 11/29/00


On Wed, 29 Nov 2000, Martijn Schoemaker wrote:

>Every player/mob uses a struct char_data. The only difference is that
>mobs don't have the player_specials struct assigned [...]

They all share a common:

struct player_special_data dummy_mob;   /* dummy spec area for mobs     */

so we don't allocate one for every mobile and the MUD doesn't crash when
you try to use it.  Now it'll just gripe at you with the infamous
CHECK_PLAYER_SPECIAL macro. (Think of it like an 'undefined value' warning
in Perl...not necessarily a bad thing, but something you should probably
take a look at and fix.)

>and the players don't have the mob_specials assigned (or at least that
>was the case in earlyer CircleMUD releases).

Actually, they do have it.  It's probably a bug that they do though.  On
the bright side, mob_special_data wastes 20 bytes per player instead of
player_special_data wasting 324 bytes per mobile (on x86).

>You can use mobs in the same way as players, except that you can use the
>IS_NPC or the IS_MOB macro's to distinguish between the two.

!IS_NPC = player
IS_NPC  = non-player
IS_MOB  = mob (prototyped non-player, a.k.a. mob_proto[])

NPC's aren't necessarily in mob_proto[].

>Try : telnet imagica.net 4000 (or 119) and be amazed.

Sure hope that doesn't run on Unix or drops root privileges. :)

--
George Greer            | If it's about the CircleMUD mailing list,
greerga@circlemud.org   | mail owner-circle@post.queensu.ca instead.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT