Heres the code:
void perform_load(struct char_data * ch, struct obj_data * ammo,
struct obj_data * gun)
{
GET_OBJ_VAL(ammo, 0) += GET_OBJ_VAL(gun, 0);
act("You load $p into $P.", FALSE, ch, ammo, gun, TO_CHAR);
act("$n loads $p into $P.", TRUE, ch, ammo, gun, TO_ROOM);
extract_obj(ammo);
}
ACMD(do_loadweapon)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
int obj_dotmode, cont_dotmode, found = 0;
struct obj_data *ammo, *gun;
two_arguments(argument, arg1, arg2);
obj_dotmode = find_all_dots(arg1);
cont_dotmode = find_all_dots(arg2);
if (!*arg1)
send_to_char("Load what ammo into what weapon??\r\n", ch);
else if (cont_dotmode != FIND_INDIV)
send_to_char("You can only put ammo into one weapon at a time.\r\n",
ch);
else if (!*arg2) {
sprintf(buf, "What do you want to put %s in?\r\n",
((obj_dotmode == FIND_INDIV) ? "it" : "them"));
send_to_char(buf, ch);
} else {
generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM, ch, &ch, &gun);
if (!gun) {
sprintf(buf, "You don't see %s %s here.\r\n", AN(arg2), arg2);
send_to_char(buf, ch);
} else if (GET_OBJ_TYPE(gun) != ITEM_FIREWEAPON)
act("$p is not a weapon that needs ammo.", FALSE, ch, gun, 0,
TO_CHAR);
else {
if (obj_dotmode == FIND_INDIV) { /* put <obj> <container> */
if (!(ammo = get_obj_in_list_vis(ch, arg1, ch->carrying))) {
sprintf(buf, "You aren't carrying %s %s.\r\n", AN(arg1), arg1);
send_to_char(buf, ch);
} else if (ammo == gun)
send_to_char("You attempt to fold it into itself, but
fail.\r\n", ch);
else
perform_load(ch, ammo, gun);
} else {
if (!found) {
if (obj_dotmode == FIND_ALL)
send_to_char("You don't seem to have anything to put in
it.\r\n", ch
);
else {
sprintf(buf, "You don't seem to have any %ss.\r\n", arg1);
send_to_char(buf, ch);
}
}
}
}
}
}
Help?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Name: Demond LaZaro the Implementor Phone: 1-505-776-8866
Mud: Master's Realm Mud Code Base: CircleMud
Addy: realms.org 6969 Addy2: 206.185.32.8 6969
Fax: None (yet :\) E-mail: demond@realms.org
Web Page: http://master.bevy.com/mrealm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST