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 ➜ Question on bitvectors available

Question on bitvectors available

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


Posted by Gadush   (92 posts)  Bio
Date Thu 12 Feb 2004 02:52 AM (UTC)

Amended on Thu 12 Feb 2004 02:53 AM (UTC) by Gadush

Message
I am working on getting a snippet that changes the archery in Smaug, but I can't get the wear_locations right. The reason is because, I think, there are only so many bitvectors, and they are all used already.

The archery snippet says to do this:


2. Open mud.h

Locate MAX_WHERE_NAME, increase the value by 3.

Locate the item wear flags.

Add the following in available BV slots:

ITEM_LODGE_RIB BVXX
ITEM_LODGE_ARM BVXX
ITEM_LODGE_LEG BVXX

Then increase ITEM_WEAR_MAX by 3.

Here is my original:

/*
 * Wear flags.
 * Used in #OBJECTS.
 */
#define ITEM_TAKE		BV00
#define ITEM_WEAR_FINGER	BV01
#define ITEM_WEAR_NECK		BV02
#define ITEM_WEAR_BODY		BV03
#define ITEM_WEAR_HEAD		BV04
#define ITEM_WEAR_LEGS		BV05
#define ITEM_WEAR_FEET		BV06
#define ITEM_WEAR_HANDS		BV07
#define ITEM_WEAR_ARMS		BV08
#define ITEM_WEAR_SHIELD	BV09
#define ITEM_WEAR_ABOUT		BV10
#define ITEM_WEAR_WAIST		BV11
#define ITEM_WEAR_WRIST		BV12
#define ITEM_WIELD		BV13
#define ITEM_HOLD		BV14
#define ITEM_DUAL_WIELD		BV15
#define ITEM_WEAR_EARS		BV16
#define ITEM_WEAR_EYES		BV17
#define ITEM_MISSILE_WIELD	BV18
#define ITEM_WEAR_BACK		BV19
#define ITEM_WEAR_FACE		BV20
#define ITEM_WEAR_ANKLE		BV21
#define ITEM_WEAR_MAX		21

And here is my changed one. Don't suppose I can just add 'em like that, hey? How do you know if there are available BV slots? Must I remove/change three of the existing ones?



/*
 * Wear flags.
 * Used in #OBJECTS.
 */
#define ITEM_TAKE		BV00
#define ITEM_WEAR_FINGER	BV01
#define ITEM_WEAR_NECK		BV02
#define ITEM_WEAR_BODY		BV03
#define ITEM_WEAR_HEAD		BV04
#define ITEM_WEAR_LEGS		BV05
#define ITEM_WEAR_FEET		BV06
#define ITEM_WEAR_HANDS		BV07
#define ITEM_WEAR_ARMS		BV08
#define ITEM_WEAR_SHIELD	BV09
#define ITEM_WEAR_ABOUT		BV10
#define ITEM_WEAR_WAIST		BV11
#define ITEM_WEAR_WRIST		BV12
#define ITEM_WIELD		BV13
#define ITEM_HOLD		BV14
#define ITEM_DUAL_WIELD		BV15
#define ITEM_WEAR_EARS		BV16
#define ITEM_WEAR_EYES		BV17
#define ITEM_MISSILE_WIELD	BV18
#define ITEM_WEAR_BACK		BV19
#define ITEM_WEAR_FACE		BV20
#define ITEM_WEAR_ANKLE		BV21
#define ITEM_LODGE_RIB      BV22
#define ITEM_LODGE_ARM      BV23
#define ITEM_LODGE_LEG      BV24
#define ITEM_WEAR_MAX		24



I read Nick's post on using the extended bitvectors that are now in Smaug, but it sounded like all the normal BVXXs would need to be changed to extended too, or am I wrong? How do you knowledgeable folks think I ought to do this?
Thanks for any help,
Gadush



Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Thu 12 Feb 2004 03:07 AM (UTC)
Message
What you did should work just fine from the declaration part. The problem may not be in mud.h, but in build.c, where the name of the flags is located, and the function to run through those flags. Take the name of one of the old wear locations ( like waist ), do a search for waist, and look at that array. You may need to add the names to the end of that array, or replace the RXX's. If you have to add to it, you also need to take the name of that array, do another search in build.c for a function that uses that array, and increase the number from 21 to 24. Hope that helps.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gadush   (92 posts)  Bio
Date Reply #2 on Thu 12 Feb 2004 03:20 AM (UTC)
Message
Thanks, Greven, for the quick response. I will go over those areas and see if I missed something. It seems likely the snippet instructions told me to do those things. Maybe I goofed up, but here is the situation right now.

The wear locations are skewed. If I ostat the armor, it shows the right wear location, and of course the message is still right. But when wearing it and looking at myself, I am one odd looking guy.

