Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapReader.cpp
Show First 20 Lines • Show All 1,051 Lines • ▼ Show 20 Lines | while (entity_idx < entities.size()) | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(sim, ent); | CmpPtr<ICmpPosition> cmpPosition(sim, ent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
{ | { | ||||
cmpPosition->JumpTo(Position.X, Position.Z); | cmpPosition->JumpTo(Position.X, Position.Z); | ||||
cmpPosition->SetYRotation(Orientation.Y); | cmpPosition->SetYRotation(Orientation.Y); | ||||
// TODO: other parts of the position | // TODO: other parts of the position | ||||
} | } | ||||
CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | |||||
if (cmpOwnership) | |||||
cmpOwnership->SetOwner(PlayerID); | |||||
if (!Garrison.empty()) | if (!Garrison.empty()) | ||||
Freagarach: `ownership change` | |||||
{ | { | ||||
CmpPtr<ICmpGarrisonHolder> cmpGarrisonHolder(sim, ent); | CmpPtr<ICmpGarrisonHolder> cmpGarrisonHolder(sim, ent); | ||||
if (cmpGarrisonHolder) | if (cmpGarrisonHolder) | ||||
cmpGarrisonHolder->SetInitEntities(std::move(Garrison)); | cmpGarrisonHolder->SetInitEntities(std::move(Garrison)); | ||||
else | else | ||||
LOGERROR("CXMLMapReader::ReadEntities() entity '%d' of player '%d' has no GarrisonHolder component and thus cannot garrison units.", ent, PlayerID); | LOGERROR("CXMLMapReader::ReadEntities() entity '%d' of player '%d' has no GarrisonHolder component and thus cannot garrison units.", ent, PlayerID); | ||||
} | } | ||||
// Needs to be before ownership changes to prevent initialising | |||||
// subunits too soon. | |||||
if (!Turrets.empty()) | if (!Turrets.empty()) | ||||
{ | { | ||||
CmpPtr<ICmpTurretHolder> cmpTurretHolder(sim, ent); | CmpPtr<ICmpTurretHolder> cmpTurretHolder(sim, ent); | ||||
if (cmpTurretHolder) | if (cmpTurretHolder) | ||||
cmpTurretHolder->SetInitEntities(std::move(Turrets)); | cmpTurretHolder->SetInitEntities(std::move(Turrets)); | ||||
else | else | ||||
LOGERROR("CXMLMapReader::ReadEntities() entity '%d' of player '%d' has no TurretHolder component and thus cannot use turrets.", ent, PlayerID); | LOGERROR("CXMLMapReader::ReadEntities() entity '%d' of player '%d' has no TurretHolder component and thus cannot use turrets.", ent, PlayerID); | ||||
} | } | ||||
CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | |||||
if (cmpOwnership) | |||||
cmpOwnership->SetOwner(PlayerID); | |||||
CmpPtr<ICmpObstruction> cmpObstruction(sim, ent); | CmpPtr<ICmpObstruction> cmpObstruction(sim, ent); | ||||
if (cmpObstruction) | if (cmpObstruction) | ||||
{ | { | ||||
if (ControlGroup != INVALID_ENTITY) | if (ControlGroup != INVALID_ENTITY) | ||||
cmpObstruction->SetControlGroup(ControlGroup); | cmpObstruction->SetControlGroup(ControlGroup); | ||||
if (ControlGroup2 != INVALID_ENTITY) | if (ControlGroup2 != INVALID_ENTITY) | ||||
cmpObstruction->SetControlGroup2(ControlGroup2); | cmpObstruction->SetControlGroup2(ControlGroup2); | ||||
▲ Show 20 Lines • Show All 513 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
ownership change