1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-13 04:43:06 +00:00

Address feedback

This commit is contained in:
Evil Eye 2025-08-25 16:46:04 +02:00
parent e97542a487
commit 79a1f1c3d2
3 changed files with 34 additions and 28 deletions

View file

@ -482,11 +482,11 @@ namespace MWGui
void SettingsWindow::onResolutionAccept() void SettingsWindow::onResolutionAccept()
{ {
auto resultion = mResolutionList->getItemDataAt<std::pair<int, int>>(mResolutionList->getIndexSelected()); auto resolution = mResolutionList->getItemDataAt<std::pair<int, int>>(mResolutionList->getIndexSelected());
if (resultion) if (resolution)
{ {
Settings::video().mResolutionX.set(resultion->first); Settings::video().mResolutionX.set(resolution->first);
Settings::video().mResolutionY.set(resultion->second); Settings::video().mResolutionY.set(resolution->second);
apply(); apply();
} }
@ -506,8 +506,8 @@ namespace MWGui
for (size_t i = 0; i < mResolutionList->getItemCount(); ++i) for (size_t i = 0; i < mResolutionList->getItemCount(); ++i)
{ {
auto resultion = mResolutionList->getItemDataAt<std::pair<int, int>>(i); auto resolution = mResolutionList->getItemDataAt<std::pair<int, int>>(i);
if (resultion && resultion->first == currentX && resultion->second == currentY) if (resolution && resolution->first == currentX && resolution->second == currentY)
{ {
mResolutionList->setIndexSelected(i); mResolutionList->setIndexSelected(i);
break; break;
@ -873,12 +873,12 @@ namespace MWGui
// check if this resolution is supported in fullscreen // check if this resolution is supported in fullscreen
if (mResolutionList->getIndexSelected() != MyGUI::ITEM_NONE) if (mResolutionList->getIndexSelected() != MyGUI::ITEM_NONE)
{ {
auto resultion auto resolution
= mResolutionList->getItemDataAt<std::pair<int, int>>(mResolutionList->getIndexSelected()); = mResolutionList->getItemDataAt<std::pair<int, int>>(mResolutionList->getIndexSelected());
if (resultion) if (resolution)
{ {
Settings::video().mResolutionX.set(resultion->first); Settings::video().mResolutionX.set(resolution->first);
Settings::video().mResolutionY.set(resultion->second); Settings::video().mResolutionY.set(resolution->second);
} }
} }
@ -886,18 +886,18 @@ namespace MWGui
int fallbackX = 0, fallbackY = 0; int fallbackX = 0, fallbackY = 0;
for (size_t i = 0; i < mResolutionList->getItemCount(); ++i) for (size_t i = 0; i < mResolutionList->getItemCount(); ++i)
{ {
auto resultion = mResolutionList->getItemDataAt<std::pair<int, int>>(i); auto resolution = mResolutionList->getItemDataAt<std::pair<int, int>>(i);
if (!resultion) if (!resolution)
continue; continue;
if (i == 0) if (i == 0)
{ {
fallbackX = resultion->first; fallbackX = resolution->first;
fallbackY = resultion->second; fallbackY = resolution->second;
} }
if (resultion->first == Settings::video().mResolutionX if (resolution->first == Settings::video().mResolutionX
&& resultion->second == Settings::video().mResolutionY) && resolution->second == Settings::video().mResolutionY)
supported = true; supported = true;
} }

View file

@ -1,6 +1,5 @@
#include "inputactions.hpp" #include "inputactions.hpp"
#include <format>
#include <queue> #include <queue>
#include <set> #include <set>
@ -116,14 +115,14 @@ namespace LuaUtil
void Registry::insert(const Info& info) void Registry::insert(const Info& info)
{ {
if (mIds.find(info.mKey) != mIds.end()) if (mIds.find(info.mKey) != mIds.end())
throw std::domain_error(std::format("Action key \"{}\" is already in use", info.mKey)); throw std::domain_error("Action key \"" + info.mKey + "\" is already in use");
if (info.mKey.empty()) if (info.mKey.empty())
throw std::domain_error("Action key can't be an empty string"); throw std::domain_error("Action key can't be an empty string");
if (info.mL10n.empty()) if (info.mL10n.empty())
throw std::domain_error("Localization context can't be empty"); throw std::domain_error("Localization context can't be empty");
if (!validateActionValue(info.mDefaultValue, info.mType)) if (!validateActionValue(info.mDefaultValue, info.mType))
throw std::logic_error(std::format( throw std::logic_error("Invalid value: \"" + LuaUtil::toString(info.mDefaultValue) + "\" for action \""
"Invalid value: \"{}\" for action \"{}\"", LuaUtil::toString(info.mDefaultValue), info.mKey)); + info.mKey + "\"");
Id id = mBindingTree.insert(); Id id = mBindingTree.insert();
mKeys.push_back(info.mKey); mKeys.push_back(info.mKey);
mIds[std::string(info.mKey)] = id; mIds[std::string(info.mKey)] = id;
@ -156,7 +155,7 @@ namespace LuaUtil
{ {
auto iter = mIds.find(key); auto iter = mIds.find(key);
if (iter == mIds.end()) if (iter == mIds.end())
throw std::logic_error(std::format("Unknown action key: \"{}\"", key)); throw std::logic_error("Unknown action key: \"" + std::string(key) + "\"");
return iter->second; return iter->second;
} }
@ -182,9 +181,16 @@ namespace LuaUtil
Id id = safeIdByKey(key); Id id = safeIdByKey(key);
Info info = mInfo[id]; Info info = mInfo[id];
if (info.mType != type) if (info.mType != type)
throw std::logic_error( {
std::format("Attempt to get value of type \"{}\" from action \"{}\" with type \"{}\"", std::string message("Attempt to get value of type \"");
typeName(type), key, typeName(info.mType))); message += typeName(type);
message += "\" from action \"";
message += key;
message += "\" with type \"";
message += typeName(info.mType);
message += "\"";
throw std::logic_error(message);
}
return mValues[id]; return mValues[id];
} }
@ -269,14 +275,14 @@ namespace LuaUtil
{ {
auto it = mIds.find(key); auto it = mIds.find(key);
if (it == mIds.end()) if (it == mIds.end())
throw std::domain_error(std::format("Unknown trigger key \"{}\"", key)); throw std::domain_error("Unknown trigger key \"" + std::string(key) + "\"");
return it->second; return it->second;
} }
void Registry::insert(const Info& info) void Registry::insert(const Info& info)
{ {
if (mIds.find(info.mKey) != mIds.end()) if (mIds.find(info.mKey) != mIds.end())
throw std::domain_error(std::format("Trigger key \"{}\" is already in use", info.mKey)); throw std::domain_error("Trigger key \"" + info.mKey + "\" is already in use");
if (info.mKey.empty()) if (info.mKey.empty())
throw std::domain_error("Trigger key can't be an empty string"); throw std::domain_error("Trigger key can't be an empty string");
if (info.mL10n.empty()) if (info.mL10n.empty())

View file

@ -1,6 +1,5 @@
#include "animblendrules.hpp" #include "animblendrules.hpp"
#include <format>
#include <iterator> #include <iterator>
#include <utility> #include <utility>
@ -103,7 +102,8 @@ namespace SceneUtil
} }
else else
{ {
throw std::domain_error(std::format("'blending_rules' object not found in '{}' file!", configPath.value())); throw std::domain_error(
"'blending_rules' object not found in '" + std::string(configPath.value()) + "' file!");
} }
// If no rules then dont allocate any instance // If no rules then dont allocate any instance