<worn on head> kid gloves
<lodged in a leg> splint mail
etc. . .

basically, now what should be legs is neck, what should be feet is body, what should be hands is head, what should be arm is wrist, and I am sure the others are goofed up too.

Makes for a rather disturbing image. =)
Gadush
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Thu 12 Feb 2004 03:37 AM (UTC)
Message
I've noticed a number of times that adding a wear flag to the existing structure will shift all items below where the flag was inserted up a wear slot and it is necessary to remove and rewear all gear to correct the issue.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Gadush   (92 posts)  Bio
Date Reply #4 on Thu 12 Feb 2004 03:50 AM (UTC)
Message
Hmmm. I tried removing everything and putting it back on, but same result, I am wearing mail leggings around my neck. All the positions are off.
Guess I should go back through the snippet yet again, and see what I goofed up.
Thanks for the help.
Gadush
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #5 on Thu 12 Feb 2004 07:28 AM (UTC)

Amended on Thu 12 Feb 2004 07:29 AM (UTC) by Samson

Message
You have another spot in mud.h that reads as such in stock:


/*
 * Equpiment wear locations.
 * Used in #RESETS.
 */
typedef enum
{
  WEAR_NONE = -1, WEAR_LIGHT = 0, WEAR_FINGER_L, WEAR_FINGER_R, WEAR_NECK_1,
  WEAR_NECK_2, WEAR_BODY, WEAR_HEAD, WEAR_LEGS, WEAR_FEET, WEAR_HANDS,
  WEAR_ARMS, WEAR_SHIELD, WEAR_ABOUT, WEAR_WAIST, WEAR_WRIST_L, WEAR_WRIST_R,
  WEAR_WIELD, WEAR_HOLD, WEAR_DUAL_WIELD, WEAR_EARS, WEAR_EYES,
  WEAR_MISSILE_WIELD, WEAR_BACK, WEAR_FACE, WEAR_ANKLE_L, WEAR_ANKLE_R,
  MAX_WEAR
} wear_locations;


The archery code requires that the new locations be added to this list, and it should come out like so:


/*
 * Equpiment wear locations.
 * Used in #RESETS.
 */
typedef enum
{
  WEAR_NONE = -1, WEAR_LIGHT = 0, WEAR_FINGER_L, WEAR_FINGER_R, WEAR_NECK_1,
  WEAR_NECK_2, WEAR_BODY, WEAR_HEAD, WEAR_LEGS, WEAR_FEET, WEAR_HANDS,
  WEAR_ARMS, WEAR_SHIELD, WEAR_ABOUT, WEAR_WAIST, WEAR_WRIST_L, WEAR_WRIST_R,
  WEAR_WIELD, WEAR_HOLD, WEAR_DUAL_WIELD, WEAR_EARS, WEAR_EYES,
  WEAR_MISSILE_WIELD, WEAR_BACK, WEAR_FACE, WEAR_ANKLE_L, WEAR_ANKLE_R,
  WEAR_LODGE_RIB, WEAR_LODGE_ARM, WEAR_LODGE_LEG, MAX_WEAR
} wear_locations;


Make sure you've done this step. It doesn't sound like you have.
Top

Posted by Gadush   (92 posts)  Bio
Date Reply #6 on Thu 12 Feb 2004 01:21 PM (UTC)

Amended on Thu 12 Feb 2004 01:30 PM (UTC) by Gadush

Message
Thanks for the post, Samson. Yeah, I just checked again, and that part has already been changed. Here is what I have in their now. (in fact, it is cut and pasted from the snippet to my mud.h)


/*
 * Equpiment wear locations.
 * Used in #RESETS.
 */
typedef enum
{
  WEAR_NONE = -1, WEAR_LIGHT = 0, WEAR_FINGER_L, WEAR_FINGER_R, WEAR_NECK_1,
  WEAR_NECK_2, WEAR_BODY, WEAR_HEAD, WEAR_LEGS, WEAR_FEET, WEAR_HANDS,
  WEAR_ARMS, WEAR_SHIELD, WEAR_ABOUT, WEAR_WAIST, WEAR_WRIST_L, WEAR_WRIST_R,
  WEAR_WIELD, WEAR_HOLD, WEAR_DUAL_WIELD, WEAR_EARS, WEAR_EYES,
  WEAR_MISSILE_WIELD, WEAR_BACK, WEAR_FACE, WEAR_ANKLE_L, WEAR_ANKLE_R, WEAR_LODGE_RIB,
  WEAR_LODGE_ARM, WEAR_LODGE_LEG,
  MAX_WEAR
} wear_locations;


