const std::pair<bool, std::string> Item::drop(const std::vector<std::string>& arguments, Entity* item) { //drop X in/into/... Y //drop X Y unsigned int size = arguments.size(); if (size > 2) { //get the name std::string into((size > 3) ? arguments[3] : arguments[2]); if (Utilities::compareTo(this->name, into)) { //its me return storeItem(item); } else { //it's not me, get the item into store if opened if (opened) { Entity* itemInto = getEntity(into); if (itemInto != nullptr) { return itemInto->drop(arguments, item); } } //I ask because if is not opened, don't know why I'm asking this item so probably is a mistake due to a misunderstanding and not because the item is closed std::pair<bool, std::string> result; result.first = false; result.second = "Drop where?"; return result; } } else if (!opened) { std::pair<bool, std::string> result; result.first = false; result.second = "Can't drop here, is closed"; return result; } else { return storeItem(item); } }
void prepend(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_PREPEND); }
void add(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_ADD); }
void append(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_APPEND); }
void set(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { storeItem(h, h1, OPERATION_SET); }