1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 12:29:56 +00:00
Commit graph

263 commits

Author SHA1 Message Date
Evil Eye
16c0f0d5cc Use a regular TypedDynamicStore for ESM:Skill 2023-06-08 18:35:47 +02:00
Evil Eye
e01a3076dd Use std::array in NpcStats 2023-06-03 14:26:37 +02:00
Evil Eye
a5bb6c7d8d Use std::array in NPDTstruct52 2023-06-03 13:27:45 +02:00
Evil Eye
dd83da5eba Use std::array in FADTstruct 2023-06-03 13:11:49 +02:00
Evil Eye
7be005c9a5 Use std::array in CLDTstruct 2023-06-03 11:58:09 +02:00
Evil Eye
8a474b9807 Use std::array in RADTstruct 2023-06-03 10:45:32 +02:00
Evil Eye
08f35fe839 Add ESM::Skill::mWerewolfValue 2023-05-31 17:45:20 +02:00
Evil Eye
eea730768b Replace sIconNames with ESM::Skill::mIcon 2023-05-30 20:22:04 +02:00
Evil Eye
9c60a6fa4d Replace sSkillNameIds with ESM::Skill::mName 2023-05-29 17:56:14 +02:00
florent.teppe
ad8cfde4e0 ESM::LandData no longer a virtual interface
instead it is constructed from ESM::Land or ESM4::Land
2023-05-29 12:10:42 +02:00
florent.teppe
f600730459 fixes functions that were virtual but not tagged as override. 2023-05-29 12:10:41 +02:00
florent.teppe
e0fa15b727 Abstracted Land data that can be used by esm3 and esm4. 2023-05-29 11:31:37 +02:00
psi29a
16a580eb21 Merge branch 'clickbait' into 'master'
Remove sAttributeIds and sSkillIds

See merge request OpenMW/openmw!3071
2023-05-28 09:14:47 +00:00
unknown
14600de185 Remove sAttributeIds and sSkillIds 2023-05-27 21:54:13 +02:00
jvoisin
c98c532213 Replace all asserts in components/esm[34] with throw 2023-05-27 16:10:53 +02:00
Evil Eye
877f6747be Deduplicate specialization code 2023-05-26 12:16:47 +02:00
elsid
dc8dfe81ce
Add more details to exceptions 2023-05-25 20:56:07 +02:00
Mads Buvik Sandvei
410e8b100a Elsid comments 2023-05-23 19:30:29 +02:00
Mads Buvik Sandvei
5a8c6df633 clang'd 2023-05-23 18:12:06 +02:00
Mads Buvik Sandvei
4bf23f152b Revert use of string_view to std::string for effectIdTo* methods. 2023-05-23 18:12:06 +02:00
Mads Buvik Sandvei
6cfc06d7d8 There is no typo 2023-05-23 18:12:06 +02:00
Mads Buvik Sandvei
9a59330561 refactor effect names in loadmgef. Added a map from effect index to non-gmst effect name for use in lua scripts. 2023-05-23 18:11:59 +02:00
Mads Buvik Sandvei
b791ce9132 Remove redundant qualifiers 2023-05-23 18:11:44 +02:00
Mads Buvik Sandvei
7ba43c9426 actor.ActiveEffects and actor.ActiveSpells 2023-05-23 18:11:44 +02:00
elsid
8f47da46ec
Show magic effect name instead of IndexRefId 2023-05-22 18:02:21 +02:00
florent.teppe
56cb2a83ec removed sDefaultWorldspace, only sDefaultWorldspaceId now.
sDefaultWorldspaceId is a StringRefId to be able to getvalue easily.
2023-05-12 22:05:53 +02:00
florent.teppe
a62e75fd19 Initial attempt at loading esm4 exteriors 2023-05-12 22:05:52 +02:00
elsid
0601d7213e
Remove ESM::RefId::sEmpty
This variable is only required to return empty RefId as const reference. There
is no point in doing so for a type cheap to copy.
2023-04-26 21:15:16 +02:00
elsid
b33d12b8e1
Add missing and remove redundant includes 2023-04-17 22:02:36 +02:00
Petr Mikheev
f09a689a4f Merge ESM::RefNum and ESM4::FormId 2023-04-09 00:23:32 +02:00
Evil Eye
8d8207b734 Refactor pathgrid indices to use size_t instead of int 2023-04-08 00:32:43 +00:00
florent.teppe
21bd28542a Applies review advice
2d coord hash moved to hash.hpp file
format version adds suffix to be more coherent
don't use ESM::RefId::sEmpty
RefId equality with string_view, conversion to refId unecessary
action teleport remove test that mCellId is empty
removes some const references, when copy is enough
invalid refid => empty refid
removes useless change
2023-04-03 14:17:35 +02:00
florent.teppe
d782d37ee2 Make sure Vec2iRefId is trivially copyable on GCC 11.3
std::pair<int, int> isn't trivially copyable on some compilers
so a specific struct is defined, it's an int pair, but it should be recognised by GCC 11.3 as trivially copyable

