ContainerWorkbench(InventoryPlayer ContainerWorkbench::inventoryplayer, World world, int i, int j, int k) 
{
        craftMatrix = new InventoryCrafting(this, 3, 3);
        craftResult = new InventoryCraftResult();
        field_20133_c = world;
        field_20132_h = i;
        field_20131_i = j;
        field_20130_j = k;
        addSlot(new SlotCrafting(inventoryplayer.player, craftMatrix, craftResult, 0, 124, 35));
        for(int l = 0; l < 3; l++)
        {
            for(int k1 = 0; k1 < 3; k1++)
            {
                addSlot(new Slot(craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
            }

        }

        for(int i1 = 0; i1 < 3; i1++)
        {
            for(int l1 = 0; l1 < 9; l1++)
            {
                addSlot(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
            }

        }

        for(int j1 = 0; j1 < 9; j1++)
        {
            addSlot(new Slot(inventoryplayer, j1, 8 + j1 * 18, 142));
        }

        onCraftMatrixChanged(craftMatrix);
}
Beispiel #2
0
/**
  Constructor.

  \param alx Length in x direction
  \param aly Length in y direction
  \param segsx Number of segments in x
  \param segsy Number of segments in y
 */
PlaneGeom::PlaneGeom(double alx, double aly, int segsx, int segsy)
    : lx(alx,0), ly(aly,0), segmentsx(segsx,0), segmentsy(segsy,0)
{
    addSlot("lx", lx);
    addSlot("ly", ly);
    addSlot("segmentsx", segmentsx);
    addSlot("segmentsy", segmentsy);
}
Beispiel #3
0
void CArtHandler::loadSlots(CArtifact * art, const JsonNode & node)
{
	if (!node["slot"].isNull()) //we assume non-hero slots are irrelevant?
	{
		if (node["slot"].getType() == JsonNode::DATA_STRING)
			addSlot(art, node["slot"].String());
		else
		{
			for (const JsonNode & slot : node["slot"].Vector())
				addSlot(art, slot.String());
		}
	}
}
        void DeleteSlotTest()
        {
            /////
            {
                ConstraintModel model {id_type<ConstraintModel>{0}, id_type<AbstractConstraintViewModel>{0}, this};
                auto content_id = getStrongId(model.rackes());
                model.createRack(content_id);
                auto rack = model.rack(content_id);

                auto slot_id = getStrongId(rack->getSlots());
                rack->addSlot(new SlotModel
                {
                    slot_id,
                    rack
                });
                rack->removeSlot(slot_id);
                model.removeRack(content_id);
            }

            //////
            {
                ConstraintModel model {id_type<ConstraintModel>{0},
                                       id_type<AbstractConstraintViewModel>{0}, this
                                      };
                auto content_id = getStrongId(model.rackes());
                model.createRack(content_id);
                auto rack = model.rack(content_id);

                rack->addSlot(new SlotModel
                {
                    getStrongId(rack->getSlots()),
                    rack
                });

                rack->addSlot(new SlotModel
                {
                    getStrongId(rack->getSlots()),
                    rack
                });

                rack->addSlot(new SlotModel
                {
                    getStrongId(rack->getSlots()),
                    rack
                });

                model.removeRack(content_id);
            }
        }
SkinData * JSONDataParser::_parseSkin(const rapidjson::Value & rawData)
{
    const auto skin = BaseObject::borrowObject<SkinData>();
    skin->name = _getString(rawData, NAME, "__default");
    if (skin->name.empty())
    {
        skin->name = "__default";
    }

    if (rawData.HasMember(SLOT))
    {
        this->_skin = skin;

        for (const auto& slotObject : rawData[SLOT].GetArray())
        {
            if (this->_isParentCooriinate) 
            {
                this->_armature->addSlot(_parseSlot(slotObject));
            }

            skin->addSlot(_parseSlotDisplaySet(slotObject));
        }

        this->_skin = nullptr;
    }

    return skin;
}
PolyhedronGeom::PolyhedronGeom()
: _on_verts_event(),
  verts(), polys(),
  //  cog(), inertiatensor(),
  //  _cog(), _inertiatensor(), _volume(),
  bb_cache(), 
  bb_cache_valid(true)
  
{
  _on_verts_event.init(this, &PolyhedronGeom::onVertsChanged, &PolyhedronGeom::onVertsResize);
  verts.addDependent(&_on_verts_event);

  // Create the constraint objects for the primitive variable slots...
  UserSizeConstraint* usc = new UserSizeConstraint();
  uniformSizeConstraint = boost::shared_ptr<SizeConstraintBase>(usc);

  LinearSizeConstraint* lsc = new LinearSizeConstraint(verts,1,0);
  varyingSizeConstraint = boost::shared_ptr<SizeConstraintBase>(lsc);

  usc = new UserSizeConstraint();
  faceVaryingSizeConstraint = boost::shared_ptr<SizeConstraintBase>(usc);

  //  cog.setProcedure(this, &PolyhedronGeom::computeCog);
  //  inertiatensor.setProcedure(this, &PolyhedronGeom::computeInertiaTensor);
  //  verts.addDependent(&cog);
  //  verts.addDependent(&inertiatensor);

  addSlot("verts", verts);
  //  addSlot("cog", cog);
  //  addSlot("inertiatensor", inertiatensor);
}
bool Loop::registerWriteCallback ( int fd, void *state, void (* callback)(int fd, void *state ) , int32_t  niceness ) {
	// the "false" answers the question "for reading?"
	if ( addSlot ( false, fd, state, callback, niceness ) ) {
		return true;
	}

	log( LOG_WARN, "loop: Unable to register write callback.");
	return false;
}
// tick is in milliseconds
bool Loop::registerSleepCallback ( int32_t tick, void *state, void (* callback)(int fd,void *state ),
                                   int32_t niceness, bool immediate ) {
	if ( ! addSlot ( true, MAX_NUM_FDS, state, callback, niceness, tick, immediate ) ) {
		log( LOG_WARN, "loop: Unable to register sleep callback" );
		return false;
	}

	ScopedLock sl(m_slotMutex);
	if ( tick < m_minTick ) {
		m_minTick = tick;
	}

	return true;
}
Beispiel #9
0
RackModel::RackModel(const RackModel& source,
                     const id_type<RackModel>& id,
                     std::function<void(const SlotModel&, SlotModel&)> lmCopyMethod,
                     QObject *parent) :
    IdentifiedObject<RackModel> {
    id, "RackModel", parent
}
{
    metadata = source.metadata;
    for(auto& slot : source.m_slots)
    {
        addSlot(new SlotModel{lmCopyMethod, *slot, slot->id(), this},
                source.slotPosition(slot->id()));
    }
}
Beispiel #10
0
CFrmSettings::CFrmSettings()
{
    this->gvc = gvContext();
    Ui_Dialog tempDia;
    tempDia.setupUi(this);
    graph = NULL;
    activeWindow = NULL;
    QString path;
#ifndef WIN32
    char *s = getenv("GVEDIT_PATH");
    if (s)
	path = s;
    else
	path = GVEDIT_DATADIR;
#endif

    connect(WIDGET(QPushButton, pbAdd), SIGNAL(clicked()), this,
	    SLOT(addSlot()));
    connect(WIDGET(QPushButton, pbNew), SIGNAL(clicked()), this,
	    SLOT(newSlot()));
    connect(WIDGET(QPushButton, pbOpen), SIGNAL(clicked()), this,
	    SLOT(openSlot()));
    connect(WIDGET(QPushButton, pbSave), SIGNAL(clicked()), this,
	    SLOT(saveSlot()));
    connect(WIDGET(QPushButton, btnOK), SIGNAL(clicked()), this,
	    SLOT(okSlot()));
    connect(WIDGET(QPushButton, btnCancel), SIGNAL(clicked()), this,
	    SLOT(cancelSlot()));
    connect(WIDGET(QPushButton, pbOut), SIGNAL(clicked()), this,
	    SLOT(outputSlot()));
    connect(WIDGET(QPushButton, pbHelp), SIGNAL(clicked()), this,
	    SLOT(helpSlot()));

    connect(WIDGET(QComboBox, cbScope), SIGNAL(currentIndexChanged(int)),
	    this, SLOT(scopeChangedSlot(int)));
    scopeChangedSlot(0);


#ifndef WIN32
    loadAttrs(path + "/attrs.txt", WIDGET(QComboBox, cbNameG),
	      WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE));
#else
    loadAttrs("../share/graphviz/gvedit/attributes.txt",
	      WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN),
	      WIDGET(QComboBox, cbNameE));
#endif
    setWindowIcon(QIcon(":/images/icon.png"));
}
PlayerListWidget::PlayerListWidget( QWidget* parent) : QWidget( parent )
{
    ui.setupUi(this);

    connect(gMainWindow, SIGNAL(tournamentOpened()), this, SLOT(tournamentOpened()));
    connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addSlot()));
    connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeSlot()));
    connect(ui.rankButton, SIGNAL(clicked()), this, SLOT(rankSlot()));
    ui.tableView->setSortingEnabled(true);

    if (gTournament) {
        connect (gTournament, SIGNAL(playerAddedSignal()), this, SLOT(refresh()));
        refresh();
    }

}//
Beispiel #12
0
int getVirtualSlot(struct p11Slot_t *slot, int index, struct p11Slot_t **vslot)
{
	struct p11Slot_t *newslot;
	char postfix[3];

	FUNC_CALLED();

	if ((index < 0) || (index > sizeof(slot->virtualSlots) / sizeof(*slot->virtualSlots)))
		FUNC_FAILS(CKR_ARGUMENTS_BAD, "Index must not exceed size of virtual slot list");

	if (slot->primarySlot)
		FUNC_FAILS(CKR_ARGUMENTS_BAD, "Slot is a virtual slot");

	if (slot->virtualSlots[index]) {
		*vslot = slot->virtualSlots[index];
		FUNC_RETURNS(CKR_OK);
	}

	newslot = (struct p11Slot_t *) calloc(1, sizeof(struct p11Slot_t));

	if (newslot == NULL)
		FUNC_FAILS(CKR_HOST_MEMORY, "Out of memory");

	*newslot = *slot;
	newslot->token = NULL;
	newslot->next = NULL;
	newslot->primarySlot = slot;

	/* If we already have a pre-allocated slot id, then assign the next id value */
	if (slot->id != 0)
		newslot->id = slot->id + index + 1;

	slot->virtualSlots[index] = newslot;

	postfix[0] = '.';
	postfix[1] = '2' + index;
	postfix[2] = 0;

	appendStr(newslot->info.slotDescription, sizeof(slot->info.slotDescription), postfix);

	addSlot(&context->slotPool, newslot);

	*vslot = newslot;
	FUNC_RETURNS(CKR_OK);
}
Beispiel #13
0
bool CRole::createHPBar()
{
    do
    {
        setHPBar((CHPBar*)(OBJECT_FACTORY->createInstance("CHPBar")));
        BREAK_IF_FAILED(getHPBar());

        BREAK_IF_FAILED(m_pHPBar->init("huds/hp_bar_fg0.png", "huds/hp_bar_bg0.png"));
        float w = m_pHPBar->getSpriteContentSize().width;
        m_pHPBar->setSpritePosition(Point(w / 2.f + 2.f, 0));
        addSlot(m_pHPBar, TAG_HUD_HPBAR);
//        addChild(m_pHPBar);
//        m_pHPBar->attachSpriteTo(getInnerSprite());

        return true;
    } while (false);
    
    return false;
}
Beispiel #14
0
MWState::Character::Character (const boost::filesystem::path& saves, const std::string& game)
: mPath (saves)
{
    if (!boost::filesystem::is_directory (mPath))
    {
        boost::filesystem::create_directories (mPath);
    }
    else
    {
        for (boost::filesystem::directory_iterator iter (mPath);
            iter!=boost::filesystem::directory_iterator(); ++iter)
        {
            boost::filesystem::path slotPath = *iter;

            try
            {
                addSlot (slotPath, game);
            }
            catch (...) {} // ignoring bad saved game files for now
        }

        std::sort (mSlots.begin(), mSlots.end());
    }
}
Beispiel #15
0
void RackModel::addSlot(SlotModel* m)
{
    addSlot(m, m_positions.size());
}
void DraftSchematicObjectTemplate::readObject(LuaObject* templateData) {
	SharedDraftSchematicObjectTemplate::readObject(templateData);

	customObjectName = templateData->getStringField("customObjectName");

	craftingToolTab = templateData->getIntField("craftingToolTab");
	complexity = templateData->getShortField("complexity");
	size = templateData->getShortField("size");

	xpType = templateData->getStringField("xpType");
	xp = templateData->getIntField("xp");
	labratory = templateData->getIntField("lab");
	disableFactory = templateData->getBooleanField("disableFactoryRun");

	assemblySkill = templateData->getStringField("assemblySkill");
	experimentingSkill = templateData->getStringField("experimentingSkill");
	customizationSkill = templateData->getStringField("customizationSkill");

	LuaObject ingredientTemplateNamesList = templateData->getObjectField(
			"ingredientTemplateNames");
	for (int i = 1; i <= ingredientTemplateNamesList.getTableSize(); ++i) {
		ingredientTemplateNames->add(ingredientTemplateNamesList.getStringAt(i));
	}
	ingredientTemplateNamesList.pop();

	LuaObject ingredientTitleNamesList = templateData->getObjectField(
			"ingredientTitleNames");
	for (int i = 1; i <= ingredientTitleNamesList.getTableSize(); ++i) {
		ingredientTitleNames->add(ingredientTitleNamesList.getStringAt(i));
	}
	ingredientTitleNamesList.pop();

	LuaObject ingredientSlotTypeList = templateData->getObjectField(
			"ingredientSlotType");
	for (int i = 1; i <= ingredientSlotTypeList.getTableSize(); ++i) {
		ingredientSlotType->add(ingredientSlotTypeList.getIntAt(i));
	}
	ingredientSlotTypeList.pop();

	LuaObject ingredientAppearanceList = templateData->getObjectField("ingredientAppearance");
	if (ingredientAppearanceList.isValidTable()) {
		for (int i = 1; i <= ingredientAppearanceList.getTableSize(); i++)
			ingredientAppearance->add(ingredientAppearanceList.getStringAt(i));
	} else {
		for (int i = 0; i < ingredientTitleNames->size(); i++)
			ingredientAppearance->add("");
	}
	ingredientAppearanceList.pop();

	LuaObject resourceTypesList = templateData->getObjectField("resourceTypes");
	for (int i = 1; i <= resourceTypesList.getTableSize(); ++i) {
		resourceTypes->add(resourceTypesList.getStringAt(i));
	}
	resourceTypesList.pop();

	LuaObject resourceQuantitiesList = templateData->getObjectField(
			"resourceQuantities");
	for (int i = 1; i <= resourceQuantitiesList.getTableSize(); ++i) {
		resourceQuantities->add(resourceQuantitiesList.getIntAt(i));
	}
	resourceQuantitiesList.pop();

	LuaObject contributionList = templateData->getObjectField("contribution");
	for (int i = 1; i <= contributionList.getTableSize(); ++i) {
		contribution->add(contributionList.getIntAt(i));
	}
	contributionList.pop();

	for (int i = 0; i < ingredientTemplateNames->size(); ++i) {
		DraftSlot* newSlot = new DraftSlot();
		newSlot->setStringId(ingredientTemplateNames->get(i),
				ingredientTitleNames->get(i));
		newSlot->setSlotType(ingredientSlotType->get(i));
		newSlot->setResourceType(resourceTypes->get(i));
		newSlot->setQuantity(resourceQuantities->get(i));
		newSlot->setContribution(contribution->get(i));

		addSlot(newSlot);
	}

	tanoCRC = templateData->getStringField("targetTemplate").hashCode();

	LuaObject availableTemplateList = templateData->getObjectField(
			"additionalTemplates");
	for (int i = 1; i <= availableTemplateList.getTableSize(); ++i) {
		additionalTemplates->add(availableTemplateList.getStringAt(i));
	}
	contributionList.pop();

	LuaObject skillModList = templateData->getObjectField("skillMods");
	for (int i = 1; i <= skillModList.getTableSize(); ++i) {
		LuaObject mod = skillModList.getObjectAt(i);

		String modName = mod.getStringAt(1);
		int modValue = mod.getIntAt(2);

		skillMods.put(modName, modValue);

		mod.pop();
	}
	skillModList.pop();

	LuaObject weaponDotList = templateData->getObjectField("weaponDots");
	for (int i = 1; i <= weaponDotList.getTableSize(); ++i) {
		LuaObject dot = weaponDotList.getObjectAt(i);
		VectorMap<String, int> dotValues;

		for (int j = 1; j <= dot.getTableSize(); ++j) {
			LuaObject attribute = dot.getObjectAt(j);

			String attrName = attribute.getStringAt(1);
			int attrValue = attribute.getIntAt(2);

			dotValues.put(attrName, attrValue);

			attribute.pop();
		}

		weaponDots.add(dotValues);

		dot.pop();
	}
	weaponDotList.pop();
}
Beispiel #17
0
bool
Class::addMemberScript(string_table::key name, Namespace *ns,
	std::uint32_t slotId, Class *type, bool isstatic)
{
	return addSlot(name, ns, slotId, type, isstatic);
}
Beispiel #18
0
int updatePCSCSlots(struct p11SlotPool_t *pool)
{
	struct p11Slot_t *slot,*vslot;
	LPTSTR readers = NULL;
	char *filter, *prealloc;
	DWORD cch = 0;
//	DWORD cch = SCARD_AUTOALLOCATE;
	LPTSTR p;
	LONG rc;
	int match,vslotcnt,i;

	FUNC_CALLED();

	/*
	 * Create a context if not already done
	 */
	if (!globalContext) {

		rc = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &globalContext);

#ifdef DEBUG
		debug("SCardEstablishContext: %s\n", pcsc_error_to_string(rc));
#endif

		if (rc != SCARD_S_SUCCESS) {
			FUNC_FAILS(CKR_DEVICE_ERROR, "Could not establish context to PC/SC manager");
		}
	}

	rc = SCardListReaders(globalContext, NULL, NULL, &cch);

