コード例 #1
0
ファイル: ItemPageUI.cpp プロジェクト: inzombiak/RPGEngine
void ItemPageUI::PopulateComboBox()
{
	ItemMap items;
	m_itemList->GetItems(items);

	for (ItemMap::iterator i = items.begin(); i != items.end(); ++i)
	{
		m_itemComboBox->AppendItem(i->second.name);
	}
}
コード例 #2
0
ファイル: itemdocument.cpp プロジェクト: zoltanp/ktechlab-0.3
void ItemDocument::slotUpdateZOrdering() {

	{ //begin WORKAROUND
 // remove zeros, Where are these zeros coming from??? they shouldn't be here!!!
		ItemMap::iterator end = m_itemList.end();
		ItemMap::iterator it = m_itemList.begin();

		while(it != end) {
			if(!(it->second)) {
				ItemMap::iterator toRemove = it; 
				it++;
				m_itemList.erase(toRemove);
			} else it++;
		}
	} //END WORKAROUND

	ItemMap toAdd = m_itemList;

	IntItemMap newZOrder;
	int atLevel = 0;

	IntItemMap::iterator zEnd = m_zOrder.end();
	for (IntItemMap::iterator it = m_zOrder.begin(); it != zEnd; ++it) {
		Item *item = it->second;

assert(item->itemDocument() == this); 

		toAdd.erase(item->id());

		if (!item->parentItem() && item->isMovable())
			newZOrder[atLevel++] = item;
	}

	{
		ItemMap::iterator addEnd = toAdd.end();
		for (ItemMap::iterator it = toAdd.begin(); it != addEnd; ++it) {
			Item *item = it->second;
assert(item && item->itemDocument() == this);
			if (item->parentItem() || !item->isMovable())
				continue;

			newZOrder[atLevel++] = item;
		}
	}

	m_zOrder = newZOrder;

	for (IntItemMap::iterator it = m_zOrder.begin(); it != zEnd; ++it)
		it->second->updateZ(it->first); // valgrind says there's a FIXME here. =\ "invalid read of size 4"
}