Skip to content

Commit

Permalink
Merge pull request #259 from IllidanS4/master
Browse files Browse the repository at this point in the history
MapAndreas and FCNPC_SetMinHeightPosCall fix
  • Loading branch information
ziggi committed Nov 16, 2021
2 parents c88c2dc + 5d7f1ac commit b744c24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
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

0 comments on commit b744c24

Please sign in to comment.