1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-29 10:04:31 +00:00
Commit graph

36932 commits

Author SHA1 Message Date
elsid
feb9cc004c
Fix portability-avoid-pragma-once warnings
components/misc/helpviewer.hpp:1:1: error: avoid 'pragma once' directive; use include guards instead [portability-avoid-pragma-once,-warnings-as-errors]
    1 | #pragma once
      | ^

apps/opencs/view/world/tableheadermouseeventhandler.hpp:1:1: error: avoid 'pragma once' directive; use include guards instead [portability-avoid-pragma-once,-warnings-as-errors]
    1 | #pragma once
      | ^
2025-11-25 21:16:50 +01:00
elsid
4186ca6ceb
Fix clang-analyzer-security.ArrayBound warning
Size of an array is not a valid index.

components/esm4/reader.cpp:925:15: error: Out of bound access to memory after the end of 'sGroupType' [clang-analyzer-security.ArrayBound,-warnings-as-errors]
  925 |         ss << sGroupType[std::min<std::size_t>(type, std::size(sGroupType))]; // avoid out of range
      |               ^
components/esm4/reader.cpp:627:13: note: Assuming field 'groupSize' is equal to field 'recHeaderSize'
  627 |         if (mCtx.recordHeader.group.groupSize == (std::uint32_t)mCtx.recHeaderSize)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:627:9: note: Taking true branch
  627 |         if (mCtx.recordHeader.group.groupSize == (std::uint32_t)mCtx.recHeaderSize)
      |         ^
components/esm4/reader.cpp:634:17: note: Assuming the condition is true
  634 |             if (!mCtx.groupStack.empty()) // top group may be empty (e.g. HAIR in Skyrim)
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:634:13: note: Taking true branch
  634 |             if (!mCtx.groupStack.empty()) // top group may be empty (e.g. HAIR in Skyrim)
      |             ^
components/esm4/reader.cpp:638:17: note: Calling 'Reader::exitGroupCheck'
  638 |                 exitGroupCheck();
      |                 ^~~~~~~~~~~~~~~~
components/esm4/reader.cpp:650:13: note: Assuming the condition is false
  650 |         if (mCtx.groupStack.empty())
      |             ^~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:650:9: note: Taking false branch
  650 |         if (mCtx.groupStack.empty())
      |         ^
components/esm4/reader.cpp:655:16: note: Assuming 'lastGroupSize' is <= field 'second'
  655 |         while (mCtx.groupStack.back().second >= lastGroupSize)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:655:9: note: Loop condition is true.  Entering loop body
  655 |         while (mCtx.groupStack.back().second >= lastGroupSize)
      |         ^
components/esm4/reader.cpp:663:17: note: Assuming 'overshoot' is <= 0
  663 |             if (overshoot > 0)
      |                 ^~~~~~~~~~~~~
components/esm4/reader.cpp:663:13: note: Taking false branch
  663 |             if (overshoot > 0)
      |             ^
components/esm4/reader.cpp:676:17: note: Assuming the condition is false
  676 |             if (mCtx.groupStack.empty())
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:676:13: note: Taking false branch
  676 |             if (mCtx.groupStack.empty())
      |             ^
components/esm4/reader.cpp:682:17: note: Assuming 'lastGroupSize' is >= field 'second'
  682 |             if (lastGroupSize < mCtx.groupStack.back().second)
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:682:13: note: Taking false branch
  682 |             if (lastGroupSize < mCtx.groupStack.back().second)
      |             ^
components/esm4/reader.cpp:686:17: note: Assuming 'lastGroupSize' is < field 'second'
  686 |             if (mCtx.groupStack.back().second > lastGroupSize) // FIXME: debugging only
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:686:13: note: Taking true branch
  686 |             if (mCtx.groupStack.back().second > lastGroupSize) // FIXME: debugging only
      |             ^
components/esm4/reader.cpp:687:30: note: Calling 'printLabel'
  687 |                 std::cerr << printLabel(mCtx.groupStack.back().first.label, mCtx.groupStack.back().first.type)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/esm4/reader.cpp:925:15: note: Access of 'sGroupType' at index 12, while it holds only 12 'class std::basic_string_view<char>' elements
  925 |         ss << sGroupType[std::min<std::size_t>(type, std::size(sGroupType))]; // avoid out of range
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-11-25 00:03:39 +01:00
jvoisin
472240526d Merge branch 'fix_niftest_afl_findings' into 'master'
Fix AFL findings in niftest

See merge request OpenMW/openmw!4988
2025-11-24 21:41:46 +00:00
Alexei Kotov
93c4424f91 Merge branch 'werewolf-lua-api' into 'master'
Add Lua API for werewolf state management

