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

entity handles - design question #95

Closed
jmkinzer opened this issue Oct 25, 2016 · 2 comments
Closed

entity handles - design question #95

jmkinzer opened this issue Oct 25, 2016 · 2 comments
Labels

Comments

@jmkinzer
Copy link

I've been reviewing the code a bit and the use of entity handles (e.g. as appears in hRequest::entity). If I understand well then (for example) the following code:

hRequest someRequest;
...
SK.GetEntity(someRequest.entity(1))

Could be restated as:

...
SK.GetEntity(SK.GetEntity(someRequest.entity(0))->point[0]);

Where the latter is technically less brittle as it doesn't assume where points are stored in the entity indices. (Of course it's slower and unwieldy...)

But if there were hypothetical helpers of the form

Entity& hRequest::point(int N) const
Entity& hRequest::normal(int N) const
...

The above becomes simply:
someRequest.point(0)

Is my basic understanding correct here? Is there a reason using entity offsets as in the first form is preferred?

Thanks

@jwesthues
Copy link
Member

It's ugly that we don't use such helpers. It's not brittle, since that mapping can't ever change without breaking all nontrivial saved files.

@jmkinzer
Copy link
Author

OK - sounds like I understand things properly, which was my main concern. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants