fixed some crashes

This commit is contained in:
mq1n
2025-09-22 11:25:58 +03:00
parent bdcb68619a
commit 51ee5feb78
5 changed files with 27 additions and 16 deletions

View File

@@ -20,7 +20,7 @@ void CGraphicObjectInstance::Clear()
m_isVisible = TRUE;
m_v3Position.x = m_v3Position.y = m_v3Position.z = 0.0f;
m_v3Scale.x = m_v3Scale.y = m_v3Scale.z = 0.0f;
m_v3Scale.x = m_v3Scale.y = m_v3Scale.z = 1.0f;
//m_fRotation = 0.0f;
m_fYaw = m_fPitch = m_fRoll = 0.0f;
D3DXMatrixIdentity(&m_worldMatrix);
@@ -278,12 +278,22 @@ void CGraphicObjectInstance::Initialize()
m_BlockCamera = false;
m_v3Position.x = m_v3Position.y = m_v3Position.z = 0.0f;
m_v3Scale.x = m_v3Scale.y = m_v3Scale.z = 0.0f;
m_v3Scale.x = m_v3Scale.y = m_v3Scale.z = 1.0f;
m_fYaw = m_fPitch = m_fRoll = 0.0f;
D3DXMatrixIdentity(&m_worldMatrix);
D3DXMatrixIdentity(&m_mRotation);
m_v3TBBoxMin = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_v3TBBoxMax = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_v3BBoxMin = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_v3BBoxMax = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
for (int i = 0; i < 8; ++i)
m_v4TBBox[i] = D3DXVECTOR4(0.0f, 0.0f, 0.0f, 0.0f);
memset(m_abyPortalID, 0, sizeof(m_abyPortalID));
ClearCollision();
OnInitialize();
}

View File

@@ -830,7 +830,8 @@ void CIME::DelCurPos()
if (ms_curpos < ms_lastpos)
{
int eraseCount = FindColorTagEndPosition(m_wText + ms_curpos, ms_lastpos - ms_curpos) + 1;
wcscpy(m_wText + ms_curpos, m_wText + ms_curpos + eraseCount);
size_t remainingChars = ms_lastpos - ms_curpos - eraseCount + 1; // +1 for null terminator
wmemmove(m_wText + ms_curpos, m_wText + ms_curpos + eraseCount, remainingChars); // wcscpy > wmemmove to handle overlapping memory
ms_lastpos -= eraseCount;
ms_curpos = std::min(ms_lastpos, ms_curpos);
}