VendingMachine::VendingMachine(std::string id, std::string ip, int numberOfDispensers, int *pins){ this->id = id; this->dispensers = new Dispenser[numberOfDispensers]; this->numberOfDispensers = numberOfDispensers; this->opcodeLength = 8; this->ip = ip; this->opcode = new char[this->opcodeLength]; for(int i = 0; i < numberOfDispensers; i++) { this->dispensers[i] = Dispenser(pins[i]); } }
void cWSSAnvil::LoadDispenserFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) { ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); int x, y, z; if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) { return; } int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) { return; // Make it an empty dispenser - the chunk loader will provide an empty cDispenserEntity for this } std::auto_ptr<cDispenserEntity> Dispenser(new cDispenserEntity(x, y, z, m_World)); LoadItemGridFromNBT(Dispenser->GetContents(), a_NBT, Items); a_BlockEntities.push_back(Dispenser.release()); }