Skip to content

Commit

Permalink
Memory leak fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggi committed Jan 3, 2019
1 parent 840480e commit 19bfab9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CPlayerData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ void CPlayerData::UpdateHeightPos(CVector *pvecPosition)
fNewZ = fZ + 1.0f;
}
} else if (iMoveMode == MOVE_MODE_COLANDREAS && colDataLoaded) {
CVector *vecResult = new CVector();
CVector vecResult;
CVector vecStart = *pvecPosition;
CVector vecEnd = *pvecPosition;
vecEnd.fZ -= 1000.0f;
Expand All @@ -1038,13 +1038,13 @@ void CPlayerData::UpdateHeightPos(CVector *pvecPosition)
vecStart.fZ = m_vecDestination.fZ;
}

if (CFunctions::RayCastLine(vecStart, vecEnd, vecResult)) {
fNewZ = vecResult->fZ + 1.0f;
if (CFunctions::RayCastLine(vecStart, vecEnd, &vecResult)) {
fNewZ = vecResult.fZ + 1.0f;
} else {
vecStart.fZ = m_vecDestination.fZ + 1000.0f;

if (CFunctions::RayCastLine(vecStart, vecEnd, vecResult)) {
fNewZ = vecResult->fZ + 1.0f;
if (CFunctions::RayCastLine(vecStart, vecEnd, &vecResult)) {
fNewZ = vecResult.fZ + 1.0f;
}
}
}
Expand Down

0 comments on commit 19bfab9

Please sign in to comment.