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

Use qualified name lookup with has_artifact_with() calls #40247

Merged

Conversation

kevingranade
Copy link
Member

Summary

SUMMARY: None

Purpose of change

LGTM reports that these invocations are problematic specifically when recalc_sight_limits() is invoked from the player constructor and its subclass constructors. Specifically when called from the npc constructor, this is actually dispatching to Character::has_artifact_with() instead of npc::has_artifact_with(), which is not normally expected.

Describe the solution

Use qualified name lookup to make it clear that Character::has_artifact_with() is being called.

Describe alternatives you've considered

I looked into refactoring this in such a way that we could call npc::has_artifact_with() when called from the npc constructor, but I could not find a way to do it that wasn't terribly invasive and/or unclear.

Testing

Arrange to spawn a NPC with a clairvoyance artifact and...?
I expect LGTM to report the removal of an alert.

@lgtm-com
Copy link

lgtm-com bot commented May 6, 2020

This pull request fixes 1 alert when merging 2a6f66f into 3fc82b4 - view on LGTM.com

fixed alerts:

  • 1 for Virtual call from constructor or destructor

@ZhilkinSerg ZhilkinSerg merged commit 3943971 into CleverRaven:master May 6, 2020
@kevingranade kevingranade deleted the qualified-artifact-lookup branch June 28, 2020 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants