Skip to content

Improve: [Refactor] remove unneeded (and dangerously named) local variable#5464

Merged
SlySven merged 2 commits intoMudlet:developmentfrom
SlySven:Refactor_removeUnneededAndDangerouslyNamedLocalVariable
Oct 9, 2021
Merged

Improve: [Refactor] remove unneeded (and dangerously named) local variable#5464
SlySven merged 2 commits intoMudlet:developmentfrom
SlySven:Refactor_removeUnneededAndDangerouslyNamedLocalVariable

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Sep 29, 2021

Brief overview of PR changes/additions

It turns out that the variable concerned, __Pick is very badly named (as symbols containing a double underscore or an underscore and followed by an upper-case letter are explicitly reserved, e.g. see: https://stackoverflow.com/a/1449301/4805858 )

Fortunately, it isn't needed and there is no need to pass the class member it copies via an argument to the drawRoom(...) method in the T2DMap class as that can use the class value directly quite safely - as it never modifies it.

Motivation for adding to Mudlet

I came across this as I was starting to look at cleaning up the 2D Mapper code to see if I could make some changes to improve the map label code - I was just reviewing all the bool flags in the T2DMap that effectively form various state machines for different operations...

Signed-off-by: Stephen Lyons slysven@virginmedia.com

It turns out that the variable concerned, `__Pick` is a very badly named
(as symbols containing a double underscore or an underscore and followed by
an upper-case letter are explicitly reserved, e.g. see:
https://stackoverflow.com/a/1449301/4805858 )

Fortunately, it isn't needed and there is no need to pass the class member
it is a copy of via the `drawRoom(...)` method in the `T2DMap` class as
that can use the class value directly quite safely - as it never modifies
it.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven requested a review from a team as a code owner September 29, 2021 20:29
@SlySven SlySven requested a review from a team September 29, 2021 20:29
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Sep 29, 2021

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Sep 30, 2021

This PR needs to be updated with latest development code to pull in the new mandatory Lua tests - would you be able to do that?

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Oct 1, 2021

This PR needs to be updated with latest development code to pull in the new mandatory Lua tests - would you be able to do that?

Well it doesn't touch anything Lua - but i can see that that one check has stalled on it - so let me just pull in those changes...

…NamedLocalVariable

Needed to pull in development branch changes that include a Lua testing
framework.

Signed-off by: Stephen Lyons <slysven@virginmedia.com>
@vadi2 vadi2 assigned SlySven and unassigned vadi2 Oct 9, 2021
@SlySven SlySven changed the title Refactor: remove unneeded (and dangerously named) local variable Improve: [Refactor] remove unneeded (and dangerously named) local variable Oct 9, 2021
@SlySven SlySven merged commit f3afe4b into Mudlet:development Oct 9, 2021
@SlySven SlySven deleted the Refactor_removeUnneededAndDangerouslyNamedLocalVariable branch October 9, 2021 11:38
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