diff --git a/CHANGELOG.md b/CHANGELOG.md index 273669163..da4dcc45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,14 @@ Bug #2222: Fatigue's effect on selling price is backwards Bug #2326: After a bound item expires the last equipped item of that type is not automatically re-equipped Bug #2835: Player able to slowly move when overencumbered + Bug #2862: [macOS] Can't quit launcher using Command-Q or OpenMW->Quit Bug #2971: Compiler did not reject lines with naked expressions beginning with x.y Bug #3374: Touch spells not hitting kwama foragers Bug #3591: Angled hit distance too low Bug #3629: DB assassin attack never triggers creature spawning Bug #3876: Landscape texture painting is misaligned Bug #3897: Have Goodbye give all choices the effects of Goodbye + Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters Bug #3993: Terrain texture blending map is not upscaled Bug #3997: Almalexia doesn't pace Bug #4036: Weird behaviour of AI packages if package target has non-unique ID @@ -30,6 +32,7 @@ Bug #4451: Script fails to compile when using "Begin, [ScriptName]" syntax Bug #4453: Quick keys behaviour is invalid for equipment Bug #4454: AI opens doors too slow + Bug #4457: Item without CanCarry flag prevents shield autoequipping in dark areas Bug #4458: AiWander console command handles idle chances incorrectly Feature #4256: Implement ToggleBorders (TB) console command Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index d3dbfa559..34442fe71 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -1,6 +1,7 @@ #include "graphicspage.hpp" #include +#include #include #include #include @@ -11,6 +12,7 @@ #define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #endif // MAC_OS_X_VERSION_MIN_REQUIRED +#include #include #include @@ -46,8 +48,28 @@ Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings: } +bool Launcher::GraphicsPage::connectToSdl() { + SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software"); + SDL_SetMainReady(); + // Required for determining screen resolution and such on the Graphics tab + if (SDL_Init(SDL_INIT_VIDEO) != 0) + { + return false; + } + signal(SIGINT, SIG_DFL); // We don't want to use the SDL event loop in the launcher, + // so reset SIGINT which SDL wants to redirect to an SDL_Quit event. + + return true; +} + bool Launcher::GraphicsPage::setupSDL() { + bool sdlConnectSuccessful = connectToSdl(); + if (!sdlConnectSuccessful) + { + return false; + } + int displays = SDL_GetNumVideoDisplays(); if (displays < 0) @@ -67,6 +89,9 @@ bool Launcher::GraphicsPage::setupSDL() screenComboBox->addItem(QString(tr("Screen ")) + QString::number(i + 1)); } + // Disconnect from SDL processes + SDL_Quit(); + return true; } diff --git a/apps/launcher/graphicspage.hpp b/apps/launcher/graphicspage.hpp index e6eb53a3b..0354e5202 100644 --- a/apps/launcher/graphicspage.hpp +++ b/apps/launcher/graphicspage.hpp @@ -37,6 +37,11 @@ namespace Launcher QStringList getAvailableResolutions(int screen); QRect getMaximumResolution(); + /** + * Connect to the SDL so that we can use it to determine graphics + * @return whether or not connecting to SDL is successful + */ + bool connectToSdl(); bool setupSDL(); }; } diff --git a/apps/launcher/main.cpp b/apps/launcher/main.cpp index 96cadc8a7..866ae2aa9 100644 --- a/apps/launcher/main.cpp +++ b/apps/launcher/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -12,24 +11,12 @@ #define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #endif // MAC_OS_X_VERSION_MIN_REQUIRED -#include - #include "maindialog.hpp" int main(int argc, char *argv[]) { try { - SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software"); - SDL_SetMainReady(); - if (SDL_Init(SDL_INIT_VIDEO) != 0) - { - qDebug() << "SDL_Init failed: " << QString::fromUtf8(SDL_GetError()); - return 0; - } - signal(SIGINT, SIG_DFL); // We don't want to use the SDL event loop in the launcher, - // so reset SIGINT which SDL wants to redirect to an SDL_Quit event. - QApplication app(argc, argv); // Now we make sure the current dir is set to application path @@ -46,13 +33,11 @@ int main(int argc, char *argv[]) if (result == Launcher::FirstRunDialogResultContinue) mainWin.show(); - int returnValue = app.exec(); - SDL_Quit(); - return returnValue; + return app.exec(); } catch (std::exception& e) { std::cerr << "ERROR: " << e.what() << std::endl; return 0; } -} +} \ No newline at end of file diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index f1bc6907c..664c41a87 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -984,7 +984,8 @@ namespace MWMechanics MWWorld::ContainerStoreIterator torch = inventoryStore.end(); for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it) { - if (it->getTypeName() == typeid(ESM::Light).name()) + if (it->getTypeName() == typeid(ESM::Light).name() && + it->getClass().canBeEquipped(*it, ptr).first) { torch = it; break; @@ -1005,8 +1006,7 @@ namespace MWMechanics heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); // If we have a torch and can equip it, then equip it now. - if (heldIter == inventoryStore.end() - && torch->getClass().canBeEquipped(*torch, ptr).first == 1) + if (heldIter == inventoryStore.end()) { inventoryStore.equip(MWWorld::InventoryStore::Slot_CarriedLeft, torch, ptr); }