Vec2iRefId => ESM3ExteriorCellRefId

more explcit name and use mX,mY instead of pair
renamed files and enum
2023-04-03 14:17:31 +02:00
florent.teppe
53b14c8b42 fix tests
hopefully also fixes clang tidy
2023-04-03 14:17:17 +02:00
florent.teppe
4c15064a83 Create new Vec2i RefId for ESM3 exterior cells.
Applies the necessary changes to use !2708 for the new Id type
2023-04-03 14:17:16 +02:00
florent.teppe
1e0c3bfdec fixes integration tests
we still want to be able to write using old formats
2023-04-03 14:16:32 +02:00
florent.teppe
f99e65843a Removes most cellId.hpp include, simplifies id generation for cells. 2023-04-03 14:16:32 +02:00
florent.teppe
c2182c2fcc Get Rid of ESM::CellId almost everywhere
it was a competing concept from using RefIds for cell.
There is almost no point to it now, except to load older data.
2023-04-03 14:16:05 +02:00
florent.teppe
fb6701ac1a ESM::CellId is no longer stored on saves. 2023-04-03 14:16:05 +02:00
florent.teppe
c39dd576f8 Gets rid of most ESM::CellId 2023-04-03 14:16:05 +02:00
florent.teppe
9f597ecfea No more Cellid used by ESM4 cells
and that also means it is no longer used by MWWorld::Cell
fixes tests
2023-04-03 14:16:04 +02:00
florent.teppe
3f678c3b0a Dest Door and teleport use ESM::RefId
This changes a lot of files as a consequence.
Still buggy, moving to exterior doesn't bring to the right place yet
coc "seyda neen" doesn't work. SO I broke somehting when fetching a cell from a name
2023-04-03 14:16:03 +02:00
florent.teppe
36502eaf75 ESM3 Cells have an Id.
Store<ESM::Cell> is updated to use it.
2023-04-03 14:16:03 +02:00
Andrei Kortunov
8c6616214b Remove redundant quotes 2023-04-03 11:28:03 +04:00
elsid
9162eaa019
Test more ESM::Player records 2023-04-02 19:58:27 +02:00
elsid
452d1e7e49
Store original string id for Dialogue records 2023-03-26 19:07:32 +02:00
elsid
06f42ba69c
Use fixed size enum type for ESM::Dialogue::mType 2023-03-26 19:07:25 +02:00
elsid
4716583f3e
Set ESM::Dialogue::mType on blank and skip load 2023-03-26 19:07:25 +02:00
elsid
90ed24f4c9
Split type traits for ESM4, ESM3 and unite common 2023-03-26 19:07:23 +02:00
elsid
d5954aba68
Add suffix to the format version name 2023-03-26 15:21:25 +02:00
Evil Eye
54d6fb29c2 Don't store a save's cell name as a RefID 2023-03-22 22:57:52 +01:00
elsid
d1e8e56619
Make QuickKey type a fixed size enum class 2023-03-21 20:53:04 +01:00
elsid
eb79b29512
Use ranged for loop 2023-03-21 20:45:49 +01:00
elsid
2135eba103
Fix loading ESM3 QuickKeys 2023-03-21 20:44:42 +01:00
elsid
04d7781424
Support not only StringRefId for checking first person body part 2023-03-19 17:49:41 +01:00
elsid
e6cf516e12
Support index RefId as pair of record type and std::uint32_t 2023-03-19 17:20:48 +01:00
elsid
86293af084
Support generated RefId as std::uint64_t 2023-03-19 17:20:48 +01:00
elsid
0992624c8b
Support reading and writing typed ESM::RefId to ESM 2023-03-19 17:20:48 +01:00
psi29a
a60f657f5a Merge branch 'fast_cell4_load' into 'master'
Lazy loading of ESM4::reference

