Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define dtAssert and rcAssert as DAEMON_ASSERT #130

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@illwieckz
Copy link
Member

illwieckz commented Oct 24, 2018

The idea is to define dtAssert and rcAssert as DAEMON_ASSERT and to patch Detour/Recast to reuse those definitions if already defined. If it works and if it's OK, I'll try to upstream the Detour/Recast patch so we can drop our custom recastnavigation fork.

See DaemonEngine/recastnavigation#1

@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Oct 25, 2018

Defining the assert this way won't work. It worked for crunch decompression because it was a header-only library. Recast has its own .cpp files, each one of which must have the assert definition supplied somehow when it is built.

The normal way to add a #define without editing the code is to use compiler flags. But this is also not so simple to apply since DAEMON_ASSERT will not be defined without including Daemon headers.

@cmf028

This comment has been minimized.

Copy link
Contributor

cmf028 commented Oct 25, 2018

The latest recast/detour allow the setting of custom failure functions (used internally by dtAssert/rcAssert). We should probably use those.

See rcAssertFailSetCustom and dtAssertFailSetCustom.

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Oct 25, 2018

oh nice !

so do I just have to do something like that:

#define dtAssertFailSetCustom DAEMON_ASSERT
#define rcAssertFailSetCustom DAEMON_ASSERT

and rebase recastnavigation on upstream?

or is there more to do?

@cmf028

This comment has been minimized.

Copy link
Contributor

cmf028 commented Oct 25, 2018

A bit different than that.

Take a look at DetourAssert.h and RecastAssert.h.

You should:

  1. Create a function with signature void (dtAssertFailFunc)(const char* expression, const char* file, int line);
  2. Have that function use DAEMON_ASSERT_CALLSITE_HELPER from Assert.h using the function's arguments.
  3. Call dtAssertFailSetCustom from BotSetupNav in bot_load.cpp using the function you created as the argument.
@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Oct 29, 2018

I'm not sure to really understand how to do it, at all ^_^

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 10, 2019

closing it as I don't know yet how to do it, no need to keep it open forever.

@cmf028 do you know how to do it?

@illwieckz illwieckz closed this Mar 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.