See merge request OpenMW/openmw!4940
2025-11-24 23:48:23 +03:00
Alexei Kotov
1918c81e4d Bump Lua API revision 2025-11-24 23:46:48 +03:00
Nova
87dc3cd0e8 Enforced local scripts can only modify self.
Updated documentation to use self and player in examples.
2025-11-24 23:45:53 +03:00
Nova
5a76783616 Added documentation. 2025-11-24 23:45:53 +03:00
Nova
dcbda0cbaa Forgot the luamanagerimp.hpp include. 2025-11-24 23:45:53 +03:00
Nova
96ab0752db Add Lua API for werewolf state management
Adds a new function to force the player or NPCS to turn into a werewolf.
- setWerewolf(bool): Transform a PC or NPC into/out of werewolf form

This enables modders to control werewolf transformations

Useage Example:

-- Turn player into werewolf
types.NPC.setWerewolf(self, true)
2025-11-24 23:45:52 +03:00
Alexei Kotov
0d4bff8ad6 Merge branch 'data-mw' into 'master'
Move Morrowind mechanics to data-mw

See merge request OpenMW/openmw!4937
2025-11-24 21:24:10 +03:00
Alexei Kotov
f0b7fec7bb Bump Lua API revision 2025-11-24 21:22:40 +03:00
Evil Eye
b4018b1962 Absorb changes from !4996 2025-11-24 17:59:50 +01:00
Evil Eye
dcde01dee9 Note that getArmorSkill can return nil 2025-11-24 17:45:07 +01:00
Evil Eye
f8ef80c522 Rename builtin template 2025-11-24 17:45:07 +01:00
Evil Eye
a501e1ad1c Workaround a cmake/ninja issue 2025-11-24 17:45:07 +01:00
Evil Eye
e66d43c083 Reduce the diff 2025-11-24 17:45:07 +01:00
Evil Eye
10c96ff68d Use configure_file substitution 2025-11-24 17:45:07 +01:00
Evil Eye
c6c515f770 Make ATTACK_SOURCE_TYPES read only 2025-11-24 17:45:07 +01:00
Evil Eye
189eff7a49 Use cmake to create vfs-mw/builtin.omwscripts 2025-11-24 17:45:07 +01:00
Evil Eye
e978c230dc Override functions by shallow copying the interface instead of overriding files 2025-11-24 17:45:07 +01:00
Evil Eye
7928930435 Move Morrowind mechanics to data-mw 2025-11-24 17:45:05 +01:00
Evil Eye
2a63ec6af6 Merge branch 'lua-docs-grammar-fixes' into 'master'
Lua docs: minor grammar fixes (mostly missing articles)

See merge request OpenMW/openmw!4996
2025-11-24 16:40:28 +00:00
Johannes Dickenson
dfc1345a63 Lua docs: minor grammar fixes (mostly missing articles) 2025-11-24 16:40:27 +00:00
Alexei Kotov
422e1135e9 Merge branch 'master' into 'master'
Update file events.rst

See merge request OpenMW/openmw!5014
2025-11-24 13:27:16 +03:00
Evil Eye
f8374f2ff0 Merge branch 'fix-8705' into 'master'
Feature #8705: Use texture-based LUT for moddable global map colors