#ifdef DEBUG
	debug("SCardListReaders: %s\n", pcsc_error_to_string(rc));
#endif

	if (rc == SCARD_E_NO_READERS_AVAILABLE) {
		FUNC_RETURNS(CKR_OK);
	}

	if (rc != SCARD_S_SUCCESS) {
		FUNC_FAILS(CKR_DEVICE_ERROR, "Error listing PC/SC card terminals");
	}

	readers = calloc(cch, 1);

	rc = SCardListReaders(globalContext, NULL, readers, &cch);

#ifdef DEBUG
	debug("SCardListReaders: %s\n", pcsc_error_to_string(rc));
#endif

	if (rc == SCARD_E_NO_READERS_AVAILABLE) {
		FUNC_RETURNS(CKR_OK);
	}

	if (rc != SCARD_S_SUCCESS) {
		FUNC_FAILS(CKR_DEVICE_ERROR, "Error listing PC/SC card terminals");
	}
	
	filter = getenv("PKCS11_READER_FILTER");
#ifdef DEBUG
	if (filter) {
		debug("Reader filter '%s'\n", filter);
	}
#endif

	/* Determine the total number of readers */
	p = readers;
	while (*p != '\0') {
#ifdef DEBUG
		debug("Found reader '%s'\n", p);
#endif

		/* Check if we already have a slot for the reader */
		slot = pool->list;
		match = FALSE;
		while (slot) {
			if (strncmp(slot->readername, p, strlen(p)) == 0) {
				match = TRUE;
				break;
			}
			slot = slot->next;
		}

		/* Skip the reader as we already have a slot for it */
		if (match) {
			p += strlen(p) + 1;
			slot->closed = FALSE;
			continue;
		}

		if (!matchFilter(p, filter)) {
			p += strlen(p) + 1;
			continue;
		}

		slot = (struct p11Slot_t *) calloc(1, sizeof(struct p11Slot_t));

		if (slot == NULL) {
			free(readers);
			FUNC_FAILS(CKR_HOST_MEMORY, "Out of memory");
		}

		/* If a reader filter is defined, then slot ids for that reader are
		 * derived from the reader name using a CRC32 value. If the token
		 * in the reader allocated virtual slots, then these have incremented
		 * slot ids.
		 *
		 * This is not enabled by default to prevent slot id collisions
		 */
		if (filter)
			slot->id = crc32(0, p, strlen(p));

		rc = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &(slot->context));

