Пример #1
0
// Return true, only if transport has correct position!
bool MOTransport::SetPosition(WorldLocation const& loc, bool teleport)
{
    // prevent crash when a bad coord is sent by the client
    if (!MaNGOS::IsValidMapCoord(loc.getX(), loc.getY(), loc.getZ(), loc.getO()))
    {
        DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES, "Transport::SetPosition(%f, %f, %f, %f, %d) bad coordinates for transport %s!", loc.getX(), loc.getY(), loc.getZ(), loc.getO(), teleport, GetName());
        return false;
    }

    if (teleport || GetMapId() != loc.GetMapId())
    {
        Map* oldMap = GetMap();
        Map* newMap = sMapMgr.CreateMap(loc.GetMapId(), this);

        if (!newMap)
        {
            sLog.outError("Transport::SetPosition cannot create map %u for transport %s!", loc.GetMapId(), GetName());
            return false;
        }

        if (oldMap != newMap)
        {
            // Transport inserted in current map ActiveObjects list
            if (!GetTransportKit()->GetPassengers().empty())
            {
                DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES,"Transport::SetPosition %s notify passengers (count " SIZEFMTD ") for change map from %u to %u",GetObjectGuid().GetString().c_str(), GetTransportKit()->GetPassengers().size(), GetPosition().GetMapId(), loc.GetMapId());
                GetTransportKit()->CallForAllPassengers(NotifyMapChangeBegin(oldMap, GetPosition(), loc));
            }

            oldMap->Remove((GameObject*)this, false);

            SkipUpdate(true);

            SetMap(newMap);

            Relocate(loc);
            SetLocationMapId(loc.GetMapId());
            SetLocationInstanceId(loc.GetInstanceId());

            newMap->Add((GameObject*)this);

            // Transport inserted in current map ActiveObjects list
            if (!GetTransportKit()->GetPassengers().empty())
            {
                DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES,"Transport::SetPosition %s notify passengers (count " SIZEFMTD ") for finished change map to %u",GetObjectGuid().GetString().c_str(), GetTransportKit()->GetPassengers().size(), loc.GetMapId());
                GetTransportKit()->CallForAllPassengers(NotifyMapChangeEnd(newMap,loc));
            }

            DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES, "Transport::SetPosition %s teleported to (%f, %f, %f, %f)", GetObjectGuid().GetString().c_str(), loc.x, loc.y, loc.z, loc.orientation);
            return true;
        }
        else if (!(GetPosition() == loc))
            GetMap()->Relocation((GameObject*)this, loc);
    }
    else if (!(GetPosition() == loc))
        GetMap()->Relocation((GameObject*)this, loc);


    return false;
}
Пример #2
0
void FvUpdater::decideWhatToDoWithCurrentUpdateProposal()
{
	QString policy = settings->value(FV_NEW_VERSION_POLICY_KEY).toString();
	if(policy == "install")
		InstallUpdate();
	else if(policy == "skip")
		SkipUpdate();
	else
		RemindMeLater();
}
Пример #3
0
FvUpdateWindow::FvUpdateWindow (QWidget *parent) :
    QWidget (parent),
    m_ui (new Ui::FvUpdateWindow) {
    m_ui->setupUi (this);

    m_appIconScene = 0;

    // Delete on close
    setAttribute (Qt::WA_DeleteOnClose, true);

    // Set the "new version is available" string
    QString newVersString = m_ui->newVersionIsAvailableLabel->text().arg (QString::fromUtf8 (FV_APP_NAME));
    m_ui->newVersionIsAvailableLabel->setText (newVersString);

    // Connect buttons
    connect (m_ui->installUpdateButton, SIGNAL (clicked()),
             FvUpdater::sharedUpdater(), SLOT (InstallUpdate()));
    connect (m_ui->skipThisVersionButton, SIGNAL (clicked()),
             FvUpdater::sharedUpdater(), SLOT (SkipUpdate()));
    connect (m_ui->remindMeLaterButton, SIGNAL (clicked()),
             FvUpdater::sharedUpdater(), SLOT (RemindMeLater()));
}
Пример #4
0
void QtTestApp::initUpdater()
{
	createUpdaterWindow();
	
	FvUpdater::sharedUpdater()->SetFeedURL("https://raw.github.com/ershovdz/WebMounter_Builds/master/Appcast.xml");

	// signals from WINDOW
	connect(m_updaterWindow, SIGNAL(installRequested()), FvUpdater::sharedUpdater(), SLOT(InstallUpdate()));
	connect(m_updaterWindow, SIGNAL(skipInstallRequested()), FvUpdater::sharedUpdater(), SLOT(SkipUpdate()));
	connect(m_updaterWindow, SIGNAL(remindLaterRequested()), FvUpdater::sharedUpdater(), SLOT(RemindMeLater()));
	connect(m_updaterWindow, SIGNAL(cancelRequested()), FvUpdater::sharedUpdater(), SLOT(CancelUpdate()));

	// signals from UPDATER
	connect(FvUpdater::sharedUpdater(), SIGNAL(finished()), m_updaterWindow, SLOT(onFinished()));
	connect(FvUpdater::sharedUpdater(), SIGNAL(failed(QString)), m_updaterWindow, SLOT(onFailed(QString)));
	connect(FvUpdater::sharedUpdater(), SIGNAL(progress(uint)), m_updaterWindow, SLOT(onProgress(uint)));
	connect(FvUpdater::sharedUpdater(), SIGNAL(updateAvailable(FvAvailableUpdate*)), this, SLOT(onUpdates(FvAvailableUpdate*)));
	connect(FvUpdater::sharedUpdater(), SIGNAL(noUpdates()), this, SLOT(onNoUpdates()));
	connect(FvUpdater::sharedUpdater(), SIGNAL(closeAppToRunInstaller()), this, SLOT(onCloseApp()));
}