Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#1659 closed enhancement (fixed)

[PATCH] Insufficient population capacity tooltip

Reported by: zoot Owned by: zoot
Priority: Nice to Have Milestone: Alpha 13
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Description of the feature:

When you've added a training order to the production queue, and there aren't sufficient population capacity for the order to commence, hovering over the production icon in the queue will show the amount of capacity missing (so you can determine at a glance how many houses you need to build etc.)

(Feel free to come up with a better wording than "Insufficient population capacity".)

Also, the icon will blink orange instead of just being green.

See this thread for images and animation.

Attachments (2)

queuecapacitytweak2.diff (4.4 KB ) - added by zoot 12 years ago.
queuecapacitytweak3.diff (5.1 KB ) - added by zoot 12 years ago.

Download all attachments as: .zip

Change History (13)

by zoot, 12 years ago

Attachment: queuecapacitytweak2.diff added

by zoot, 12 years ago

Attachment: queuecapacitytweak3.diff added

comment:1 by zoot, 12 years ago

Updated patch per Deiz's suggestions:

  • Move population counter blinking into onSimulationUpdate().
  • Use "colour: r g b a" sprite instead of defining a new one in sprites.xml.
  • Fix as many indentation errors as possible.
Last edited 12 years ago by zoot (previous) (diff)

comment:2 by leper, 12 years ago

Keywords: patch review added
Summary: Insufficient population capacity tooltip[PATCH] Insufficient population capacity tooltip

Nice to see you using trac :-). Just for future patches: Please take a look at SubmittingPatches.

comment:3 by Deiz, 12 years ago

Keywords: review removed
Milestone: BacklogAlpha 12

There's one small issue with making it all run on simulation update: Single-player simulation turns are 200ms, so the indicators will be orange for either 400ms or 600ms. Shouldn't matter much in multiplayer since its turn rate is 500ms

In any case, the production queue blinking requires knowledge of the particular selected entity, and I think it'd be far uglier to cram that code into session.js's onTick than it is to deal with some minor visual inconsistencies.

comment:4 by Kieran P, 11 years ago

Milestone: Alpha 12Alpha 13

Moving to next release because changes are required before this can be completed.

comment:5 by zoot, 11 years ago

I've cleaned this up a bit:

https://github.com/zootzoot/0ad/compare/insufficient-pop-capacity-tooltip (diff)

The tooltip now mirrors the "insufficient resources" tooltip, with icon for the population count, as seen below. Also, I've dropped the 'blinking' feature which wasn't ready for prime-time. I'll add that in separate ticket if I get it to work.

http://i.imgur.com/Sn0pk7f.png

comment:6 by zoot, 11 years ago

Keywords: review added
Owner: set to zoot
Status: newassigned

comment:7 by leper, 11 years ago

Why don't you return 0 on success and the number of needed slots (positive) on failure? That way you can just have item.slots (maybe rename to neededSlots).

comment:8 by historic_bruno, 11 years ago

It wasn't introduced by this patch, but there's currently a weird redundant test for item.unitTemplate on lines 548 and 552. Also the added slots property should be documented in the comment block around line 40-49.

in reply to:  8 comment:9 by zoot, 11 years ago

Replying to leper:

Why don't you return 0 on success and the number of needed slots (positive) on failure? That way you can just have item.slots (maybe rename to neededSlots).

Done.

Replying to historic_bruno:

It wasn't introduced by this patch, but there's currently a weird redundant test for item.unitTemplate on lines 548 and 552.

Done.

Also the added slots property should be documented in the comment block around line 40-49.

Done.

New diff: https://github.com/zootzoot/0ad/compare/insufficient-pop-capacity-tooltip.diff

Last edited 11 years ago by zoot (previous) (diff)

comment:10 by leper, 11 years ago

Resolution: fixed
Status: assignedclosed

In 13198:

Add insufficient population count to production queue tooltip. Patch by zoot. Fixes #1659.

comment:11 by leper, 11 years ago

Keywords: review removed

Thanks for the patch.

Note: See TracTickets for help on using tickets.