<commit_before>#include "removeitemcommand.h"


RemoveItemCommand::RemoveItemCommand(Player *character, QObject *parent) :
    AdminCommand(character, parent) {

    setDescription("Remove an item from the current area.\n"
                   "\n"
                   "Usage: remove-item <item-name> [#]");
}

RemoveItemCommand::~RemoveItemCommand() {
}

void RemoveItemCommand::execute(const QString &command) {

    setCommand(command);

    /*QString alias = */takeWord();
    if (!assertWordsLeft("Usage: remove-item <item-name> [#]")) {
        return;
    }

    GameObjectPtrList items = takeObjects(currentArea()->objects());
    if (!requireSome(items, "That's not here.")) {
        return;
    }

    foreach (const GameObjectPtr &item, items) {
        currentArea()->removeItem(item);

        player()->send(QString("Item %1 removed.").arg(item->name()));

        item->deleteLater();
    }
}<commit_msg>remove-item is now safer.<commit_after>#include "removeitemcommand.h"


RemoveItemCommand::RemoveItemCommand(Player *character, QObject *parent) :
    AdminCommand(character, parent) {

    setDescription("Remove an item from the current area.\n"
                   "\n"
                   "Usage: remove-item <item-name> [#]");
}

RemoveItemCommand::~RemoveItemCommand() {
}

void RemoveItemCommand::execute(const QString &command) {

    setCommand(command);

    /*QString alias = */takeWord();
    if (!assertWordsLeft("Usage: remove-item <item-name> [#]")) {
        return;
    }

    GameObjectPtrList items = takeObjects(currentArea()->items());
    if (!requireSome(items, "That's not here.")) {
        return;
    }

    foreach (const GameObjectPtr &item, items) {
        currentArea()->removeItem(item);

        player()->send(QString("Item %1 removed.").arg(item->name()));

        item->setDeleted();
    }
}
{'fraction_non_alphanumeric': 0.15735214324470972, 'fraction_numerical': 0.0010851871947911015, 'mean_word_length': 3.1531531531531534, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '407131', 'n_tokens_mistral': 549, 'n_tokens_neox': 519, 'n_words': 107}