1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:59:57 +00:00
Commit graph

281 commits

Author SHA1 Message Date
AnyOldName3
581b333386 Add missing include 2022-09-24 22:11:46 +00:00
Project579
6fe89ff22b Fix dumb regression, initialize "std::filesystem::file_time_type" with "clock::now()". 2022-09-24 21:52:10 +02:00
Project579
5cf2a958eb Make conversions between std::chrono time_point and string safer by not using "localtime" directly. 2022-09-24 21:47:27 +02:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
elsid
409f83a149
Use raw string literal for error marker definition 2022-09-12 21:00:45 +02:00
psi29a
29f3de30c2 Merge branch 'master' into 'cellstore_refactor'
# Conflicts:
#   apps/openmw/mwworld/scene.cpp
2022-09-11 15:03:37 +00:00
Project579
5456ef1d50 Add new functions and overloads to support std::u8string and std::filesystem::path. 2022-09-11 14:41:20 +02:00
florent.teppe
10899ed680 typo 2022-09-11 13:18:56 +02:00
Project579
35fe214588 Updated components/misc/timeconvert.hpp to fix the Android build. 2022-09-11 02:20:01 +02:00
Project579
4bb07282c9 Replace all remaining occurrences of boost::filesystem with std::filesystem. 2022-09-11 02:19:00 +02:00
florent.teppe
cdc7864863 missing file 2022-09-10 20:25:18 +02:00
florent.teppe
256d8a699a moves one function from tuplemeta.hpp to newly created tuplehelpers.hpp 2022-09-10 20:13:18 +02:00
florent.teppe
65bd007baa simplified some big switch/case 2022-09-09 23:40:56 +02:00
ζeh Matt
aa65df8872
Rename meta.hpp to tuplemeta.hpp 2022-09-08 15:03:01 +03:00
ζeh Matt
c856095562
Use compile time generated indices for tuples types 2022-09-08 03:38:07 +03:00
ζeh Matt
8f7703d5c8
Rename HasMember to TupleHasType and move code into misc/meta.hpp 2022-09-08 00:13:50 +03:00
jvoisin
9f62f0c292 Reserve the output buffer in lowerCaseUtf8
Since lowercasing an utf8 string shouldn't change its size very much,
it does make sense to reserve the output buffer, to reduce
memory allocations.
2022-09-05 19:46:39 +02:00
Cédric Mocquillon
83ee25711e Use the pattern according to the esm version 2022-09-03 18:55:06 +02:00
Cédric Mocquillon
6a3d27ce82 Add a dictionary to retrieve the LOD mesh name of a mesh cache 2022-09-03 18:52:27 +02:00
Evil Eye
02bbb0be45 Improve format workaround and add unit tests 2022-08-26 19:43:57 +00:00
Evil Eye
4e2e5ad002 Revert format change and ensure string_view args are null-terminated 2022-08-24 23:10:05 +02:00
Evil Eye
1d21330fcc Return string_view from getGameSettingString 2022-08-24 22:16:03 +02:00
psi29a
1f5277349c Merge branch 'span' into 'master'
Replace Misc::Span by std::span

See merge request OpenMW/openmw!2324
2022-08-22 17:34:51 +00:00
psi29a
9c24d6b390 Merge branch 'ci_starts_with' into 'master'
Replace ciCompareLen with ciStartsWith where possible

See merge request OpenMW/openmw!2325
2022-08-22 17:34:03 +00:00
Evil Eye
150d1840d6 Use more string_view and const string& 2022-08-22 16:55:53 +02:00
elsid
5dc612aa54
Replace ciCompareLen with ciStartsWith where possible
`ciCompareLen(a, b, b.size()) == 0` expression is an equivalent of checking for
equality of `a` prefix with size `b.size()` with `b`.

`ciCompareLen(a, b, a.size()) == 0` is also the same thing but `a` is a prefix
`b` should start with.
2022-08-22 09:32:22 +02:00
elsid
e4a254deb7
Replace Misc::Span by std::span 2022-08-21 23:53:27 +02:00
psi29a
bf40f9b287 Merge branch 'name_view' into 'master'
Make Class::getName return string_view

