/*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MAP_HEADER
#define MAP_HEADER
#include <jmutex.h>
#include <jmutexautolock.h>
#include <jthread.h>
#include <iostream>
#include "common_irrlicht.h"
#include "mapnode.h"
#include "mapblock_nodemod.h"
#include "constants.h"
#include "voxel.h"
class MapSector;
class ServerMapSector;
class ClientMapSector;
class MapBlock;
class NodeMetadata;
namespace mapgen{
struct BlockMakeData;
};
/*
MapEditEvent
*/
#define MAPTYPE_BASE 0
#define MAPTYPE_SERVER 1
#define MAPTYPE_CLIENT 2
enum MapEditEventType{
// Node added (changed from air or something else to something)
MEET_ADDNODE,
// Node removed (changed to air)
MEET_REMOVENODE,
// Node metadata of block changed (not knowing which node exactly)
// p stores block coordinate
MEET_BLOCK_NODE_METADATA_CHANGED,
// Anything else (modified_blocks are set unsent)
MEET_OTHER
};
struct MapEditEvent
{
MapEditEventType type;
v3s16 p;
MapNode n;
core::map<v3s16, bool> modified_blocks;
u16 already_known_by_peer;
MapEditEvent():
type(MEET_OTHER),
already_known_by_peer(0)
{
}
MapEditEvent * clone()
{
MapEditEvent *event = new MapEditEvent();
event->type = type;
event->p = p;
event->n = n;
for(core::map<v3s16, bool>::Iterator
i = modified_blocks.getIterator();
i.atEnd()==false; i++)
{
|