1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-09 21:44:54 +00:00

Merge branch 'more_cleanup' into 'master'

Code cleanup

See merge request OpenMW/openmw!3746
This commit is contained in:
jvoisin 2024-01-08 11:35:24 +00:00
commit 57066bcac1
6 changed files with 11 additions and 12 deletions

View File

@ -154,7 +154,7 @@ bool Launcher::GraphicsPage::loadSettings()
if (Settings::shadows().mEnableIndoorShadows) if (Settings::shadows().mEnableIndoorShadows)
indoorShadowsCheckBox->setCheckState(Qt::Checked); indoorShadowsCheckBox->setCheckState(Qt::Checked);
auto boundMethod = Settings::shadows().mComputeSceneBounds.get(); const auto& boundMethod = Settings::shadows().mComputeSceneBounds.get();
if (boundMethod == "bounds") if (boundMethod == "bounds")
shadowComputeSceneBoundsComboBox->setCurrentIndex(0); shadowComputeSceneBoundsComboBox->setCurrentIndex(0);
else if (boundMethod == "primitives") else if (boundMethod == "primitives")

View File

@ -300,11 +300,9 @@ namespace MWGui
return MyGUI::IntCoord(position.left - halfMarkerSize, position.top - halfMarkerSize, markerSize, markerSize); return MyGUI::IntCoord(position.left - halfMarkerSize, position.top - halfMarkerSize, markerSize, markerSize);
} }
MyGUI::Widget* LocalMapBase::createDoorMarker( MyGUI::Widget* LocalMapBase::createDoorMarker(const std::string& name, float x, float y) const
const std::string& name, const MyGUI::VectorString& notes, float x, float y) const
{ {
MarkerUserData data(mLocalMapRender); MarkerUserData data(mLocalMapRender);
data.notes = notes;
data.caption = name; data.caption = name;
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>( MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>(
"MarkerButton", getMarkerCoordinates(x, y, data, 8), MyGUI::Align::Default); "MarkerButton", getMarkerCoordinates(x, y, data, 8), MyGUI::Align::Default);
@ -662,8 +660,9 @@ namespace MWGui
MarkerUserData* data; MarkerUserData* data;
if (mDoorMarkersToRecycle.empty()) if (mDoorMarkersToRecycle.empty())
{ {
markerWidget = createDoorMarker(marker.name, destNotes, marker.x, marker.y); markerWidget = createDoorMarker(marker.name, marker.x, marker.y);
data = markerWidget->getUserData<MarkerUserData>(); data = markerWidget->getUserData<MarkerUserData>();
data->notes = std::move(destNotes);
doorMarkerCreated(markerWidget); doorMarkerCreated(markerWidget);
} }
else else
@ -672,7 +671,7 @@ namespace MWGui
mDoorMarkersToRecycle.pop_back(); mDoorMarkersToRecycle.pop_back();
data = markerWidget->getUserData<MarkerUserData>(); data = markerWidget->getUserData<MarkerUserData>();
data->notes = destNotes; data->notes = std::move(destNotes);
data->caption = marker.name; data->caption = marker.name;
markerWidget->setCoord(getMarkerCoordinates(marker.x, marker.y, *data, 8)); markerWidget->setCoord(getMarkerCoordinates(marker.x, marker.y, *data, 8));
markerWidget->setVisible(true); markerWidget->setVisible(true);

View File

@ -170,8 +170,7 @@ namespace MWGui
MyGUI::IntPoint getMarkerPosition(float worldX, float worldY, MarkerUserData& markerPos) const; MyGUI::IntPoint getMarkerPosition(float worldX, float worldY, MarkerUserData& markerPos) const;
MyGUI::IntCoord getMarkerCoordinates( MyGUI::IntCoord getMarkerCoordinates(
float worldX, float worldY, MarkerUserData& markerPos, size_t markerSize) const; float worldX, float worldY, MarkerUserData& markerPos, size_t markerSize) const;
MyGUI::Widget* createDoorMarker( MyGUI::Widget* createDoorMarker(const std::string& name, float x, float y) const;
const std::string& name, const MyGUI::VectorString& notes, float x, float y) const;
MyGUI::IntCoord getMarkerCoordinates(MyGUI::Widget* widget, size_t markerSize) const; MyGUI::IntCoord getMarkerCoordinates(MyGUI::Widget* widget, size_t markerSize) const;
virtual void notifyPlayerUpdate() {} virtual void notifyPlayerUpdate() {}

View File

@ -122,7 +122,8 @@ namespace MWLua
return "ESM3_FactionRank[" + rec.mFactionId.toDebugString() + ", " + std::to_string(rec.mRankIndex + 1) return "ESM3_FactionRank[" + rec.mFactionId.toDebugString() + ", " + std::to_string(rec.mRankIndex + 1)
+ "]"; + "]";
}; };
rankT["name"] = sol::readonly_property([](const FactionRank& rec) { return rec.mRankName; }); rankT["name"]
= sol::readonly_property([](const FactionRank& rec) -> std::string_view { return rec.mRankName; });
rankT["primarySkillValue"] = sol::readonly_property([](const FactionRank& rec) { return rec.mPrimarySkill; }); rankT["primarySkillValue"] = sol::readonly_property([](const FactionRank& rec) { return rec.mPrimarySkill; });
rankT["favouredSkillValue"] = sol::readonly_property([](const FactionRank& rec) { return rec.mFavouredSkill; }); rankT["favouredSkillValue"] = sol::readonly_property([](const FactionRank& rec) { return rec.mFavouredSkill; });
rankT["factionReaction"] = sol::readonly_property([](const FactionRank& rec) { return rec.mFactReaction; }); rankT["factionReaction"] = sol::readonly_property([](const FactionRank& rec) { return rec.mFactReaction; });

View File

@ -161,7 +161,8 @@ namespace MWLua
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
sol::usertype<FileHandle> handle = context.mLua->sol().new_usertype<FileHandle>("FileHandle"); sol::usertype<FileHandle> handle = context.mLua->sol().new_usertype<FileHandle>("FileHandle");
handle["fileName"] = sol::readonly_property([](const FileHandle& self) { return self.mFileName; }); handle["fileName"]
= sol::readonly_property([](const FileHandle& self) -> std::string_view { return self.mFileName; });
handle[sol::meta_function::to_string] = [](const FileHandle& self) { handle[sol::meta_function::to_string] = [](const FileHandle& self) {
return "FileHandle{'" + self.mFileName + "'" + (!self.mFilePtr ? ", closed" : "") + "}"; return "FileHandle{'" + self.mFileName + "'" + (!self.mFilePtr ? ", closed" : "") + "}";
}; };

View File

@ -315,8 +315,7 @@ namespace Stereo
else else
{ {
auto* ds = osg::DisplaySettings::instance().get(); auto* ds = osg::DisplaySettings::instance().get();
auto viewMatrix = mMainCamera->getViewMatrix(); const auto& projectionMatrix = mMainCamera->getProjectionMatrix();
auto projectionMatrix = mMainCamera->getProjectionMatrix();
auto s = ds->getEyeSeparation() * Constants::UnitsPerMeter; auto s = ds->getEyeSeparation() * Constants::UnitsPerMeter;
mViewOffsetMatrix[0] mViewOffsetMatrix[0]
= osg::Matrixd(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, s, 0.0, 0.0, 1.0); = osg::Matrixd(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, s, 0.0, 0.0, 1.0);