Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapAndreas and FCNPC_SetMinHeightPosCall fix #259

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/CPlayerData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,12 +1051,12 @@ void CPlayerData::UpdateHeightPos(CVector *pvecPosition)
}

if (iMoveMode != MOVE_MODE_NONE) {
if (m_fMinHeightPos < 0.0f) {
pvecPosition->fZ = fNewZ;
} else if (m_fMinHeightPos <= std::abs(fNewZ - pvecPosition->fZ)) {
if (m_fMinHeightPos >= 0.0f && m_fMinHeightPos <= std::abs(fNewZ - pvecPosition->fZ)) {
if (CCallbackManager::OnChangeHeightPos(m_wPlayerId, fNewZ, pvecPosition->fZ)) {
pvecPosition->fZ = fNewZ;
}
} else {
pvecPosition->fZ = fNewZ;
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/CServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ CServer::CServer(eSAMPVersion version)
m_pNodeManager = NULL;
m_pMovePath = NULL;
m_pRecordManager = NULL;
m_pMapAndreas = NULL;
m_pColAndreas = NULL;
// Initialize the update rate
m_dwUpdateRate = DEFAULT_UPDATE_RATE;
Expand All @@ -49,7 +48,6 @@ CServer::~CServer()
SAFE_DELETE(m_pNodeManager);
SAFE_DELETE(m_pMovePath);
SAFE_DELETE(m_pRecordManager);
SAFE_DELETE(m_pMapAndreas);
SAFE_DELETE(m_pColAndreas);
}

Expand All @@ -75,9 +73,6 @@ BYTE CServer::Initialize()
// Create the record instance
m_pRecordManager = new CRecordManager;

// Create the MapAndreas instance
m_pMapAndreas = new CMapAndreas;

// Create the ColAndreas instance
m_pColAndreas = new ColAndreasWorld;
collisionWorld = m_pColAndreas;
Expand Down Expand Up @@ -132,9 +127,11 @@ CRecordManager *CServer::GetRecordManager()
return m_pRecordManager;
}

extern CMapAndreas MapAndreas;

CMapAndreas *CServer::GetMapAndreas()
{
return m_pMapAndreas;
return &MapAndreas;
}

ColAndreasWorld *CServer::GetColAndreas()
Expand Down
1 change: 0 additions & 1 deletion src/CServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class CServer
CPlayerManager *m_pPlayerDataManager;
CNodeManager *m_pNodeManager;
CRecordManager *m_pRecordManager;
CMapAndreas *m_pMapAndreas;
ColAndreasWorld *m_pColAndreas;
CMovePath *m_pMovePath;
DWORD m_dwUpdateRate;
Expand Down