Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1915 closed enhancement (fixed)

[PATCH] display the current number of garrisoned units when trying to garrison more units

Reported by: mimo Owned by: leper
Priority: Should Have Milestone: Alpha 14
Component: Core engine Keywords: patch
Cc: Patch:

Description

When garrisoning units, there is no convenient way to know what is the capacity of the building and how many units are already garrisoned. Presently, we have to select the building we want to garrison in (so losing our units selection) and then reselect the units. Not really practical if not in the same portion of the map. Here is a simple patch to display a tooltip with these information when we are about to garrison units.

Attachments (3)

garrisonCapacity.diff (2.5 KB ) - added by mimo 11 years ago.
garrisonCapacity-v2.diff (2.7 KB ) - added by mimo 11 years ago.
garrisonCapacity-v3.diff (3.7 KB ) - added by mimo 11 years ago.

Download all attachments as: .zip

Change History (14)

by mimo, 11 years ago

Attachment: garrisonCapacity.diff added

comment:1 by mimo, 11 years ago

Keywords: patch review garrison added

comment:2 by Kieran P, 11 years ago

Keywords: garrison removed
Milestone: BacklogAlpha 14
Type: defectenhancement

comment:3 by alpha123, 11 years ago

This looks very good. Two minor things:

  • The current message is very verbose, it would be great if you changed it to something like "Current garrison: 5/20" which is much easier to understand at a glance.
  • A nice extra feature would be to make either the numbers or the whole tooltip orange if the building is full. That way it's easy to tell where you can or can't garrison.

comment:4 by mimo, 11 years ago

OK for these two changes. Here is a modified version of the patch.

comment:5 by alpha123, 11 years ago

Excellent. This looks good, although there are 2 very minor issues:

  • In English there is no space between a colon and the word before it, so the message should be "Current garrison: 0/20" instead of the "Current garrison : 0 / 20" (which is the current message). Just a minor grammatical thing.
  • tooltip = "[color=\"orange\"]" + tooltip; should have an extra + "[/color]"; so that the tags are properly formed (each opening tag should have a matching end one). The parser seems to accept it anyway however.

Also, I noticed that this only appears when you hold Ctrl to garrison, not when using the garrison button in the unit commands panel or when setting a rally point. Both of those should display the current/max capacity as well.

comment:6 by mimo, 11 years ago

You are right about the missing color. That's strange that the parser accept it. For the english, I trust you. So I've just replaced the patch by a corrected version.

For the garrison button, I never use it, so I just forget it. I can try to implement also something here. For the rally point, what do you mean exactly ?

by mimo, 11 years ago

Attachment: garrisonCapacity-v2.diff added

comment:7 by mimo, 11 years ago

In fact, the garrison button change was trivial. It is now included.

comment:8 by mimo, 11 years ago

And a last version with the rally point also included

by mimo, 11 years ago

Attachment: garrisonCapacity-v3.diff added

comment:9 by alpha123, 11 years ago

I tested it, looked over the code, and this seems ready to commit. Nice work. :)

comment:10 by leper, 11 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 13361:

Display number of garrisoned units when trying to garrison. Patch by mimo. Fixes #1915.

comment:11 by leper, 11 years ago

Keywords: review removed

Thanks for the patch.

Note: See TracTickets for help on using tickets.