See merge request OpenMW/openmw!2289
2022-08-17 20:14:27 +00:00
Evil Eye
4ff12d8945 Make Class::getName return string_view 2022-08-16 21:15:03 +02:00
elsid
cc8c7002ea
Cleanup components includes 2022-08-16 19:14:04 +02:00
Matt
e6868fd211 Allow constexpr hashing 2022-08-14 19:06:29 +00:00
Evil Eye
de8d9b8db3 Use Fowler-Noll-Vo hash instead of std::hash 2022-08-14 19:55:32 +02:00
Evil Eye
de51525c76 Allow string_view lookups in MWWorld::Store and get some use out of that 2022-08-09 20:43:14 +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
Andrei Kortunov
de58c9dff3 Get rid of obsolete osg::Geode where it is possible 2022-07-20 15:28:56 +04:00
Andrei Kortunov
6f6b5ba04b Some refactoring 2022-07-17 22:01:48 +04:00
elsid
22ed6d5c1e
Use unsigned to define number of threads 2022-07-12 15:19:52 +02:00
Andrei Kortunov
fe785ea788 Don't cast away const when we can avoid it 2022-07-03 16:36:41 +04:00
glassmancody.info
b09411d396 allow soft particles on meshes and add extra data extensions 2022-06-29 18:15:12 -07:00
elsid
6abb963bd9
Use string_view for StringUtils functions 2022-06-21 19:40:28 +02:00
uramer
1fb136a417 Correct icon and mesh paths in Lua records 2022-06-12 11:30:29 +02:00
psi29a
a737b05d84 Merge branch 'faster_toLower' into 'master'
Improve the speed of toLower

See merge request OpenMW/openmw!1889
2022-05-24 07:53:01 +00:00
jvoisin
998f1c960e Improve the speed of toLower
This significantly improves the speed of my fuzzer,
by something like 15%.
2022-05-23 21:24:17 +02:00
Evil Eye
e79f803402 Change includes 2022-05-21 10:48:32 +02:00
Evil Eye
c6ca0e78c9 Make getStringLiteral return a string_view 2022-05-21 01:21:55 +02:00
cody glassman
0cb63ca4e6 experimental point light bindings 2022-05-15 10:03:58 -07:00
elsid
79676aee15
Make Environment a storage of referencing pointers instead of owned
Engine controls lifetime of managers therefore it should own them. Environment
is only access provider.

This allows to avoid redundant virtual calls and also some functions from
managers base classes can be removed if they are used only by Engine.
2022-05-06 23:44:01 +02:00
elsid
0dcb1f5aac
Fix build on Windows
Use wrapper header over Windows.h to undefine far and near in a single place.
2022-04-25 00:25:46 +02:00
elsid
39da3bfef8
Ignore player when checking whether AiTravel destination is occupied by other actor 2022-04-11 19:30:54 +02:00
elsid
2d5ccc804b
Exchange binary messages between navmeshtool and launcher 2022-03-30 19:24:54 +02:00
ζeh Matt
d7de17a1ac
Add a comment explaining the pick of the prng 2022-03-22 17:09:36 +02:00
ζeh Matt
5df76f5051
Remove unnecessary debug output 2022-03-21 17:49:42 +02:00
ζeh Matt
f8f3bb2421
Use std::minstd_rand and split serialization from save/load 2022-03-21 17:49:42 +02:00
ζeh Matt
151770ccf1
Separate global vs world rng functions and use custom prng 2022-03-21 17:49:42 +02:00
ζeh Matt
08fae7be6e
Pass the prng from world where appropriate 2022-03-21 17:49:42 +02:00
ζeh Matt
d83a381f79
Refactor and rename some things around Misc::Rng 2022-03-06 17:28:28 +02:00
Bret Curtis
6601274992 constify weakcache overloaded operators 2022-03-01 10:53:01 +01:00
elsid
42d6032c8b
Support compilation with c++20 2022-02-24 00:49:40 +01:00
elsid
1b2954f2db
Remove unused z coordinate 2022-02-03 21:43:53 +01:00
elsid
b0f192d878
Fix warning: maybe-uninitialized
../../components/misc/color.cpp: In static member function 'static Misc::Color Misc::Color::fromHex(std::string_view)':
../../components/misc/color.cpp:36:24: error: 'v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   36 |             rgb[i] = v / 255.0f;
      |                      ~~^~~~~~~~
