mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:47:43 +00:00
CScript*: Return std::nullopt in GetTouchBounds()
In some implementations, returning via default construction for std::optional can cause the entire inner buffer to be zeroed out. Returning with std::nullopt causes only the internal validity flag to be set and nothing more.
This commit is contained in:
@@ -365,15 +365,17 @@ void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type) {
|
||||
}
|
||||
|
||||
std::optional<zeus::CAABox> CScriptDoor::GetTouchBounds() const {
|
||||
if (GetActive() && GetMaterialList().HasMaterial(EMaterialTypes::Solid))
|
||||
return {CPhysicsActor::GetBoundingBox()};
|
||||
return {};
|
||||
if (GetActive() && GetMaterialList().HasMaterial(EMaterialTypes::Solid)) {
|
||||
return CPhysicsActor::GetBoundingBox();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<zeus::CAABox> CScriptDoor::GetProjectileBounds() const {
|
||||
if (x2a8_28_projectilesCollide)
|
||||
return {{x284_modelBounds.min + GetTranslation(), x284_modelBounds.max + GetTranslation()}};
|
||||
return {};
|
||||
if (x2a8_28_projectilesCollide) {
|
||||
return zeus::CAABox{x284_modelBounds.min + GetTranslation(), x284_modelBounds.max + GetTranslation()};
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
Reference in New Issue
Block a user