#3518 closed task (fixed)
[PATCH] Summary screen code style
Reported by: | bb | Owned by: | elexis |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 20 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
The attached patch improves the code style from the javascript files in /public/gui/summary.
Attachments (4)
Change History (12)
by , 9 years ago
Attachment: | ticket3518_summarystyle.diff added |
---|
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
Milestone: | Backlog → Alpha 20 |
---|---|
Type: | defect → task |
comment:3 by , 9 years ago
Priority: | Should Have → If Time Permits |
---|
by , 8 years ago
Attachment: | ticket3518_summarystyle_2.diff added |
---|
New version: changed global params into g_GlobalSomething
comment:5 by , 8 years ago
Component: | Core engine → UI & Simulation |
---|---|
Keywords: | review removed |
Priority: | If Time Permits → Nice to Have |
Thanks for the patch!
Before the ticket is closed, someone should replace the deprecated for-each with for-in. (For-of probably doesn't work mostly as it loops over objects).
Capital letters for constant globals
TLDR: We use g_Foo
for GUI code.
Since we had some discussions recently about using CAPS
or g_Foo
for global consts:
Many JS sites recommend using capitals only for all globals (no matter if const or variable). This is not reflected in our wiki:Coding_Conventions:
global variables should be named with a g_ prefix.
so when following them strictly, they should be renamed to g_Foo
or the documentation updated.
By searching for "const" in all "js" files of the gui directory, we can see that most GUI files meanwhile use the g_Foo
naming. So it would be more coherent for the summary screen code to use it too. Hence the commit.
by , 8 years ago
Attachment: | ticket3518_summarystyle_3.diff added |
---|
deprecate the for each to for in and treat "resourcestotal" the same as "unitstotal" and "buildingstotal"
comment:6 by , 8 years ago
Keywords: | review added |
---|
by , 8 years ago
Attachment: | ticket3518_summarystyle_3.1.diff added |
---|
splitted from last patch: 2* foreach deprecated
comment:8 by , 8 years ago
Keywords: | simple review removed |
---|
Thanks for the patches.
Notice there was another for-each loop in another file. Also the variable names were wrong as we don't loop over the amount of resources anymore, but over the resource types.
Some spaces and let to var changes