2022-01-30 00:44:22 +01:00
psi29a
7bab714825 Merge branch 'fix_circling_fargoth' into 'master'
Remove unnecessary loops from path (#6510)

Closes #6510

See merge request OpenMW/openmw!1584
2022-01-29 19:48:02 +00:00
elsid
7ec7c57879
Remove unnecessary loops from path
This prevents actors going back when a new shortest path includes a point
behind them where they were right before. Such situation can happen when path
includes off mesh connection. Resulting cost of such path can be lower than
the real one because off mesh connections are straight lines and walking
surface usually is not a plane but a surface.

Skip to path point where distance from current position to the line between
previous and this point is less than point tolerance. Which means actor is
standing very close to the edge between those points. Additionally check by
navmesh raycasting to make sure there is actually a valid path.
2022-01-24 22:32:04 +01:00
Bret Curtis
74e7cfc023 remove unused includes: part1
remove unused imports: part2

revert one tidy we will keep for c++20
2022-01-23 17:30:25 +01:00
Bret Curtis
d1fb854521 move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo

esm typo
2022-01-23 17:04:48 +01:00
elsid
a2002bc983
Support frequency of ProgressReporter calls lower than interval 2022-01-19 01:10:58 +01:00
uramer
d1d8f058ac Lua bindings for Colours 2022-01-17 22:35:06 +00:00
elsid
aaf6c82e33
Do not write shapes to navmeshdb when writing is disabled 2021-12-16 22:57:35 +01:00
elsid
5a6b39f8e0
Store mesh source data in recast mesh 2021-12-10 23:55:02 +01:00
psi29a
adc3bab51e Merge branch 'Embedded-error-marker' into 'master'
Embed marker error

See merge request OpenMW/openmw!1383
2021-11-20 18:07:13 +00:00
Cédric Mocquillon
40656b3135 Embed error marker in osgt format inside a string defined in misc/errorMarker.hpp.
Use the embed error marker we fail to load a mesh.
2021-11-20 11:12:08 +01:00
Evil Eye
6daefe3ddc Cast to the unsigned char expected by cctype functions 2021-11-14 11:26:18 +01:00
Evil Eye
f23bd51175 Don't check bounds when the type is unambiguously a char 2021-11-14 11:26:18 +01:00
Evil Eye
c6470f33d3 Use string_view 2021-11-14 11:26:16 +01:00
Evil Eye
751e8cf76b Do a bounds check before calling functions defined in cctype 2021-11-14 11:26:15 +01:00
Evil Eye
8f48a1f030 Handle non-ASCII characters while saving without triggering an assertion 2021-11-14 11:26:06 +01:00
elsid
08a25c2b1f
Support seed type different from std::size_t for hashCombine 2021-11-13 16:14:50 +01:00
psi29a
41bd20e358 Merge branch 'bullet_shape_hash' into 'master'
Store BulletShape source file name and content hash

See merge request OpenMW/openmw!1379
2021-11-13 13:33:22 +00:00
elsid
d7041613ef
Store BulletShape source file name and content hash 2021-11-11 00:27:18 +01:00
Cédric Mocquillon
512d64e514 Extract correctSoundPath method to avoid code duplication. Add unit test for the new method 2021-11-10 23:06:35 +01:00
elsid
3f80725ebe
Remove duplicated implementation of Misc::Convert::toOsg 2021-11-05 22:57:08 +01:00
Bo Svensson
1960e976e2
refactors stringops.hpp (#3192)
With this PR we refactor `StringUtils::replaceAll` to accept `string_view` as suggested in a code comment. In addition, while we are touching this rebuild happy file, we slim it down a bit by moving a few sparingly used functions elsewhere.
2021-11-05 10:53:52 +01:00
Bo Svensson
0371072631
removes lowerCaseInPlace (#3217)
This PR removes unneeded `lowerCaseInPlace` calls in in a hot path of `objectpaging.cpp` that are no longer necessary after PR #3197. In addition, I have been informed that these changes should by coincidence address a compiler specific compilation error we currently experience.
2021-11-04 22:20:06 +01:00
Petr Mikheev
33d71be81f Add LuaUtil::ScriptsConfiguration 2021-10-26 21:32:02 +02:00
Bo Svensson
7f9beac3a7
refactors a case insensitive map (#3184)
This PR aims to spark the retirement of a questionable pattern I have found all over our code base. I will illustrate how this pattern encourages code duplication, lacks type safety, requires documentation and can be prone to bugs.
```
std::map<std::string, Object> mMap; // Stored in all lowercase for a case-insensitive lookup

std::string lowerKey = Misc::StringUtils::lowerCase(key);
mMap.emplace(lowerKey, object);

std::string lowerKey = Misc::StringUtils::lowerCase(key);
mMap.find(lowerKey);

mMap.find(key); // Not found. Oops!
```
An alternative approach produces no such issues.
```
std::unordered_map<std::string, Object, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> mMap;

mMap.emplace(key, object);

mMap.find(key);
```
Of course, such an alternative will work for a `map` as well, but an `unordered_map` is generally preferable over a `map` with these changes because we have moved `lowerCase` into the comparison operator. 

In this PR I have refactored `Animation::mNodeMap` accordingly. I have reviewed and adapted all direct and indirect usage of `Animation::mNodeMap` to ensure we do not change behaviour with this PR.
2021-10-25 09:18:26 +02:00
elsid
e5413c0664
Add functions to compress/decompress vector of bytes 2021-10-18 20:46:22 +02:00
elsid
bb26ba30b6
Add progress reporter type
To log/report progress of long duration operations using given time period.
2021-10-18 01:26:10 +02:00
psi29a
207a7245bc Merge branch 'navigator_settings' into 'master'
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager

See merge request OpenMW/openmw!1283
2021-10-12 07:02:08 +00:00
elsid
405e814190
Move btCollisionObject creation for MWPhysics::Object into components 2021-10-11 23:14:02 +02:00
elsid
6986feb81b
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager
To avoid having multiple places to initialize them when they will be required
by multiple binaries.
2021-10-11 18:50:26 +02:00
fredzio
21dbe314bf Use common function for sync and async case. Now both cases follow the
same flow, synchronous simulation is just a special case.
2021-10-05 15:44:20 +02:00
Cédric Mocquillon
6817282097 Move getFileExtension to common header and use instead of repeating same code 2021-09-14 18:09:55 +02:00
elsid
6b7434ca69
Pass std::string_view instead of const std::string&
* Starting with Actor::getBodyPartMesh and ending with
  Misc::StringUtils::ciEqual.
* Add tests for Misc::StringUtils::ciEqual.
2021-09-09 18:39:50 +02:00
elsid
3caf45807f
Use common implementation to filter hidden markers 2021-08-12 22:35:16 +02:00
jvoisin
9db7d0278a Sprinkle some const ref 2021-06-25 21:54:35 +02:00
Evil Eye
2be27da791 Merge branch 'const_refs' into 'master'
Add a ton of const refs

See merge request OpenMW/openmw!954
2021-06-24 18:57:41 +00:00
Evil Eye
9f7980ecd7 Merge branch 'refenreces' into 'master'
Sprinkle some references where it makes sense

See merge request OpenMW/openmw!952
2021-06-24 17:40:36 +00:00
jvoisin
cf11870b1c Sprinkle some references where it makes sense 2021-06-24 00:28:09 +02:00
jvoisin
5840279f16 Use default instead of empty constructors/destructors
See https://pvs-studio.com/en/docs/warnings/v832/ for details
2021-06-24 00:26:15 +02:00
jvoisin
1123dc46ee Add a ton of const refs 2021-06-23 23:13:59 +02:00
jvoisin
e51669c05d Don't assign a variable passed by value 2021-05-21 18:15:31 +02:00