コード例 #1
0
ファイル: Weapon.cpp プロジェクト: andrewservania/KMINTWeek2
Weapon::Weapon()
{
	mTexture = mApplication->LoadTexture("gun-metal.png");

	// Put the weapon at a random location as long as its not at the same location
	// as the cow or rabbit
	SetCurrentNode(Graph::graphNodes.at(rand() % Graph::graphNodes.size()));

	while (Graph::rabbit->getCurrentNode()->id == currentNode->id ||
		Graph::pill->GetCurrentNode()->id == currentNode->id)
		SetCurrentNode(Graph::graphNodes.at(rand() % Graph::graphNodes.size()));

	mApplication->AddRenderable(this);
}
コード例 #2
0
ファイル: frmMain.cpp プロジェクト: kleopatra999/pgadmin3
// Attempt to reselect the node with the given path
bool frmMain::SetCurrentNode(wxTreeItemId node, const wxString &origPath)
{
	wxString path = origPath.Lower();
	wxTreeItemIdValue cookie;
	wxTreeItemId child = browser->GetFirstChild(node, cookie);


	while (child.IsOk())
	{
		wxString actNodePath = GetNodePath(child).Lower();

		if(path.StartsWith(actNodePath))
		{
			if(!browser->IsExpanded(child))
			{
				browser->SelectItem(child, true);
				browser->Expand(child);
			}

			if (actNodePath == path)
			{
				browser->SelectItem(child, true);
				return true;
			}
			else if (SetCurrentNode(child, path))
				return true;
		}
		child = browser->GetNextChild(node, cookie);

	}

	return false;
}
コード例 #3
0
ファイル: salary.c プロジェクト: ekuznets/PKM2
void ProcCommand()
{
	string comName = GetEventData();
	string nodName = GetEventData();

	switch(nodName)
	{
	case "B_OK":
		if(comName=="activate" || comName=="click")
		{
			ExecuteSailorPayment();
			PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT);
		}
	break;

	case "B_CANCEL":
		if(comName=="activate" || comName=="click")
		{
			SkipSailorPayment();
			PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT);
		}
		if(comName=="upstep")
		{
			if(GetSelectable("B_OK"))	{SetCurrentNode("B_OK");}
		}
	break;
	}
}
コード例 #4
0
ファイル: salary.c プロジェクト: ekuznets/PKM2
void CalculateInfoData()
{
	int i,cn,crewQ;
	ref mchref,chref;

	crewQ = 0;
	mchref = GetMainCharacter();
	for(i=0; i<4; i++)
	{
		cn = GetCompanionIndex(mchref,i);
		if( cn>=0 && GetRemovable(&Characters[cn]) )
		{
			chref = GetCharacter(cn);
			crewQ += GetCrewQuantity(chref);
		}
	}

	int nLeaderShip = GetSummonSkillFromName(mchref,SKILL_LEADERSHIP);
	nPaymentQ = 5 + crewQ*(16-nLeaderShip);
	if( CheckAttribute(mchref,"CrewPayment") ) {
		nPaymentQ += makeint( stf(mchref.CrewPayment)*(11.0-SKILL_LEADERSHIP)/10.0 );
	}

	nMoraleDecreaseQ = 30-nLeaderShip;
	if( CheckCharacterPerk(mchref,"IronWill") ) nMoraleDecreaseQ /= 2;

	CreateString(true,"payment",""+nPaymentQ,FONT_NORMAL,COLOR_NORMAL,320,258,SCRIPT_ALIGN_CENTER,1.0);

	if( sti(mchref.Money) < nPaymentQ )
	{
		SetSelectable("B_OK",false);
		SetCurrentNode("B_CANCEL");
	}
}
コード例 #5
0
ファイル: nettree.cpp プロジェクト: JackOfMostTrades/mythtv
void NetTree::handleDirSelect(MythGenericTree *node)
{
    if (m_imageDownload && m_imageDownload->isRunning())
        m_imageDownload->cancel();

    SetCurrentNode(node);
    loadData();
}
コード例 #6
0
ファイル: TreeWalker.cpp プロジェクト: Andrel322/gecko-dev
NS_IMETHODIMP TreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
{
    NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    NS_ENSURE_TRUE(mRoot, NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentNode);
    NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);

    ErrorResult rv;
    SetCurrentNode(*node, rv);
    return rv.ErrorCode();
}
コード例 #7
0
ファイル: nettree.cpp プロジェクト: JackOfMostTrades/mythtv
void NetTree::loadData(void)
{
    if (m_type == DLG_TREE)
        m_siteMap->AssignTree(m_siteGeneric);
    else
    {
        m_siteButtonList->Reset();

        if (!m_currentNode)
            SetCurrentNode(m_siteGeneric);

        if (!m_currentNode)
            return;

        MythGenericTree *selectedNode = m_currentNode->getSelectedChild();

        typedef QList<MythGenericTree *> MGTreeChildList;
        MGTreeChildList *lchildren = m_currentNode->getAllChildren();

        for (MGTreeChildList::const_iterator p = lchildren->begin();
                p != lchildren->end(); ++p)
        {
            if (*p != NULL)
            {
                MythUIButtonListItem *item =
                        new MythUIButtonListItem(m_siteButtonList, QString(), 0,
                                true, MythUIButtonListItem::NotChecked);

                item->SetData(qVariantFromValue(*p));

                UpdateItem(item);

                if (*p == selectedNode)
                    m_siteButtonList->SetItemCurrent(item);
            }
        }

        slotItemChanged();
    }

    if (m_siteGeneric->childCount() == 0 && m_noSites)
        m_noSites->SetVisible(true);
    else if (m_noSites)
        m_noSites->SetVisible(false);

    if (m_siteGeneric->childCount() == 0)
        runTreeEditor();
}
コード例 #8
0
ファイル: frmMain.cpp プロジェクト: mhagander/pgadmin3
// Attempt to reselect the node with the given path
bool frmMain::SetCurrentNode(wxTreeItemId node, const wxString &path)
{
    wxTreeItemIdValue cookie;
    wxTreeItemId child = browser->GetFirstChild(node, cookie);

    while (child.IsOk())
    {
        if (GetNodePath(child) == path)
        {
            browser->SelectItem(child, true);
            return true;
        }
        else
            if (SetCurrentNode(child, path))
                return true;

        child = browser->GetNextChild(node, cookie);
    }

    return false;
}
コード例 #9
0
ファイル: nettree.cpp プロジェクト: JackOfMostTrades/mythtv
bool NetTree::goBack()
{
    bool handled = false;

    if (m_imageDownload && m_imageDownload->isRunning())
        m_imageDownload->cancel();

    if (m_currentNode != m_siteGeneric)
    {
        MythGenericTree *lparent = m_currentNode->getParent();
        if (lparent)
        {
            SetCurrentNode(lparent);
            handled = true;
        }
    }

    loadData();

    return handled;
}
コード例 #10
0
ファイル: events.cpp プロジェクト: search5/pgadmin3
void frmMain::ExecDrop(bool cascaded)
{
	wxTreeItemId item = browser->GetSelection();
	pgCollection *collection = (pgCollection *)browser->GetObject(item);

	// Get any table object for later update
	wxTreeItemId owneritem;
	pgObject *node = (pgObject *)browser->GetObject(item);

	int metatype = node->GetMetaType();

	switch (metatype)
	{
		case PGM_COLUMN:
			owneritem = node->GetTable()->GetId();
			break;

		case PGM_CHECK:
		case PGM_CONSTRAINT:
		case PGM_EXCLUDE:
		case PGM_FOREIGNKEY:
		case PGM_INDEX:
		case PGM_PRIMARYKEY:
		case PGM_UNIQUE:
		case PGM_TRIGGER:
		case PGM_RULE: // Rules are technically table objects! Yeuch
		case EDB_PACKAGEFUNCTION:
		case EDB_PACKAGEVARIABLE:
		case PGM_SCHEDULE:
		case PGM_STEP:
			if (node->IsCollection())
				owneritem = browser->GetParentObject(node->GetId())->GetId();
			else
				owneritem = browser->GetParentObject(browser->GetParentObject(node->GetId())->GetId())->GetId();
			break;

		default:
			break;
	}

	// Grab the parent item to re-focus on.
	wxString parent = GetNodePath(item).BeforeLast('/');

	bool success = false;
	if (collection == currentObject)
		success = dropSingleObject(currentObject, true, cascaded);
	else
	{
		if (collection && collection->IsCollection())
		{
			long index = properties->GetFirstSelected();

			if (index >= 0)
			{
				pgObject *data = collection->FindChild(browser, index);

				if (!data || !data->CanDrop())
					return;

				if (properties->GetSelectedItemCount() == 1)
				{
					success = dropSingleObject(data, true, cascaded);
				}
				else
				{
					if (cascaded || data->RequireDropConfirm() || settings->GetConfirmDelete())
					{
						wxString text, caption;
						if (cascaded)
						{
							text = _("Are you sure you wish to drop multiple objects including all objects that depend on them?");
							caption = _("Drop multiple objects cascaded?");
						}
						else
						{
							text = _("Are you sure you wish to drop multiple objects?");
							caption = _("Drop multiple objects?");
						}
						wxMessageDialog msg(this, text, caption, wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT);
						if (msg.ShowModal() != wxID_YES)
						{
							return;
						}
					}

					bool done = true;
					long count = 0;
					while (done && data && index >= 0)
					{
						if (data->GetSystemObject())
						{
							wxMessageDialog msg(this,
							                    data->GetTranslatedMessage(CANNOTDROPSYSTEM),
							                    _("Trying to drop system object"), wxICON_EXCLAMATION);
							msg.ShowModal();
							return;
						}

						done = dropSingleObject(data, false, cascaded);

						if (done)
						{
							properties->DeleteItem(index);
							count++;
							index = properties->GetFirstSelected();

							if (index >= 0)
								data = collection->FindChild(browser, index);

							success = true;
						}
					}
				}
			}
		}
	}

	if (success)
	{
		// If the collection has a table, refresh that as well.
		if (owneritem)
		{
			ObjectBrowserRefreshing(true);
			Refresh(browser->GetObject(owneritem));
			ObjectBrowserRefreshing(false);
		}

		// Now re-focus on the parent of the deleted node
		if (!parent.IsEmpty())
			SetCurrentNode(browser->GetRootItem(), parent);
	}
}
コード例 #11
0
ファイル: Weapon.cpp プロジェクト: andrewservania/KMINTWeek2
void Weapon::PutOnRandomLocation()
{
	SetCurrentNode(Graph::graphNodes.at(rand() % Graph::graphNodes.size()));
}