806 Commits

Author SHA1 Message Date
Ben Hymers
3eb9c808c1 Fix many cases of return values from ftell and fseek being ignored
These could lead to undefined behaviour if e.g. a negative value from ftell
was used to allocate memory.

Also store result of ftell in a long;
The result may previously have been truncated on some platforms
2016-03-15 08:02:06 +00:00
Ben Hymers
632ae709d7 Fix unused parameter warning in Contrib/stb_truetype.h 2016-03-15 07:56:57 +00:00
Ben Hymers
e344fe8295 Remove dead code in rcBuildRegions
The code is checking for an invalid region ID, after setting it to a valid value
2016-03-15 07:56:57 +00:00
Ben Hymers
3a0140c2ac Initialise dtTileCache::m_reqs on construction 2016-03-15 07:56:56 +00:00
Ben Hymers
58bd564438 Initialise BuildContext::m_messages to null pointers
Fixes warning reported by Coverity Scan
2016-03-15 07:56:56 +00:00
Ben Hymers
e4791becd5 Fix Coverity warning about odd null check in TempObstacleHilightTool
m_sample was being checked for null after being used, which looks like a
null dereference, though actually if m_sample becomes null, the tool will
be deactivated anyway. Regardless, this code looks more sensible.
2016-03-14 10:22:31 +00:00
Ben Hymers
222fa1ee6f Fix possible out of bounds array access in Detour closest point functions
These were reported by Coverity Scan. They're extremely unlikely but still
possible - if all edges of a poly are FLT_MAX or further away from the
input point, a negative index may be used to access the verts array of a
poly.

The fix is to arbitrarily pick the first edge as the closest in case all
are tied as being very far away.
2016-03-14 10:22:31 +00:00
Ben Hymers
299ed08087 Fix leaking file handles in Sample_TileMesh::loadAll after various failures
Leaks were reported by Coverity Scan
2016-03-14 10:22:31 +00:00
Ben Hymers
e1f297e4bf Fix memory leak in Contrib/stb_truetype.h, stbtt_GetGlyphBitmapSubpixel
Leak was reported by Coverity Scan

Issue reported to stb project here:
https://github.com/nothings/stb/issues/251
2016-03-14 10:22:31 +00:00
Ben Hymers
2f382134d4 Remove dead assignments to status value in findStraightPath
Add comments explaining why the return values are ignored
Clarify the status return value logic in appendVertex
2016-03-14 09:03:41 +00:00
Ben Hymers
8f16b7de2f Remove dead assignments
Credit to @rafzi in PR #93
2016-03-14 09:03:40 +00:00
Ben Hymers
c208fd332c Minor typo and style changes 2016-03-14 09:03:40 +00:00
Ben Hymers
40a88dae73 Fix blank assignments while advancing through buffer, using new dtGetThenAdvanceBufferPointer 2016-03-14 09:03:39 +00:00
Ben Hymers
d7d58b98d9 Fix ReSharper warnings: remove unused methods 2016-02-26 08:41:17 +00:00
Ben Hymers
a2730f9fdd Fix warnings; initialise all uninitialised class members 2016-02-26 08:40:53 +00:00
Graham Pentheny
511eeabe9f Merge pull request #187 from hymerman/demo-test-fix
Fix crashes and odd behaviour in RecastDemo tests
2016-02-23 12:42:56 -05:00
Ben Hymers
f44e151556 Fix crashes and odd behaviour in RecastDemo on geometry load failure
Would crash if selecting a test with geometry then a test with missing geometry
Would use the previous sample type if selecting a sample that doesn't exist in the list
Two of the test cases had an incorrect sample name
2016-02-22 22:24:48 +00:00
Graham Pentheny
cc35cd8126 Merge pull request #186 from hymerman/filelist-crash-fix
Fix Win64 when populating input file list
2016-02-22 11:23:09 -05:00
Jakob Botsch Nielsen
09afa02f4a Fail when too many nodes are requested
dtNavMeshQuery now fails initialization if too many nodes are requested
in the node pool. This could cause wrong paths and infinite loops to
happen if the node indices started overflowing dtNodeIndex or
dtNode::pidx.

Fix #178
2016-02-22 08:45:24 +00:00
Ben Hymers
7babde3103 Fix Win64 when populating input file list
As identified by @b-desconocido, _findfirst has a return type of intptr_t;
this was previously being truncated to long.

Fix #185
2016-02-20 15:46:22 +00:00
Graham Pentheny
0f8ebe285e Merge pull request #183 from hymerman/stb_truetype_upgrade
Update stb_truetype to latest version
2016-02-17 11:01:53 -05:00
Graham Pentheny
baa1a5a858 Merge pull request #184 from hymerman/slideshow-removal
Remove SlideShow, and stb_image
2016-02-17 11:00:52 -05:00
Ben Hymers
13edcb54ce Update stb_truetype to latest version 2016-02-17 13:16:59 +00:00
Ben Hymers
aac9ae6e11 Remove SlideShow, and stb_image 2016-02-17 13:14:34 +00:00
Jakob Botsch Nielsen
8378805d35 Merge pull request #180 from Janiels/more-text-and-warnings
Fix warnings and increase demo text pool size
2016-02-16 13:20:47 +01:00
Jakob Botsch Nielsen
e30a6635a2 Fix warnings and increase demo text pool size
Fix three warnings added in fc5df2c, and increase the text pool size in
the demo. This would frequently be overflowed, even just by building
with the default settings and expanding the log.
2016-02-16 10:27:18 +01:00
Ben Hymers
1f97552d02 Merge pull request #177 from hymerman/contributing-screenshots
Add note to CONTRIBUTING doc to mention screenshots and debug draw
2016-02-15 21:31:38 +00:00
Ben Hymers
5098d88ee8 Add note to CONTRIBUTING doc to mention screenshots and debug draw interface 2016-02-14 20:08:58 +00:00
Jakob Botsch Nielsen
8259fe6763 Merge pull request #176 from hymerman/contributing-doc
Add CONTRIBUTING.md
2016-02-09 18:59:00 +01:00
Ben Hymers
f0c09d7583 Add CONTRIBUTING.md
Contains a first pass of contributing guidelines and code of conduct