See merge request OpenMW/openmw!4932
2025-11-23 20:54:11 +00:00
Andrzej Głuszak
1bc95605ce Feature #8705: Use texture-based LUT for moddable global map colors 2025-11-23 20:54:11 +00:00
Alexei Kotov
c687a21ccb Merge branch 'enum_naming' into 'master'
Fix and enforce enum naming (#8424)

See merge request OpenMW/openmw!4986
2025-11-23 22:36:23 +03:00
Alexei Kotov
b571835695 Merge branch 'fix_nif_bhk_ragdoll_template' into 'master'
Use proper type for bhkRagdollTemplate::mBones

See merge request OpenMW/openmw!5013
2025-11-23 22:17:12 +03:00
ComeBESNIER
ec81e3b4a6 Edit events.rst
Add a space between `amount` and `=` for stylistical reasons.
2025-11-23 13:42:05 +00:00
elsid
7e1c1e8625
Use proper type for bhkRagdollTemplate::mBones 2025-11-23 13:21:41 +01:00
elsid
246759ecd2
Only reserve capacity when reading collections
But do not initialize. If the meta information is invalid and has a big
value, initialization will take significant amount of time but there
might be no actual data in the file because it's too small.
2025-11-23 13:17:00 +01:00
elsid
434f450778
Check Nif::RecordPtrT in debug builds
To verify class invariant.
2025-11-23 13:17:00 +01:00
elsid
0c2164330b
Use at instead of operator[] to access nif record types
To fix crash on out of bounds access.
2025-11-23 13:17:00 +01:00
elsid
20c388a410
Replace asserts by exceptions in RecordPtrT
It's possible to fail when reading nif file.
2025-11-23 13:17:00 +01:00
elsid
aa4caae2bf
Use proper naming for Nif::RecordPtrT index 2025-11-23 13:16:59 +01:00
elsid
e882c1c722
Check if nif stream has requested amount of data
Memory allocation with initialization may take significat amount of time
if meta information does not match actual content.
2025-11-23 13:16:59 +01:00
elsid
1ae0aadfed
Use fail function to verify nif stream state
If there is a failure to read the file like incomplete read, bad returns
false, but fail returns true. This is important for reading number of
items more than the file actually has.
2025-11-23 13:16:59 +01:00
Alexei Kotov
b49b048f72 Merge branch 'warn-baby-warn-warning-inferno' into 'master'
Warning inferno - fix warnings, then fix warnings

Closes #8674

See merge request OpenMW/openmw!4927
2025-11-23 15:01:53 +03:00
Alexei Kotov
46e0369fee Merge branch 'fix_benchmark_distribution' into 'master'
Use uniform_real_distribution for agent half extents

See merge request OpenMW/openmw!5005
2025-11-23 15:00:08 +03:00
Alexei Kotov
3abc719aa6 Merge branch 'fix_msvc_warnings' into 'master'
Fix C4244 in navmeshtilescache benchmark

See merge request OpenMW/openmw!5011
2025-11-23 14:48:19 +03:00
ComeBESNIER
ac7cc4c9ea Update file events.rst 2025-11-23 09:16:55 +00:00
elsid
d4ce5a2ac6
Fix and enforce enum naming 2025-11-22 11:19:18 +01:00
elsid
cde34d8041 Fix C4244 in navmeshtilescache benchmark
apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(192): note: see reference to function template instantiation 'void `anonymous-namespace'::getFromFilledCache<1048576,100>(benchmark::State &)' being compiled
apps\benchmarks\detournavigator\navmeshtilescache.cpp(179): note: see reference to function template instantiation 'void `anonymous-namespace'::generateKeys<std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,std::linear_congruential_engine<unsigned int,48271,0,2147483647>>(_T0,size_t,_T1 &)' being compiled
        with
        [
            _T0=std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(153): note: see reference to function template instantiation '`anonymous-namespace'::Key `anonymous-namespace'::generateKey<_T1>(size_t,_T0 &)' being compiled
        with
        [
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>,
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(141): note: see reference to function template instantiation 'DetourNavigator::Mesh `anonymous-namespace'::generateMesh<_T0>(size_t,_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(99): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(144): note: see reference to function template instantiation 'DetourNavigator::Heightfield `anonymous-namespace'::generateHeightfield<_T0>(_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
2025-11-21 15:37:40 +00:00
elsid
c844e93f82 Use uniform_real_distribution for agent half extents
They have float type.
2025-11-21 15:37:01 +00:00
elsid
0a2234ad3e
Fix C4244 in navmeshtilescache benchmark
apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(192): note: see reference to function template instantiation 'void `anonymous-namespace'::getFromFilledCache<1048576,100>(benchmark::State &)' being compiled
apps\benchmarks\detournavigator\navmeshtilescache.cpp(179): note: see reference to function template instantiation 'void `anonymous-namespace'::generateKeys<std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,std::linear_congruential_engine<unsigned int,48271,0,2147483647>>(_T0,size_t,_T1 &)' being compiled
        with
        [
            _T0=std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(153): note: see reference to function template instantiation '`anonymous-namespace'::Key `anonymous-namespace'::generateKey<_T1>(size_t,_T0 &)' being compiled
        with
        [
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>,
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(141): note: see reference to function template instantiation 'DetourNavigator::Mesh `anonymous-namespace'::generateMesh<_T0>(size_t,_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(99): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(144): note: see reference to function template instantiation 'DetourNavigator::Heightfield `anonymous-namespace'::generateHeightfield<_T0>(_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
2025-11-21 13:57:51 +01:00
elsid
d7db0d3d46
Use uniform_real_distribution for agent half extents
They have float type.
2025-11-19 20:17:22 +01:00
Evil Eye
c06f94fee8 Merge branch 'fix_esmtool_afl_findings' into 'master'
Check index for ESM4 race parts

See merge request OpenMW/openmw!4987
2025-11-16 13:18:27 +00:00
Alexei Kotov
dcedbfdb26 Merge branch 'feat/potion-autocalc' into 'master'
FEAT: Add & document autocalc flag on potions

See merge request OpenMW/openmw!5000
2025-11-16 12:56:41 +03:00
Dave Corley
f773da37ee FEAT: Add & document autocalc flag on potions (#8796) 2025-11-16 12:56:41 +03:00
Evil Eye
2386c9d1dc Move 0 check to the top 2025-11-15 11:03:56 +01:00