summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/Bindings.cpp3
-rw-r--r--source/Bindings.h2
-rw-r--r--source/WSSAnvil.cpp6
-rw-r--r--source/WSSAnvil.h2
-rw-r--r--source/WSSCompact.cpp27
-rw-r--r--source/WSSCompact.h10
-rw-r--r--source/WorldStorage.cpp28
-rw-r--r--source/WorldStorage.h50
-rw-r--r--source/cBlockEntity.h11
-rw-r--r--source/cChestEntity.cpp12
-rw-r--r--source/cChestEntity.h2
-rw-r--r--source/cEntity.h4
-rw-r--r--source/cFurnaceEntity.cpp15
-rw-r--r--source/cFurnaceEntity.h2
-rw-r--r--source/cSignEntity.cpp9
-rw-r--r--source/cSignEntity.h1
-rw-r--r--source/cWorld.cpp98
-rw-r--r--source/cWorld.h23
18 files changed, 47 insertions, 258 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index e8d5da34b..8e3c4bd96 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/23/12 21:50:57.
+** Generated automatically by tolua++-1.0.92 on 03/11/12 17:55:41.
*/
#ifndef __cplusplus
@@ -17574,7 +17574,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ENT_LOOK",E_ENT_LOOK);
tolua_constant(tolua_S,"E_REL_ENT_MOVE_LOOK",E_REL_ENT_MOVE_LOOK);
tolua_constant(tolua_S,"E_ENT_TELEPORT",E_ENT_TELEPORT);
- tolua_constant(tolua_S,"E_ENT_HEAD_LOOK",E_ENT_HEAD_LOOK);
tolua_constant(tolua_S,"E_ENT_STATUS",E_ENT_STATUS);
tolua_constant(tolua_S,"E_METADATA",E_METADATA);
tolua_constant(tolua_S,"E_PRE_CHUNK",E_PRE_CHUNK);
diff --git a/source/Bindings.h b/source/Bindings.h
index 6f5fecd76..c100812cf 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/23/12 21:50:57.
+** Generated automatically by tolua++-1.0.92 on 03/11/12 17:55:42.
*/
/* Exported function */
diff --git a/source/WSSAnvil.cpp b/source/WSSAnvil.cpp
index cf0010362..6520a7c95 100644
--- a/source/WSSAnvil.cpp
+++ b/source/WSSAnvil.cpp
@@ -111,7 +111,7 @@ cWSSAnvil::cMCAFile * cWSSAnvil::LoadMCAFile(const cChunkCoords & a_Chunk)
// Load it anew:
AString FileName;
- Printf(FileName, "%s/r.%d.%d.mca", m_WSI->WSIGetFolder().c_str(), RegionX, RegionZ);
+ Printf(FileName, "%s/r.%d.%d.mca", m_World->GetName().c_str(), RegionX, RegionZ);
cMCAFile * f = new cMCAFile(FileName, RegionX, RegionZ);
if (f == NULL)
{
@@ -282,7 +282,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, cNBTTag & a_NBT)
memset(ChunkData + cChunkDef::SkyLightOffset, 0xff, cChunkDef::NumBlocks / 2);
//*/
- m_WSI->WSIChunkDataLoaded(
+ m_World->ChunkDataLoaded(
a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ,
ChunkData,
ChunkData + cChunkDef::MetaOffset,
@@ -353,7 +353,7 @@ void cWSSAnvil::LoadChestFromNBT(cBlockEntityList & a_BlockEntities, const cNBTC
{
return; // Make it an empty chest
}
- std::auto_ptr<cChestEntity> Chest(new cChestEntity(x, y, z));
+ std::auto_ptr<cChestEntity> Chest(new cChestEntity(x, y, z, m_World));
const cNBTTags & ItemDefs = Items->GetChildren();
for (cNBTTags::const_iterator itr = ItemDefs.begin(); itr != ItemDefs.end(); ++itr)
{
diff --git a/source/WSSAnvil.h b/source/WSSAnvil.h
index 529a123fb..1052d0e5a 100644
--- a/source/WSSAnvil.h
+++ b/source/WSSAnvil.h
@@ -40,7 +40,7 @@ class cWSSAnvil :
public:
- cWSSAnvil(cWSInterface * a_WSI) : super(a_WSI) {}
+ cWSSAnvil(cWorld * a_World) : super(a_World) {}
virtual ~cWSSAnvil();
protected:
diff --git a/source/WSSCompact.cpp b/source/WSSCompact.cpp
index 86c92e7ed..8c27dba51 100644
--- a/source/WSSCompact.cpp
+++ b/source/WSSCompact.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "WSSCompact.h"
+#include "cWorld.h"
#include "zlib.h"
#include <json/json.h>
#include "StringCompression.h"
@@ -67,7 +68,7 @@ bool cWSSCompact::LoadChunk(const cChunkCoords & a_Chunk)
return false;
}
- return LoadChunkFromData(a_Chunk, UncompressedSize, ChunkData, m_WSI);
+ return LoadChunkFromData(a_Chunk, UncompressedSize, ChunkData, m_World);
}
@@ -85,7 +86,7 @@ bool cWSSCompact::SaveChunk(const cChunkCoords & a_Chunk)
LOG("Cannot locate a proper PAK file for chunk [%d, %d]", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ);
return false;
}
- return f->SaveChunk(a_Chunk, m_WSI);
+ return f->SaveChunk(a_Chunk, m_World);
}
@@ -118,7 +119,7 @@ cWSSCompact::cPAKFile * cWSSCompact::LoadPAKFile(const cChunkCoords & a_Chunk)
// Load it anew:
AString FileName;
- Printf(FileName, "%s/X%i_Z%i.pak", m_WSI->WSIGetFolder().c_str(), LayerX, LayerZ );
+ Printf(FileName, "%s/X%i_Z%i.pak", m_World->GetName().c_str(), LayerX, LayerZ );
cPAKFile * f = new cPAKFile(FileName, LayerX, LayerZ);
if (f == NULL)
{
@@ -187,7 +188,7 @@ bool cWSSCompact::EraseChunkData(const cChunkCoords & a_Chunk)
-void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWSInterface * a_WSI)
+void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World)
{
// Load chests
Json::Value AllChests = a_Value.get("Chests", Json::nullValue);
@@ -196,7 +197,7 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En
for (Json::Value::iterator itr = AllChests.begin(); itr != AllChests.end(); ++itr )
{
Json::Value & Chest = *itr;
- cChestEntity * ChestEntity = new cChestEntity(0, 0, 0);
+ cChestEntity * ChestEntity = new cChestEntity(0,0,0, a_World);
if (!ChestEntity->LoadFromJson( Chest ) )
{
LOGERROR("ERROR READING CHEST FROM JSON!" );
@@ -216,7 +217,7 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En
for( Json::Value::iterator itr = AllFurnaces.begin(); itr != AllFurnaces.end(); ++itr )
{
Json::Value & Furnace = *itr;
- cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0, 0, 0);
+ cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0,0,0, a_World);
if( !FurnaceEntity->LoadFromJson( Furnace ) )
{
LOGERROR("ERROR READING FURNACE FROM JSON!" );
@@ -236,7 +237,7 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En
for( Json::Value::iterator itr = AllSigns.begin(); itr != AllSigns.end(); ++itr )
{
Json::Value & Sign = *itr;
- cSignEntity * SignEntity = new cSignEntity( E_BLOCK_SIGN_POST, 0, 0, 0);
+ cSignEntity * SignEntity = new cSignEntity( E_BLOCK_SIGN_POST, 0,0,0, a_World);
if ( !SignEntity->LoadFromJson( Sign ) )
{
LOGERROR("ERROR READING SIGN FROM JSON!" );
@@ -381,7 +382,7 @@ bool cWSSCompact::cPAKFile::GetChunkData(const cChunkCoords & a_Chunk, int & a_U
-bool cWSSCompact::cPAKFile::SaveChunk(const cChunkCoords & a_Chunk, cWSInterface * a_World)
+bool cWSSCompact::cPAKFile::SaveChunk(const cChunkCoords & a_Chunk, cWorld * a_World)
{
if (!SaveChunkToData(a_Chunk, a_World))
{
@@ -680,7 +681,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
-bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWSInterface * a_WSI)
+bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWorld * a_World)
{
// Crude data integrity check:
if (a_UncompressedSize < cChunkDef::BlockDataSize)
@@ -729,13 +730,13 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_Uncomp
}
else
{
- LoadEntitiesFromJson(root, Entities, BlockEntities, a_WSI);
+ LoadEntitiesFromJson(root, Entities, BlockEntities, a_World);
}
}
BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data();
- a_WSI->WSIChunkDataLoaded(
+ a_World->ChunkDataLoaded(
a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ,
BlockData,
BlockData + cChunkDef::MetaOffset,
@@ -777,11 +778,11 @@ bool cWSSCompact::cPAKFile::EraseChunkData(const cChunkCoords & a_Chunk)
-bool cWSSCompact::cPAKFile::SaveChunkToData(const cChunkCoords & a_Chunk, cWSInterface * a_WSI)
+bool cWSSCompact::cPAKFile::SaveChunkToData(const cChunkCoords & a_Chunk, cWorld * a_World)
{
// Serialize the chunk:
cJsonChunkSerializer Serializer;
- if (!a_WSI->WSIGetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ, Serializer))
+ if (!a_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ, Serializer))
{
// Chunk not valid
LOG("cWSSCompact: Trying to save chunk [%d, %d, %d] that has no data, ignoring request.", a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ);
diff --git a/source/WSSCompact.h b/source/WSSCompact.h
index a50405d6d..cd753ce9c 100644
--- a/source/WSSCompact.h
+++ b/source/WSSCompact.h
@@ -22,7 +22,7 @@ class cWSSCompact :
public cWSSchema
{
public:
- cWSSCompact(cWSInterface * a_WSI) : cWSSchema(a_WSI) {}
+ cWSSCompact(cWorld * a_World) : cWSSchema(a_World) {}
virtual ~cWSSCompact();
protected:
@@ -42,7 +42,7 @@ protected:
bool SetChunkData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data);
bool EraseChunkData(const cChunkCoords & a_Chunk);
- bool SaveChunk(const cChunkCoords & a_Chunk, cWSInterface * a_WSI);
+ bool SaveChunk(const cChunkCoords & a_Chunk, cWorld * a_World);
int GetLayerX(void) const {return m_LayerX; }
int GetLayerZ(void) const {return m_LayerZ; }
@@ -68,7 +68,7 @@ protected:
char m_ChunkVersion;
char m_PakVersion;
- bool SaveChunkToData(const cChunkCoords & a_Chunk, cWSInterface * a_WSI); // Saves the chunk to m_DataContents, updates headers and m_NumDirty
+ bool SaveChunkToData(const cChunkCoords & a_Chunk, cWorld * a_World); // Saves the chunk to m_DataContents, updates headers and m_NumDirty
void SynchronizeFile(void); // Writes m_DataContents along with the headers to file, resets m_NumDirty
void UpdateChunk1To2(void); // Height from 128 to 256
@@ -93,9 +93,9 @@ protected:
bool EraseChunkData(const cChunkCoords & a_Chunk);
/// Loads the chunk from the data (no locking needed)
- bool LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWSInterface * a_WSI);
+ bool LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWorld * a_World);
- void LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWSInterface * a_WSI);
+ void LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World);
// cWSSchema overrides:
virtual bool LoadChunk(const cChunkCoords & a_Chunk) override;
diff --git a/source/WorldStorage.cpp b/source/WorldStorage.cpp
index 5fc19ff59..e0e9e7c7b 100644
--- a/source/WorldStorage.cpp
+++ b/source/WorldStorage.cpp
@@ -24,7 +24,7 @@ class cWSSForgetful :
public cWSSchema
{
public:
- cWSSForgetful(cWSInterface * a_WSI) : cWSSchema(a_WSI) {}
+ cWSSForgetful(cWorld * a_World) : cWSSchema(a_World) {}
protected:
// cWSSchema overrides:
@@ -97,7 +97,7 @@ void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity)
cWorldStorage::cWorldStorage(void) :
super("cWorldStorage"),
- m_WSI(NULL),
+ m_World(NULL),
m_SaveSchema(NULL)
{
}
@@ -120,9 +120,9 @@ cWorldStorage::~cWorldStorage()
-bool cWorldStorage::Start(cWSInterface * a_WSI, const AString & a_StorageSchemaName)
+bool cWorldStorage::Start(cWorld * a_World, const AString & a_StorageSchemaName)
{
- m_WSI = a_WSI;
+ m_World = a_World;
m_StorageSchemaName = a_StorageSchemaName;
InitSchemas();
@@ -266,9 +266,9 @@ void cWorldStorage::UnqueueSave(const cChunkCoords & a_Chunk)
void cWorldStorage::InitSchemas(void)
{
// The first schema added is considered the default
- m_Schemas.push_back(new cWSSCompact (m_WSI));
- m_Schemas.push_back(new cWSSAnvil (m_WSI));
- m_Schemas.push_back(new cWSSForgetful(m_WSI));
+ m_Schemas.push_back(new cWSSCompact (m_World));
+ m_Schemas.push_back(new cWSSAnvil (m_World));
+ m_Schemas.push_back(new cWSSForgetful(m_World));
// Add new schemas here
if (NoCaseCompare(m_StorageSchemaName, "default") == 0)
@@ -286,7 +286,7 @@ void cWorldStorage::InitSchemas(void)
} // for itr - m_Schemas[]
// Unknown schema selected, let the admin know:
- LOGWARNING("World \"%s\": Unknown storage schema name \"%s\". Using default. Available schemas:", m_WSI->WSIGetFolder().c_str(), m_StorageSchemaName.c_str());
+ LOGWARNING("Unknown storage schema name \"%s\". Using default. Available schemas:", m_StorageSchemaName.c_str());
for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
{
LOGWARNING("\t\"%s\"", (*itr)->GetName().c_str());
@@ -346,7 +346,7 @@ bool cWorldStorage::LoadOneChunk(void)
if (ToLoad.m_Generate)
{
// The chunk couldn't be loaded, generate it:
- m_WSI->WSIGenerateChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ);
+ m_World->GetGenerator().GenerateChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ);
}
else
{
@@ -376,12 +376,12 @@ bool cWorldStorage::SaveOneChunk(void)
}
HasMore = (m_SaveQueue.size() > 0);
}
- if (ShouldSave && m_WSI->WSIIsChunkValid(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ))
+ if (ShouldSave && m_World->IsChunkValid(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ))
{
- m_WSI->WSIMarkChunkSaving(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ);
+ m_World->MarkChunkSaving(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ);
if (m_SaveSchema->SaveChunk(Save))
{
- m_WSI->WSIMarkChunkSaved(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ);
+ m_World->MarkChunkSaved(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ);
}
else
{
@@ -397,7 +397,7 @@ bool cWorldStorage::SaveOneChunk(void)
bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
- if (m_WSI->WSIIsChunkValid(a_ChunkX, a_ChunkY, a_ChunkZ))
+ if (m_World->IsChunkValid(a_ChunkX, a_ChunkY, a_ChunkZ))
{
// Already loaded (can happen, since the queue is async)
return true;
@@ -421,7 +421,7 @@ bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
}
// Notify the chunk owner that the chunk failed to load (sets cChunk::m_HasLoadFailed to true):
- m_WSI->WSIChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ);
+ m_World->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ);
return false;
}
diff --git a/source/WorldStorage.h b/source/WorldStorage.h
index 047c358ba..da78b69f2 100644
--- a/source/WorldStorage.h
+++ b/source/WorldStorage.h
@@ -22,45 +22,8 @@
-/** Interface between cWorld and cWorldStorage, contains all calls into cWorld that cWorldStorage needs
-Defining this as an interface lets us re-use the cWorldStorage outside of MC-Server's main executable,
-for example for tools such as storage converters or chunk analytics
-*/
-class cWSInterface
-{
-public:
- /// Asks the world if the chunk is fully valid
- virtual bool WSIIsChunkValid(int a_ChunkX, int a_ChunkY, int a_ChunkZ) = 0;
-
- /// Marks the chunk as being saved
- virtual void WSIMarkChunkSaving(int a_ChunkX, int a_ChunkY, int a_ChunkZ) = 0;
-
- /// Marks the chunk as having been saved (if there was no change since the last MarkSaving)
- virtual void WSIMarkChunkSaved(int a_ChunkX, int a_ChunkY, int a_ChunkZ) = 0;
-
- /// Marks the chunk as unable to load
- virtual void WSIChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) = 0;
-
- /// Called when chunk generation has been specified for a chunk that cannot be loaded
- virtual void WSIGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) = 0;
-
- /// Marks the chunk as having been saved (if there was no change since the last MarkSaving)
- virtual bool WSIGetChunkData(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cChunkDataCallback & a_Callback) = 0;
-
- /// Gets the folder where the world is saved
- virtual AString WSIGetFolder(void) = 0;
-
- virtual void WSIChunkDataLoaded(
- int a_ChunkX, int a_ChunkY, int a_ChunkZ,
- const BLOCKTYPE * a_BlockTypes,
- const BLOCKTYPE * a_BlockMeta,
- const BLOCKTYPE * a_BlockLight,
- const BLOCKTYPE * a_BlockSkyLight,
- const cChunkDef::HeightMap * a_HeightMap,
- cEntityList & a_Entities,
- cBlockEntityList & a_BlockEntities
- ) = 0;
-} ;
+// fwd:
+class cWorld;
@@ -70,7 +33,7 @@ public:
class cWSSchema abstract
{
public:
- cWSSchema(cWSInterface * a_WSI) : m_WSI(a_WSI) {}
+ cWSSchema(cWorld * a_World) : m_World(a_World) {}
virtual ~cWSSchema() {} // Force the descendants' destructors to be virtual
virtual bool LoadChunk(const cChunkCoords & a_Chunk) = 0;
@@ -79,7 +42,7 @@ public:
protected:
- cWSInterface * m_WSI;
+ cWorld * m_World;
} ;
typedef std::list<cWSSchema *> cWSSchemaList;
@@ -140,7 +103,7 @@ public:
void UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
void UnqueueSave(const cChunkCoords & a_Chunk);
- bool Start(cWSInterface * a_WSI, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args
+ bool Start(cWorld * a_World, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args
void WaitForFinish(void);
void WaitForQueuesEmpty(void);
@@ -161,8 +124,7 @@ protected:
typedef std::list<sChunkLoad> sChunkLoadQueue;
- cWSInterface * m_WSI;
-
+ cWorld * m_World;
AString m_StorageSchemaName;
// Both queues are locked by the same CS
diff --git a/source/cBlockEntity.h b/source/cBlockEntity.h
index 662a6c5eb..3f0190c77 100644
--- a/source/cBlockEntity.h
+++ b/source/cBlockEntity.h
@@ -41,17 +41,7 @@ protected:
, m_BlockType( a_BlockType )
, m_World( a_World )
{}
-
- cBlockEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z)
- : m_PosX( a_X )
- , m_PosY( a_Y )
- , m_PosZ( a_Z )
- , m_BlockType( a_BlockType )
- , m_World(NULL)
- {}
-
public:
-
virtual ~cBlockEntity() {};
virtual void Destroy() {};
@@ -62,7 +52,6 @@ public:
ENUM_BLOCK_ID GetBlockType() { return m_BlockType; }
cWorld * GetWorld(void) const {return m_World; }
- void SetWorld(cWorld * a_World) {m_World = a_World; }
virtual void SaveToJson (Json::Value & a_Value ) = 0;
diff --git a/source/cChestEntity.cpp b/source/cChestEntity.cpp
index 7961cee5b..f1a99b8c3 100644
--- a/source/cChestEntity.cpp
+++ b/source/cChestEntity.cpp
@@ -34,18 +34,6 @@ cChestEntity::cChestEntity(int a_X, int a_Y, int a_Z, cWorld * a_World)
-cChestEntity::cChestEntity(int a_X, int a_Y, int a_Z)
- : cBlockEntity( E_BLOCK_CHEST, a_X, a_Y, a_Z)
- , m_TopChest( false )
- , m_JoinedChest( NULL )
-{
- m_Content = new cItem[ c_ChestHeight*c_ChestWidth ];
-}
-
-
-
-
-
cChestEntity::~cChestEntity()
{
if( GetWindow() )
diff --git a/source/cChestEntity.h b/source/cChestEntity.h
index 5223ad6eb..323eb0f8a 100644
--- a/source/cChestEntity.h
+++ b/source/cChestEntity.h
@@ -29,8 +29,6 @@ class cChestEntity :
{
public:
cChestEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
- cChestEntity(int a_X, int a_Y, int a_Z);
-
virtual ~cChestEntity();
virtual void Destroy();
diff --git a/source/cEntity.h b/source/cEntity.h
index 179af4b17..1b26f46be 100644
--- a/source/cEntity.h
+++ b/source/cEntity.h
@@ -84,9 +84,6 @@ public: //tolua_export
int GetChunkY(void) const {return m_ChunkY; }
int GetChunkZ(void) const {return m_ChunkZ; }
- // Can be used only once - to set the initial world after loading. Not to be used for moving to another world!
- void SetWorld( cWorld* a_World ) { ASSERT(m_World == NULL); m_World = a_World; }
-
void SetPosX( const double & a_PosX ); //tolua_export
void SetPosY( const double & a_PosY ); //tolua_export
void SetPosZ( const double & a_PosZ ); //tolua_export
@@ -113,6 +110,7 @@ public: //tolua_export
protected:
virtual void Destroyed() {} // Called after the entity has been destroyed
+ void SetWorld( cWorld* a_World ) { m_World = a_World; }
void MoveToCorrectChunk(bool a_bIgnoreOldChunk = false);
friend class cReferenceManager;
diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp
index 63876ae19..389d4af54 100644
--- a/source/cFurnaceEntity.cpp
+++ b/source/cFurnaceEntity.cpp
@@ -36,21 +36,6 @@ cFurnaceEntity::cFurnaceEntity(int a_X, int a_Y, int a_Z, cWorld * a_World)
-cFurnaceEntity::cFurnaceEntity(int a_X, int a_Y, int a_Z)
- : cBlockEntity( E_BLOCK_FURNACE, a_X, a_Y, a_Z)
- , m_Items( new cItem[3] )
- , m_CookingItem( 0 )
- , m_CookTime( 0 )
- , m_TimeCooked( 0 )
- , m_BurnTime( 0 )
- , m_TimeBurned( 0 )
-{
-}
-
-
-
-
-
cFurnaceEntity::~cFurnaceEntity()
{
// Tell window its owner is destroyed
diff --git a/source/cFurnaceEntity.h b/source/cFurnaceEntity.h
index d72865c16..21cdb1e38 100644
--- a/source/cFurnaceEntity.h
+++ b/source/cFurnaceEntity.h
@@ -28,8 +28,6 @@ class cFurnaceEntity :
{
public:
cFurnaceEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
- cFurnaceEntity(int a_X, int a_Y, int a_Z);
-
virtual ~cFurnaceEntity();
virtual void Destroy();
diff --git a/source/cSignEntity.cpp b/source/cSignEntity.cpp
index 92db18d91..ca21d847b 100644
--- a/source/cSignEntity.cpp
+++ b/source/cSignEntity.cpp
@@ -25,15 +25,6 @@ cSignEntity::cSignEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z, c
-cSignEntity::cSignEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z)
- : cBlockEntity(a_BlockType, a_X, a_Y, a_Z)
-{
-}
-
-
-
-
-
cSignEntity::~cSignEntity()
{
}
diff --git a/source/cSignEntity.h b/source/cSignEntity.h
index a8b0820dd..5d9d11a9c 100644
--- a/source/cSignEntity.h
+++ b/source/cSignEntity.h
@@ -21,7 +21,6 @@ class cSignEntity :
{
public:
cSignEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
- cSignEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z);
virtual ~cSignEntity();
OBSOLETE bool LoadFromFile(cFile & a_File); // deprecated format
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 588640c03..266d425e4 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -1502,101 +1502,3 @@ int cWorld::GetNumChunks(void) const
-
-bool cWorld::WSIIsChunkValid(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
-{
- return m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
-
-void cWorld::WSIMarkChunkSaving(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
-{
- m_ChunkMap->MarkChunkSaving(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
-
-void cWorld::WSIMarkChunkSaved(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
-{
- m_ChunkMap->MarkChunkSaved(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
-
-void cWorld::WSIChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
-{
- ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
-
-void cWorld::WSIGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
-{
- m_Generator.GenerateChunk(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
-
-bool cWorld::WSIGetChunkData(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cChunkDataCallback & a_Callback)
-{
- return m_ChunkMap->GetChunkData(a_ChunkX, a_ChunkY, a_ChunkZ, a_Callback);
-}
-
-
-
-
-
-AString cWorld::WSIGetFolder(void)
-{
- return m_WorldName;
-}
-
-
-
-
-
-void cWorld::WSIChunkDataLoaded(
- int a_ChunkX, int a_ChunkY, int a_ChunkZ,
- const BLOCKTYPE * a_BlockTypes,
- const BLOCKTYPE * a_BlockMeta,
- const BLOCKTYPE * a_BlockLight,
- const BLOCKTYPE * a_BlockSkyLight,
- const cChunkDef::HeightMap * a_HeightMap,
- cEntityList & a_Entities,
- cBlockEntityList & a_BlockEntities
-)
-{
- // Set all a_Entities' and a_BlockEntities' world to this:
- for (cEntityList::iterator itr = a_Entities.begin(); itr != a_Entities.end(); ++itr)
- {
- (*itr)->SetWorld(this);
- } // for itr - a_Entities[]
- for (cBlockEntityList::iterator itr = a_BlockEntities.begin(); itr != a_BlockEntities.end(); ++itr)
- {
- (*itr)->SetWorld(this);
- } // for itr - a_BlockEntities[]
-
- m_ChunkMap->ChunkDataLoaded(
- a_ChunkX, a_ChunkY, a_ChunkZ,
- a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight,
- a_HeightMap,
- a_Entities,
- a_BlockEntities
- );
- m_ChunkSender.ChunkReady(a_ChunkX, a_ChunkY, a_ChunkZ);
-}
-
-
-
-
diff --git a/source/cWorld.h b/source/cWorld.h
index fd5f800fd..a8591af65 100644
--- a/source/cWorld.h
+++ b/source/cWorld.h
@@ -45,8 +45,7 @@ typedef cItemCallback<cEntity> cEntityCallback;
-class cWorld : //tolua_export
- public cWSInterface
+class cWorld //tolua_export
{ //tolua_export
public:
@@ -258,26 +257,6 @@ public:
cWorldStorage & GetStorage (void) { return m_Storage; }
cChunkMap * GetChunkMap (void) { return m_ChunkMap; }
-protected:
- // cWSInterface overrides:
- virtual bool WSIIsChunkValid(int a_ChunkX, int a_ChunkY, int a_ChunkZ) override;
- virtual void WSIMarkChunkSaving(int a_ChunkX, int a_ChunkY, int a_ChunkZ) override;
- virtual void WSIMarkChunkSaved(int a_ChunkX, int a_ChunkY, int a_ChunkZ) override;
- virtual void WSIChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) override;
- virtual void WSIGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) override;
- virtual bool WSIGetChunkData(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cChunkDataCallback & a_Callback) override;
- virtual AString WSIGetFolder(void) override;
- virtual void WSIChunkDataLoaded(
- int a_ChunkX, int a_ChunkY, int a_ChunkZ,
- const BLOCKTYPE * a_BlockTypes,
- const BLOCKTYPE * a_BlockMeta,
- const BLOCKTYPE * a_BlockLight,
- const BLOCKTYPE * a_BlockSkyLight,
- const cChunkDef::HeightMap * a_HeightMap,
- cEntityList & a_Entities,
- cBlockEntityList & a_BlockEntities
- ) override;
-
private:
friend class cRoot;