#ifdef DEBUG
		debug("SCardEstablishContext: %s\n", pcsc_error_to_string(rc));
#endif

		if (rc != SCARD_S_SUCCESS) {
			free(slot);
			free(readers);
			FUNC_FAILS(CKR_DEVICE_ERROR, "Could not establish context to PC/SC manager");
		}

		slotCounter++;

		strbpcpy(slot->info.slotDescription,
				(char *)p,
				sizeof(slot->info.slotDescription));

		strcpy(slot->readername, (char *)p);

		strbpcpy(slot->info.manufacturerID,
				"CardContact",
				sizeof(slot->info.manufacturerID));

		slot->info.hardwareVersion.minor = 0;
		slot->info.hardwareVersion.major = 0;

		slot->info.firmwareVersion.major = VERSION_MAJOR;
		slot->info.firmwareVersion.minor = VERSION_MINOR;

		slot->info.flags = CKF_REMOVABLE_DEVICE | CKF_HW_SLOT;

		// The REINER SCT readers have an APDU buffer limitation of 1014 bytes
		if (!strncmp((char *)p, "REINER SCT", 10)) {
#ifdef DEBUG
			debug("Detected a REINER SCT reader\n");
#endif
			if (!strncmp((char *)p, "REINER SCT cyberJack ecom_a", 27)) {
#ifdef DEBUG
				debug("Detected a 'REINER SCT cyberJack ecom_a' reader. Limiting use of Le='000000'\n");
#endif
				// Some REINER SCT readers fail if Le='000000' returns more than
				// 1014 bytes.
				slot->noExtLengthReadAll = 1;
			}
			slot->maxRAPDU = 1000;
			slot->maxCAPDU = 1000;
		}

		addSlot(&context->slotPool, slot);

