endif()
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops")
- #set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}")
- set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS}")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}")
if(USE_GPROF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
MapBlock * Map::getBlockNoCreateNoEx(v3s16 p3d)
{
v2s16 p2d(p3d.X, p3d.Z);
- MapSector * sector = getSectorNoGenerate(p2d);
+ MapSector * sector = getSectorNoGenerateNoEx(p2d);
+ if(sector == NULL)
+ return NULL;
MapBlock *block = sector->getBlockNoCreateNoEx(p3d.Y);
return block;
}
virtual void onMapEditEvent(MapEditEvent *event) = 0;
};
-class Map : public NodeContainer
+class Map /*: public NodeContainer*/
{
public:
Map(std::ostream &dout);
virtual ~Map();
- virtual u16 nodeContainerId() const
+ /*virtual u16 nodeContainerId() const
{
return NODECONTAINER_ID_MAP;
- }
+ }*/
virtual s32 mapType() const
{
MapBlock
*/
-MapBlock::MapBlock(NodeContainer *parent, v3s16 pos, bool dummy):
+MapBlock::MapBlock(Map *parent, v3s16 pos, bool dummy):
m_parent(parent),
m_pos(pos),
m_modified(MOD_STATE_WRITE_NEEDED),
#include "mapblock_mesh.h"
#endif
+class Map;
#define BLOCK_TIMESTAMP_UNDEFINED 0xffffffff
BLOCKGEN_FULLY_GENERATED=6
};*/
+#if 0
enum
{
NODECONTAINER_ID_MAPBLOCK,
}
}
};
+#endif
/*
MapBlock itself
*/
-class MapBlock : public NodeContainer
+class MapBlock /*: public NodeContainer*/
{
public:
- MapBlock(NodeContainer *parent, v3s16 pos, bool dummy=false);
+ MapBlock(Map *parent, v3s16 pos, bool dummy=false);
~MapBlock();
- virtual u16 nodeContainerId() const
+ /*virtual u16 nodeContainerId() const
{
return NODECONTAINER_ID_MAPBLOCK;
- }
+ }*/
- NodeContainer * getParent()
+ Map * getParent()
{
return m_parent;
}
*/
// NOTE: Lots of things rely on this being the Map
- NodeContainer *m_parent;
+ Map *m_parent;
// Position in blocks on parent
v3s16 m_pos;
*/
// Get map
- NodeContainer *parentcontainer = block->getParent();
- // This will only work if the parent is the map
- assert(parentcontainer->nodeContainerId() == NODECONTAINER_ID_MAP);
- // OK, we have the map!
- Map *map = (Map*)parentcontainer;
+ Map *map = block->getParent();
for(u16 i=0; i<6; i++)
{
assert(m_objects.find(object->m_id) != NULL);
assert(m_objects[object->m_id] == object);
- NodeContainer *parentcontainer = m_block->getParent();
- // This will only work if the parent is the map
- if(parentcontainer->nodeContainerId() != NODECONTAINER_ID_MAP)
- {
- dstream<<"WARNING: Wrapping object not possible: "
- "MapBlock's parent is not map"<<std::endl;
- return true;
- }
- // OK, we have the map!
- Map *map = (Map*)parentcontainer;
+ Map *map = m_block->getParent();
// Calculate blockpos on map
v3s16 oldblock_pos_i_on_map = m_block->getPosRelative();
#include "exceptions.h"
#include "mapblock.h"
-MapSector::MapSector(NodeContainer *parent, v2s16 pos):
+MapSector::MapSector(Map *parent, v2s16 pos):
differs_from_disk(false),
m_parent(parent),
m_pos(pos),
ServerMapSector
*/
-ServerMapSector::ServerMapSector(NodeContainer *parent, v2s16 pos):
+ServerMapSector::ServerMapSector(Map *parent, v2s16 pos):
MapSector(parent, pos)
{
}
ServerMapSector* ServerMapSector::deSerialize(
std::istream &is,
- NodeContainer *parent,
+ Map *parent,
v2s16 p2d,
core::map<v2s16, MapSector*> & sectors
)
ClientMapSector
*/
-ClientMapSector::ClientMapSector(NodeContainer *parent, v2s16 pos):
+ClientMapSector::ClientMapSector(Map *parent, v2s16 pos):
MapSector(parent, pos)
{
}
#include <ostream>
class MapBlock;
-class NodeContainer;
+class Map;
/*
This is an Y-wise stack of MapBlocks.
{
public:
- MapSector(NodeContainer *parent, v2s16 pos);
+ MapSector(Map *parent, v2s16 pos);
virtual ~MapSector();
virtual u32 getId() const = 0;
// The pile of MapBlocks
core::map<s16, MapBlock*> m_blocks;
- NodeContainer *m_parent;
+ Map *m_parent;
// Position on parent (in MapBlock widths)
v2s16 m_pos;
class ServerMapSector : public MapSector
{
public:
- ServerMapSector(NodeContainer *parent, v2s16 pos);
+ ServerMapSector(Map *parent, v2s16 pos);
~ServerMapSector();
u32 getId() const
static ServerMapSector* deSerialize(
std::istream &is,
- NodeContainer *parent,
+ Map *parent,
v2s16 p2d,
core::map<v2s16, MapSector*> & sectors
);
class ClientMapSector : public MapSector
{
public:
- ClientMapSector(NodeContainer *parent, v2s16 pos);
+ ClientMapSector(Map *parent, v2s16 pos);
~ClientMapSector();
u32 getId() const
}
};
+/*
+ NOTE: These tests became non-working then NodeContainer was removed.
+ These should be redone, utilizing some kind of a virtual
+ interface for Map (IMap would be fine).
+*/
+#if 0
struct TestMapBlock
{
class TC : public NodeContainer
}
};
+#endif
struct TestSocket
{
TEST(TestCompress);
TEST(TestMapNode);
TEST(TestVoxelManipulator);
- TEST(TestMapBlock);
- TEST(TestMapSector);
+ //TEST(TestMapBlock);
+ //TEST(TestMapSector);
if(INTERNET_SIMULATOR == false){
TEST(TestSocket);
dout_con<<"=== BEGIN RUNNING UNIT TESTS FOR CONNECTION ==="<<std::endl;