Commit Graph

436 Commits (06bf80cc3b6e9ebd4907f192b30a54766f334b98)

Author SHA1 Message Date
elsid 6fb7af3b63
Avoid redundant copy when finding item in NavMeshTilesCache
std::make_tuple returns a tuple for types with removed references which makes it
to copy arguments. std::tie leaves references.
3 years ago
elsid 5b9ca3b979
Avoid possible division by zero
components/detournavigator/navmeshdb.cpp:183:43: warning: Division by zero [clang-analyzer-core.DivideZero]
        setMaxPageCount(*mDb, maxFileSize / dbPageSize + static_cast<std::uint64_t>((maxFileSize % dbPageSize) != 0));
                              ~~~~~~~~~~~~^~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:33: note: Calling 'getPageSize'
        const auto dbPageSize = getPageSize(*mDb);
                                ^~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:144:13: note: 'value' initialized to 0
            std::uint64_t value = 0;
            ^~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:145:13: note: Calling 'request<DetourNavigator::(anonymous namespace)::GetPageSize, unsigned long *, >'
            request(db, statement, &value, 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/sqlite3/request.hpp:254:64: note: Left side of '&&' is false
            for (std::size_t i = 0; executeStep(db, statement) && i < max; ++i)
                                                               ^
components/detournavigator/navmeshdb.cpp:145:13: note: Returning from 'request<DetourNavigator::(anonymous namespace)::GetPageSize, unsigned long *, >'
            request(db, statement, &value, 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:146:13: note: Returning zero (loaded from 'value')
            return value;
            ^~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:33: note: Returning from 'getPageSize'
        const auto dbPageSize = getPageSize(*mDb);
                                ^~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:9: note: 'dbPageSize' initialized to 0
        const auto dbPageSize = getPageSize(*mDb);
        ^~~~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:183:43: note: Division by zero
        setMaxPageCount(*mDb, maxFileSize / dbPageSize + static_cast<std::uint64_t>((maxFileSize % dbPageSize) != 0));
                              ~~~~~~~~~~~~^~~~~~~~~~~~
3 years ago
Andrei Kortunov 124db67496 Add an assert to detect possible nullptr dereference 3 years ago
elsid 8544aa481c
Fix C4459 msvc warning
declaration of 'navMeshVersion' hides global declaration
3 years ago
elsid 1a5932a669
Move std::ostream& operator<< to .cpp 3 years ago
elsid 1a12c453d6
Support different agent collision shape type for pathfinding
Actors may have different collision shapes. Currently there are axis-aligned
bounding boxes and rotating bounding boxes. With AABB it's required to use
bounding cylinder for navmesh agent to avoid providing paths where actor can't
pass. But for rotating bounding boxes cylinder with diameter equal to the front
face width should be used to not reduce of available paths. For example rats
have rotating bounding box as collision shape because of the difference between
front and side faces width.

* Add agent bounds to navmesh tile db cache key. This is required to distinguish
  tiles for agents with different bounds.
* Increase navmesh version because navmesh tile db cache key and data has changed.
* Move navmesh version to the code to avoid misconfiguration by users.
* Fix all places where wrong half extents were used for pathfinding.
3 years ago
elsid fdd84265b3
Use proper agent height and radius when render actor path
That are based on half extents used to find path over navmesh which is different
for interior and exterior cells.

Use common functions to get agent height and radius for actor path rendering and
navmesh generation.
3 years ago
jvoisin 72a6d1f69f Clean up bullet includes 3 years ago
jvoisin 4e4debb1cb Remove even more of boost::filesystem 3 years ago
elsid 5b592e09e6
Log more information when navmeshtool fails on not enough space 3 years ago
ζeh Matt 18f16eac4c
Refactor DetourNavigator to pass prng along, use world prng for AiWander 3 years ago
elsid a75c7c49f0
Disable writes to navmeshdb on database is locked error
Simultaneously writing to sqlite3 database is not possible. Process exclusively
locks the database for this. Another process will fail to perform any request
when database is locked. Alternatively it can wait. Handling this situation
properly requires complexity that is not really needed. Users are not expected
to run multiple openmw processes simultaneously using the same navmeshdb.

Before this change running multiple openmw processes using the same navmeshdb
can lead to a crash when first transaction fails to start because there is
exception thrown and not catched.

Remove use of explicit transactions from DbWorker. Handling all possible
transaction states due to different errors brings unnecessary complexity.
Initially they were introduced to increase time between flushes to disk. This
makes sense for navmeshtool because of massive number of writes but for the
engine this is not an issue.
3 years ago
elsid 5b9dd10cbe
Limit max navmeshdb file size
Use "pragma max_page_count" to define max allowed file size in combination with
"pragma page_size" based on a new setting "max navmeshdb file size".

* Stop navmeshtool on the first db error.
* Disable writes to db in the engine on first "database or disk is full"
  SQLite3 error. There is no special error code for this error.
* Change default "write to navmeshdb" to true.
* Use time intervals for transaction duration instead of number of changes.
3 years ago
elsid 42d6032c8b
Support compilation with c++20 3 years ago
psi29a b03f9e430c Merge branch 'navmesh_disk_rm_unused_tiles' into 'master'
Add navmeshtool flag to remove unused tiles from navmesh disk cache

See merge request OpenMW/openmw!1671
3 years ago
elsid 8b4362ece7
Disable navmesh disk cache when db is failed to open 3 years ago
elsid ab1a6e034e
Add navmeshtool flag to remove unused tiles from navmesh disk cache
* Remove tiles outside processing range. Useful when new content profile map
  has different bounds.
* Remove ignored tiles. For a case when content profile maps have intersection
  but there is no more data for navmesh.
* Remove older tiles at the same worldspace position. If navmesh tile data has
  changed with new content, the old ones unlikely to be used.
* Vacuum the database when there are modifications. SQLite leaves empty pages
  in the file on database modification. Vacuum cleans up unused pages reducing
  the file size.
3 years ago
elsid 67741402b5
Replace reference to const std::string by std::string_view for navmeshdb related arguments 3 years ago
elsid 0b644a897e
Explicitly bind TileCachedRecastMeshManager with mutex 3 years ago
elsid 05b54cbfb8
Cull navmesh objects by scene bounds
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.

Each object is associated with a set of tiles its present in. Culling can
reduce this set but it has to be update when bounds change position. Do this
in TileCachedRecastMeshManager::setBounds updating the set and adding/removing
objects to the corresponding CachedRecastMeshManagers.
3 years ago
elsid 563f3f87dd
Reduce critical sections size 3 years ago
elsid a5b078e9a7
Allow to represent empty range with TilesPositionsRange 3 years ago
elsid 1b2954f2db
Remove unused z coordinate 3 years ago
elsid 1a52a2a029
Clamp tile position 3 years ago
elsid 542717394a
Remove objects, water and heightfields when no longer required 3 years ago
elsid 7ea5aa250b
Revert "Cull navmesh objects by scene bounds"
This reverts commit b0ef20c303.
3 years ago
psi29a 6f7a067e0c Merge branch 'esmrename' into 'master'
esm refactor work

See merge request OpenMW/openmw!1575
3 years ago
elsid 9069e97dce
Filter out triangles with NaN coordinates
Sorting a vector with such values gives invalid result because comparison with
NaN is always false.
3 years ago
elsid b0ef20c303
Cull navmesh objects by scene bounds
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.
3 years ago
elsid bba7beb0c5
Split tiles position range creation and iteration over 3 years ago
elsid 12ce82980c
Revert "Limit and filter navmesh input (#5858)"
This reverts commit ecc654a369.
3 years ago
elsid ecc654a369 Limit and filter navmesh input (#5858) 3 years ago
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
3 years ago
jvoisin 421e6629ad Fix unnecessary-copy-initialization
> warning: the variable 'key' is copy-constructed from a const reference but is
only used as const reference; consider making it a const reference
[performance-unnecessary-copy-initialization]

Found by clang-tidy.
3 years ago
elsid aaf6c82e33
Do not write shapes to navmeshdb when writing is disabled 3 years ago
elsid 96eb8d7be9
Write generated navmesh to navmeshdb
Perform all request to db in a single thread to avoid blocking navmesh
generator threads due to slow write operations.

Write to db navmesh for all changes except update as it done for memory cache.

Batch multiple db operations into a single transaction to speed up writing by
not executing fsync after each insert/update query. All reads are performed in
the same transaction so they see uncommited data.
3 years ago
elsid c9b8ba7b46
Read navmesh tile data from database
When tile is not found in memory cache try to find it in the database.
3 years ago
elsid 953a4c5550
Add a binary to generate navmesh from content files
Load content files based on the engine config files. Generate navmesh per cell
for all cells and store into SQLite database.
3 years ago
elsid 5325495f46
Move serialization detournavigator/ -> components/ 3 years ago
elsid 01c712d5f1
Split navigator settings into subtypes
Mostly to distinguish settings that affect properties of the generated navmesh.
3 years ago
elsid 33bb18850d
Move operator<< to debug.hpp 3 years ago
elsid 5a6b39f8e0
Store mesh source data in recast mesh 3 years ago
elsid 7dcb219ecf
Add raw heightfield data to navigator 3 years ago
elsid 8571c317d8
Add raw water data to navigator 3 years ago
elsid f4f4458d01
Calculate recast mesh bounds when building navmesh 3 years ago
elsid e10bbb9ad7
Shift heightfield and water in navigator tests 3 years ago
psi29a 7256654f29 Merge branch 'navmesh_render' into 'master'
Rework navmesh render (#6187)

See merge request OpenMW/openmw!1338
3 years ago
elsid 3c41d0efc3
Render each navmesh tile independently 3 years ago
elsid 6b7363bd59
Replace generation and revision by version 3 years ago
elsid ce7f8c90f8
Fix unity build 3 years ago
Brian Kelley ee41b94a73 Enable compilation on apple silicon 3 years ago
elsid 3b6184dcda
Add missing include
In file included from /<<BUILDDIR>>/openmw-0.47.0+git202111080927~ubuntu18.04.1/components/detournavigator/findsmoothpath.cpp:1:0:
/<<BUILDDIR>>/openmw-0.47.0+git202111080927~ubuntu18.04.1/components/detournavigator/findsmoothpath.hpp:93:48: error: field ‘mSettings’ has incomplete type ‘std::reference_wrapper<const DetourNavigator::Settings>’
         std::reference_wrapper<const Settings> mSettings;
                                                ^~~~~~~~~
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/nested_exception.h:40,
                 from /usr/include/c++/7/exception:143,
                 from /usr/include/c++/7/ios:39,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /<<BUILDDIR>>/openmw-0.47.0+git202111080927~ubuntu18.04.1/components/detournavigator/dtstatus.hpp:6,
                 from /<<BUILDDIR>>/openmw-0.47.0+git202111080927~ubuntu18.04.1/components/detournavigator/findsmoothpath.hpp:4,
                 from /<<BUILDDIR>>/openmw-0.47.0+git202111080927~ubuntu18.04.1/components/detournavigator/findsmoothpath.cpp:1:
/usr/include/c++/7/type_traits:2125:11: note: declaration of ‘class std::reference_wrapper<const DetourNavigator::Settings>’
     class reference_wrapper;
3 years ago
elsid 5972520b1a
Make sure areas size is 2 for rectangle 3 years ago
elsid 671e1e5424
Avoid copy when adding heightfield to vector 3 years ago
elsid 5f5163905a
Remove unused operator< for RecastMesh 3 years ago
elsid e0c4f08aa5
Remove redundant includes 3 years ago
psi29a 256ec4c752 Merge branch 'fix_tile_bounds' into 'master'
Fix tile bounds scaling

See merge request OpenMW/openmw!1353
3 years ago
psi29a 627f816348 Merge branch 'navigator_impl' into 'master'
Reduce the size of included code from detournavigator/ into the engine

See merge request OpenMW/openmw!1355
3 years ago
elsid 9f808fbe3a
Move findPath-like navigator functions into a separate header 3 years ago
elsid 5e99454cc4
Add factory functions to create navigator implementations 3 years ago
elsid 3f80725ebe
Remove duplicated implementation of Misc::Convert::toOsg 3 years ago
elsid 5db4898bec
Fix tile bounds scaling
OscillatingRecastMeshObject::update should be called with tile bounds in real
coordinates not in navmesh. But proper scaling was done only in
RecastMeshManager::getMesh and RecastMeshManager::updateObject used tile bounds
in navmesh coordinates.

Add a new function to create tile bounds with proper scaling and pass correct
value into RecastMeshManager constructor through CachedRecastMeshManager
constuctor from TileCachedRecastMeshManager member functions.
3 years ago
psi29a 523289c531 Merge branch 'refactor_bullet_shape' into 'master'
Refactor bullet shape

See merge request OpenMW/openmw!1333
3 years ago
elsid 9c5f8b8719
Store holder only in parent RecastMeshObject 3 years ago
elsid 8e71c246bf
Remove redundant BulletShape getters 3 years ago
psi29a 2765bcee5e Merge branch 'serialization' into 'master'
Add helpers for binary serialization

See merge request OpenMW/openmw!1319
3 years ago
Andrei Kortunov 0f3c0cb0a0 Fix argument types mismatch 3 years ago
Andrei Kortunov 107a9ecb17 Fix variables hiding 3 years ago
elsid a58f1a94e3
Add helpers for binary serialization
To construct serializer from given entities:
* Data source/destination - any value that has to be serialized/deserialized,
  usually already existing type.
* Format - functional object to define high level serialization logic to
  define specific format and data schema. Like order of fields, allocation.
* Visitor - functional object to define low level serialization logic to
  operator on given data part.
  * BinaryWriter - copies given value into provided buffer.
  * BinaryReader - copies value into given destination from provided buffer.
  * SizeAccumulator - calculates required buffer size for given data.
3 years ago
elsid 06ea47f74b
Fix crash in DetourNavigator::fixupCorridor
Handle situation when resulting path does not fit into destination vector.
3 years ago
elsid f6d1689bb9
Avoid redundant polygon path reallocations
Use separate variable to store size and make all operations in-place.
3 years ago
elsid 79665cea66
Avoid access to the path vector element out of range
polygonPath.front() in some cases might reference to a first element of empty
vector. Copy the value into a local variable to be able to access later.
3 years ago
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.
3 years ago
psi29a f9124ccea6 Merge branch 'recast_mesh_slope' into 'master'
Use different colors for walkable and non-walkable recast mesh triangles

See merge request OpenMW/openmw!1277
3 years ago
elsid 0c8a811ad5
Render only cached recast mesh
To avoid waiting while recast mesh is generating.

Remove redundant continue.
3 years ago
elsid 88ac77df1f
Fix writing to file for RecastMesh
Add missing scaling and y, z coordinates swap.
3 years ago
Andrei Kortunov fc2076db1a
Fix MSVC warnings about local variables redeclaration (#3130) 3 years ago
jvoisin d4e3575f1d Don't use `const` for objects returned by value.
This prevents the usage of std::move semantics,
and makes clang-tidy sad.
3 years ago
psi29a e8057d9fd1 Merge branch 'aipursue_path' into 'master'
Make AiPursue path destination to be as close as possible to target (#6211)

Closes #6211

See merge request OpenMW/openmw!1154
3 years ago
elsid ee63ee9d93
Fix coverity warning
CID 332936 (#1 of 1): Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
integer_division: Dividing integer expressions size and 2, and then converting
the integer quotient to type float. Any remainder, or fractional part of the
quotient, is ignored.
3 years ago
elsid 0066c446f8
Remove navmesh tiles outside allowed range first
* Change job change type to remove when tile is outside allowed range.
* Swap try number and change type in job priority. To make sure remove jobs
  always processed before any other.
3 years ago
elsid 0f11acf709
Report more stats from AsyncNavMeshUpdater 3 years ago
elsid 431501e23a
Remove redundant job distribution between threads
Instead don't take jobs from queue until job for the same tile is processing.
3 years ago
elsid 277a1268c0
Avoid access to removed map item
To fix ASAN warning:
=11799==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000436058 at pc 0x55c90acccaa8 bp 0x7f787eeac830 sp 0x7f787eeac820
READ of size 8 at 0x60c000436058 thread T18
    #0 0x55c90acccaa7 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&) /usr/include/c++/11.1.0/bits/stl_deque.h:269
    #1 0x55c90acccaa7 in std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >::empty() const /usr/include/c++/11.1.0/bits/stl_deque.h:1311
    #2 0x55c90acccaa7 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:350
    #3 0x55c90acccaa7 in wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> >, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:151
    #4 0x55c90acccaa7 in wait_for<long int, std::ratio<1, 1000>, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:175
    #5 0x55c90acccaa7 in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:353
    #6 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    #7 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    #8 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    #9 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    #10 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    #11 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    #12 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    #13 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82
    #14 0x7f78c36b1258 in start_thread (/usr/lib/libpthread.so.0+0x9258)
    #15 0x7f78c35da5e2 in __GI___clone (/usr/lib/libc.so.6+0xfe5e2)

0x60c000436058 is located 88 bytes inside of 120-byte region [0x60c000436000,0x60c000436078)
freed by thread T0 here:
    #0 0x7f78c688cd69 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
    #1 0x55c90acdbe20 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::deallocate(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/ext/new_allocator.h:139
    #2 0x55c90acdbe20 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::deallocate(std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:492
    #3 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_put_node(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:565
    #4 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:632
    #5 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_erase(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    #6 0x55c90acc0569 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_tree.h:1254
    #7 0x55c90acc0569 in std::map<std:🧵:id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_map.h:1134
    #8 0x55c90acc0569 in DetourNavigator::AsyncNavMeshUpdater::~AsyncNavMeshUpdater() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:105
    #9 0x55c90acab2dc in DetourNavigator::NavigatorImpl::~NavigatorImpl() (/home/elsid/dev/openmw/build/gcc/asan/openmw+0x2d152dc)
    #10 0x55c9097db4b5 in std::default_delete<DetourNavigator::Navigator>::operator()(DetourNavigator::Navigator*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    #11 0x55c9097db4b5 in std::unique_ptr<DetourNavigator::Navigator, std::default_delete<DetourNavigator::Navigator> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    #12 0x55c9097db4b5 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    #13 0x55c9097dc3a4 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    #14 0x55c90a1925e4 in MWBase::Environment::cleanup() /home/elsid/dev/openmw/apps/openmw/mwbase/environment.cpp:192
    #15 0x55c90a1f544d in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:434
    #16 0x55c90a1f6700 in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:455
    #17 0x55c90a19d523 in std::default_delete<OMW::Engine>::operator()(OMW::Engine*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    #18 0x55c90a19d523 in std::unique_ptr<OMW::Engine, std::default_delete<OMW::Engine> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    #19 0x55c90a19d523 in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:320
    #20 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    #21 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    #22 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

previously allocated by thread T18 here:
    #0 0x7f78c688bca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55c90ace8c73 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::allocate(unsigned long, void const*) /usr/include/c++/11.1.0/ext/new_allocator.h:121
    #2 0x55c90ace8c73 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:460
    #3 0x55c90ace8c73 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_get_node() /usr/include/c++/11.1.0/bits/stl_tree.h:561
    #4 0x55c90ace8c73 in std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >* std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:611
    #5 0x55c90ace8c73 in std::_Rb_tree_iterator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:2429
    #6 0x55c90accc5fb in std::map<std:🧵:id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::operator[](std:🧵:id const&) /usr/include/c++/11.1.0/bits/stl_map.h:501
    #7 0x55c90accc5fb in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:344
    #8 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    #9 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    #10 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    #11 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    #12 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    #13 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    #14 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    #15 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82

Thread T18 created by T0 here:
    #0 0x7f78c682bfa7 in __interceptor_pthread_create /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x7f78c38fd6aa in std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663
    #2 0x55c90ae008d1 in DetourNavigator::NavMeshManager::NavMeshManager(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navmeshmanager.cpp:47
    #3 0x55c90aca3bfe in DetourNavigator::NavigatorImpl::NavigatorImpl(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navigatorimpl.cpp:13
    #4 0x55c9097d9e6f in MWWorld::World::World(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, Files::Collections const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ToUTF8::Utf8Encoder*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:196
    #5 0x55c90a1e9992 in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:789
    #6 0x55c90a1ed138 in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949
    #7 0x55c90a19d4cb in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316
    #8 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    #9 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    #10 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/11.1.0/bits/stl_deque.h:269 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&)
Shadow bytes around the buggy address:
  0x0c188007ebb0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c188007ebc0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c188007ebd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ebe0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ebf0: 00 00 00 00 00 00 07 fa fa fa fa fa fa fa fa fa
=>0x0c188007ec00: fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fa
  0x0c188007ec10: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec20: 00 00 00 00 00 00 02 fa fa fa fa fa fa fa fa fa
  0x0c188007ec30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ec40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec50: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==11799==ABORTING
3 years ago
elsid fea4fb6e69
Make AiPursue path destination to be as close as possible to target
Even when target is not reachable actor will try to run there either because
target navmesh polygon is selected within extended area or because partial path
is built to the closest possible polygon.
3 years ago
psi29a 6360bdc859 Merge branch 'navmesh_job' into 'master'
Store async navmesh jobs in the same container until they are processed

See merge request OpenMW/openmw!1131
3 years ago
psi29a 6595c731f7 Merge branch 'fix_rc_poly_mesh_flags_length' into 'master'
Fix flags length for rcPolyMesh

See merge request OpenMW/openmw!1134
3 years ago
elsid 46fa3ce083
Fix flags length for rcPolyMesh
recastnavigation documentation of rcPolyMesh is misleading. It says flags field
length is maxpolys when actually it's allocated as npolys.
3 years ago
elsid 54a676f2e3
Add functions to get length of recast type arrays
To avoid duplicating same formulas in multiple places.
3 years ago
elsid 05258ed644
Remove redundant TileCachedRecastMeshManager::hasTile function
It's used only for tests. getMesh is a valid replacement.
3 years ago
elsid 8ac8d56e8c
Mark TileCachedRecastMeshManager member functions as const where possible 3 years ago
elsid 09b1a2e3c6
Make unchanging Job fields const 3 years ago
elsid 21ce4fe637
Use structured binding 3 years ago
elsid 8bca9eec80
Use single set to store pushed tiles 3 years ago
elsid a97b2ced27
Use single map to store last updates 3 years ago
elsid bfcc430822
Use single map to store processing tiles 3 years ago
elsid 902b0f9f84
Store jobs in the same container until they are processed
Push to queue and reorder only iterators.
3 years ago
elsid 8db640289c
Use single set to store pushed jobs for tiles 3 years ago
elsid a99266a60e
Do not measure total navmesh generation duration
This is not a useful thing anymore.
3 years ago
elsid 9460a8760e
Move operator<< for UpdateNavMeshStatus to header 3 years ago
elsid 94e71d9b14
Avoid division by zero 3 years ago
elsid 0985d8e03d
Handle failed NavMesh allocation 3 years ago
elsid a6260453ea
Add missing initialization 3 years ago
elsid 86e6d3dac8
Do not cache navmesh when only object transformation is changed
This saves cache capacity when a scene contains objects contantly transforming
by scripts and causing changes in navmesh. The probability to get cache hit for
such states is almost zero because even a constant change in a single float
value may give up to 2^32 different states.
3 years ago
elsid 3cbe93358a
Move dtNavMeshParams initialization to where it's required 3 years ago
elsid 41b02ff1aa
Copy only required RecastMeshObject fields 3 years ago
elsid c91ef34a70
Avoid using a specific type for stored ref_ptr to extend lifetime 3 years ago
elsid 050b7d31aa
Create RecastMesh outside critical section
To not lock main thread when it tries to update objects.
3 years ago
elsid c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
To keep btCollisionShape lifetime.
3 years ago
elsid 4574e5f565
Remove redundant Navigator API functions 3 years ago
elsid 9a5ec5fd03
Store heightfields as array of heights instead of triangles
To reduce size of RecastMesh and therefore cache size.
3 years ago
elsid fdee9db20c
Consider RecastMeshManager not empty when there is water 3 years ago
elsid 24b802b3d8
Simplify adding water to recast mesh
Remove redundant computations and conversions.
3 years ago
elsid 5d6c93566d
Rename DetourNavigator::Water -> Cell 3 years ago
elsid 753767d6d9
Store only water shift
Rotation is not used.
3 years ago
elsid da4ec31cd8
Remove redundant RecastMeshManager::Water 3 years ago
elsid a1549321d7
Move Water struct out of RecastMesh class 3 years ago
elsid d60edb36aa
Make RecastMesh independent from recast scale factor
To avoid scaling until it's required by delaying coordinates conversion until
navmesh generation.
3 years ago
elsid af7059373c
Make RecastMesh independent from the order of RecastMeshBuilder calls
To make sure RecastMesh objects are equal if built with the same data but in
different order. Will be used later when there will be more than one place
building RecasMesh objects.
3 years ago
elsid 07c70dfb73
Remove unused local variables 3 years ago
elsid d2b935684d
Add missing include 4 years ago
elsid beeb882ea8
Do not use off mesh connections as a part of navmesh cache key
To reduce cache size and make it more flexible.

Adding off mesh connections to the navmesh is the last step of navmesh
generation and it's very fast comparing to other steps (microseconds vs
milliseconds). Having less cache size makes get and set operations almost 2x
times faster that also have an order of microseconds. So in total there is
no performance impact.
4 years ago
elsid 09f9075842
Use RecastMeshBuilder once to create RecastMesh
This allows to move all data out of the object instead of copying.
4 years ago
elsid 0193c95b26
Shrink to fit recast mesh data 4 years ago
elsid 94e460ba1e
Use proper check for distance
To avoid invalid results for r < 1.
4 years ago
elsid a54c4bc2e9
Check dtNavMeshQuery::findStraightPath status 4 years ago
elsid 793c30ab8d
Check dtNavMeshQuery::getPolyHeight status
Otherwise when it fails a node with zero height will be added to a path.
4 years ago
elsid 7e1630a7ad
Remove redundant getPolyHeight wrapper 4 years ago
elsid cc08a45c31
Move include where it is needed 4 years ago
elsid a3942a1e0a
Remove redundant check for y coordinate in inRange function 4 years ago
Petr Mikheev 4b98d460da Merge branch 'const_moar' into 'master'
Sprinkle some const ref

See merge request OpenMW/openmw!963
4 years ago
psi29a 67f32263b2 Merge branch 'fix_malexa_escape' into 'master'
Inscribe physical bounding box into navmesh agent cylinder (#6114)

Closes #6114

See merge request OpenMW/openmw!967
4 years ago
elsid 1552e7e3e3
Add pathgrid edges as one direction off mesh connection 4 years ago
elsid ff1af5e8ec
Use only off mesh connections starting or ending in a given tile 4 years ago
elsid a8ba9a0e2a
Cleanup unused tile positions from OffMeshConnectionsManager 4 years ago
elsid 81e569c3d9
Move OffMeshConnectionsManager implementation into cpp 4 years ago
elsid 7f65a2c4c2
Remove unused code 4 years ago
elsid 3e98db8d60
Fix styleguide 4 years ago
elsid 84d6dea277
Inscribe physical bounding box into navmesh agent cylinder
To disallow too narrow navmesh for a bounding box.
4 years ago
jvoisin 9db7d0278a Sprinkle some const ref 4 years ago
jvoisin 1123dc46ee Add a ton of const refs 4 years ago
elsid 4a6961b365
Trigger navmesh update on moved player only when player tile has been changed 4 years ago
elsid ed91cf9397
Replace unordered_map by map for storing objects
For small amount of items it gives better performance for find by key
for update.
4 years ago
elsid 22c2f106b7
Store object tiles position as sorted vector instead of set 4 years ago
elsid f4f9fa4701
Limit oscillating recast mesh object AABB by tile bounds
AABB change outside recast mesh tile should not affect navmesh for this tile.
4 years ago
elsid d122e184cc
Report navmesh change for not posted tiles
Corresponding recast mesh tiles can be updated but navmesh tiles may never
appear for them. Report back zero navmesh version to allow oscillating recast
objects detection to work. This version is always less than any generated
navmesh tile version so any report for generated navmesh will override it.
If zero navmesh version is reported after recast mesh tile got report about
generated navmesh tile it is a no-op since generated version is always greater
than zero.
4 years ago
elsid a73ffc25c3
Add missing synchronization for present tiles modification
insert/erase can be done from multiple threads simultaneously. mMutex is
already used to synchronize reads so use it for writes too.
4 years ago
psi29a f1f1703441 Merge branch 'fix_navmesh_wait' into 'master'
Fix redundant waiting until navmesh is generated

See merge request OpenMW/openmw!861
4 years ago
elsid 59f89d22f8
Apply min distance only for not present tiles
To avoid waiting when navmesh update is triggered by transformed object for
already present tiles.
4 years ago
elsid d0ea9c482a
Reorder async navmesh updater jobs when player tile changes
When player tile changes distance to player that is part of jobs priority is
invalidated. So jobs are no longer in the right order. This can lead to
processing of farests tiles first.

Sort queue each time player tile is changed.
4 years ago