See merge request OpenMW/openmw!2804
2023-03-17 21:46:37 +00:00
psi29a
2ff4a5a11a Merge branch 'cs_fix_info_collection' into 'master'
Fix loading, inserting and moving topic info records

See merge request OpenMW/openmw!2806
2023-03-17 14:40:05 +00:00
Petr Mikheev
0b385d5db9 Create MWWorld::SafePtr 2023-03-13 23:44:00 +01:00
elsid
e032214fcb
Use common info ordering implementation for engine and editor 2023-03-13 21:57:41 +01:00
elsid
e892c62b10
Fix loading, inserting and moving topic info records
Topic info records need to have specific order defined via mNext and mPrev
fields (next and previous records). When loading multiple files a record may be
inserted into middle of the topic but neighborhood records may not be aware of
it. Having the order it's possible to move the records within one topic.

Sort the record once after loading all content files but preserve the order for
all other operations. Use std::map to group info ids by topic to make sure the
topics order is stable. Keep order within a topic for info ids on loading new
records. Use this order later for sorting the records.
2023-03-13 21:57:38 +01:00
florent.teppe
170b732854 readers cache keep a stateless encoder
to keep access to the current encoding configuration

build linux
2023-03-10 12:39:47 +01:00
psi29a
0ed1310417 Merge branch 'fix_fog_state_load' into 'master'
Fix loading fog state

See merge request OpenMW/openmw!2743
2023-02-18 07:27:05 +00:00
elsid
b5ec584be2
Replace ESM::RefId::sEmpty by default constructed RefId where possible
Static const is only required to provide a reference or a pointer when it is not
possible with default constructed temporary.
2023-02-18 01:07:15 +01:00
elsid
959de6f4c1
Avoid UB on empty fog data record 2023-02-17 23:42:49 +01:00
elsid
996153f78d
Convert RefId to class 2023-02-15 23:20:44 +01:00
elsid
6d261d38dd
Add functions to read and write ESM::RefId and use them
To be later changed with another implementation.
2023-02-13 22:07:58 +01:00
elsid
80e6d6cbe3
Support variable size strings in ESM3 2023-02-13 10:18:32 +01:00
elsid
beb017e699
Do not truncate too long strings on writing ESM 2023-02-13 10:18:32 +01:00
elsid
c0c723bb1b
Add const to read only function 2023-02-13 10:18:32 +01:00
elsid
2e64155c0f
Use signed type for left record and files size in ESM3 reader context
Otherwise reading some of the records like ESM::CellRef without a subrecord
after could lead to underflow of ESM_Context::leftRec which makes
ESM::ESMReader::hasMoreSubs to return true and load hangs for a while trying to
read the same subrecord many times.

