|
Equipment Ordering [by Lord Kyu] |
|
|
|
Posted Wednesday, August 12th @ 11:27:15 PM, by George Greer in the Utils dept.
Added Jul 6, 1998. Click the link below to read it or download it.
From: Richard Glover <magik@PYRAMID.NET>
Subject: do_equipment and look_at_char ordering
Apologies in advance if someone has already posted this. This is not an
official patch nor snippet since I really have no time for either. If
someone cares to make a patch, feel free...just make sure to credit me for
the code, thanks.
Rick Glover
This code will allow you to see equipment in the order that you (the coder)
want it viewed, by equipment positions from head to foot or whatever you
decide without having to reorder your WEAR_x defines.
In constants.c, after the /* WEAR_x - for stat */ list, which ends with:
"Held",
"\n"
};
+/* Wear order to be viewed by players. RG 6/23/98 */
+const int wear_order_index[NUM_WEARS] = {
+ WEAR_HEAD,
+ WEAR_NECK_1,
+ WEAR_NECK_2,
+ WEAR_ABOUT,
+ WEAR_BODY,
+ WEAR_WAIST,
+ WEAR_ARMS,
+ WEAR_WRIST_R,
+ WEAR_WRIST_L,
+ WEAR_HANDS,
+ WEAR_FINGER_R,
+ WEAR_FINGER_L,
+ WEAR_WIELD,
+ WEAR_HOLD,
+ WEAR_LIGHT,
+ WEAR_SHIELD,
+ WEAR_LEGS,
+ WEAR_FEET
+};
/* ITEM_x (ordinal object types) */
const char *item_types[] = {
"UNDEFINED",
Then in act.informative.c, at the begging declarations of external
variables:
extern struct char_data *character_list;
extern struct obj_data *object_list;
extern struct str_app_type str_app[];
+extern const int wear_order_index[NUM_WEARS]; /* RG 6/23/98 */
extern char *credits;
extern char *news;
extern char *info;
In the function look_at_char:
void look_at_char(struct char_data * i, struct char_data * ch)
{
int j, found;
struct obj_data *tmp_obj;
+ extern int wear_order_index[NUM_WEARS];
if (!ch->desc)
return;
Further down:
if (found) {
act("\r\n$n is using:", FALSE, i, 0, ch, TO_VICT);
for (j = 0; j < NUM_WEARS; j++)
- if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) {
- send_to_char(where[j], ch);
- show_obj_to_char(GET_EQ(i, j), ch, 1);
+ if (GET_EQ(i, wear_order_index[j])
+ && CAN_SEE_OBJ(ch, GET_EQ(i, wear_order_index[j]))) {
+ send_to_char(where[wear_order_index[j]], ch);
+ show_obj_to_char(GET_EQ(i, wear_order_index[j]), ch, 1);
}
}
In do_equipment:
ACMD(do_equipment)
{
int i, found = 0;
+ extern int wear_order_index[NUM_WEARS];
send_to_char("You are using:\r\n", ch);
for (i = 0; i < NUM_WEARS; i++) {
- if (GET_EQ(ch, i)) {
- if (CAN_SEE_OBJ(ch, GET_EQ(ch, i))) {
- send_to_char(where[i], ch);
- show_obj_to_char(GET_EQ(ch, i), ch, 1);
+ if (GET_EQ(ch, wear_order_index[i])) {
+ if (CAN_SEE_OBJ(ch, GET_EQ(ch, wear_order_index[i]))) {
+ send_to_char(where[wear_order_index[i]], ch);
+ show_obj_to_char(GET_EQ(ch, wear_order_index[i]), ch, 1);
found = TRUE;
} else {
- send_to_char(where[i], ch);
+ send_to_char(where[wear_order_index[i]], ch);
send_to_char("Something.\r\n", ch);
found = TRUE;
}
Enjoy,
Rick Glover aka Magik
<< Emblamer code [by Mendar] | Reply | View as text | Flattened | Events [by Skylar] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|