CScriptPlatform: Fix AddRider assign to copy

This commit is contained in:
Luke Street 2020-04-07 15:41:26 -04:00
parent 4d3050cac4
commit 1dc90f78d3
2 changed files with 13 additions and 12 deletions

View File

@ -24,19 +24,19 @@ static CMaterialList MakePlatformMaterialList() {
return ret;
}
CScriptPlatform::CScriptPlatform(
TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
const CActorParameters& actParms, const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha,
bool active, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
const std::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool rainSplashes,
u32 maxRainSplashes, u32 rainGenRate)
CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha,
bool active, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
std::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> dcln,
bool rainSplashes, u32 maxRainSplashes, u32 rainGenRate)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
actParms, 0.3f, 0.1f)
, x25c_currentSpeed(speed)
, x28c_initialHealth(hInfo)
, x294_health(hInfo)
, x29c_damageVuln(dVuln)
, x304_treeGroupContainer(dcln) {
, x304_treeGroupContainer(std::move(dcln)) {
x348_xrayAlpha = xrayAlpha;
x34c_maxRainSplashes = maxRainSplashes;
x350_rainGenRate = rainGenRate;
@ -374,7 +374,8 @@ void CScriptPlatform::BuildSlaveList(CStateManager& mgr) {
void CScriptPlatform::AddRider(std::vector<SRiders>& riders, TUniqueId riderId, const CPhysicsActor* ridee,
CStateManager& mgr) {
auto search = std::find_if(riders.begin(), riders.end(), [riderId](const SRiders& r) { return r.x0_uid == riderId; });
const auto& search =
std::find_if(riders.begin(), riders.end(), [riderId](const SRiders& r) { return r.x0_uid == riderId; });
if (search == riders.end()) {
zeus::CTransform xf;
if (TCastToPtr<CPhysicsActor> act = mgr.ObjectById(riderId)) {
@ -388,8 +389,8 @@ void CScriptPlatform::AddRider(std::vector<SRiders>& riders, TUniqueId riderId,
}
void CScriptPlatform::AddSlave(TUniqueId id, CStateManager& mgr) {
auto search = std::find_if(x338_slavesDynamic.begin(), x338_slavesDynamic.end(),
[id](const SRiders& r) { return r.x0_uid == id; });
const auto& search = std::find_if(x338_slavesDynamic.begin(), x338_slavesDynamic.end(),
[id](const SRiders& r) { return r.x0_uid == id; });
if (search == x338_slavesDynamic.end()) {
if (TCastToPtr<CActor> act = mgr.ObjectById(id)) {
act->AddMaterial(EMaterialTypes::PlatformSlave, mgr);

View File

@ -31,7 +31,7 @@ struct SRiders {
};
class CScriptPlatform : public CPhysicsActor {
u32 x254_;
// u32 x254_;
TUniqueId x258_currentWaypoint = kInvalidUniqueId;
TUniqueId x25a_targetWaypoint = kInvalidUniqueId;
float x25c_currentSpeed;
@ -83,7 +83,7 @@ public:
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float speed,
bool detectCollision, float xrayAlpha, bool active, const CHealthInfo& hInfo,
const CDamageVulnerability& dVuln,
const std::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool rainSplashes,
std::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> dcln, bool rainSplashes,
u32 maxRainSplashes, u32 rainGenRate);
void Accept(IVisitor& visitor) override;