Fix ESM::Variant tests since it's now required to have a record for any ESM
data. Add 16 (size of record header) to all expected data sizes.
2023-02-11 16:09:14 +01:00
elsid
a5ec108cfb
Add missing space 2023-02-11 15:14:02 +01:00
elsid
4f683d1ee9
Throw exception on failed write 2023-02-11 15:14:02 +01:00
elsid
080700f8fe
Name all custom ESM format versions and add tests 2023-02-10 19:54:15 +01:00
elsid
c79c14da91
Fix -Wnon-virtual-dtor warnings 2023-02-03 23:00:09 +01:00
florent.teppe
3780033837 Reverts Cell name to a string 2023-01-21 18:39:42 +01:00
elsid
c173348cbe
Use default initializers for ESM::RefNum members
Instead of unset function that is removed now and assignments all over the code.
2023-01-10 00:44:51 +01:00
elsid
755067f0f3
Remove redundant ESM::RefId member functions 2022-12-30 00:32:47 +01:00
Petr Mikheev
b8fb013edf Merge MWLua::ObjectRegistry and MWWorld::WorldModel 2022-12-28 12:45:11 +01:00
florent.teppe
afed7e60ef Upgraded Filesave version for RefIDs
Fix logic issue
2022-12-27 23:05:31 +01:00
florent.teppe
1ef1de974d script blacklist => RefId
Applies changes from review

Fixed clang format

Clang format + review.
2022-12-27 19:16:21 +01:00
florent.teppe
2c30575b3b CellName is now a RefId, makes more sense that way. 2022-12-27 19:16:21 +01:00
florent.teppe
6ff90b34a8 Fixed an issue with RefId in CellRefs where Ids wouldn't be loaded
Fixed multiple issues from the review.
2022-12-27 19:15:58 +01:00
florent.teppe
65cdd489fb create a specific esm reader function for RefID to avoid allocation for string and then again for RefId
Fixed some types

removed useless header

applied clang format

fixed compile tests

fixed clang tidy, and closer to logic before this MR

Removed hardcoded refids

unless there is a returned value we don't use static RefIds
can use == between RefId and hardcoded string

Fix clang format

Fixed a few instances where std::string was used, when only const std::string& was needed

removed unused variable
2022-12-27 19:15:57 +01:00
fteppe
20da0892ef openMW_test_suite compiles and runs
Slowly moving through the open-cs errors

Good progress in openCS

Very good progress on openCS

Getting closer with openCS

OpenCS compiles and runs! Didn't have time to test it all though

ix openMW

everything compiles on windows??

Fix gcc

Fix Clang
2022-12-27 19:15:55 +01:00
fteppe
c8bb733360 removed clear() function, the only way to change the Id from the outside is from the assignment operator
replaced ciEqual with == operator
2022-12-27 19:15:55 +01:00
fteppe
125b21de20 Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID

Slowly going through all the changes to make, still hundreds of errors

a lot of functions/structures use std::string or stringview to designate an ID. So it takes time

Continues slowly replacing ids. There are technically more and more compilation errors

I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type

Continue moving forward, changes to the stores

slowly moving along

Starting to see the fruit of those changes.

still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.

More replacements. Things are starting to get easier

I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.

Still moving forward, and for the first time error count is going down!

Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably

Cells are back to using string for the name, haven't fixed everything yet. Many other changes

Under the bar of 400 compilation errors.

more good progress <100 compile errors!

More progress

Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string

some more progress on other fronts

Mostly game settings clean

one error opened a lot of other errors. Down to 18, but more will prbably appear

only link errors left??

Fixed link errors

OpenMW compiles, and launches, with some issues, but still!
2022-12-27 19:15:54 +01:00
Evil Eye
bbbcc5e4b7 Add an early out to dialogue loading to match Morrowind.exe behaviour 2022-11-27 22:23:35 +01:00
psi29a
c164437d91 Merge branch 'classism' into 'master'
Use class service flags for autocalc NPCs

Closes #7044

