summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-21 23:25:29 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-21 23:25:29 +0200
commitc7b4b9f819e0c1335ece87695599474fc14fcdcf (patch)
treed640af246fec0ea63c408a57a28c61ee4f5961dd /source/cChunk.cpp
parentSetting files (diff)
downloadcuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.gz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.bz2
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.lz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.xz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.zst
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.zip
Diffstat (limited to 'source/cChunk.cpp')
-rw-r--r--source/cChunk.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index c6d0fb3b3..a8e8938a0 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -22,6 +22,7 @@
#include "cItem.h"
#include "cNoise.h"
#include "cRoot.h"
+#include "cCriticalSection.h"
#include "cGenSettings.h"
@@ -37,6 +38,10 @@
#include <vector>
#include <map>
+#ifndef _WIN32
+#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
+#endif
+
extern bool g_bWaterPhysics;
@@ -77,8 +82,7 @@ cChunk::~cChunk()
if( m_EntitiesCriticalSection )
{
- DeleteCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
- delete (CRITICAL_SECTION*)m_EntitiesCriticalSection;
+ delete m_EntitiesCriticalSection;
m_EntitiesCriticalSection = 0;
}
delete m_pState;
@@ -102,8 +106,7 @@ cChunk::cChunk(int a_X, int a_Y, int a_Z)
, m_EntitiesCriticalSection( 0 )
{
//LOG("cChunk::cChunk(%i, %i, %i)", a_X, a_Y, a_Z);
- m_EntitiesCriticalSection = new CRITICAL_SECTION;
- InitializeCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection = new cCriticalSection();
}
void cChunk::Initialize()
@@ -1064,12 +1067,12 @@ bool cChunk::RemoveEntity( cEntity & a_Entity, cChunk* a_CalledFrom /* = 0 */ )
void cChunk::LockEntities()
{
- EnterCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection->Lock();
}
void cChunk::UnlockEntities()
{
- LeaveCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection->Unlock();
}
char cChunk::GetBlock( int a_X, int a_Y, int a_Z )