I don't know what I goofed up. I added the weapon proficiency first, and it seemed to be working great. But on the chance I might have screwed it up before adding the archery, I have now gone back over that first, trying to make sure I follow all the weap prof instructions, and then going through the archery snippet and doing the same afterwards. So far, I can't find where I strayed.
Thanks,
Gadush
Top

Posted by Gadush   (92 posts)  Bio
Date Reply #7 on Thu 12 Feb 2004 01:25 PM (UTC)
Message
I have a question on the wear flags bitvectors. At the bottom, where it defines ITEM_WEAR_MAX, I increased it by 3, as told. However, I realized that BV00 through BV24 is actually 25 in number, correct? Shouldn't ITEM_MAX_WEAR be 25, or am I off base?
Gadush
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #8 on Thu 12 Feb 2004 03:46 PM (UTC)
Message
I beleive that since it starts and uses 0 in the loop that ITEM_WEAR_MAX references, its still using 25 or them. C always likes to start counting at 0 rather than 1, and if your new, its something that you wouldn't expect. Thats why this check is often used:
if ( argument[0] == '\0' )"

This is checking the first character of argument to see if its empty, since the string/character array starts at 0. It just something you'll get used to, when you see a number 24 in a list like that, you'll automatically think "Oh, there are 25 items there."

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gadush   (92 posts)  Bio
Date Reply #9 on Sat 14 Feb 2004 12:36 AM (UTC)
Message
Hmmm. I am still trying to get my wear locations correct. The snippet says this:

Locate char * const item_w_flags [] =

Add the following to the list, corresponding to the values used for the equipment wear locations in mud.h:

"lodge_rib", "lodge_arm", "lodge_leg"

Here's the pertinent area, with the modifications. My question is, how do I correspond them to the values used in equipment wear locations in mud.h?

char *	const	item_w_flags	[] =
{
"take", "finger", "neck", "neck", "neck",  "body", "head", "legs", "feet",
"hands", "arms", "shield", "about", "waist", "wrist", "wrist", "wield",
"hold", "dual", "ears", "eyes", "missile", "back", "face", "ankle", "ankle",
"lodge_rib", "lodge_arm", "lodge_leg",
"r4","r5","r6","r7","r8","r9","r10","r11","r12","r13"
};

Here is that area from mud.h

/*
 * Equpiment wear locations.
 * Used in #RESETS.
 */
typedef enum
{
  WEAR_NONE = -1, WEAR_LIGHT = 0, WEAR_FINGER_L, WEAR_FINGER_R, WEAR_NECK_1,
  WEAR_NECK_2, WEAR_BODY, WEAR_HEAD, WEAR_LEGS, WEAR_FEET, WEAR_HANDS,
  WEAR_ARMS, WEAR_SHIELD, WEAR_ABOUT, WEAR_WAIST, WEAR_WRIST_L, WEAR_WRIST_R,
  WEAR_WIELD, WEAR_HOLD, WEAR_DUAL_WIELD, WEAR_EARS, WEAR_EYES,
  WEAR_MISSILE_WIELD, WEAR_BACK, WEAR_FACE, WEAR_ANKLE_L, WEAR_ANKLE_R,
  WEAR_LODGE_RIB, WEAR_LODGE_ARM, WEAR_LODGE_LEG,
  MAX_WEAR
} wear_locations;

I put the additions right after WEAR_ANKLE_R, and did the same in the array, but I'm not sure that is what is meant. Am I missing something?
Thanks,
Gadush
Top

Posted by Paradox_24   (2 posts)  Bio
Date Reply #10 on Wed 27 Oct 2004 01:55 AM (UTC)
Message
I'm glad to see someone else is going through this code, and so recently :P

from what I can tell, what you've done it add the wearlocs below finger, instead of at the bottom of the list.
It is also important to have , (commas) after each wearloc except the last one.

Just a note to Samson:
You own at coding, but that particular part of your instructions I think should use the last 4 wearlocs (face/back/ankles) or explain it better.. cuz I was somewhat confused as what to do.. but seeing as there was no comma at the end of your snippet, I assumed it had to be at the end :P

If I'm way way off in either accoutn, please correct me..

Glad to be a part of the list :P

-Paradox_24
Top

Posted by Paradox_24   (2 posts)  Bio
Date Reply #11 on Wed 27 Oct 2004 02:10 AM (UTC)
Message
Just a note.. I got it working fine and all..
by that I mean compiled successfully..

but I've never been able to get an item 'lodged' into anywhere... pretty sure I didn't do anything wrong.. considering I've been over it well over 10x..

thing is, it all kinda makes sense to me (as far as why I'm putting each snippet in each location) and I can't see anything wrong.. dunno what to do.

Of course, I'm not uber knowledgeable.. so if someone could plz gimme a hand getting the lodging working, I'd be much ablidged :P

-Paradox_24
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.


35,921 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.