#ifdef DEBUG
		debug("Added slot (%lu, %s) - slot counter is %i\n", slot->id, slot->readername, slotCounter);
#endif

		// The PREALLOCATE option creates two additional virtual slots per card reader.
		// This is required for Firefox/NSS which sets the friendly flag only for slots that are
		// already present during the first C_GetSlotList
		prealloc = getenv("PKCS11_PREALLOCATE_VIRTUAL_SLOTS");
		if (prealloc) {
			vslotcnt = *prealloc;
			if ((vslotcnt == '1') || (vslotcnt == '2')) {
				vslotcnt -= '0';
			} else {
				vslotcnt = 2;
			}
#ifdef DEBUG
			debug("Pre-allocate virtual slots '' %d\n", prealloc, vslotcnt);
#endif
			for (i = 0; i < vslotcnt; i++) {
				getVirtualSlot(slot, i, &vslot);
			}
		}

		checkForNewPCSCToken(slot);

		p += strlen(p) + 1;
	}

	free(readers);

	FUNC_RETURNS(CKR_OK);
}
Beispiel #19
0
bool
Method::addMemberScript(string_table::key name, Namespace *ns,
	boost::uint32_t slotId, Class *type)
{
	return addSlot(name, ns, slotId, type);
}
Beispiel #20
0
ArmatureData * JSONDataParser::_parseArmature(const rapidjson::Value & rawData)
{
    const auto armature = BaseObject::borrowObject<ArmatureData>();
    armature->name = _getString(rawData, NAME, "");
    armature->frameRate = _getNumber(rawData, FRAME_RATE, this->_data->frameRate);

    if (rawData.HasMember(TYPE) && rawData[TYPE].IsString())
    {
        armature->type = _getArmatureType(rawData[TYPE].GetString());
    }
    else
    {
        armature->type = (ArmatureType)_getNumber(rawData, TYPE, (int)ArmatureType::Armature);
    }

    this->_armature = armature;
    this->_rawBones.clear();

    if (rawData.HasMember(BONE))
    {
        for (const auto& boneObject : rawData[BONE].GetArray())
        {
            const auto bone = _parseBone(boneObject);
            armature->addBone(bone, _getString(boneObject, PARENT, ""));
            this->_rawBones.push_back(bone);
        }
    }

    if (rawData.HasMember(IK))
    {
        for (const auto& ikObject : rawData[IK].GetArray())
        {
            _parseIK(ikObject);
        }
    }

    if (rawData.HasMember(SLOT))
    {
        for (const auto& slotObject : rawData[SLOT].GetArray())
        {
            armature->addSlot(_parseSlot(slotObject));
        }
    }

    if (rawData.HasMember(SKIN))
    {
        for (const auto& skinObject : rawData[SKIN].GetArray())
        {
            armature->addSkin(_parseSkin(skinObject));
        }
    }

    if (rawData.HasMember(ANIMATION))
    {
        for (const auto& animationObject : rawData[ANIMATION].GetArray())
        {
            armature->addAnimation(_parseAnimation(animationObject));
        }
    }

    this->_armature = nullptr;
    this->_rawBones.clear();


    if (this->_isParentCooriinate && _getBoolean(rawData, IS_GLOBAL, true)) 
    {
        this->_globalToLocal(armature);
    }

    return armature;
}
Beispiel #21
0
MenuActionBar::MenuActionBar()
	: sprite_emptyslot(NULL)
	, sprite_disabled(NULL)
	, sprite_attention(NULL)
	, slots_count(0)
	, drag_prev_slot(-1)
	, updated(false)
	, twostep_slot(-1) {

	src.w = ICON_SIZE;
	src.h = ICON_SIZE;

	menu_labels.resize(4);

	tablist = TabList(HORIZONTAL, ACTIONBAR_BACK, ACTIONBAR_FORWARD, ACTIONBAR);

	for (unsigned int i=0; i<4; i++) {
		menus[i] = new WidgetSlot(-1, ACTIONBAR);
	}

	// Read data from config file
	FileParser infile;

	// @CLASS MenuActionBar|Description of menus/actionbar.txt
	if (infile.open("menus/actionbar.txt")) {
		while (infile.next()) {
			if (parseMenuKey(infile.key, infile.val))
				continue;

			// @ATTR slot|repeatable(int, int, int) : Index, X, Y|Index (max 10) and position for power slot.
			if (infile.key == "slot") {
				unsigned index = popFirstInt(infile.val);
				if (index == 0 || index > 10) {
					infile.error("MenuActionBar: Slot index must be in range 1-10.");
				}
				else {
					int x = popFirstInt(infile.val);
					int y = popFirstInt(infile.val);
					addSlot(index-1, x, y);
				}
			}
			// @ATTR slot_M1|point|Position for the primary action slot.
			else if (infile.key == "slot_M1") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				addSlot(10, x, y);
			}
			// @ATTR slot_M2|point|Position for the secondary action slot.
			else if (infile.key == "slot_M2") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				addSlot(11, x, y);
			}

			// @ATTR char_menu|point|Position for the Character menu button.
			else if (infile.key == "char_menu") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				menus[MENU_CHARACTER]->setBasePos(x, y);
				menus[MENU_CHARACTER]->pos.w = menus[MENU_CHARACTER]->pos.h = ICON_SIZE;
			}
			// @ATTR inv_menu|point|Position for the Inventory menu button.
			else if (infile.key == "inv_menu") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				menus[MENU_INVENTORY]->setBasePos(x, y);
				menus[MENU_INVENTORY]->pos.w = menus[MENU_INVENTORY]->pos.h = ICON_SIZE;
			}
			// @ATTR powers_menu|point|Position for the Powers menu button.
			else if (infile.key == "powers_menu") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				menus[MENU_POWERS]->setBasePos(x, y);
				menus[MENU_POWERS]->pos.w = menus[MENU_POWERS]->pos.h = ICON_SIZE;
			}
			// @ATTR log_menu|point|Position for the Log menu button.
			else if (infile.key == "log_menu") {
				int x = popFirstInt(infile.val);
				int y = popFirstInt(infile.val);
				menus[MENU_LOG]->setBasePos(x, y);
				menus[MENU_LOG]->pos.w = menus[MENU_LOG]->pos.h = ICON_SIZE;
			}

			else infile.error("MenuActionBar: '%s' is not a valid key.", infile.key.c_str());
		}
		infile.close();
	}

	for (unsigned int i=0; i<4; i++) {
		tablist.add(menus[i]);
	}

	slots_count = static_cast<unsigned>(slots.size());

	hotkeys.resize(slots_count);
	hotkeys_temp.resize(slots_count);
	hotkeys_mod.resize(slots_count);
	locked.resize(slots_count);
	slot_item_count.resize(slots_count);
	slot_enabled.resize(slots_count);
	slot_activated.resize(slots_count);
	slot_cooldown_size.resize(slots_count);

	clear();

	loadGraphics();

	align();

	menu_act = this;
}
	void Inventory::setProperty(const CeGuiString& key, const Property& value)
	{
        if (key == Inventory::PROPERTY_SLOTS)
        {
            PropertyArray slotVec = value.toArray();

            for (PropertyArray::const_iterator it = slotVec.begin(); it != slotVec.end(); ++it)
            {
                PropertyMap slotProps = it->toMap();

                CeGuiString name = slotProps["name"].toString();
                int holdItems = Item::ITEMTYPE_ALL_ITEMS;
                if (slotProps.find("holds") != slotProps.end())
                {
                    holdItems = slotProps["holds"].toInt();
                }
                int readyItems = Item::ITEMTYPE_ALL_ITEMS;
                if (slotProps.find("readies") != slotProps.end())
                {
                    readyItems = slotProps["readies"].toInt();
                }

                CeGuiString type = slotProps.find("type")->second.toString();
                if (type == "bone")
                {
                    CeGuiString bone = slotProps["bone"].toString();
                    LOG_MESSAGE("Inventory", "Add bone slot "+ bone);
                    addSlot(name, bone.c_str(), readyItems, holdItems, SLOT_BONE);
                }
                else if (type == "submesh")
                {
                    CeGuiString submesh = slotProps["submesh"].toString();
                    LOG_MESSAGE("Inventory", "Add submesh slot "+ submesh);
                    addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_SUBMESH);
                }
                else if (type == "material")
                {
                    CeGuiString submesh = slotProps["submesh"].toString();
                    LOG_MESSAGE("Inventory", "Add material slot "+ submesh);
                    addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_MATERIAL);
                }
                else if (type == "default")
                {
                    LOG_MESSAGE("Inventory", "Add default slot "+ name);
                    addSlot(name, "", readyItems, holdItems, SLOT_DEFAULT);
                }
                else
                {
                    LOG_ERROR(Logger::RULES, 
                        "Unknown slot type '"+type+"' in inventory properties.");
                }
            }
        }
		else if (key == Inventory::PROPERTY_CONTENT)
		{
			PropertyMap bonesContent = value.toMap();
			for (PropertyMap::const_iterator it = bonesContent.begin();
				it != bonesContent.end(); ++it)
			{
				Item* item = dynamic_cast<Item*>(
					GameObjectManager::getSingleton().createGameObjectFromProperty(
						(*it).second));
				if (item)
				{
					LOG_MESSAGE("Inventory", "Add item " + it->second.toString() + " to slot "+ (*it).first);
					hold(item, (*it).first);
				}
			}
		}
	}
Beispiel #23
0
const MWState::Slot *MWState::Character::createSlot (const ESM::SavedGame& profile)
{
    addSlot (profile);

    return &mSlots.back();
}