Fix #174
2016-02-09 17:52:55 +00:00
Ben Hymers
0a9e36d91b Merge pull request #175 from Janiels/fix-107
Add API to query polygons in batches
2016-01-27 15:18:04 +00:00
Jakob Botsch Nielsen
fc5df2c6fd Add API to query polygons in batches
This adds a version of queryPolygon that takes an interface which is
passed batches of polygons in the search area. This new API is then used
from the old queryPolygons to collect polygons, and from findNearestRef
to find the nearest poly in an arbitrarily sized area. Previously
findNearestPoly had an arbitrary poly limit of 128 which could cause it
to return potentially wrong results.

Fix #107
2016-01-25 23:25:48 +01:00
Graham Pentheny
6ee79b25a8 Merge pull request #169 from wbierman/master
Detect, log and fail in the event of an overflow of region ids in watershed partitioning
2016-01-21 13:21:03 -05:00
Bill Bierman
e49017ac63 Detect, log and fail in the event of an overflow of region ids in watershed partitioning 2016-01-21 07:07:40 -10:00
Ben Hymers
41de583d97 Merge pull request #166 from grahamboree/rule_of_three
Fixed rule of 3 violations
2016-01-21 15:20:59 +00:00
Graham Pentheny
b7a83e0afb Fixed rule of 3 violations in many places.
* Added virtual qualifier to a few destructors in subclasses.
* Removed a few empty destructors that didn't need to be explicitly defined.
* Fixed a few typos
* Removed unnecessary empty virtual destructors in some classes with parent's who derrived from a class with a virtual destructor
2016-01-20 11:57:32 -05:00
Graham Pentheny
43a3a0104a Merge pull request #165 from wbierman/master
Change if to else-if to avoid unnecessary comparison
2016-01-19 17:08:03 -05:00
Bill Bierman
92bc6ce5bd Change if to else-if to avoid unnecessary comparison 2016-01-19 11:34:04 -10:00
Graham Pentheny
451c87b687 Merge pull request #160 from Janiels/settings-presets
Add settings storage to geometry sets
2016-01-18 15:58:21 -05:00
Jakob Botsch Nielsen
a31da928ba Add settings storage to geometry sets
This adds the ability for geometry sets to store build settings that can
be automatically applied when they are loaded. This should allow sharing
of .gset files to demonstrate problems with certain settings on certain
files. It also allows people to diagnose problems more easily by being
able to dump their own triangle meshes and settings and load them in the
demo, with all of its visualization options. .gset files can be created
from the current mesh and settings by pressing the 9 key, which will
generate it in the same folder as the input mesh.

Also converts more of the demo to use STL.
2016-01-17 20:31:09 +01:00
Graham Pentheny
f8d6d3976d Merge pull request #158 from recastnavigation/allocators-use-size-t
Use size_t for rcAlloc and dtAlloc
2016-01-15 01:03:41 -05:00
Graham Pentheny
d873a73853 Merge pull request #159 from recastnavigation/readme-issue-stats-badges
Add Issue Stats badges to README.md
2016-01-15 00:38:12 -05:00
Ben Hymers
dd02c843a1 Merge pull request #157 from recastnavigation/fix-multiple-buildcontext-definition
Fix possible compile/link error with multiple BuildContext definitions
2016-01-15 00:43:14 +00:00
Ben Hymers
5d58cf40c1 Add Issue Stats badges to README.md
The readme was looking lonely after the BitDeli badge was taken away. Here are some nice badges to replace it, which also helpfully show how active a project this has become! They show recent average time to close issues and PRs.
2016-01-15 00:40:33 +00:00
Ben Hymers
a4a97dc03f Merge pull request #156 from recastnavigation/hymerman-remove-bitdeli-badge
Remove BitDeli badge from README.md
2016-01-15 00:37:46 +00:00
Ben Hymers
551d1b250e Use size_t for rcAlloc and dtAlloc
This was already partly done by @cexikitin in #65, I'm just finishing it
off in their absence!

Closes #65
2016-01-15 00:36:18 +00:00
Ben Hymers
f117bf4a91 Fix possible compile/link error with multiple BuildContext definitions
There is a class and a struct called BuildContext in two different files,
one .h and one .cpp. Depending on how the user structures their program,
it's possible that this would cause a compile or link error, as seems to
have happened in #44. I've just renamed the struct to get around this.

Fixes #44
2016-01-14 23:57:48 +00:00
Ben Hymers
f22f431a90 Remove BitDeli badge from README.md
It appears that BitDeli is defunct; their website has had a banner about a change in the GitHub API for a long time, which is a dead link to a blog article, and none of the example stats have been updated for years. Let's just remove it!
2016-01-14 23:43:19 +00:00
Jakob Botsch Nielsen
0143337a64 Merge pull request #154 from Janiels/fix-detail-unsampled-heights
Increase recover radius for unsampled heights
2016-01-14 22:18:43 +01:00
Jakob Botsch Nielsen
b99d62047b Increase recover radius for unsampled heights
When the detail mesh sampling sees an unset height it previously tried
to recover by looking for heights of neighbors. When the heightfield was
not eroded this recovery would fail since the contour simplification
could mean that the nearest valid cell was further away than a neighbor.
We now walk adjacent cells in a spiral to find a height and do this
depending on the max simplification error.

Fix #153
2016-01-14 19:20:43 +01:00