Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Anti-flags not working properly...

Anti-flags not working properly...

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by USER007   (124 posts)  Bio
Date Thu 07 Apr 2005 11:08 PM (UTC)

Amended on Fri 08 Apr 2005 12:37 AM (UTC) by USER007

Message

Build.c:

char *	const	o_flags	[] =
{
"glow", "hum", "dark", "loyal", "evil", "invis", "magic", "nodrop", "bless",
"antigood", "antievil", "antineutral", "noremove", "inventory",
"antihuman", "antifighter", "antifircedemon", "antifiredemon", "organic", "metal",
"donation", "clanobject", "clancorpse", "antifoxdemon", "antispiritdet", 
"hidden", "poisoned", "covering", "deathrot", "buried", "prototype", 
"nolocate", "groundrot", "lootable", "antispirithm", "antiwarrior"
};

mud.h:

typedef enum
{
  ITEM_GLOW, ITEM_HUM, ITEM_DARK, ITEM_LOYAL, ITEM_EVIL, ITEM_INVIS, ITEM_MAGIC, 
  ITEM_NODROP, ITEM_BLESS, ITEM_ANTI_GOOD, ITEM_ANTI_EVIL, ITEM_ANTI_NEUTRAL, 
  ITEM_NOREMOVE, ITEM_INVENTORY, ITEM_ANTI_HUMAN, ITEM_ANTI_FIGHTER, 
  ITEM_ANTI_FIRCE_DEMON, ITEM_ANTI_FIRE_DEMON, ITEM_ORGANIC, ITEM_METAL, ITEM_DONATION, 
  ITEM_CLANOBJECT, ITEM_CLANCORPSE, ITEM_ANTI_FOX_DEMON, ITEM_ANTI_SPIRIT_DET, 
  ITEM_HIDDEN, ITEM_POISONED, ITEM_COVERING, ITEM_DEATHROT, ITEM_BURIED, 
  ITEM_PROTOTYPE, ITEM_NOLOCATE, ITEM_GROUNDROT, ITEM_LOOTABLE, ITEM_ANTI_SPIRIT_HM,
  ITEM_ANTI_WARRIOR,
  MAX_ITEM_FLAG
} item_extra_flags;

act_obj.c:
    if ( !IS_IMMORTAL(ch)
    &&  (( IS_OBJ_STAT(obj, ITEM_ANTI_HUMAN)
        && ch->class == CLASS_HUMAN					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_FIGHTER)
        && ch->class == CLASS_FIGHTER					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_FIRCE_DEMON)
	&& ch->class == CLASS_FIRCE_DEMON					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_FIRE_DEMON)
	&& ch->class == CLASS_FIRE_DEMON					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_FOX_DEMON)
	&& ch->class == CLASS_FOX_DEMON					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_SPIRIT_DET)
	&& ch->class == CLASS_SPIRIT_DET					)
    ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_SPIRIT_HM)
	&& ch->class == CLASS_SPIRIT_HM					)
    ||	 ( IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR)
	&& ch->class == CLASS_WARRIOR					)) )
    {
	act( AT_MAGIC, "You are forbidden to use that item.", ch, NULL, NULL, TO_CHAR );
	act( AT_ACTION, "$n tries to use $p, but is forbidden to do so.",
	    ch, obj, NULL, TO_ROOM );
	return;
    }

handler.c:

    if ( xIS_SET(*extra_flags, ITEM_ANTI_HUMAN)	) strcat( buf, " anti-human"    );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_FIGHTER) ) strcat( buf, " anti-fighter"   );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_FIRCE_DEMON) ) strcat( buf, " anti-firce-demon" );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_FIRE_DEMON) ) strcat( buf, " anti-fire-demon"  );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_FOX_DEMON)	) strcat( buf, " anti-fox-demon"   );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_SPIRIT_DET)) strcat( buf, " anti-spirit-det" );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_SPIRIT_HM) ) strcat( buf, " anti-spirit-hm"  );
    if ( xIS_SET(*extra_flags, ITEM_ANTI_WARRIOR) ) strcat( buf, " anti-warrior"   );



Heres the object:

Name: Some battle armor
Vnum: 10320 Type: armor Count: 3 Gcount: 1
Serial#: 67 TopIdxSerial#: 67 TopSerial#: 67
Short description: Some battle armor
Long description : Some battle armor is here.
Wear flags : take body
Extra flags: glow antiwarrior
Magic flags: none
Number: 1/1 Weight: 1/1 Layers: 0 Wear_loc: -1
Cost: 0 Rent: 0 Timer: 0 Level: 0
In room: 0 In object: (none) Carried by: Anavel
Index Values : 0 0 0 0 5600 5600.
Object Values: 0 0 0 0 5600 5600.


Mortal:
class : 00/Warrior

Problem is that my mortal can still wear the object with the anti flag.

Obed gets Some battle armor.
Obed fits Some battle armor on his body.

Did I miss something?

[EDIT] I downloaded the recent SmaugFUSS and examed the code with mine and I realized something in the newer FUSS, it had "class" capitalized: ch->Class. Anyways I changed it to how it was in the newer FUSS and the anti flags seem to be working now. Seems that their was a fix for this, but I never saw it on any of Samson's message boards.

[EDIT 2] I also noticed that most "sh_int's" were replaced with "short". Is their a reason for this?
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Fri 08 Apr 2005 01:10 AM (UTC)
Message
Class was changed because you cannot use "class" in C++ and I assume Samson did that to make it easier in the conversion to C++ if one is done. I did a quick look over your posted code and saw nothing wrong.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #2 on Fri 08 Apr 2005 11:31 AM (UTC)
Message
Quote:

I also noticed that most "sh_int's" were replaced with "short". Is their a reason for this?


Because sh_int was a needless typedef for the proper type "short". Honestly didn't see any reason to continue using it even though other Merc bases have just left it in place since it was first added. I did an extensive Google search for it and it never shows up in anything outside of MUD code.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,055 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.