#3113 closed enhancement (fixed)
[PATCH] Provide information about carried resources of a selection
Reported by: | Kalle Richter | Owned by: | Imarok |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
It'd be nice to be an overview of which resources (and eventually how much of it) is carried in sum by a selection of units. This would serve to avoid sending a group of units carrying a valuable amount of resources of one type to collect another type and thus dropping the carried resources.
Attachments (9)
Change History (30)
comment:1 by , 9 years ago
Component: | Core engine → UI & Simulation |
---|---|
Keywords: | simple added |
comment:2 by , 9 years ago
comment:3 by , 8 years ago
Owner: | set to |
---|
by , 8 years ago
Attachment: | total_carried_resources_v1.patch added |
---|
Shows the carried resources of the whole selection as a tooltip of the total number of units in the selection
comment:4 by , 8 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
comment:5 by , 8 years ago
Summary: | Provide information about carried resources of a selection → [PATCH] Provide information about carried resources of a selection |
---|
by , 8 years ago
Attachment: | total_carried_resources_v1.1.patch added |
---|
used BARTER_RESOURCES instead of defining it again
comment:6 by , 8 years ago
Keywords: | simple review removed |
---|
- As getCostComponentDisplayName returns an icon, then concatenation is ok with i != 3.
- You copy & pasted that code from
selection_panels.js
. Better move that code to a function and use that. getCostComponentDisplayName
should be renamed, as it returns an icon, not names. Can be done in a separate commit.
follow-up: 9 comment:8 by , 8 years ago
Replying to Lionkanzen:
Talk me if you need a new icon, guys.
Completely unrelated, but the fishing net was discussed to get a new icon (the one that looks like a spooky ghost). Might want to ask mimo / sanderd17 / forum about further opinion.
comment:9 by , 8 years ago
Replying to elexis:
Replying to Lionkanzen:
Talk me if you need a new icon, guys.
Completely unrelated, but the fishing net was discussed to get a new icon (the one that looks like a spooky ghost). Might want to ask mimo / sanderd17 / forum about further opinion.
Sorry, but I don't know if you guys needs a icons, for the description of the problem may be need symbol ( capacity symbol like a cart) isn't my intention Elexis bother anyone here. Ok this is the last time. And sorry too much.
comment:10 by , 8 years ago
No problem Lionkanzen! We appreciate your offers. Better ask and get rejected rather than not asking when we could actually use your help.
For this ticket we use the existing food / wood / metal / stone icons. I will ask mimo if we could use an improvement of http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/art/textures/ui/session/portraits/technologies/fishing_net.png
follow-up: 12 comment:11 by , 8 years ago
Small comment on the code: you should try to avoid relying on the knowledge that there are 4 resources, and they are called these 4 names. If we ever want to add or remove a resource, it will already be a PITA to search all the places where the names are used. So better not add new places like these.
comment:12 by , 8 years ago
Replying to sanderd17:
Small comment on the code: you should try to avoid relying on the knowledge that there are 4 resources, and they are called these 4 names. If we ever want to add or remove a resource, it will already be a PITA to search all the places where the names are used. So better not add new places like these.
Where in the patch do I rely on the knowledge there are 4 resources?
by , 8 years ago
Attachment: | total_carried_resources_v1.4.1.patch added |
---|
Updated to the new revision
comment:14 by , 8 years ago
by , 8 years ago
Attachment: | total_carried_resources_v1.6.patch added |
---|
rename getCostComponentDisplayName
to getCostComponentDisplayIcon
comment:16 by , 8 years ago
Keywords: | review added |
---|
comment:17 by , 8 years ago
Keywords: | review removed |
---|
- 2 revisions changed that code, the patch doesn't apply anymore
- 369-372 can be merged into a single line using
totalResourcesCarried[carrying.type] = (totalResourcesCarried[carrying.type] || 0) + carrying.amount
- the
substr
call is ugly and could be replaced withtrim'. Better avoid adding that unneeded space in the first place and replace the whole loop, if and trimming with
Object.keys(totalResourcesCarried).map(res => getCostComponentDisplayIcon(res) + totalResourcesCarried[res]).join(",")` - this allows allows to init
totalResourcesCarried
to{}
immediately and removing theif ( totalResourcesCarried)
check .length !== 0
only needs!= 0
by , 8 years ago
Attachment: | total_carried_resources_v1.7.1.patch added |
---|
followed the suggestions of comment:17
comment:18 by , 8 years ago
Keywords: | review added |
---|
comment:20 by , 8 years ago
Keywords: | review removed |
---|
Thanks for the patch. I changed few characters:
-whitespace around Object.keys
-length != 0
-> length
-str
-> tooltip
Your code assumes there will be only one type of resource carried per unit. Since thats actually the case, likely won't change soon and if it would, it would be easy to identify by searching for resourceCarrying
, it is acceptable.
You already have that info in the tooltips of the unit icons of the central panel. I don't know if that is what you wanted, or if this ticket is specifically to add the sum on the different groups ? which I'm not sure it is that useful :-)