See merge request OpenMW/openmw!2461
2022-10-10 07:32:46 +00:00
elsid
843753da14
Remove unused includes 2022-10-09 16:44:18 +02:00
Evil Eye
60c26832d2 Use class service flags for autocalc NPCs 2022-10-08 17:00:33 +02:00
elsid
063fff7fa4
Fix and prevent -Wextra-semi warning 2022-10-06 00:26:43 +02:00
Evil Eye
e6592aa850 Add key flag on load 2022-09-30 12:16:45 +02:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
AnyOldName3
84f8a6848a Renormalise line endings
This should replace accidental CRLF with LF
2022-09-16 00:53:24 +01:00
elsid
51314db2f1
Remove AI_CNDT from AI package types
AI_CNDT is a label of subrecord containing cell name. It's not AI package type.
2022-09-13 00:05:12 +02:00
elsid
52b7b66e9f
Add comma to the last array element to prevent putting multiple elements on a single line 2022-09-12 21:00:51 +02:00
Project579
a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2022-09-11 14:41:20 +02:00
Project579
e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2022-09-11 14:41:15 +02:00
AnyOldName3
4e8e2e1c60 Eliminate &thing[0] pattern 2022-09-03 16:41:35 +01:00
Alexei Kotov
a8e561d885 Avoid issues with saved games that have no screenshot data 2022-09-02 07:04:02 +03:00
elsid
cc8c7002ea
Cleanup components includes 2022-08-16 19:14:04 +02:00
psi29a
b382e92953 Merge branch 'please_dont_copy_my_nfts' into 'master'
Prevent various values from being copied

See merge request OpenMW/openmw!2267
2022-08-16 08:36:34 +00:00
Andrei Kortunov
e3ad30a517 Do not copy data when it is not needed 2022-08-15 11:52:09 +04:00
Evil Eye
eaa108d25d Return string_view from SoundId methods 2022-08-14 14:39:58 +02:00
elsid
f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2022-08-03 22:06:24 +02:00
Evil Eye
3967509cdd Use meaningful names instead of pretending we don't know what snow is 2022-07-17 19:54:59 +02:00
jvoisin
498a835b77 Merge branch 'coverity' into 'master'
Fix some Coverity issues

See merge request OpenMW/openmw!2082
2022-07-03 16:29:05 +00:00
Andrei Kortunov
fe785ea788 Don't cast away const when we can avoid it 2022-07-03 16:36:41 +04:00
Andrei Kortunov
aa349f2ed9 Initialize some missing variables 2022-07-03 15:44:50 +04:00
psi29a
9c1970dce4 Merge branch 'lua_esm' into 'master'
Advanced Lua scripts configuration in omwaddon

