I came across locate object showing pages and pages of swords in only Midgaard, School and Limbo. Below is locate object utilizing the owhere code. The other code looks right as rain using std::string and concatenations so I'm not sure what's going on.
spells.cpp: void Character::spell_locate_object (int sn, int lvl, void *vo) { char buf[MAX_STRING_LENGTH]; bool found = false; Object *in_obj;
ObjIter o; for (o = object_list.begin(); o != object_list.end(); o++) { if (!can_see_obj(*o) || !is_name (target_name, (*o)->name)) continue;
I'll definitely try buf.append or follow other sections of code. Thanks for replying. I hope Murk++ gets its own subcategory under Merc. I hate uploading spells or mods to the same page as Merc releases.
Yeah, changing the two += (concatenate) to = (assignment):
302hp 232m 490mv> c 'lo' sword A small sword carried by the weaponsmith A long sword carried by the weaponsmith A long sword carried by the weaponsmith A long sword carried by the armourer A long sword carried by the grocer A long sword carried by the baker A long sword carried by the bartender A long sword carried by the waiter A long sword carried by the waiter A long sword carried by the waiter A long sword carried by the waiter A long sword carried by Filthy A long sword carried by someone A long sword carried by the knight templar A long sword carried by someone A long sword carried by the knight A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A small sword carried by the vagabond A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A standard issue sword carried by the cityguard A long sword carried by the mayor A standard issue sword carried by someone A standard issue sword carried by someone A standard issue sword carried by someone A standard issue sword carried by someone
spells.cpp:
void Character::spell_locate_object (int sn, int lvl, void *vo)
{
char buf[MAX_STRING_LENGTH];
bool found = false;
Object *in_obj;
ObjIter o;
for (o = object_list.begin(); o != object_list.end(); o++) {
if (!can_see_obj(*o) || !is_name (target_name, (*o)->name))
continue;
found = true;
for (in_obj = *o; in_obj->in_obj != NULL; in_obj = in_obj->in_obj) ;
if (in_obj->carried_by != NULL) {
snprintf (buf, sizeof buf, "%s carried by %s.\r\n",
(*o)->short_descr.c_str(), in_obj->carried_by->describe_to(this).c_str());
} else {
snprintf (buf, sizeof buf, "%s in %s.\r\n",
(*o)->short_descr.c_str(), (in_obj->in_room == NULL) ?
"somewhere" : in_obj->in_room->name.c_str());
}
buf[0] = toupper (buf[0]);
send_to_char (buf);
}
if (!found)
send_to_char ("Nothing like that in hell, earth, or heaven.\r\n");
return;
}