mirror of
https://github.com/Mudlet/Mudlet
synced 2026-08-13 18:26:27 -04:00
Fix: don't load a map if trying to create a mapper & map is already loaded (#9415)
#### Brief overview of PR changes/additions Under some circumstances Mudlet will load the same map twice - not only does that waste time it is now triggering a warning about creating a room that already exists - for every room in the map. This PR aims to prevent the second load attempt from happen under those circumstances #### Motivation for adding to Mudlet Improve the speed of the map loading process by not doing it twice. #### Other info (issues closed, discussion etc) This situation was analysed and a fix for all the warning messages proposed in #9396 - however that was not addressing the underlying issue that this PR should. I believe that this will make that PR redundant - however I will acknowledge and thank the creator of that PR for their work which pinpointed something that I had noticed but not looked into fixing before now. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
This commit is contained in:
parent
44c253468e
commit
2a3334a6a0
1 changed files with 20 additions and 15 deletions
|
|
@ -843,24 +843,29 @@ std::pair<bool, QString> TMainConsole::createMapper(const QString& windowname, i
|
|||
}
|
||||
mpHost->mpMap->mpHost = mpHost;
|
||||
mpHost->mpMap->mpMapper = mpMapper;
|
||||
qDebug() << "TConsole::createMapper() - restore map case 2.";
|
||||
mpHost->mpMap->pushErrorMessagesToFile(tr("Pre-Map loading(2) report"), true);
|
||||
const QDateTime now(QDateTime::currentDateTime());
|
||||
|
||||
if (mpHost->mpMap->restore(QString())) {
|
||||
mpHost->mpMap->audit();
|
||||
mpMapper->mp2dMap->init();
|
||||
mpMapper->updateAreaComboBox();
|
||||
mpMapper->resetAreaComboBoxToPlayerRoomArea();
|
||||
mpMapper->show();
|
||||
if (mpHost->mpMap->mpRoomDB->isEmpty()) {
|
||||
// Don't load a map if we already have one around!
|
||||
qDebug() << "TConsole::createMapper() - restore map case 2.";
|
||||
mpHost->mpMap->pushErrorMessagesToFile(tr("Pre-Map loading(2) report"), true);
|
||||
const QDateTime now(QDateTime::currentDateTime());
|
||||
|
||||
if (mpHost->mpMap->restore(QString())) {
|
||||
mpHost->mpMap->audit();
|
||||
mpMapper->mp2dMap->init();
|
||||
mpMapper->updateAreaComboBox();
|
||||
mpMapper->resetAreaComboBoxToPlayerRoomArea();
|
||||
mpMapper->show();
|
||||
}
|
||||
|
||||
mpHost->mpMap->pushErrorMessagesToFile(tr("Loading map(2) at %1 report").arg(now.toString(Qt::ISODate)), true);
|
||||
|
||||
TEvent mapOpenEvent{};
|
||||
mapOpenEvent.mArgumentList.append(QLatin1String("mapOpenEvent"));
|
||||
mapOpenEvent.mArgumentTypeList.append(ARGUMENT_TYPE_STRING);
|
||||
mpHost->raiseEvent(mapOpenEvent);
|
||||
}
|
||||
|
||||
mpHost->mpMap->pushErrorMessagesToFile(tr("Loading map(2) at %1 report").arg(now.toString(Qt::ISODate)), true);
|
||||
|
||||
TEvent mapOpenEvent{};
|
||||
mapOpenEvent.mArgumentList.append(QLatin1String("mapOpenEvent"));
|
||||
mapOpenEvent.mArgumentTypeList.append(ARGUMENT_TYPE_STRING);
|
||||
mpHost->raiseEvent(mapOpenEvent);
|
||||
}
|
||||
mpMapper->resize(width, height);
|
||||
mpMapper->move(x, y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue