Here is how I fixed it with us in case anybody else runs into this issue:
Code:
char buf[MAX_STRING_LENGTH] = {'\0'};
struct list_data *room_list = NULL;
snprintf(buf, sizeof(buf), "$n commands, '%s'.", message);
act(buf, FALSE, ch, 0, 0, TO_ROOM);
room_list = create_list();
for (vict = world[IN_ROOM(ch)].people; vict; vict = next_vict)
{
next_vict = vict->next_in_room;
if (pet_order_check(ch, vict)) /* this is a function to check whether its a valid pet */
{
add_to_list(vict, room_list);
}
}
if (room_list->iSize == 0)
{
free_list(room_list);
send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n");
return;
}
while ((vict = (struct char_data *)simple_list(room_list)) != NULL)
{
if (pet_order_check(ch, vict))
{
found = TRUE;
command_interpreter(vict, message);
}
}
if (found)
{
USE_FULL_ROUND_ACTION(ch);
send_to_char(ch, "%s", CONFIG_OK);
}
else
{
/* it shouldn't be possible to get here, but regardless... */
send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n");
}
if (room_list)
free_list(room_list);