int main() { int itemNum, quantity; double cost; // Create an Inventory object Inventory item; cout << "Please enter the following values:" << endl; cout << "Item Number > "; cin >> itemNum; item.setItemNumber(itemNum); cout << "Quantity > "; cin >> quantity; item.setQuantity(quantity); cout << "Item cost > $"; cin >> cost; item.setCost(cost); item.setTotalCost(); system("CLS"); displayInventory(item); system("PAUSE"); return 0; }
// --------------------------------------------------------- bool LocationCommand::execute() { map<Name, const Item *> itemTable = myMap->getItemLocations(); map<Name, const Item *>::iterator iter; for ( iter = itemTable.begin(); iter != itemTable.end(); ++iter ) { cout << iter->first << '\t'; if ( iter->second == 0 ) { Inventory * inv = myAdventurer->getInventory(); if ( inv->hasItem( iter->first ) ) { cout << "(inventory)" << '\n'; } else { cout << "(unknown)" << '\n'; } } else { cout << iter->second->getID() << '\n'; } } cout << endl; return true; }
void Server::sendDetachedInventory(const std::string &name, u16 peer_id) { if(m_detached_inventories.count(name) == 0){ errorstream<<FUNCTION_NAME<<": \""<<name<<"\" not found"<<std::endl; return; } Inventory *inv = m_detached_inventories[name]; std::ostringstream os(std::ios_base::binary); inv->serialize(os); MSGPACK_PACKET_INIT(TOCLIENT_DETACHED_INVENTORY, 2); PACK(TOCLIENT_DETACHED_INVENTORY_NAME, name); PACK(TOCLIENT_DETACHED_INVENTORY_DATA, os.str()); if (peer_id != PEER_ID_INEXISTENT) { // Send as reliable m_clients.send(peer_id, 0, buffer, true); } else { m_clients.sendToAll(0,buffer,true); } }
int punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher, float time_from_last_punch) { // Take item into inventory ItemStack item = createItemStack(); Inventory *inv = puncher->getInventory(); if(inv != NULL) { std::string wieldlist = puncher->getWieldList(); ItemStack leftover = inv->addItem(wieldlist, item); puncher->setInventoryModified(); if(leftover.empty()) { m_removed = true; } else { m_itemstring = leftover.getItemString(); m_itemstring_changed = true; } } return 0; }
bool Inventory::operator==(const Inventory& other) const { if (isEmpty() and other.isEmpty()) { //both are empty, so they are the same return true; } if (isEmpty() or other.isEmpty()) { //only one is empty, so they are not the same return false; } ConstInventoryIterator other_one = other.getFirst(); const ConstInventoryIterator other_end = other.getEnd(); ConstInventoryIterator self_one = m_Items.begin(); const ConstInventoryIterator self_end = m_Items.end(); while (self_one!=self_end and other_one!=other_end) { if (self_one->first!=other_one->first or self_one->second!=other_one->second) { return false; } ++self_one; ++other_one; }//while if ((self_one!=self_end) xor (other_one!=other_end)) { return false; } return true; }
static int InventoryL_RemoveItem(lua_State* luaVM) { bool success = false; const int nargs = lua_gettop(luaVM); Inventory* inv; if(nargs > 1) { inv = luaW_to<Inventory>(luaVM, 1); switch(nargs) { case 2: { success = inv->removeItem(lua_tonumber(luaVM, 2)); break; } case 3: { success = inv->removeItem(lua_tonumber(luaVM, 2), lua_tonumber(luaVM, 3)); break; } } } lua_pushboolean(luaVM, success); return 1; }
//============================================================================= //handles the financial side // void EntertainerManager::applyMoney(PlayerObject* customer,PlayerObject* designer,int32 amount) { int32 amountcash; int32 amountbank; int8 sql[1024]; amountcash = amount; amountbank = 0; Inventory* inventory = dynamic_cast<Inventory*>(customer->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory)); if(inventory && inventory->getCredits() < amount) { // cash alone isnt sufficient amountcash = inventory->getCredits(); amountbank = (amount - amountcash); } EntertainerManagerAsyncContainer* asyncContainer = new EntertainerManagerAsyncContainer(EMQuery_IDFinances,0); Transaction* mTransaction = mDatabase->startTransaction(this,asyncContainer); asyncContainer->customer = customer; asyncContainer->performer = designer; asyncContainer->amountcash = amountcash; asyncContainer->amountbank = amountbank; sprintf(sql,"UPDATE inventories SET credits=credits-%i WHERE id=%"PRIu64"",amountcash, customer->getId()+1); mTransaction->addQuery(sql); sprintf(sql,"UPDATE banks SET credits=credits-%i WHERE id=%"PRIu64"",amountbank, customer->getId()+4); mTransaction->addQuery(sql); sprintf(sql,"UPDATE banks SET credits=credits+%i WHERE id=%"PRIu64"",amount, designer->getId()+4); mTransaction->addQuery(sql); mTransaction->execute(); }
//============================================================================= // // filled components get returned to the inventory // // void CraftingSession::bagComponents(ManufactureSlot* manSlot,uint64 containerId) { //add the components back to the inventory (!!!) manSlot->setFilledType(DST_Empty); //put them into the inventory no matter what - only alternative might be a crafting stations hopper at one point ?? Inventory* inventory = dynamic_cast<Inventory*>(mOwner->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory)); FilledComponent::iterator compIt = manSlot->mUsedComponentStacks.begin(); while(compIt != manSlot->mUsedComponentStacks.end()) { Item* filledComponent = dynamic_cast<Item*>((*compIt).first); if(!filledComponent) { return; } inventory->addObject(filledComponent); gMessageLib->sendContainmentMessage(filledComponent->getId(),inventory->getId(),0xffffffff,mOwner); filledComponent->setParentIdIncDB(inventory->getId()); compIt = manSlot->mUsedComponentStacks.erase(compIt); continue; } manSlot->mUsedComponentStacks.clear(); manSlot->mFilledResources.clear(); }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> bool ResponsePolynomial::detachFrom(PublicObject* object) { if ( object == NULL ) return false; // check all possible parents Inventory* inventory = Inventory::Cast(object); if ( inventory != NULL ) { // If the object has been added already to the parent locally // just remove it by pointer if ( object == parent() ) return inventory->remove(this); // The object has not been added locally so it must be looked up else { ResponsePolynomial* child = inventory->findResponsePolynomial(publicID()); if ( child != NULL ) return inventory->remove(child); else { SEISCOMP_DEBUG("ResponsePolynomial::detachFrom(Inventory): responsePolynomial has not been found"); return false; } } } SEISCOMP_ERROR("ResponsePolynomial::detachFrom(%s) -> wrong class type", object->className()); return false; }
bool ContainerRecord::loadFromStream(std::ifstream& inStream) { if (!inStream.good()) { DuskLog() << "ContainerRecord::loadFromStream: ERROR: stream contains errors!\n"; return false; } uint32_t len = 0; inStream.read((char*) &len, sizeof(uint32_t)); if (len != cHeaderCont) { DuskLog() << "ContainerRecord::loadFromStream: ERROR: stream contains unexpected header!\n"; return false; } char ID_Buffer[256]; memset(ID_Buffer, 0, 256); //read ID len = 0; inStream.read((char*) &len, sizeof(uint32_t)); if (len>255) { DuskLog() << "ContainerRecord::loadFromStream: ERROR: ID is " << "longer than 255 characters!\n"; return false; } inStream.read(ID_Buffer, len); if (!inStream.good()) { DuskLog() << "ContainerRecord::loadFromStream: ERROR while " << "reading ID from stream!\n"; return false; } //read Mesh char Mesh_Buffer[256]; memset(Mesh_Buffer, 0, 256); len = 0; inStream.read((char*) &len, sizeof(uint32_t)); if (len>255) { DuskLog() << "ContainerRecord::loadFromStream: ERROR: mesh path " << "is longer than 255 characters!\n"; return false; } inStream.read(Mesh_Buffer, len); if (!inStream.good()) { DuskLog() << "ContainerRecord::loadFromStream: ERROR while " << "reading mesh path from stream!\n"; return false; } Inventory temp; if (!temp.loadFromStream(inStream)) { DuskLog() << "ContainerRecord::loadFromStream: ERROR while " << "reading inventory contens from stream!\n"; return false; } //all right so far return inStream.good(); }
static void draw_player_inventory(GameState* gs, Inventory& inv, const BBox& bbox, int min_slot, int max_slot, int slot_selected = -1) { int mx = gs->mouse_x(), my = gs->mouse_y(); int slot = min_slot; for (int y = bbox.y1; y < bbox.y2; y += TILE_SIZE) { for (int x = bbox.x1; x < bbox.x2; x += TILE_SIZE) { if (slot >= max_slot) break; ItemSlot& itemslot = inv.get(slot); BBox slotbox(x, y, x + TILE_SIZE, y + TILE_SIZE); Colour outline(COL_UNFILLED_OUTLINE); if (itemslot.amount > 0 && slot != slot_selected) { outline = COL_FILLED_OUTLINE; if (slotbox.contains(mx, my)) { outline = COL_PALE_YELLOW; draw_console_item_description(gs, itemslot.item); } } if (slot != slot_selected) draw_player_inventory_slot(gs, itemslot, x, y); //draw rectangle over item edges gl_draw_rectangle_outline(slotbox, outline); slot++; } } if (slot_selected != -1) { draw_player_inventory_slot(gs, inv.get(slot_selected), gs->mouse_x() - TILE_SIZE / 2, gs->mouse_y() - TILE_SIZE / 2); } }
bool UiBarter::SwapFunctor(InventoryObject* object, Inventory& from, Inventory& to) { if (from.IncludesObject(object)) { string object_name = object->GetName(); function<void (unsigned short)> swap_callback([this, &from, &to, object_name](unsigned short quantity) { while (quantity--) { InventoryObject* swapping = from.GetObject(object_name); to.AddObject(swapping); from.DelObject(swapping); } Update(); if (_quantity_picker) _quantity_picker->SetModal(false); }); if (from.ContainsHowMany(object->GetName()) > 1) { if (_quantity_picker) delete _quantity_picker; _quantity_picker = new UiObjectQuantityPicker(window, context, from, object); _quantity_picker->SetModal(true); _quantity_picker->QuantityPicked.Connect(swap_callback); _quantity_picker->Observer.Connect(VisibilityToggledOff, *_quantity_picker, &UiBase::Hide); } else swap_callback(1); return (true); } return (false); }
static void ItemInHandRenderer_render_hook(ItemInHandRenderer* renderer, float partialTicks) { // call the actual Minecraft method first to render the right hand ItemInHandRenderer_render_real(renderer, partialTicks); // store the current camera position MatrixStack::Ref matref = MatrixStack::World.push(); // move the camera 1 units to the left Vec3 oneleft {-1.0f, 0.0f, 0.0f}; matref.matrix->translate(oneleft); uintptr_t playerPtr = *((uintptr_t*) ((uintptr_t) renderer->minecraft + MINECRAFT_LOCAL_PLAYER_OFFSET)); Inventory* inventory = *((Inventory**) (playerPtr + PLAYER_INVENTORY_OFFSET)); // save the current active slot ItemInstance backup(renderer->currentItem); // change the active slot to the item held in slot 1 renderer->currentItem.cloneSafe(inventory->getLinked(1)); // and call the actual ItemInHandRenderer method in MCPE again ItemInHandRenderer_render_real(renderer, partialTicks); // restore active slot renderer->currentItem.cloneSafe(&backup); // restore // MatrixStack::View.pop(); // the MatrixStack::Ref auto pops }
BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) { Inventory inv; inv.Add(GD_BOARDS, 10); inv.Add(GD_IRON, 10); world.GetSpecObj<nobBaseWarehouse>(hqPos)->AddGoods(inv, true); ggs.setSelection(AddonId::METALWORKSBEHAVIORONZERO, 1); ggs.setSelection(AddonId::TOOL_ORDERING, 1); ToolSettings settings; std::fill(settings.begin(), settings.end(), 0); this->ChangeTools(settings); MapPoint housePos(hqPos.x + 3, hqPos.y); const nobUsual* mw = static_cast<nobUsual*>(BuildingFactory::CreateBuilding(world, BLD_METALWORKS, housePos, curPlayer, NAT_ROMANS)); MapPoint flagPos = world.GetNeighbour(hqPos, Direction::SOUTHEAST); this->BuildRoad(flagPos, false, std::vector<Direction>(3, Direction::EAST)); RTTR_EXEC_TILL(200, mw->HasWorker()); BOOST_REQUIRE(!mw->is_working); // Wait till he has all the wares RTTR_EXEC_TILL(3000, mw->GetNumWares(0) == 6); RTTR_EXEC_TILL(3000, mw->GetNumWares(1) == 6); // No order -> not working BOOST_REQUIRE(!mw->is_working); std::array<int8_t, NUM_TOOLS> orders; std::fill(orders.begin(), orders.end(), 0); orders[0] = 1; this->ChangeTools(settings, &orders.front()); RTTR_EXEC_TILL(1300, mw->is_working); }
int main(int argc, const char *argv[]) { Inventory inventory; GuitarSpec whatErinLikes = GuitarSpec(GBuilder::FENDER, "Stratocastor", GType::ELECTRIC, GWood::ALDER, GWood::ALDER); //add a guitar GuitarSpec newspec = GuitarSpec(GBuilder::FENDER, "Stratocastor", GType::ELECTRIC, GWood::ALDER, GWood::ALDER); inventory.addGuitar("V95693", 1499.95, newspec) ; inventory.addGuitar("V9512", 1549.95, newspec) ; try{ list<Guitar> guitars = inventory.search(whatErinLikes); cout << "Erin, you might like these guitars:" << endl; for ( list<Guitar >::const_iterator i = guitars.begin(); i != guitars.end(); i++){ GuitarSpec spec = i->getSpec(); cout <<" We have a " << spec.getBuilder() <<" " << spec.getModel() <<" " << spec.getType() << " guitar:" << endl <<" " << spec.getBackWood() << " back and sides," << endl <<" " << spec.getTopWood() << " top.\n You can have it for only $" << i->getPrice() << "!\n ----" << endl; } } catch(InventoryException &ie) { cout << "Sorry, Erin, we have nothing for you." << endl; } return 0; }
static void testItemMove (void) { Inventory inv; const objDef_t* od; const invDef_t* container, *containerTo; Item* addedItem; ResetInventoryList(); od = INVSH_GetItemByIDSilent("assault"); CU_ASSERT_PTR_NOT_NULL(od); container = INVSH_GetInventoryDefinitionByID("right"); CU_ASSERT_PTR_NOT_NULL(container); Item item(od); CU_ASSERT(inv.containsItem(container->id, &item) == false); addedItem = i.addToInventory(&inv, &item, container, NONE, NONE, 1); CU_ASSERT_PTR_NOT_NULL(addedItem); CU_ASSERT(inv.containsItem(container->id, &item) == true); containerTo = INVSH_GetInventoryDefinitionByID("backpack"); CU_ASSERT_PTR_NOT_NULL(containerTo); CU_ASSERT_EQUAL(IA_MOVE, i.moveInInventory(&inv, container, addedItem, containerTo, NONE, NONE, nullptr, nullptr)); CU_ASSERT(inv.containsItem(container->id, &item) == false); CU_ASSERT(inv.containsItem(containerTo->id, &item) == true); }
static void testItemDel (void) { Inventory inv; const objDef_t* od; const invDef_t* container; Item* addedItem; ResetInventoryList(); od = INVSH_GetItemByIDSilent("assault"); CU_ASSERT_PTR_NOT_NULL(od); container = INVSH_GetInventoryDefinitionByID("right"); CU_ASSERT_PTR_NOT_NULL(container); Item item(od); CU_ASSERT(inv.containsItem(container->id, &item) == false); addedItem = i.addToInventory(&inv, &item, container, NONE, NONE, 1); CU_ASSERT(inv.containsItem(container->id, &item) == true); CU_ASSERT(i.removeFromInventory(&inv, container, addedItem)); CU_ASSERT(inv.containsItem(container->id, &item) == false); }
void displayInventory(Inventory i) { cout << showpoint << setprecision(2) << fixed; cout << "Item Number: " << i.getItemNumber() << endl; cout << "Quantity: " << i.getQuantity() << endl; cout << "Cost: $" << i.getCost() << endl; cout << "Total cost: $" << i.getTotalCost() << endl << endl; }
// take off armory int Script::takeOff(lua_State* L){ short tx = (short)luaL_checknumber(L, 1); short ty = (short)luaL_checknumber(L, 2); string weapon = string(luaL_checkstring(L, 3)); Inventory* inv = dynamic_cast<Creature*>(wrld.getObject(Vector2D(tx,ty)))->getInventory(); inv->removeArmory(weapon); return 0; }
bool AgentTravel::condObjectCarry(unsigned int p_objectId) { bool success = false; Inventory inventory = m_ad->adventurer.getInventory(); if( inventory.carriesItem( p_objectId ) ) { success = true; } return success; }
string InventoryCommand::Execute(Player &player, const vector<string> *cmd) { Health *health = (Health*)player.GetComponent("HEALTH"); Inventory *inventory = (Inventory*)player.GetComponent("INVENTORY"); stringstream ss; ss << "Health: " << health->HealthLeft() << endl; ss << "Your inventory contains:" << endl << inventory->LongContents(); return ss.str(); }
InventoryList* InvRef::getlist(lua_State *L, InvRef *ref, const char *listname) { NO_MAP_LOCK_REQUIRED; Inventory *inv = getinv(L, ref); if(!inv) return NULL; return inv->getList(listname); }
void CoinNodeAbstractListener::askForBlock(const std::string& hash) { InventoryItem block(MSG_BLOCK, uchar_vector(hash)); Inventory inv; inv.addItem(block); GetDataMessage getData(inv); CoinNodeMessage msg(this->getMagic(), &getData); this->sendMessage(msg); }
void GUIInventoryMenu::drawList(const ListDrawSpec &s) { video::IVideoDriver* driver = Environment->getVideoDriver(); // Get font gui::IGUIFont *font = NULL; gui::IGUISkin* skin = Environment->getSkin(); if (skin) font = skin->getFont(); Inventory *inv = m_invmgr->getInventory(m_c, s.inventoryname); assert(inv); InventoryList *ilist = inv->getList(s.listname); core::rect<s32> imgrect(0,0,imgsize.X,imgsize.Y); for(s32 i=0; i<s.geom.X*s.geom.Y; i++) { s32 x = (i%s.geom.X) * spacing.X; s32 y = (i/s.geom.X) * spacing.Y; v2s32 p(x,y); core::rect<s32> rect = imgrect + s.pos + p; InventoryItem *item = NULL; if(ilist) item = ilist->getItem(i); if(m_selected_item != NULL && m_selected_item->listname == s.listname && m_selected_item->i == i) { /*s32 border = imgsize.X/12; driver->draw2DRectangle(video::SColor(255,192,192,192), core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border, rect.LowerRightCorner + v2s32(1,1)*border), NULL); driver->draw2DRectangle(video::SColor(255,0,0,0), core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*((border+1)/2), rect.LowerRightCorner + v2s32(1,1)*((border+1)/2)), NULL);*/ s32 border = 2; driver->draw2DRectangle(video::SColor(255,255,0,0), core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border, rect.LowerRightCorner + v2s32(1,1)*border), &AbsoluteClippingRect); } video::SColor bgcolor(255,128,128,128); driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect); if(item) { drawInventoryItem(driver, font, item, rect, &AbsoluteClippingRect); } } }
/** * Removes all items from the inventory. * * @returns boolean True if all items were successfully removed, false is there was an error. */ int Inventory_remove_all(lua_State *lua) { Inventory *inv = castUData<Inventory>(lua, 1); if (inv) { lua_pushboolean(lua, inv->removeAll()); return 1; } return LuaState::expectedContext(lua, "remove_all", "Inventory"); }
/** * Releases the reference counter on this inventory. */ int Inventory_dtor(lua_State *lua) { Inventory *inv = castUData<Inventory>(lua, 1); if (inv) { inv->release(); return 0; } return LuaState::expectedContext(lua, "__gc", "Inventory"); }
//! deletes one item from inventory int Script::deleteItem(lua_State* L){ short tx = (short)luaL_checknumber(L, 1); short ty = (short)luaL_checknumber(L, 2); string name = string(luaL_checkstring(L, 3)); Creature* creat = dynamic_cast<Creature*>(wrld.getObject(Vector2D(tx,ty))); Inventory* inv = creat->getInventory(); bool done = inv->deleteItem(name); lua_pushboolean(L, done); return 1; }
//--------------------------------------------------------------------------------------------------------------------------- //ITEM MANAGEMENT //--------------------------------------------------------------------------------------------------------------------------- VIRTUAL void Agent::PickUpItems(Tile* fromTile) { Inventory* inv = fromTile->GetInventory(); std::vector<Item*>* items = inv->GetItemsInBag(); for (unsigned int i = 0; i < items->size(); i++) { Item* item = items->at(i); switch (item->GetType()) { case ITEM_WEAPON: if (m_equipment->GetWeaponInWeaponSlot()) { if (!m_inventory->IsInventoryFull()) { m_inventory->PutItemInBag(item); LogItemPickup(item); } else { LogItemCouldntPickup(item); } } else { m_equipment->EquipWeapon(item); LogEquipItem(item); } break; case ITEM_ARMOR: if (m_equipment->GetArmorInArmorSlot()) { if (!m_inventory->IsInventoryFull()) { m_inventory->PutItemInBag(item); LogItemPickup(item); } else { LogItemCouldntPickup(item); } } else { m_equipment->EquipArmor(item); LogEquipItem(item); } break; case ITEM_POTION: if (!m_inventory->IsInventoryFull()) { m_inventory->PutItemInBag(item); LogItemPickup(item); } else { LogItemCouldntPickup(item); } break; default: break; } } fromTile->ClearInventory(); }
NPCObject* PersistentNpcFactory::_createPersistentNpc(DatabaseResult* result) { NPCObject* npc ; NpcIdentifier npcIdentifier; uint64 count = result->getRowCount(); result->GetNextRow(mNpcIdentifierBinding,(void*)&npcIdentifier); result->ResetRowIndex(); switch(npcIdentifier.mFamilyId) { case NpcFamily_Trainer: npc = new Trainer(); break; case NpcFamily_Filler: npc = new FillerNPC(); break; case NpcFamily_QuestGiver: npc = new QuestGiver(); break; default: { npc = new NPCObject(); gLogger->log(LogManager::DEBUG,"PersistentNpcFactory::createPersistent unknown Family %u",npcIdentifier.mFamilyId); } break; } Inventory* npcInventory = new Inventory(); npcInventory->setParent(npc); result->GetNextRow(mPersistentNpcBinding,(void*)npc); npc->mHam.mHealth.setCurrentHitPoints(500); npc->mHam.mAction.setCurrentHitPoints(500); npc->mHam.mMind.setCurrentHitPoints(500); npc->mHam.calcAllModifiedHitPoints(); // inventory npcInventory->setId(npc->mId + INVENTORY_OFFSET); npcInventory->setParentId(npc->mId); npcInventory->setModelString("object/tangible/inventory/shared_creature_inventory.iff"); npcInventory->setName("inventory"); npcInventory->setNameFile("item_n"); npcInventory->setTangibleGroup(TanGroup_Inventory); npcInventory->setTangibleType(TanType_CreatureInventory); npc->mEquipManager.addEquippedObject(CreatureEquipSlot_Inventory,npcInventory); npc->mTypeOptions = 0x108; //npc->setPvPStatus(npc->getPvPStatus() + CreaturePvPStatus_Attackable + CreaturePvPStatus_Aggressive); npc->setLoadState(LoadState_Attributes); // Save default direction, since player can make the npc change heading. npc->storeDefaultDirection(); return npc; }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> bool ResponsePolynomial::attachTo(PublicObject* parent) { if ( parent == NULL ) return false; // check all possible parents Inventory* inventory = Inventory::Cast(parent); if ( inventory != NULL ) return inventory->add(this); SEISCOMP_ERROR("ResponsePolynomial::attachTo(%s) -> wrong class type", parent->className()); return false; }