Changeset 25192

Timestamp:
Apr 5, 2021, 7:22:25 AM (3 years ago)
Author:
Freagarach
Message:

Allow to specify subunits on creation.

This basically does two things:

  • Allow turrets on moving entities (fixes serialisation in cmpPos).
  • Allow an entity to be present on another when the other is created.

That makes it basically a boiled down version of a prior patch, omitting the part where orders could be passed on.
This does allow e.g. ranged units on chariots that fire while the chariot moves.

Original diff by: @sanderd17
Redone by: @Stan
Differential revision: D1958
Comments by: @Alexandermb, @Angen, @bb, @Langbart, @Nescio, @Stan, @wraitii
Refs. #2577 by implementing the entity on platform case.

Location:
ps/trunk
Files:
12 edited

Legend:

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

    r25123 r25192  
    13221322
    13231323                if (allowedPlayersCheck([entState], ["Player"]))
    1324                     count += entState.turretHolder.turretPoints.filter(turretPoint => turretPoint.entity).length;
     1324                    count += entState.turretHolder.turretPoints.filter(turretPoint => turretPoint.entity).length;
    13251325                else
    13261326                    for (let turretPoint of entState.turretHolder.turretPoints)
     
    14441444        {
    14451445            if (entStates.every(entState => !entState.turretable ||
    1446                 entState.turretable.holder == INVALID_ENTITY))
     1446                entState.turretable.holder == INVALID_ENTITY ||
     1447                !entState.turretable.ejectable))
    14471448                return false;
    14481449
     
    14611462                "type": "leave-turret",
    14621463                "entities": entStates.filter(entState => entState.turretable &&
    1463                     entState.turretable.holder != INVALID_ENTITY).map(entState => entState.id)
     1464                    entState.turretable.holder != INVALID_ENTITY ||
     1465                    !entState.turretable.ejectable).map(entState => entState.id)
    14641466            });
    14651467        },
  • ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js

    r25191 r25192  
    392392    if (cmpTurretable)
    393393        ret.turretable = {
     394
    394395            "holder": cmpTurretable.HolderID()
    395396        };
  • ps/trunk/binaries/data/mods/public/simulation/components/Health.js

    r25089 r25192  
    135135    {
    136136        let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
    137         if (cmpUnitAI && (cmpUnitAI.IsIdle() ||
    138             cmpUnitAI.GetGarrisonHolder() != INVALID_ENTITY && !cmpUnitAI.IsTurret()))
     137        if (cmpUnitAI && cmpUnitAI.IsIdle())
    139138            regen += this.GetIdleRegenRate();
    140139    }
  • ps/trunk/binaries/data/mods/public/simulation/components/TurretHolder.js

    r25178 r25192  
    2020                "allowedClasses": points[point].AllowedClasses?._string,
    2121                "angle": points[point].Angle ? +points[point].Angle * Math.PI / 180 : null,
    22                 "entity": null
     22                "entity": null,
     23                "template": points[point].Template,
     24                "ejectable": "Ejectable" in points[point] ? points[point].Ejectable == "true" : true
    2325            });
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
    2465    }
    2566
     
    3879     * @return {boolean} - Whether the entity is allowed to occupy the specified turret point.
    3980     */
    40     AllowedToOccupyTurret(entity, turretPoint)
     81    AllowedToOccupyTurret(entity, turretPoint)
    4182    {
    4283        if (!turretPoint || turretPoint.entity)
     
    59100    CanOccupy(entity)
    60101    {
    61         return !!this.turretPoints.find(turretPoint => this.AllowedToOccupyTurret(entity, turretPoint));
     102        return !!this.turretPoints.find(turretPoint => this.AllowedToOccupyTurret(entity, turretPoint));
    62103    }
    63104
     
    69110     * @return {boolean} - Whether the occupation was successful.
    70111     */
    71     OccupyTurret(entity, requestedTurretPoint)
     112    OccupyTurret(entity, requestedTurretPoint)
    72113    {
    73114        let cmpPositionOccupant = Engine.QueryInterface(entity, IID_Position);
     
    79120            return false;
    80121
    81         if (this.OccupiesTurret(entity))
     122        if (this.OccupiesTurret(entity))
    82123            return false;
    83124
     
    85126        if (requestedTurretPoint)
    86127        {
    87             if (this.AllowedToOccupyTurret(entity, requestedTurretPoint))
     128            if (this.AllowedToOccupyTurret(entity, requestedTurretPoint))
    88129                turretPoint = requestedTurretPoint;
    89130        }
    90131        else
    91             turretPoint = this.turretPoints.find(turret => !turret.entity && this.AllowedToOccupyTurret(entity, turret));
     132            turretPoint = this.turretPoints.find(turret => !turret.entity && this.AllowedToOccupyTurret(entity, turret));
    92133
    93134        if (!turretPoint)
     
    122163     * @return {boolean} - Whether the occupation has succeeded.
    123164     */
    124     OccupyNamedTurret(entity, turretName)
    125     {
    126         return this.OccupyTurret(entity, this.turretPoints.find(turret => turret.name == turretName));
     165    OccupyNamedTurretPoint(entity, turretName)
     166    {
     167        return this.OccupyTurretPoint(entity, this.TurretPointByName(turretName));
     168    }
     169
     170    /**
     171     * @param {string} turretPointName - The name of the requested turret point.
     172     * @return {Object} - The requested turret point.
     173     */
     174    TurretPointByName(turretPointName)
     175    {
     176        return this.turretPoints.find(turret => turret.name == turretPointName);
    127177    }
    128178
     
    130180     * Remove the entity from a turret.
    131181     * @param {number} entity - The specific entity to eject.
     182
    132183     * @param {Object} turret - Optionally the turret to abandon.
    133184     *
    134      * @return {boolean} - Whether the entity was occupying a/the turret before.
    135      */
    136     LeaveTurret(entity, requestedTurretPoint)
     185     * @return {boolean} - Whether the entity .
     186     */
     187    LeaveTurret, requestedTurretPoint)
    137188    {
    138189        let turretPoint;
     
    143194        }
    144195        else
    145             turretPoint = this.turretPoints.find(turret => turret.entity == entity);
    146 
    147         if (!turretPoint)
     196            turretPoint = this.entity);
     197
     198        if (!turretPoint)
    148199            return false;
    149200
    150201        turretPoint.entity = null;
    151 
    152         let cmpPositionEntity = Engine.QueryInterface(entity, IID_Position);
    153         if (cmpPositionEntity)
    154             cmpPositionEntity.SetTurretParent(INVALID_ENTITY, new Vector3D());
    155202
    156203        Engine.PostMessage(this.entity, MT_TurretsChanged, {
     
    168215     * @return {boolean} - Whether the entity is positioned on a turret of this entity.
    169216     */
    170     OccupiesTurret(entity, requestedTurretPoint)
     217    OccupiesTurret(entity, requestedTurretPoint)
    171218    {
    172219        return requestedTurretPoint ? requestedTurretPoint.entity == entity :
    173             this.turretPoints.some(turretPoint => turretPoint.entity == entity);
     220            entity);
    174221    }
    175222
     
    178225     * @return {Object} - The turret this entity is positioned on, if applicable.
    179226     */
    180     GetOccupiedTurret(entity)
     227    GetOccupiedTurret(entity)
    181228    {
    182229        return this.turretPoints.find(turretPoint => turretPoint.entity == entity);
     
    187234     * @return {Object} - The turret this entity is positioned on, if applicable.
    188235     */
    189     GetOccupiedTurretName(entity)
    190     {
    191         let turret = this.GetOccupiedTurret(entity);
     236    GetOccupiedTurretName(entity)
     237    {
     238        let turret = this.GetOccupiedTurret(entity);
    192239        return turret ? turret.name : "";
    193240    }
     
    307354
    308355        for (let [turretPointName, entity] of this.initTurrets)
    309             if (!this.OccupyNamedTurret(entity, turretPointName))
     356        {
     357            let cmpTurretable = Engine.QueryInterface(entity, IID_Turretable);
     358            if (!cmpTurretable || !cmpTurretable.OccupyTurret(this.entity, turretPointName, this.TurretPointByName(turretPointName).ejectable))
    310359                warn("Entity " + entity + " could not occupy the turret point " +
    311360                    turretPointName + " of turret holder " + this.entity + ".");
     361
    312362
    313363        delete this.initTurrets;
     
    324374            if (!cmpTurretable)
    325375                continue;
    326             let currentPoint = this.GetOccupiedTurretName(entity);
     376            let currentPoint = this.GetOccupiedTurretName(entity);
    327377            cmpTurretable.LeaveTurret(true);
    328378            cmpTurretable.OccupyTurret(msg.newentity, currentPoint);
     
    335385    OnOwnershipChanged(msg)
    336386    {
    337         let entities = this.GetEntities();
    338         if (!entities.length)
     387        if (msg.to === INVALID_PLAYER)
     388        {
     389            this.EjectOrKill(this.GetEntities());
    339390            return;
    340 
    341         if (msg.to == INVALID_PLAYER)
    342             this.EjectOrKill(entities);
    343         else
    344             for (let entity of entities.filter(entity => !IsOwnedByMutualAllyOfEntity(entity, this.entity)))
     391        }
     392        for (let point of this.turretPoints)
     393        {
     394            // If we were created, create any subunits now.
     395            // This has to be done here (instead of on Init)
     396            // for Ownership ought to be initialised.
     397            if (point.template && msg.from === INVALID_PLAYER)
    345398            {
    346                 let cmpTurretable = Engine.QueryInterface(entity, IID_Turretable);
     399                this.CreateSubunit(point.name);
     400                continue;
     401            }
     402            if (!point.entity)
     403                continue;
     404            if (!point.ejectable)
     405            {
     406                let cmpTurretOwnership = Engine.QueryInterface(point.entity, IID_Ownership);
     407                if (cmpTurretOwnership)
     408                    cmpTurretOwnership.SetOwner(msg.to);
     409            }
     410            else if (!IsOwnedByMutualAllyOfEntity(point.entity, this.entity))
     411            {
     412                let cmpTurretable = Engine.QueryInterface(point.entity, IID_Turretable);
    347413                if (cmpTurretable)
    348414                    cmpTurretable.LeaveTurret();
    349415            }
     416
     417
    350418    }
    351419}
     
    366434                        "<data type='decimal'/>" +
    367435                    "</element>" +
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
    368446                    "<optional>" +
    369447                        "<element name='AllowedClasses' a:help='If specified, only entities matching the given classes will be able to use this turret.'>" +
  • ps/trunk/binaries/data/mods/public/simulation/components/Turretable.js

    r25162 r25192  
    3636
    3737/**
     38
     39
     40
     41
     42
     43
     44
     45
    3846 * @param {number} target - The entity ID to check.
    3947 * @return {boolean} - Whether we can occupy the turret.
     
    5159 * @param {number} target - The entity ID of the entity this entity is being turreted on.
    5260 * @param {string} turretPointName - Optionally the turret point name to occupy.
     61
     62
    5363 * @return {boolean} - Whether occupying succeeded.
    5464 */
    55 Turretable.prototype.OccupyTurret = function(target, turretPointName = "")
     65Turretable.prototype.OccupyTurret = function(target, turretPointName = "")
    5666{
    5767    if (!this.CanOccupy(target))
     
    5969
    6070    let cmpTurretHolder = Engine.QueryInterface(target, IID_TurretHolder);
    61     if (!cmpTurretHolder || !cmpTurretHolder.OccupyNamedTurret(this.entity, turretPointName))
     71    if (!cmpTurretHolder || !cmpTurretHolder.OccupyNamedTurret(this.entity, turretPointName))
    6272        return false;
    6373
    6474    this.holder = target;
     75
    6576
    6677    let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
     
    97108        return true;
    98109
     110
     111
     112
    99113    let pos = PositionHelper.GetSpawnPosition(this.holder, this.entity, forced);
    100114    if (!pos)
     
    102116
    103117    let cmpTurretHolder = Engine.QueryInterface(this.holder, IID_TurretHolder);
    104     if (!cmpTurretHolder || !cmpTurretHolder.LeaveTurret(this.entity))
     118    if (!cmpTurretHolder || !cmpTurretHolder.LeaveTurret))
    105119        return false;
    106120
     
    112126    if (cmpPosition)
    113127    {
     128
    114129        cmpPosition.JumpTo(pos.x, pos.z);
    115130        cmpPosition.SetHeightOffset(0);
     131
     132
     133
     134
    116135    }
    117 
    118     let cmpHolderPosition = Engine.QueryInterface(this.holder, IID_Position);
    119     if (cmpHolderPosition)
    120         cmpPosition.SetYRotation(cmpHolderPosition.GetPosition().horizAngleTo(pos));
    121136
    122137    let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
     
    139154
    140155    let cmpRallyPoint = Engine.QueryInterface(this.holder, IID_RallyPoint);
     156
     157
     158
     159
     160
    141161    if (cmpRallyPoint)
    142162        cmpRallyPoint.OrderToRallyPoint(this.entity, ["occupy-turret"]);
    143163
    144     delete this.holder;
     164    delete this.;
    145165    return true;
    146166};
     
    156176
    157177    let holder = this.holder;
    158     let currentPoint = cmpTurretHolder.GetOccupiedTurretName(this.entity);
     178    let currentPoint = cmpTurretHolder.GetOccupiedTurretName(this.entity);
    159179    this.LeaveTurret(true);
    160180    let cmpTurretableNew = Engine.QueryInterface(msg.newentity, IID_Turretable);
  • ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js

    r25164 r25192  
    35753575};
    35763576
    3577 UnitAI.prototype.GetGarrisonHolder = function()
    3578 {
    3579     if (!this.isGarrisoned)
    3580         return INVALID_ENTITY;
    3581 
    3582     let cmpGarrisonable = Engine.QueryInterface(this.entity, IID_Garrisonable);
    3583     return cmpGarrisonable ? cmpGarrisonable.HolderID() : INVALID_ENTITY;
    3584 };
    3585 
    35863577UnitAI.prototype.ShouldRespondToEndOfAlert = function()
    35873578{
  • ps/trunk/binaries/data/mods/public/simulation/components/tests/test_TurretHolder.js

    r25123 r25192  
    9292
    9393// Test visible garrisoning restrictions.
    94 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[0]), true);
    95 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[1]), true);
    96 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[2]), true);
    97 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[0]), true);
    98 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[1]), false);
    99 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[2]), true);
    100 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[0]), true);
    101 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[1]), false);
    102 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[2]), true);
    103 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[0]), true);
    104 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[1]), false);
    105 TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[2]), false);
     94TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[0]), true);
     95TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[1]), true);
     96TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(siegeEngineID, cmpTurretHolder.turretPoints[2]), true);
     97TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[0]), true);
     98TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[1]), false);
     99TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(archerID, cmpTurretHolder.turretPoints[2]), true);
     100TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[0]), true);
     101TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[1]), false);
     102TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(cavID, cmpTurretHolder.turretPoints[2]), true);
     103TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[0]), true);
     104TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[1]), false);
     105TS_ASSERT_EQUALS(cmpTurretHolder.AllowedToOccupyTurret(infID, cmpTurretHolder.turretPoints[2]), false);
    106106
    107107// Test that one cannot leave a turret that is not occupied.
    108 TS_ASSERT(!cmpTurretHolder.LeaveTurret(archerID));
     108TS_ASSERT(!cmpTurretHolder.LeaveTurret(archerID));
    109109
    110110// Test occupying a turret.
    111 TS_ASSERT(!cmpTurretHolder.OccupiesTurret(archerID));
    112 TS_ASSERT(cmpTurretHolder.OccupyTurret(archerID));
    113 TS_ASSERT(cmpTurretHolder.OccupiesTurret(archerID));
     111TS_ASSERT(!cmpTurretHolder.OccupiesTurret(archerID));
     112TS_ASSERT(cmpTurretHolder.OccupyTurret(archerID));
     113TS_ASSERT(cmpTurretHolder.OccupiesTurret(archerID));
    114114
    115115// We're not occupying a turret that we can't occupy.
    116 TS_ASSERT(!cmpTurretHolder.OccupiesTurret(archerID, cmpTurretHolder.turretPoints[1]));
    117 TS_ASSERT(!cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[1]));
    118 TS_ASSERT(!cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[0]));
    119 TS_ASSERT(cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[2]));
     116TS_ASSERT(!cmpTurretHolder.OccupiesTurret(archerID, cmpTurretHolder.turretPoints[1]));
     117TS_ASSERT(!cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[1]));
     118TS_ASSERT(!cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[0]));
     119TS_ASSERT(cmpTurretHolder.OccupyTurret(cavID, cmpTurretHolder.turretPoints[2]));
    120120
    121121// Leave turrets.
    122 TS_ASSERT(cmpTurretHolder.LeaveTurret(archerID));
    123 TS_ASSERT(!cmpTurretHolder.LeaveTurret(cavID, cmpTurretHolder.turretPoints[1]));
    124 TS_ASSERT(cmpTurretHolder.LeaveTurret(cavID, cmpTurretHolder.turretPoints[2]));
     122TS_ASSERT(cmpTurretHolder.LeaveTurret(archerID));
     123TS_ASSERT(!cmpTurretHolder.LeaveTurret, cmpTurretHolder.turretPoints[1]));
     124TS_ASSERT(cmpTurretHolder.LeaveTurret, cmpTurretHolder.turretPoints[2]));
  • ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Turrets.js

    r25123 r25192  
    8888TS_ASSERT(cmpTurretable.OccupyTurret(holder));
    8989TS_ASSERT_UNEVAL_EQUALS(cmpTurretHolder.GetEntities(), [turret]);
    90 TS_ASSERT(cmpTurretHolder.OccupiesTurret(turret));
     90TS_ASSERT(cmpTurretHolder.OccupiesTurret(turret));
    9191TS_ASSERT(cmpTurretable.LeaveTurret());
    9292TS_ASSERT_UNEVAL_EQUALS(cmpTurretHolder.GetEntities(), []);
     
    9999TS_ASSERT(cmpTurretable.OccupyTurret(holder));
    100100TS_ASSERT(cmpTurretableNew.LeaveTurret());
    101 let previousTurret = cmpTurretHolder.GetOccupiedTurretName(turret);
     101let previousTurret = cmpTurretHolder.GetOccupiedTurretName(turret);
    102102cmpTurretable.OnEntityRenamed({
    103103    "entity": turret,
    104104    "newentity": newTurret
    105105});
    106 let newTurretPos = cmpTurretHolder.GetOccupiedTurretName(newTurret);
     106let newTurretPos = cmpTurretHolder.GetOccupiedTurretName(newTurret);
    107107TS_ASSERT_UNEVAL_EQUALS(newTurretPos, previousTurret);
    108108TS_ASSERT(cmpTurretableNew.LeaveTurret());
  • ps/trunk/binaries/data/mods/public/simulation/helpers/Transform.js

    r25069 r25192  
    2727    }
    2828
     29
     30
     31
     32
     33
     34
     35
    2936    var cmpOwnership = Engine.QueryInterface(oldEnt, IID_Ownership);
    3037    var cmpNewOwnership = Engine.QueryInterface(newEnt, IID_Ownership);
     
    5966        cmpNewBuilderList.AddBuilders(cmpBuilderList.GetBuilders());
    6067
    61     var cmpUnitAI = Engine.QueryInterface(oldEnt, IID_UnitAI);
    62     var cmpNewUnitAI = Engine.QueryInterface(newEnt, IID_UnitAI);
    63     if (cmpUnitAI && cmpNewUnitAI)
    64     {
    65         let pos = cmpUnitAI.GetHeldPosition();
    66         if (pos)
    67             cmpNewUnitAI.SetHeldPosition(pos.x, pos.z);
    68         if (cmpUnitAI.GetStanceName())
    69             cmpNewUnitAI.SwitchToStance(cmpUnitAI.GetStanceName());
    70         if (cmpUnitAI.GetGarrisonHolder() != INVALID_ENTITY)
    71             cmpNewUnitAI.SetGarrisoned();
    72         cmpNewUnitAI.AddOrders(cmpUnitAI.GetOrders());
    73         if (cmpUnitAI.IsGuardOf())
    74         {
    75             let guarded = cmpUnitAI.IsGuardOf();
    76             let cmpGuard = Engine.QueryInterface(guarded, IID_Guard);
    77             if (cmpGuard)
    78             {
    79                 cmpGuard.RenameGuard(oldEnt, newEnt);
    80                 cmpNewUnitAI.SetGuardOf(guarded);
    81             }
    82         }
    83     }
    84 
    8568    let cmpPromotion = Engine.QueryInterface(oldEnt, IID_Promotion);
    8669    let cmpNewPromotion = Engine.QueryInterface(newEnt, IID_Promotion);
     
    9679        cmpNewResGatherer.SetLastCarriedType(cmpResGatherer.GetLastCarriedType());
    9780    }
    98 
    9981
    10082    // Maintain the list of guards
     
    134116    Engine.PostMessage(oldEnt, MT_EntityRenamed, { "entity": oldEnt, "newentity": newEnt });
    135117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
    136139    if (cmpPosition && cmpPosition.IsInWorld())
    137140        cmpPosition.MoveOutOfWorld();
  • ps/trunk/source/graphics/MapReader.cpp

    r24661 r25192  
    10591059            }
    10601060
    1061             CmpPtr<ICmpOwnership> cmpOwnership(sim, ent);
    1062             if (cmpOwnership)
    1063                 cmpOwnership->SetOwner(PlayerID);
    1064 
    10651061            if (!Garrison.empty())
    10661062            {
     
    10721068            }
    10731069
     1070
     1071
    10741072            if (!Turrets.empty())
    10751073            {
     
    10801078                    LOGERROR("CXMLMapReader::ReadEntities() entity '%d' of player '%d' has no TurretHolder component and thus cannot use turrets.", ent, PlayerID);
    10811079            }
     1080
     1081
     1082
     1083
    10821084
    10831085            CmpPtr<ICmpObstruction> cmpObstruction(sim, ent);
  • ps/trunk/source/simulation2/components/CCmpPosition.cpp

    r24766 r25192  
    1 /* Copyright (C) 2020 Wildfire Games.
     1/* Copyright (C) 202 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    2222
    2323#include "simulation2/MessageTypes.h"
     24
    2425
    2526#include "ICmpTerrain.h"
     
    229230            serialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
    230231        }
     232
    231233    }
    232234
     
    266268            deserialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
    267269        }
     270
    268271
    269272        if (m_InWorld)
  • ps/trunk/source/simulation2/components/ICmpTurretHolder.cpp

    r24542 r25192  
    4141        for (entity_id_t entity : entities)
    4242            turrets.push_back(std::make_pair(
    43                 m_Script.Call<std::string>("GetOccupiedTurretName", entity),
     43                m_Script.Call<std::string>("GetOccupiedTurretName", entity),
    4444                entity
    4545            ));
Note: See TracChangeset for help on using the changeset viewer.