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

Stores alphabetical sorting #345

Merged
merged 3 commits into from
Apr 30, 2015

Conversation

AndySky21
Copy link
Contributor

Fixes #185 for stores box.

The bulk of this small change was to sort stores by alphabetical order according to translated names, instead of english strings.
This meant removing the ID splitting as well as hyphen/space replacing, as the ID is not considered for the test.
Also changed:
1. line 800: as the original english string is no longer necessary in the iteration, k takes the value of translated string. k is then used for alphabetical comparison (as before) with the right value.
2. line 816: removed the test on curPrev variable. Items already listed have been placed in alphabetical order, so there is no need to check whether each item actually follows value of control variable.
@PanArnaud
Copy link
Contributor

+1

@@ -797,6 +797,7 @@ var Room = {
$SM.set('stores["'+k+'"]', 0);
}

k = _(k);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer to use a different variable here, since k is used for object lookups and stuff. If someone moves this line, or adds more lookups below it (thinking it's fine, 'cause we do it above), things will break unexpectedly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it right now.
However, I did the same for outside.js (in that case it's a variable called "name"). I saw that you merged my change, but perhaps I should have used something different there, too, for consistency. I'll give it a try.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that one was being used for lookups, was it? If so, I should
have caught it too...

On Thu, Apr 30, 2015 at 10:48 AM Andrea Rendine notifications@github.com
wrote:

In script/room.js
#345 (comment)
:

@@ -797,6 +797,7 @@ var Room = {
$SM.set('stores["'+k+'"]', 0);
}

  •       k = _(k);
    

I will fix it right now.
However, I did the same for outside.js (in that case it's a variable
called "name"). I saw that you merged my change, but perhaps I should have
used something different there, too, for consistency. I'll give it a try.


Reply to this email directly or view it on GitHub
https://github.com/doublespeakgames/adarkroom/pull/345/files#r29435743.

"k" still refers to the English string, while "lk" carries the translated value.
@AndySky21
Copy link
Contributor Author

Variable name fixed (k into lk, what a fantasy). Also posted #349 for "name" variable in outside.js. No, "name" is not used for lookups, now, but if in future changes updateVillageRow() is extended, it could be useful to split original and translated names.

@@ -797,6 +797,7 @@ var Room = {
$SM.set('stores["'+k+'"]', 0);
}

lk = _(k);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs var or you're polluting the global scope. Polluting the global scope is bad.

Working in a hurry is bad.
@AndySky21
Copy link
Contributor Author

Fixed var. Sorry for the mess.

@Continuities
Copy link
Contributor

No problem at all! Thanks for helping out.

Continuities added a commit that referenced this pull request Apr 30, 2015
@Continuities Continuities merged commit d2bd08d into doublespeakgames:master Apr 30, 2015
@AndySky21
Copy link
Contributor Author

Thank you for the invaluable job in developing ADR!

@AndySky21 AndySky21 deleted the stores-az-sorting branch May 4, 2015 14:23
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.

Translation and lists
3 participants