25 Jan, 2015, wifidi wrote in the 1st comment:
Votes: 0
302hp 232m 490mv> owfind wield
[ 3005] An executioner's axe
[ 3020] A dagger
[ 3021] A small sword
[ 3022] A long sword
[ 3124] A long sword
[ 3350] A standard issue sword
[ 3351] A standard issue dagger
[ 3352] A standard issue mace
[ 3700] A sub issue mace
[ 3701] A sub issue dagger
[ 3702] A sub issue sword

<302hp 232m 490mv> owfind waist
[ 3362] A standard issue belt
[ 3712] A sub issue belt

<302hp 232m 490mv>

cmd_list.hpp 153:
COMMAND (do_owfind)

murk.cpp 500:
{"owfind", &Character::do_owfind, POS_DEAD, L_ANG},

commands.cpp 5743:
void Character::do_owfind (std::string argument)
{
std::string arg, buf1;

one_argument (argument, arg);
if (arg.empty()) {
send_to_char ("Owfind what?\r\n");
return;
}

bool found = false;
int nMatch = 0;
char buf[MAX_STRING_LENGTH];
ObjectPrototype *pObjIndex;

sh_int item_worn =
!str_cmp (arg, "finger") ? ITEM_WEAR_FINGER :
(!str_cmp (arg, "neck") ? ITEM_WEAR_NECK :
(!str_cmp (arg, "body") ? ITEM_WEAR_BODY :
(!str_cmp (arg, "head") ? ITEM_WEAR_HEAD :
(!str_cmp (arg, "legs") ? ITEM_WEAR_LEGS :
(!str_cmp (arg, "feet") ? ITEM_WEAR_FEET :
(!str_cmp (arg, "hands") ? ITEM_WEAR_HANDS :
(!str_cmp (arg, "arms") ? ITEM_WEAR_ARMS :
(!str_cmp (arg, "shield") ? ITEM_WEAR_SHIELD :
(!str_cmp (arg, "about") ? ITEM_WEAR_ABOUT :
(!str_cmp (arg, "waist") ? ITEM_WEAR_WAIST :
(!str_cmp (arg, "wrist") ? ITEM_WEAR_WRIST :
(!str_cmp (arg, "wield") ? ITEM_WIELD : ITEM_HOLD))))))))))));

/*
* Yeah, so iterating over all vnum's takes 10,000 loops.
* Get_obj_index is fast, and I don't feel like threading another link.
* Do you?
* – Furey
*/
for (int vn = 0; nMatch < ObjectPrototype::top_obj; vn++) {
if ((pObjIndex = get_obj_index (vn)) != NULL) {
nMatch++;
if (pObjIndex->wear_flags & item_worn) {
found = true;
snprintf (buf, sizeof buf, "[%5d] %s\r\n",
pObjIndex->vnum, capitalize (pObjIndex->short_descr).c_str());
buf1.append(buf);
}
}
}
if (!found) {
send_to_char ("Nothing like that in hell, earth, or heaven.\r\n");
return;
}
send_to_char (buf1);
return;
}


At this point I guess it's better to leave it as "etc." because so many similar optimizations are possible. I think it's worth this post though to emphasize how much power is built-in that can be unleashed to greatly aid admins or imms who might want to be able to see certain sets of items, rooms or mobiles for game balance, style or related purposes. I'll probably develop as many that make sense and at that point maybe they can go into a code release.
Expanding commands is probably only so useful and could wind up making a list that's harder to remember than entering basic commands. A higher goal would be making an OLC, which takes some programmers way longer than others.
0.0/1