Ticket #1989: selection_limitation.diff

File selection_limitation.diff, 3.8 KB (added by sanderd17, 11 years ago)
  • binaries/data/config/default.cfg

     
    263263hotkey.selection.group.select.9 = 9
    264264hotkey.selection.group.save.9 = "Ctrl+9"
    265265hotkey.selection.group.add.9 = "Shift+9"
     266hotkey.selection.part1 = "Num1" ; select one part of a selection
     267hotkey.selection.part2 = "Num2"
     268hotkey.selection.part3 = "Num3"
     269hotkey.selection.part4 = "Num4"
     270hotkey.selection.part5 = "Num5"
     271hotkey.selection.part6 = "Num6"
     272hotkey.selection.part7 = "Num7"
     273hotkey.selection.part8 = "Num8"
     274hotkey.selection.part9 = "Num9"
    266275
    267276; > SESSION CONTROLS
    268277hotkey.session.kill = Delete                ; Destroy selected units
  • binaries/data/mods/public/gui/manual/intro.txt

     
    6666Ctrl + 1 (and so on up to Ctrl + 0): Create control group 1 (to 0) from the selected units/buildings
    67671 (and so on up to 0): Select the units/buildings in control group 1 (to 0)
    6868Shift + 1 (to 0): Add selected units/buildings to control group 1 (to 0)
     69Numpad 1 (and so on, up to Numpad 9): Restrict the selection to the number you pushed (f.e. 4 units if you pressed '4'). Hold Shift to multiply it by five (f.e. 20 units if you pressed Shift+4)
    6970Ctrl + F5 (and so on up to F8): Mark the current camera position, for jumping back to later.
    7071F5, F6, F7, and F8: Move the camera to a marked position. Jump back to the last location if the camera is already over the marked position.
    7172Z, X, C, V, B, N, M: With training buildings selected. Add the 1st, 2nd, ... unit shown to the training queue for all the selected buildings.
  • binaries/data/mods/public/gui/session/input.js

     
    10941094                        prevHotkey = ev.hotkey;
    10951095                    }
    10961096                }
     1097                if (ev.hotkey.indexOf("selection.part") == 0 )
     1098                {
     1099                    var num = +ev.hotkey.charAt(ev.hotkey.length - 1);
     1100                    performSelectionPart(num);
     1101                }
    10971102                break;
    10981103        }
    10991104        break;
     
    18571862    }
    18581863}
    18591864
     1865// Perform part the selection
     1866function performSelectionPart(number)
     1867{
     1868    if( Engine.HotkeyIsPressed("session.queue"))
     1869    {
     1870        g_Selection.selectPart(number*5);   
     1871    }
     1872    else
     1873    {
     1874        g_Selection.selectPart(+number);
     1875    }
     1876}
     1877
    18601878// Performs the specified group
    18611879function performGroup(action, groupId)
    18621880{
  • binaries/data/mods/public/gui/session/selection.js

     
    213213}
    214214
    215215/**
     216 * Remove entities from selection until you have exactly 'number' left
     217 * Prefer to keep idle entities
     218 */
     219EntitySelection.prototype.selectPart = function(number)
     220{
     221    var ents = this.selected;
     222    var count = 0;
     223    var newSelection = {};
     224
     225    for each (var ent in ents)
     226    {
     227        var entState = GetEntityState(ent);
     228        // prefer idle entities
     229        if (entState && entState.unitAI && entState.unitAI.state == "INDIVIDUAL.IDLE")
     230        {
     231            newSelection[ent] = ents[ent];
     232            delete ents[ent];
     233
     234            if ( ++count >= number )
     235                break;
     236        }
     237    }
     238
     239    for each (var ent in ents)
     240    {
     241       
     242        if ( ++count > number )
     243            break;
     244        newSelection[ent] = ents[ent];
     245       
     246    }
     247
     248    this.reset();
     249    this.addList(newSelection);
     250}
     251
     252/**
    216253 * Update the selection to take care of changes (like units that have been killed)
    217254 */
    218255EntitySelection.prototype.update = function()