See merge request OpenMW/openmw!1947
2022-06-11 18:48:23 +00:00
Evil Eye
10e4eb8e8e Append orphaned dialogue instead of always appending it 2022-06-06 10:12:36 +02:00
Petr Mikheev
a70d5831c5 Lua scripts configuration in omwaddon 2022-06-05 01:36:39 +02:00
psi29a
58fd560ce9 Merge branch 'esm_readers_cache' into 'master'
Limit the number of simultaneously open not actively used content files (#6756)

Closes #6756

See merge request OpenMW/openmw!1966
2022-06-04 19:11:27 +00:00
jvoisin
df0cd86cf4 Use the proper types 2022-06-04 16:34:23 +02:00
jvoisin
6c71071083 Make the sRedcordId constexpr 2022-06-04 16:07:59 +02:00
elsid
3affe9913f
Limit the number of simultaneously open not actively used content files
Use LRU cache for ESMReaders. When cache capacity is reached close least
recently used ESMReader. Remember the file name if a reader was open. Once the
reader requested again open the file if there is stored name for it. Put
released ESMReader to the back of the free items list. Close ESMReader's from
the front of the free items list.

Cached item can be used only by one client at the same time. If the same item is
requested twice exception is thrown. This should never happen in practice. If
this happens need to fix the client logic.

It's allowed to go over the capacity limit when requesting different readers.
Ideally this should never happen but there will be system error anyway
signalizing about too many open files. Need to fix client logic in this case.

All places that were using a vector of ESMReaders now using the cache. Cache is
local for each use case and there is no need for a thread safety.
2022-06-03 01:29:03 +02:00
Evil Eye
bb495bffeb 0 initialize mRecordFlags 2022-05-29 22:12:30 +02:00
jvoisin
6feb92a9bf Remove boost::filesystem from a couple of files 2022-05-24 21:18:21 +00:00
psi29a
f17d7fc00b Merge branch 'string_view' into 'master'
Make getStringLiteral return a string_view

See merge request OpenMW/openmw!1896
2022-05-22 20:50:04 +00:00
jvoisin
fb732d74a2 Remove boost::filesystem from bsatool 2022-05-22 18:53:10 +02:00
Evil Eye
ac78b537d2 Address feedback 2022-05-22 09:29:03 +02:00
jvoisin
23eccebe9e Convert esmtool from const std::string& to std::string_view 2022-05-21 21:39:26 +02:00
Evil Eye
134dc2b21b Address feedback on !1857 2022-05-16 17:37:55 +02:00
Evil Eye
c0cc5feecd Initialize DialInfo::DATAstruct with the proper blank values 2022-05-15 14:52:44 +02:00
jvoisin
331363d469 Merge branch 'fix_uninit' into 'master'
Fix uninitialized coverity warnings

See merge request OpenMW/openmw!1819
2022-05-05 17:35:16 +00:00
Evil Eye
a64979e25d Replace empty std::string assignments 2022-05-04 22:33:39 +02:00
elsid
b67a0a8f2b
Fix uninitialized coverity warnings 2022-05-01 18:36:16 +02:00
elsid
92538dde89
End SNAM record as SNAM record 2022-05-01 15:45:22 +02:00
Evil Eye
9a96d64611 Use subrecord size instead of version to load WEAT 2022-04-30 10:11:49 +02:00
elsid
b09570692e
Use ifstream for ESMReader
ESMReader reads the whole file, there is no need in the ConstrainedFileStream.
2022-04-15 02:58:57 +02:00
elsid
4447ab0ed7
Remove ESM:: namespace qualifier in components/esm3/ and tests 2022-04-12 02:04:24 +02:00
psi29a
03806eb75e Merge branch 'esm_rm_redundant_include' into 'master'
Remove redundant include from esm3/esmreader.hpp

See merge request OpenMW/openmw!1761
2022-04-11 07:47:48 +00:00
psi29a
cf1764f255 Merge branch 'constrained_file_stream' into 'master'
Avoid redundant conversion to const char* and use make_shared

See merge request OpenMW/openmw!1763
2022-04-11 07:26:53 +00:00
elsid
6481324eb1
Read when need to skip few bytes 2022-04-11 01:55:05 +02:00
elsid
5eb8c4aebe
Avoid redundant conversion to const char* and use make_shared 2022-04-10 22:33:08 +02:00
elsid
db44f91fd5
Remove redundant include from esm3/esmreader.hpp 2022-04-10 22:16:32 +02:00
elsid
c3a924de23
Fix skip DATA in cell ref loading 2022-04-10 19:16:30 +02:00
elsid
6b464a9330
Check ESMReader value size in compile time 2022-04-10 19:16:11 +02:00
elsid
bbfdb347bd
Skip load cell ref when there is no need
Primarily to avoid temporary allocations by ESMReader::getHString.
2022-04-08 19:16:38 +02:00
psi29a
6d55317d57 Merge branch 'refactor/prng-2' into 'master'
Save random state and refactor usage of generators

See merge request OpenMW/openmw!1715
2022-03-23 09:50:54 +00:00
ζeh Matt
b502dc12f0
Add prng to World instance and serialize state in Save 2022-03-21 17:49:42 +02:00
Evil Eye
484a7c7b7e Base dialogue order solely on mPrev 2022-03-16 18:09:21 +01:00
duncanspumpkin
3a117cac22 Switch to a constexpr for FourCC constant
Add static asssert on wrong size
2022-03-08 14:48:37 +00:00
Matt
54e114d83e Avoid string copies for ESM::Variant::getString 2022-03-06 17:38:58 +00:00
elsid
3c66a927d8
Fix coverity issue about uninitialized members of LevelledListBase
* Remove explicit constructor.
* Use static constexpr where possible.
* Use CRTP to get RecName.
2022-02-23 20:39:05 +01:00
elsid
595c2e0a8e
Use unique_ptr to manage AiPackage lifetime 2022-02-23 00:39:30 +01:00
psi29a
776b286286 Merge branch 'esm_name' into 'master'
Use ESM::NAME instead of const char* and std::string as argument type

See merge request OpenMW/openmw!1659
2022-02-15 08:11:12 +00:00