This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 10140 for ps


Ignore:
Timestamp:
08/31/11 00:29:03 (13 years ago)
Author:
ben
Message:

Fixes promoted entities dropping from control groups, based on patch from gruby. Fixes #859.

Location:
ps/trunk/binaries/data/mods/public
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/gui/session/selection.js

    r9745 r10140  
    234234
    235235/**
    236  * Update selection if some selected entities was renamed
     236 * Update selection if some selected entities were renamed
    237237 * (in case of unit promotion or finishing building structure)
    238238 */
    239239EntitySelection.prototype.checkRenamedEntities = function()
    240240{
    241     var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities", true);
     241    var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities");
    242242    if (renamedEntities.length > 0)
    243243    {
     
    393393EntityGroupsContainer.prototype.update = function()
    394394{
     395    this.checkRenamedEntities();
    395396    for each (var group in this.groups)
    396397    {
     
    408409}
    409410
     411/**
     412 * Update control group if some entities in the group were renamed
     413 * (in case of unit promotion or finishing building structure)
     414 */
     415EntityGroupsContainer.prototype.checkRenamedEntities = function()
     416{
     417    var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities");
     418    if (renamedEntities.length > 0)
     419    {
     420        for each (var group in this.groups)
     421        {
     422            var addToGroup = [];
     423            for each (var renamedEntity in renamedEntities)
     424            {
     425                if (renamedEntity.entity in group.ents)
     426                {
     427                    group.removeEnt(renamedEntity.entity);
     428                    addToGroup.push(renamedEntity.newentity);
     429                }
     430            }
     431            group.add(addToGroup);
     432        }
     433    }
     434}
     435
    410436var g_Groups = new EntityGroupsContainer();
  • ps/trunk/binaries/data/mods/public/gui/session/session.js

    r9726 r10140  
    180180    else
    181181        getGUIObjectByName("resourcePop").textcolor = "white";
     182       
     183    // Clear renamed entities list
     184    Engine.GuiInterfaceCall("ClearRenamedEntities", {});
    182185}
    183186
  • ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js

    r10007 r10140  
    103103};
    104104
    105 GuiInterface.prototype.GetRenamedEntities = function(player, clearList)
    106 {
    107     var result = this.renamedEntities;
    108     if (clearList)
    109         this.renamedEntities = [];
    110     return result;
     105GuiInterface.prototype.GetRenamedEntities = function(player)
     106{
     107    return this.renamedEntities;
     108};
     109
     110GuiInterface.prototype.ClearRenamedEntities = function(player)
     111{
     112    this.renamedEntities = [];
    111113};
    112114
     
    669671    "GetExtendedSimulationState": 1,
    670672    "GetRenamedEntities": 1,
     673    "ClearRenamedEntities": 1,
    671674    "GetEntityState": 1,
    672675    "GetTemplateData": 1,
Note: See TracChangeset for help on using the changeset viewer.