Example #1
0
bool CPetControl::checkNode(const CString &name) {
	CGameManager *gameManager = getGameManager();
	if (!gameManager)
		return true;
	if (name == "NULL")
		return false;

	CViewItem *view = gameManager->getView();
	if (!view)
		return true;

	CNodeItem *node = view->findNode();
	if (!node)
		return true;

	CString viewName = view->getName();
	CString nodeName = node->getName();
	CRoomItem *room = getGameManager()->getRoom();

	if (room) {
		CString roomName = room->getName();
		CString newNode;

		if (roomName == "1stClassRestaurant") {
		} else if (nodeName == "Lobby Node") {
			nodeName = "Node 1";
		} else if (nodeName == "Entrance Node") {
			nodeName = "Node 2";
		} else if (nodeName == "MaitreD Node") {
			nodeName = "Node 3";
		} else if (nodeName == "Scraliontis Table Standing Node") {
			nodeName = "Node 4";
		} else if (nodeName == "Pellerator Node") {
			nodeName = "Node 5";
		} else if (nodeName == "SUB Node") {
			nodeName = "Node 6";
		} else if (nodeName == "Phonograph Node") {
			nodeName = "Node 7";
		} else if (nodeName == "Scraliontis Table Seated Node") {
			nodeName = "Node 8";
		}

		if (roomName == "MusicRoom") {
			if (nodeName == "Musical Instruments")
				nodeName = "Node 1";
			if (nodeName == "Phonograph Node")
				nodeName = "Node 2";
		}
	}

	CString str = CString::format("%s.%s", nodeName.c_str(), viewName.c_str());
	str = str.right(5);
	str.toLowercase();

	CString nameLower = name;
	nameLower.toLowercase();

	return nameLower.contains(str);
}
Example #2
0
void CWizFolder::MoveToLocation(const CString& strDestLocation)
{
    Q_ASSERT(strDestLocation.right(1) == "/");
    Q_ASSERT(strDestLocation.left(1) == "/");

    if (!CanMove(Location(), strDestLocation))
        return;

    CString strOldLocation = Location();
    //CString strNewLocation;
//
    //CString strLocationName = CWizDatabase::GetLocationName(strOldLocation);
//
    //if (strDestLocation.IsEmpty()) {
    //    strNewLocation = "/" + strLocationName + "/";
    //} else {
    //    strNewLocation = strDestLocation + strLocationName + "/";
    //}

    CWizDocumentDataArray arrayDocument;
    if (!m_db.GetDocumentsByLocationIncludeSubFolders(strOldLocation, arrayDocument))
    {
        TOLOG1(_T("Failed to get documents by location (include sub folders): %1"), strOldLocation);
        return;
    }

    CWizDocumentDataArray::const_iterator it;
    for (it = arrayDocument.begin(); it != arrayDocument.end(); it++)
    {
        WIZDOCUMENTDATA data = *it;

        Q_ASSERT(data.strLocation.startsWith(strOldLocation));
        if (!data.strLocation.startsWith(strOldLocation)) {
            TOLOG(_T("Error location of document!"));
            continue;
        }

        data.strLocation.Delete(0, strOldLocation.GetLength());
        data.strLocation.Insert(0, strDestLocation);

        if (!m_db.ModifyDocumentInfo(data))
        {
            TOLOG(_T("Failed to move document to new folder!"));
            continue;
        }
    }

    m_db.LogDeletedFolder(strOldLocation);
}