Example #1
0
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);
	}
}
Example #2
0
void prepend(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
    storeItem(h, h1, OPERATION_PREPEND);
}
Example #3
0
void add(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
    storeItem(h, h1, OPERATION_ADD);
}
Example #4
0
void append(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
    storeItem(h, h1, OPERATION_APPEND);
}
Example #5
0
void set(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
    storeItem(h, h1, OPERATION_SET);
}