/** * Creates an empty slot with a given name. We assume there isn't already a slot * with the name. * * @param name the slot name * @param complexity the slot's initial complexity */ void ManufactureSchematicSynchronizedUi::createNewSlot(const StringId & name, float complexity) { m_slotName.push_back(name); m_slotType.push_back(Crafting::IT_none); m_slotIngredient.push_back(NetworkIdList()); m_slotIngredientCount.push_back(IntList()); m_slotComplexity.push_back(complexity); m_slotDraftOption.push_back(-1); m_slotDraftIndex.push_back(-1); signalIngredientsChanged (); } // ManufactureSchematicSynchronizedUi::createNewSlot(const StringId & name)
/** * Clears the data for a given slot in the schematic. * * @param name the name of the slot to clear * @param complexity the slot's initial complexity */ void ManufactureSchematicSynchronizedUi::clearSlot(const StringId & name, float complexity) { int iter = m_slotName.find(name); if (iter >= 0) { m_slotType.set(iter, Crafting::IT_none); m_slotIngredient.set(iter, NetworkIdList()); m_slotIngredientCount.set(iter, IntList()); m_slotComplexity.set(iter, complexity); m_slotDraftOption.set(iter, -1); signalIngredientsChanged (); } } // ManufactureSchematicSynchronizedUi::clearSlot
TypeNode* Parser::Type() { if(currenttoken->type == Arreglo) { ConsumeToken(); if(currenttoken->type != OpenBracket) throw invalid_argument("Se esperaba [. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); vector<int> dimensions=IntList(); if(currenttoken->type != CloseBracket) throw invalid_argument("Se esperaba ]. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); if(currenttoken->type != De) throw invalid_argument("Se esperaba palabra reservada de. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); TypeNode*type=Type(); return new ArregloNode(dimensions,type); } else if(currenttoken->type == Entero){ ConsumeToken(); return new EnteroNode(); } else if(currenttoken->type == Real){ ConsumeToken(); return new RealNode(); } else if(currenttoken->type == Booleano){ ConsumeToken(); return new BooleanoNode(); } else if(currenttoken->type == Caracter){ ConsumeToken(); return new CaracterNode(); } else if(currenttoken->type == Archivo) { ConsumeToken(); if (currenttoken->type != Secuencial) throw invalid_argument("Se esperaba palabra reservada secuencial. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); return new ArchivoNode(); } else if(currenttoken->type == Cadena) { ConsumeToken(); if(currenttoken->type != OpenBracket) throw invalid_argument("Se esperaba [. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); if(currenttoken->type != EnteroNumber ) throw invalid_argument("Se esperaba numero entero. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); int size = atoi(currenttoken->lexeme.c_str()); ConsumeToken(); if(currenttoken->type != CloseBracket) throw invalid_argument("Se esperaba ]. Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column)); ConsumeToken(); return new CadenaNode(size); } }