| 411 | /** |
| 412 | * Update control groups if some entities in them was renamed |
| 413 | * (in case of unit promotion or finishing building structure) |
| 414 | */ |
| 415 | EntityGroupsContainer.prototype.checkRenamedEntities = function() |
| 416 | { |
| 417 | var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities", true); |
| 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 | |