summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt26
-rw-r--r--doc/protocol.txt2
-rw-r--r--old/changelog.txt2
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/activeobject.h4
-rw-r--r--src/ban.cpp4
-rw-r--r--src/ban.h4
-rw-r--r--src/biome.cpp4
-rw-r--r--src/biome.h4
-rw-r--r--src/camera.cpp4
-rw-r--r--src/camera.h4
-rw-r--r--src/chat.cpp4
-rw-r--r--src/chat.h4
-rw-r--r--src/client.cpp4
-rw-r--r--src/client.h4
-rw-r--r--src/clientmap.cpp4
-rw-r--r--src/clientmap.h4
-rw-r--r--src/clientobject.cpp4
-rw-r--r--src/clientobject.h4
-rw-r--r--src/clientserver.cpp4
-rw-r--r--src/clientserver.h4
-rw-r--r--src/clientsimpleobject.h4
-rw-r--r--src/clouds.cpp4
-rw-r--r--src/clouds.h4
-rw-r--r--src/collision.cpp4
-rw-r--r--src/collision.h4
-rw-r--r--src/connection.cpp4
-rw-r--r--src/connection.h4
-rw-r--r--src/constants.h4
-rw-r--r--src/content_abm.cpp4
-rw-r--r--src/content_abm.h4
-rw-r--r--src/content_cao.cpp4
-rw-r--r--src/content_cao.h4
-rw-r--r--src/content_cso.cpp4
-rw-r--r--src/content_cso.h4
-rw-r--r--src/content_mapblock.cpp4
-rw-r--r--src/content_mapblock.h4
-rw-r--r--src/content_mapnode.cpp4
-rw-r--r--src/content_mapnode.h4
-rw-r--r--src/content_nodemeta.cpp4
-rw-r--r--src/content_nodemeta.h4
-rw-r--r--src/content_object.h4
-rw-r--r--src/content_sao.cpp4
-rw-r--r--src/content_sao.h4
-rw-r--r--src/craftdef.cpp4
-rw-r--r--src/craftdef.h4
-rw-r--r--src/daynightratio.h4
-rw-r--r--src/debug.cpp4
-rw-r--r--src/debug.h7
-rw-r--r--src/defaultsettings.cpp9
-rw-r--r--src/defaultsettings.h4
-rw-r--r--src/emerge.cpp453
-rw-r--r--src/emerge.h128
-rw-r--r--src/environment.cpp4
-rw-r--r--src/environment.h5
-rw-r--r--src/event.h4
-rw-r--r--src/event_manager.h4
-rw-r--r--src/exceptions.h4
-rw-r--r--src/farmesh.cpp4
-rw-r--r--src/farmesh.h4
-rw-r--r--src/filecache.cpp6
-rw-r--r--src/filecache.h6
-rw-r--r--src/filesys.cpp4
-rw-r--r--src/filesys.h4
-rw-r--r--src/game.cpp4
-rw-r--r--src/game.h4
-rw-r--r--src/gamedef.h4
-rw-r--r--src/genericobject.cpp4
-rw-r--r--src/genericobject.h4
-rw-r--r--src/gettime.h4
-rw-r--r--src/guiChatConsole.cpp4
-rw-r--r--src/guiChatConsole.h4
-rw-r--r--src/guiConfigureWorld.cpp4
-rw-r--r--src/guiConfigureWorld.h4
-rw-r--r--src/guiConfirmMenu.cpp4
-rw-r--r--src/guiConfirmMenu.h4
-rw-r--r--src/guiCreateWorld.cpp4
-rw-r--r--src/guiCreateWorld.h4
-rw-r--r--src/guiDeathScreen.cpp4
-rw-r--r--src/guiDeathScreen.h4
-rw-r--r--src/guiFormSpecMenu.cpp4
-rw-r--r--src/guiFormSpecMenu.h4
-rw-r--r--src/guiKeyChangeMenu.cpp8
-rw-r--r--src/guiKeyChangeMenu.h8
-rw-r--r--src/guiMainMenu.cpp4
-rw-r--r--src/guiMainMenu.h4
-rw-r--r--src/guiMessageMenu.cpp4
-rw-r--r--src/guiMessageMenu.h4
-rw-r--r--src/guiPasswordChange.cpp6
-rw-r--r--src/guiPasswordChange.h6
-rw-r--r--src/guiPauseMenu.cpp4
-rw-r--r--src/guiPauseMenu.h4
-rw-r--r--src/guiTextInputMenu.cpp4
-rw-r--r--src/guiTextInputMenu.h4
-rw-r--r--src/guiVolumeChange.cpp6
-rw-r--r--src/guiVolumeChange.h6
-rw-r--r--src/hex.h4
-rw-r--r--src/intlGUIEditBox.cpp2
-rw-r--r--src/intlGUIEditBox.h2
-rw-r--r--src/inventory.cpp4
-rw-r--r--src/inventory.h4
-rw-r--r--src/inventorymanager.cpp4
-rw-r--r--src/inventorymanager.h4
-rw-r--r--src/irr_aabb3d.h4
-rw-r--r--src/irr_v2d.h4
-rw-r--r--src/irr_v3d.h4
-rw-r--r--src/irrlichttypes.h4
-rw-r--r--src/irrlichttypes_bloated.h4
-rw-r--r--src/irrlichttypes_extrabloated.h4
-rw-r--r--src/itemdef.cpp6
-rw-r--r--src/itemdef.h6
-rw-r--r--src/itemgroup.h4
-rw-r--r--src/jthread/jmutex.h53
-rw-r--r--src/keycode.cpp4
-rw-r--r--src/keycode.h4
-rw-r--r--src/light.cpp4
-rw-r--r--src/light.h4
-rw-r--r--src/localplayer.cpp4
-rw-r--r--src/localplayer.h4
-rw-r--r--src/log.cpp4
-rw-r--r--src/log.h4
-rw-r--r--src/logoutputbuffer.h4
-rw-r--r--src/luaentity_common.h4
-rw-r--r--src/main.cpp4
-rw-r--r--src/main.h4
-rw-r--r--src/mainmenumanager.h4
-rw-r--r--src/map.cpp90
-rw-r--r--src/map.h23
-rw-r--r--src/mapblock.cpp4
-rw-r--r--src/mapblock.h4
-rw-r--r--src/mapblock_mesh.cpp4
-rw-r--r--src/mapblock_mesh.h4
-rw-r--r--src/mapchunk.h4
-rw-r--r--src/mapgen.cpp157
-rw-r--r--src/mapgen.h55
-rw-r--r--src/mapgen_v6.cpp12
-rw-r--r--src/mapgen_v6.h4
-rw-r--r--src/mapnode.cpp4
-rw-r--r--src/mapnode.h4
-rw-r--r--src/mapsector.cpp4
-rw-r--r--src/mapsector.h4
-rw-r--r--src/mesh.cpp4
-rw-r--r--src/mesh.h4
-rw-r--r--src/modalMenu.h4
-rw-r--r--src/modifiedstate.h4
-rw-r--r--src/mods.cpp4
-rw-r--r--src/mods.h4
-rw-r--r--src/nameidmapping.cpp4
-rw-r--r--src/nameidmapping.h4
-rw-r--r--src/nodedef.cpp4
-rw-r--r--src/nodedef.h4
-rw-r--r--src/nodemetadata.cpp4
-rw-r--r--src/nodemetadata.h4
-rw-r--r--src/nodetimer.cpp4
-rw-r--r--src/nodetimer.h4
-rw-r--r--src/noise.cpp4
-rw-r--r--src/noise.h4
-rw-r--r--src/object_properties.cpp4
-rw-r--r--src/object_properties.h4
-rw-r--r--src/particles.cpp4
-rw-r--r--src/particles.h4
-rw-r--r--src/player.cpp4
-rw-r--r--src/player.h4
-rw-r--r--src/porting.cpp125
-rw-r--r--src/porting.h47
-rw-r--r--src/profiler.h4
-rw-r--r--src/quicktune.cpp4
-rw-r--r--src/quicktune.h4
-rw-r--r--src/quicktune_shortcutter.h4
-rw-r--r--src/rollback.cpp4
-rw-r--r--src/rollback.h4
-rw-r--r--src/rollback_interface.cpp4
-rw-r--r--src/rollback_interface.h4
-rw-r--r--src/script.cpp4
-rw-r--r--src/script.h4
-rw-r--r--src/scriptapi.cpp4
-rw-r--r--src/scriptapi.h4
-rw-r--r--src/serialization.cpp4
-rw-r--r--src/serialization.h4
-rw-r--r--src/server.cpp350
-rw-r--r--src/server.h153
-rw-r--r--src/serverlist.cpp4
-rw-r--r--src/serverlist.h4
-rw-r--r--src/serverobject.cpp4
-rw-r--r--src/serverobject.h4
-rw-r--r--src/settings.h4
-rw-r--r--src/shader.cpp6
-rw-r--r--src/shader.h6
-rw-r--r--src/sky.h4
-rw-r--r--src/socket.cpp4
-rw-r--r--src/socket.h4
-rw-r--r--src/sound.cpp4
-rw-r--r--src/sound.h4
-rw-r--r--src/sound_openal.cpp4
-rw-r--r--src/sound_openal.h4
-rw-r--r--src/staticobject.cpp4
-rw-r--r--src/staticobject.h4
-rw-r--r--src/strfnd.h4
-rw-r--r--src/subgame.cpp4
-rw-r--r--src/subgame.h4
-rw-r--r--src/test.cpp4
-rw-r--r--src/test.h4
-rw-r--r--src/threads.h4
-rw-r--r--src/tile.cpp4
-rw-r--r--src/tile.h4
-rw-r--r--src/tool.cpp4
-rw-r--r--src/tool.h4
-rw-r--r--src/treegen.cpp4
-rw-r--r--src/treegen.h4
-rw-r--r--src/util/container.h4
-rw-r--r--src/util/directiontables.cpp4
-rw-r--r--src/util/directiontables.h4
-rw-r--r--src/util/numeric.cpp4
-rw-r--r--src/util/numeric.h4
-rw-r--r--src/util/pointedthing.cpp4
-rw-r--r--src/util/pointedthing.h4
-rw-r--r--src/util/pointer.h4
-rw-r--r--src/util/serialize.cpp4
-rw-r--r--src/util/serialize.h4
-rw-r--r--src/util/string.cpp4
-rw-r--r--src/util/string.h4
-rw-r--r--src/util/thread.h4
-rw-r--r--src/util/timetaker.cpp4
-rw-r--r--src/util/timetaker.h4
-rw-r--r--src/voxel.cpp12
-rw-r--r--src/voxel.h4
-rw-r--r--src/voxelalgorithms.cpp4
-rw-r--r--src/voxelalgorithms.h4
-rwxr-xr-xutil/buildbot/buildwin32.sh14
-rw-r--r--util/wireshark/minetest.lua2
230 files changed, 1413 insertions, 1169 deletions
diff --git a/README.txt b/README.txt
index d6344bd2c..20917d772 100644
--- a/README.txt
+++ b/README.txt
@@ -3,23 +3,23 @@ Minetest
An InfiniMiner/Minecraft inspired game.
-Copyright (c) 2010-2012 Perttu Ahola <celeron55@gmail.com>
-and ther contributors (see source file comments and the version control log)
+Copyright (c) 2010-2013 Perttu Ahola <celeron55@gmail.com>
+and contributors (see source file comments and the version control log)
In case you downloaded the source code:
---------------------------------------
If you downloaded the Minetest Engine source code in which this file is
contained, you probably want to download the minetest_game project too:
- https://github.com/celeron55/minetest_game/
+ https://github.com/minetest/minetest_game/
See the README.txt in it.
Further documentation
----------------------
- Website: http://minetest.net/
- Wiki: http://wiki.minetest.com/
-- Developer wiki: http://minetest.net/wiki/
-- Forum: http://minetest.net/forum/
-- Github: https://github.com/celeron55/minetest/
+- Developer wiki: http://dev.minetest.net/
+- Forum: http://forum.minetest.net/
+- Github: https://github.com/minetest/minetest/
- doc/ directory of source distribution
This game is not finished
@@ -41,7 +41,7 @@ Default Controls
Paths
------
$bin - Compiled binaries
-$share - Cistributed read-only data
+$share - Distributed read-only data
$user - User-created modifiable data
Windows .zip / RUN_IN_PLACE source:
@@ -83,15 +83,15 @@ Install dependencies. Here's an example for Debian/Ubuntu:
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev
Download source, extract (this is the URL to the latest of source repository, which might not work at all times):
-$ wget https://github.com/celeron55/minetest/tarball/master -O master.tar.gz
+$ wget https://github.com/minetest/minetest/tarball/master -O master.tar.gz
$ tar xf master.tar.gz
-$ cd celeron55-minetest-286edd4 (or similar)
+$ cd minetest-minetest-286edd4 (or similar)
Download minetest_game (otherwise only the "Minimal development test" game is available)
$ cd games/
-$ wget https://github.com/celeron55/minetest_game/tarball/master -O master.tar.gz
+$ wget https://github.com/minetest/minetest_game/tarball/master -O master.tar.gz
$ tar xf master.tar.gz
-$ mv celeron55-minetest_game-* minetest_game
+$ mv minetest-minetest_game-* minetest_game
$ cd ..
Build a version that runs directly from the source directory:
@@ -126,7 +126,7 @@ Compiling on Windows:
http://www.winimage.com/zLibDll/index.html
* Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
http://www.winimage.com/zLibDll/index.html
- * Optional: gettext bibrary and tools:
+ * Optional: gettext library and tools:
http://gnuwin32.sourceforge.net/downlinks/gettext.php
- This is used for other UI languages. Feel free to leave it out.
* And, of course, Minetest:
@@ -258,7 +258,7 @@ License of Minetest source code
-------------------------------
Minetest
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/doc/protocol.txt b/doc/protocol.txt
index 82dca59bf..160f15226 100644
--- a/doc/protocol.txt
+++ b/doc/protocol.txt
@@ -1,4 +1,4 @@
-Minetest-c55 protocol (incomplete, early draft):
+Minetest protocol (incomplete, early draft):
Updated 2011-06-18
A custom protocol over UDP.
diff --git a/old/changelog.txt b/old/changelog.txt
index b27fc506b..1750d71d1 100644
--- a/old/changelog.txt
+++ b/old/changelog.txt
@@ -1,4 +1,4 @@
-Minetest-c55 changelog
+Minetest changelog
----------------------
This should contain all the major changes.
For minor stuff, refer to the commit log of the repository.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c06da20c4..d2f080c90 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -209,6 +209,7 @@ set(common_SRCS
script.cpp
log.cpp
content_sao.cpp
+ emerge.cpp
mapgen.cpp
mapgen_v6.cpp
treegen.cpp
diff --git a/src/activeobject.h b/src/activeobject.h
index 1108a19de..e454f2c8c 100644
--- a/src/activeobject.h
+++ b/src/activeobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/ban.cpp b/src/ban.cpp
index e080586a3..75bae746f 100644
--- a/src/ban.cpp
+++ b/src/ban.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/ban.h b/src/ban.h
index f5b9c4440..529635c26 100644
--- a/src/ban.h
+++ b/src/ban.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/biome.cpp b/src/biome.cpp
index 34d51839f..86af75310 100644
--- a/src/biome.cpp
+++ b/src/biome.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
+Minetest
+Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/biome.h b/src/biome.h
index 265f1df44..c30af46ad 100644
--- a/src/biome.h
+++ b/src/biome.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
+Minetest
+Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/camera.cpp b/src/camera.cpp
index 33e85d069..b1e588415 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/camera.h b/src/camera.h
index 642b8d2d0..fc43d1176 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/chat.cpp b/src/chat.cpp
index b9d115bd0..c3509ae49 100644
--- a/src/chat.cpp
+++ b/src/chat.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/chat.h b/src/chat.h
index 49de52985..27863922c 100644
--- a/src/chat.h
+++ b/src/chat.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/client.cpp b/src/client.cpp
index 415f07311..be35db5de 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/client.h b/src/client.h
index 43fac9c9a..809e98b81 100644
--- a/src/client.h
+++ b/src/client.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/clientmap.cpp b/src/clientmap.cpp
index 0b30453b8..aa92dfdee 100644
--- a/src/clientmap.cpp
+++ b/src/clientmap.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientmap.h b/src/clientmap.h
index f8a69630e..786f35b77 100644
--- a/src/clientmap.h
+++ b/src/clientmap.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientobject.cpp b/src/clientobject.cpp
index e1dbaf627..e7c735dac 100644
--- a/src/clientobject.cpp
+++ b/src/clientobject.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientobject.h b/src/clientobject.h
index 852d2c76b..d1ee366cf 100644
--- a/src/clientobject.h
+++ b/src/clientobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientserver.cpp b/src/clientserver.cpp
index bd0a8ede0..591a95542 100644
--- a/src/clientserver.cpp
+++ b/src/clientserver.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientserver.h b/src/clientserver.h
index 7fb3e83d2..769272a68 100644
--- a/src/clientserver.h
+++ b/src/clientserver.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clientsimpleobject.h b/src/clientsimpleobject.h
index 9dd8cc472..c94db22f1 100644
--- a/src/clientsimpleobject.h
+++ b/src/clientsimpleobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/clouds.cpp b/src/clouds.cpp
index 5b980a5ba..9f0bc06d8 100644
--- a/src/clouds.cpp
+++ b/src/clouds.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/clouds.h b/src/clouds.h
index a7cde42bc..72923c2c5 100644
--- a/src/clouds.h
+++ b/src/clouds.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/collision.cpp b/src/collision.cpp
index eb948e3c3..58517b779 100644
--- a/src/collision.cpp
+++ b/src/collision.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/collision.h b/src/collision.h
index 52a7bbb7d..38cc3efb3 100644
--- a/src/collision.h
+++ b/src/collision.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/connection.cpp b/src/connection.cpp
index ed5a752be..7a3018bfd 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/connection.h b/src/connection.h
index f99cd1bf9..05b1ca2e8 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/constants.h b/src/constants.h
index 97e94b361..8246c8c21 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/content_abm.cpp b/src/content_abm.cpp
index 971ac4f34..03fc82ed4 100644
--- a/src/content_abm.cpp
+++ b/src/content_abm.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/content_abm.h b/src/content_abm.h
index beb9b2e16..0a91a96a2 100644
--- a/src/content_abm.h
+++ b/src/content_abm.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index d71911b95..5e5cb38ae 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_cao.h b/src/content_cao.h
index 566117716..441c74922 100644
--- a/src/content_cao.h
+++ b/src/content_cao.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_cso.cpp b/src/content_cso.cpp
index 666f17734..20eb88b7d 100644
--- a/src/content_cso.cpp
+++ b/src/content_cso.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/content_cso.h b/src/content_cso.h
index 0b467f6c4..5007d2526 100644
--- a/src/content_cso.h
+++ b/src/content_cso.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index e224f0b06..0d80dc173 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_mapblock.h b/src/content_mapblock.h
index 142c00edf..bb1e129da 100644
--- a/src/content_mapblock.h
+++ b/src/content_mapblock.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp
index c3fdb4a42..44d0b8e38 100644
--- a/src/content_mapnode.cpp
+++ b/src/content_mapnode.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_mapnode.h b/src/content_mapnode.h
index 45c2b0763..5c9c0b66d 100644
--- a/src/content_mapnode.h
+++ b/src/content_mapnode.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index 0e4c3dd75..a9a8cc60c 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_nodemeta.h b/src/content_nodemeta.h
index d206c35ad..907649b5f 100644
--- a/src/content_nodemeta.h
+++ b/src/content_nodemeta.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_object.h b/src/content_object.h
index e4690d295..65a829773 100644
--- a/src/content_object.h
+++ b/src/content_object.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 196c10e61..718a42dff 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/content_sao.h b/src/content_sao.h
index 065c6a039..2fd1034eb 100644
--- a/src/content_sao.h
+++ b/src/content_sao.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/craftdef.cpp b/src/craftdef.cpp
index b15443607..99e3fcc3d 100644
--- a/src/craftdef.cpp
+++ b/src/craftdef.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/craftdef.h b/src/craftdef.h
index a2258c6e8..eb3cd7e39 100644
--- a/src/craftdef.h
+++ b/src/craftdef.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/daynightratio.h b/src/daynightratio.h
index 96c6729eb..3375133ef 100644
--- a/src/daynightratio.h
+++ b/src/daynightratio.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/debug.cpp b/src/debug.cpp
index 8b25cc22d..e32cceb86 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/debug.h b/src/debug.h
index 3e8066f4d..56952427c 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
@@ -32,6 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
+ #ifndef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0500
+ #endif
#include <windows.h>
#ifdef _MSC_VER
#include <eh.h>
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index f2c9886b4..7afe8df05 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
@@ -184,6 +184,11 @@ void set_default_settings(Settings *settings)
settings->setDefault("congestion_control_min_rate", "10");
settings->setDefault("remote_media", "");
settings->setDefault("debug_log_level", "0");
+ settings->setDefault("emergequeue_limit_total", "256");
+ settings->setDefault("emergequeue_limit_diskonly", "");
+ settings->setDefault("emergequeue_limit_generate", "");
+ settings->setDefault("num_emerge_threads", "1");
+
// physics stuff
settings->setDefault("movement_acceleration_default", "3");
settings->setDefault("movement_acceleration_air", "2");
diff --git a/src/defaultsettings.h b/src/defaultsettings.h
index faac7a886..37e3f717f 100644
--- a/src/defaultsettings.h
+++ b/src/defaultsettings.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/emerge.cpp b/src/emerge.cpp
new file mode 100644
index 000000000..250c44fbb
--- /dev/null
+++ b/src/emerge.cpp
@@ -0,0 +1,453 @@
+/*
+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 Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser 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.
+*/
+
+
+#include "server.h"
+#include <iostream>
+#include <queue>
+#include "clientserver.h"
+#include "map.h"
+#include "jmutexautolock.h"
+#include "main.h"
+#include "constants.h"
+#include "voxel.h"
+#include "config.h"
+#include "mapblock.h"
+#include "serverobject.h"
+#include "settings.h"
+#include "script.h"
+#include "scriptapi.h"
+#include "profiler.h"
+#include "log.h"
+#include "nodedef.h"
+#include "biome.h"
+#include "emerge.h"
+#include "mapgen_v6.h"
+
+
+/////////////////////////////// Emerge Manager ////////////////////////////////
+
+EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) {
+ //register built-in mapgens
+ registerMapgen("v6", new MapgenFactoryV6());
+
+ this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef);
+ this->params = NULL;
+
+ mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
+
+ queuemutex.Init();
+
+ int nthreads;
+ if (g_settings->get("num_emerge_threads").empty()) {
+ int nprocs = porting::getNumberOfProcessors();
+ // leave a proc for the main thread and one for some other misc threads
+ nthreads = (nprocs > 2) ? nthreads = nprocs - 2 : 1;
+ } else {
+ nthreads = g_settings->getU16("num_emerge_threads");
+ }
+ if (nthreads < 1)
+ nthreads = 1;
+
+ qlimit_total = g_settings->getU16("emergequeue_limit_total");
+ qlimit_diskonly = g_settings->get("emergequeue_limit_diskonly").empty() ?
+ nthreads * 5 + 1 :
+ g_settings->getU16("emergequeue_limit_diskonly");
+ qlimit_generate = g_settings->get("emergequeue_limit_generate").empty() ?
+ nthreads + 1 :
+ g_settings->getU16("emergequeue_limit_generate");
+
+ for (int i = 0; i != nthreads; i++)
+ emergethread.push_back(new EmergeThread((Server *)gamedef, i));
+
+ infostream << "EmergeManager: using " << nthreads << " threads" << std::endl;
+}
+
+
+EmergeManager::~EmergeManager() {
+ for (int i = 0; i != emergethread.size(); i++) {
+ emergethread[i]->setRun(false);
+ emergethread[i]->qevent.signal();
+ emergethread[i]->stop();
+ delete emergethread[i];
+ delete mapgen[i];
+ }
+
+ delete biomedef;
+ delete params;
+}
+
+
+void EmergeManager::initMapgens(MapgenParams *mgparams) {
+ Mapgen *mg;
+
+ if (mapgen.size())
+ return;
+
+ this->params = mgparams;
+ for (int i = 0; i != emergethread.size(); i++) {
+ mg = createMapgen(params->mg_name, 0, params);
+ if (!mg) {
+ infostream << "EmergeManager: falling back to mapgen v6" << std::endl;
+ delete params;
+ params = createMapgenParams("v6");
+ mg = createMapgen("v6", 0, params);
+ }
+ mapgen.push_back(mg);
+ }
+}
+
+
+bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate) {
+ std::map<v3s16, BlockEmergeData *>::const_iterator iter;
+ BlockEmergeData *bedata;
+ u16 count;
+ u8 flags = 0;
+ int idx = 0;
+
+ if (allow_generate)
+ flags |= BLOCK_EMERGE_ALLOWGEN;
+
+ {
+ JMutexAutoLock queuelock(queuemutex);
+
+ count = blocks_enqueued.size();
+ if (count >= qlimit_total)
+ return false;
+
+ count = peer_queue_count[peer_id];
+ u16 qlimit_peer = allow_generate ? qlimit_generate : qlimit_diskonly;
+ if (count >= qlimit_peer)
+ return false;
+
+ iter = blocks_enqueued.find(p);
+ if (iter != blocks_enqueued.end()) {
+ bedata = iter->second;
+ bedata->flags |= flags;
+ return true;
+ }
+
+ bedata = new BlockEmergeData;
+ bedata->flags = flags;
+ bedata->peer_requested = peer_id;
+ blocks_enqueued.insert(std::make_pair(p, bedata));
+
+ peer_queue_count[peer_id] = count + 1;
+
+ // insert into the EmergeThread queue with the least items
+ int lowestitems = emergethread[0]->blockqueue.size();
+ for (int i = 1; i != emergethread.size(); i++) {
+ int nitems = emergethread[i]->blockqueue.size();
+ if (nitems < lowestitems) {
+ idx = i;
+ lowestitems = nitems;
+ }
+ }
+
+ emergethread[idx]->blockqueue.push(p);
+ }
+ emergethread[idx]->qevent.signal();
+
+ return true;
+}
+
+
+int EmergeManager::getGroundLevelAtPoint(v2s16 p) {
+ if (mapgen.size() == 0 || !mapgen[0]) {
+ errorstream << "EmergeManager: getGroundLevelAtPoint() called"
+ " before mapgen initialized" << std::endl;
+ return 0;
+ }
+
+ return mapgen[0]->getGroundLevelAtPoint(p);
+}
+
+
+bool EmergeManager::isBlockUnderground(v3s16 blockpos) {
+ /*
+ v2s16 p = v2s16((blockpos.X * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2,
+ (blockpos.Y * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2);
+ int ground_level = getGroundLevelAtPoint(p);
+ return blockpos.Y * (MAP_BLOCKSIZE + 1) <= min(water_level, ground_level);
+ */
+
+ //yuck, but then again, should i bother being accurate?
+ //the height of the nodes in a single block is quite variable
+ return blockpos.Y * (MAP_BLOCKSIZE + 1) <= params->water_level;
+}
+
+
+u32 EmergeManager::getBlockSeed(v3s16 p) {
+ return (u32)(params->seed & 0xFFFFFFFF) +
+ p.Z * 38134234 +
+ p.Y * 42123 +
+ p.X * 23;
+}
+
+
+Mapgen *EmergeManager::createMapgen(std::string mgname, int mgid,
+ MapgenParams *mgparams) {
+ std::map<std::string, MapgenFactory *>::const_iterator iter;
+ iter = mglist.find(mgname);
+ if (iter == mglist.end()) {
+ errorstream << "EmergeManager; mapgen " << mgname <<
+ " not registered" << std::endl;
+ return NULL;
+ }
+
+ MapgenFactory *mgfactory = iter->second;
+ return mgfactory->createMapgen(mgid, mgparams, this);
+}
+
+
+MapgenParams *EmergeManager::createMapgenParams(std::string mgname) {
+ std::map<std::string, MapgenFactory *>::const_iterator iter;
+ iter = mglist.find(mgname);
+ if (iter == mglist.end()) {
+ errorstream << "EmergeManager: mapgen " << mgname <<
+ " not registered" << std::endl;
+ return NULL;
+ }
+
+ MapgenFactory *mgfactory = iter->second;
+ return mgfactory->createMapgenParams();
+}
+
+
+MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
+ std::string mg_name = settings->get("mg_name");
+ MapgenParams *mgparams = createMapgenParams(mg_name);
+
+ mgparams->mg_name = mg_name;
+ mgparams->seed = settings->getU64(settings == g_settings ? "fixed_map_seed" : "seed");
+ mgparams->water_level = settings->getS16("water_level");
+ mgparams->chunksize = settings->getS16("chunksize");
+ mgparams->flags = settings->getFlagStr("mg_flags", flagdesc_mapgen);
+
+ if (!mgparams->readParams(settings)) {
+ delete mgparams;
+ return NULL;
+ }
+ return mgparams;
+}
+
+
+void EmergeManager::setParamsToSettings(Settings *settings) {
+ settings->set("mg_name", params->mg_name);
+ settings->setU64("seed", params->seed);
+ settings->setS16("water_level", params->water_level);
+ settings->setS16("chunksize", params->chunksize);
+ settings->setFlagStr("mg_flags", params->flags, flagdesc_mapgen);
+
+ params->writeParams(settings);
+}
+
+
+bool EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) {
+ mglist.insert(std::make_pair(mgname, mgfactory));
+ infostream << "EmergeManager: registered mapgen " << mgname << std::endl;
+}
+
+
+////////////////////////////// Emerge Thread //////////////////////////////////
+
+bool EmergeThread::popBlockEmerge(v3s16 *pos, u8 *flags) {
+ std::map<v3s16, BlockEmergeData *>::iterator iter;
+ JMutexAutoLock queuelock(emerge->queuemutex);
+
+ if (blockqueue.empty())
+ return false;
+ v3s16 p = blockqueue.front();
+ blockqueue.pop();
+
+ *pos = p;
+
+ iter = emerge->blocks_enqueued.find(p);
+ if (iter == emerge->blocks_enqueued.end())
+ return false; //uh oh, queue and map out of sync!!
+
+ BlockEmergeData *bedata = iter->second;
+ *flags = bedata->flags;
+
+ emerge->peer_queue_count[bedata->peer_requested]--;
+
+ delete bedata;
+ emerge->blocks_enqueued.erase(iter);
+
+ return true;
+}
+
+
+bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
+ BlockMakeData *data, bool allow_gen) {
+ v2s16 p2d(p.X, p.Z);
+ //envlock: usually takes <=1ms, sometimes 90ms or ~400ms to acquire
+ JMutexAutoLock envlock(m_server->m_env_mutex);
+
+ // Load sector if it isn't loaded
+ if (map->getSectorNoGenerateNoEx(p2d) == NULL)
+ map->loadSectorMeta(p2d);
+
+ // Attempt to load block
+ MapBlock *block = map->getBlockNoCreateNoEx(p);
+ if (!block || block->isDummy() || !block->isGenerated()) {
+ EMERGE_DBG_OUT("not in memory, attempting to load from disk");
+ block = map->loadBlock(p);
+ }
+
+ // If could not load and allowed to generate,
+ // start generation inside this same envlock
+ if (allow_gen && (block == NULL || !block->isGenerated())) {
+ EMERGE_DBG_OUT("generating");
+ *b = block;
+ return map->initBlockMake(data, p);
+ }
+
+ *b = block;
+ return false;
+}
+
+
+void *EmergeThread::Thread() {
+ ThreadStarted();
+ log_register_thread("EmergeThread" + id);
+ DSTACK(__FUNCTION_NAME);
+ BEGIN_DEBUG_EXCEPTION_HANDLER
+
+ v3s16 last_tried_pos(-32768,-32768,-32768); // For error output
+ v3s16 p;
+ u8 flags;
+
+ map = (ServerMap *)&(m_server->m_env->getMap());
+ emerge = m_server->m_emerge;
+ mapgen = emerge->mapgen[id];
+ enable_mapgen_debug_info = emerge->mapgen_debug_info;
+
+ while (getRun())
+ try {
+ if (!popBlockEmerge(&p, &flags)) {
+ qevent.wait();
+ continue;
+ }
+
+ last_tried_pos = p;
+ if (blockpos_over_limit(p))
+ continue;
+
+ bool allow_generate = flags & BLOCK_EMERGE_ALLOWGEN;
+ EMERGE_DBG_OUT("p=" PP(p) " allow_generate=" << allow_generate);
+
+ /*
+ Try to fetch block from memory or disk.
+ If not found and asked to generate, initialize generator.
+ */
+ BlockMakeData data;
+ MapBlock *block = NULL;
+ core::map<v3s16, MapBlock *> modified_blocks;
+
+ if (getBlockOrStartGen(p, &block, &data, allow_generate)) {
+ {
+ ScopeProfiler sp(g_profiler, "EmergeThread: Mapgen::makeChunk", SPT_AVG);
+ TimeTaker t("mapgen::make_block()");
+
+ mapgen->makeChunk(&data);
+
+ if (enable_mapgen_debug_info == false)
+ t.stop(true); // Hide output
+ }
+
+ {
+ //envlock: usually 0ms, but can take either 30 or 400ms to acquire
+ JMutexAutoLock envlock(m_server->m_env_mutex);
+ ScopeProfiler sp(g_profiler, "EmergeThread: after "
+ "Mapgen::makeChunk (envlock)", SPT_AVG);
+
+ map->finishBlockMake(&data, modified_blocks);
+
+ block = map->getBlockNoCreateNoEx(p);
+ if (block) {
+ /*
+ Do some post-generate stuff
+ */
+ v3s16 minp = data.blockpos_min * MAP_BLOCKSIZE;
+ v3s16 maxp = data.blockpos_max * MAP_BLOCKSIZE +
+ v3s16(1,1,1) * (MAP_BLOCKSIZE - 1);
+
+ // Ignore map edit events, they will not need to be sent
+ // to anybody because the block hasn't been sent to anybody
+ MapEditEventAreaIgnorer
+ ign(&m_server->m_ignore_map_edit_events_area,
+ VoxelArea(minp, maxp));
+ { // takes about 90ms with -O1 on an e3-1230v2
+ scriptapi_environment_on_generated(m_server->m_lua,
+ minp, maxp, emerge->getBlockSeed(minp));
+ }
+
+ EMERGE_DBG_OUT("ended up with: " << analyze_block(block));
+
+ m_server->m_env->activateBlock(block, 0);
+ }
+ }
+ }
+
+ /*
+ Set sent status of modified blocks on clients
+ */
+
+ // NOTE: Server's clients are also behind the connection mutex
+ //conlock: consistently takes 30-40ms to acquire
+ JMutexAutoLock lock(m_server->m_con_mutex);
+ // Add the originally fetched block to the modified list
+ if (block)
+ modified_blocks.insert(p, block);
+
+ // Set the modified blocks unsent for all the clients
+ for (core::map<u16, RemoteClient*>::Iterator
+ i = m_server->m_clients.getIterator();
+ i.atEnd() == false; i++) {
+ RemoteClient *client = i.getNode()->getValue();
+ if (modified_blocks.size() > 0) {
+ // Remove block from sent history
+ client->SetBlocksNotSent(modified_blocks);
+ }
+ }
+ }
+ catch (VersionMismatchException &e) {
+ std::ostringstream err;
+ err << "World data version mismatch in MapBlock "<<PP(last_tried_pos)<<std::endl;
+ err << "----"<<std::endl;
+ err << "\""<<e.what()<<"\""<<std::endl;
+ err << "See debug.txt."<<std::endl;
+ err << "World probably saved by a newer version of Minetest."<<std::endl;
+ m_server->setAsyncFatalError(err.str());
+ }
+ catch (SerializationError &e) {
+ std::ostringstream err;
+ err << "Invalid data in MapBlock "<<PP(last_tried_pos)<<std::endl;
+ err << "----"<<std::endl;
+ err << "\""<<e.what()<<"\""<<std::endl;
+ err << "See debug.txt."<<std::endl;
+ err << "You can ignore this using [ignore_world_load_errors = true]."<<std::endl;
+ m_server->setAsyncFatalError(err.str());
+ }
+
+ END_DEBUG_EXCEPTION_HANDLER(errorstream)
+ log_deregister_thread();
+ return NULL;
+}
diff --git a/src/emerge.h b/src/emerge.h
new file mode 100644
index 000000000..e5014df58
--- /dev/null
+++ b/src/emerge.h
@@ -0,0 +1,128 @@
+#ifndef EMERGE_HEADER
+#define EMERGE_HEADER
+
+#include <map>
+#include <queue>
+#include "util/thread.h"
+
+#define BLOCK_EMERGE_ALLOWGEN (1<<0)
+
+#define EMERGE_DBG_OUT(x) \
+ { if (enable_mapgen_debug_info) \
+ infostream << "EmergeThread: " x << std::endl; }
+
+class Mapgen;
+class MapgenParams;
+class MapgenFactory;
+class Biome;
+class BiomeDefManager;
+class EmergeThread;
+class ManualMapVoxelManipulator;
+
+#include "server.h"
+
+struct BlockMakeData {
+ ManualMapVoxelManipulator *vmanip;
+ u64 seed;
+ v3s16 blockpos_min;
+ v3s16 blockpos_max;
+ v3s16 blockpos_requested;
+ UniqueQueue<v3s16> transforming_liquid;
+ INodeDefManager *nodedef;
+
+ BlockMakeData():
+ vmanip(NULL),
+ seed(0),
+ nodedef(NULL)
+ {}
+
+ ~BlockMakeData() { delete vmanip; }
+};
+
+struct BlockEmergeData {
+ u16 peer_requested;
+ u8 flags;
+};
+
+class EmergeManager {
+public:
+ std::map<std::string, MapgenFactory *> mglist;
+
+ std::vector<Mapgen *> mapgen;
+ std::vector<EmergeThread *> emergethread;
+
+ //settings
+ MapgenParams *params;
+ bool mapgen_debug_info;
+ u16 qlimit_total;
+ u16 qlimit_diskonly;
+ u16 qlimit_generate;
+
+ //block emerge queue data structures
+ JMutex queuemutex;
+ std::map<v3s16, BlockEmergeData *> blocks_enqueued;
+ std::map<u16, u16> peer_queue_count;
+
+ //biome manager
+ BiomeDefManager *biomedef;
+
+ EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef);
+ ~EmergeManager();
+
+ void initMapgens(MapgenParams *mgparams);
+ Mapgen *createMapgen(std::string mgname, int mgid,
+ MapgenParams *mgparams);
+ MapgenParams *createMapgenParams(std::string mgname);
+ bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate);
+
+ bool registerMapgen(std::string name, MapgenFactory *mgfactory);
+ MapgenParams *getParamsFromSettings(Settings *settings);
+ void setParamsToSettings(Settings *settings);
+
+ //mapgen helper methods
+ Biome *getBiomeAtPoint(v3s16 p);
+ int getGroundLevelAtPoint(v2s16 p);
+ bool isBlockUnderground(v3s16 blockpos);
+ u32 getBlockSeed(v3s16 p);
+};
+
+class EmergeThread : public SimpleThread
+{
+ Server *m_server;
+ ServerMap *map;
+ EmergeManager *emerge;
+ Mapgen *mapgen;
+ bool enable_mapgen_debug_info;
+ int id;
+
+public:
+ Event qevent;
+ std::queue<v3s16> blockqueue;
+
+ EmergeThread(Server *server, int ethreadid):
+ SimpleThread(),
+ m_server(server),
+ map(NULL),
+ emerge(NULL),
+ mapgen(NULL),
+ id(ethreadid)
+ {
+ }
+
+ void *Thread();
+
+ void trigger()
+ {
+ setRun(true);
+ if(IsRunning() == false)
+ {
+ Start();
+ }
+ }
+
+ bool popBlockEmerge(v3s16 *pos, u8 *flags);
+ bool getBlockOrStartGen(v3s16 p, MapBlock **b,
+ BlockMakeData *data, bool allow_generate);
+};
+
+#endif
diff --git a/src/environment.cpp b/src/environment.cpp
index ebf5e9a63..e939672e7 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/environment.h b/src/environment.h
index d1e61967f..07a4d7635 100644
--- a/src/environment.h
+++ b/src/environment.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -40,7 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapnode.h"
#include "mapblock.h"
-class Server;
class ServerEnvironment;
class ActiveBlockModifier;
class ServerActiveObject;
diff --git a/src/event.h b/src/event.h
index 9e7a0dbf5..cfc222d5d 100644
--- a/src/event.h
+++ b/src/event.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/event_manager.h b/src/event_manager.h
index 9bc8e35eb..33d99b28c 100644
--- a/src/event_manager.h
+++ b/src/event_manager.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/exceptions.h b/src/exceptions.h
index 35a57d070..458fb50b1 100644
--- a/src/exceptions.h
+++ b/src/exceptions.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/farmesh.cpp b/src/farmesh.cpp
index 23f3db5f6..443e2b3bf 100644
--- a/src/farmesh.cpp
+++ b/src/farmesh.cpp
@@ -1,6 +1,6 @@
/*
-Part of Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Part of Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/farmesh.h b/src/farmesh.h
index 2eaf7d486..47147fa8f 100644
--- a/src/farmesh.h
+++ b/src/farmesh.h
@@ -1,6 +1,6 @@
/*
-Part of Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Part of Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/filecache.cpp b/src/filecache.cpp
index 716c769aa..23df1d7d0 100644
--- a/src/filecache.cpp
+++ b/src/filecache.cpp
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2012 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/filecache.h b/src/filecache.h
index da7e59f6a..cf59a8e5b 100644
--- a/src/filecache.h
+++ b/src/filecache.h
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2012 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/filesys.cpp b/src/filesys.cpp
index bf26c8dac..256c8f16a 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/filesys.h b/src/filesys.h
index b7e6f3715..263eb796f 100644
--- a/src/filesys.h
+++ b/src/filesys.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/game.cpp b/src/game.cpp
index 86909ccf0..8ab0f3fe3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/game.h b/src/game.h
index b74a7a8da..fef777fea 100644
--- a/src/game.h
+++ b/src/game.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/gamedef.h b/src/gamedef.h
index 6fc99b9f1..1d46b028e 100644
--- a/src/gamedef.h
+++ b/src/gamedef.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/genericobject.cpp b/src/genericobject.cpp
index 398b07feb..f7b272b00 100644
--- a/src/genericobject.cpp
+++ b/src/genericobject.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/genericobject.h b/src/genericobject.h
index b69c24b48..9a21baa67 100644
--- a/src/genericobject.h
+++ b/src/genericobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/gettime.h b/src/gettime.h
index b5cb830cc..611906559 100644
--- a/src/gettime.h
+++ b/src/gettime.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 13883901e..f522af01f 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h
index 033a26244..c896aae28 100644
--- a/src/guiChatConsole.h
+++ b/src/guiChatConsole.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiConfigureWorld.cpp b/src/guiConfigureWorld.cpp
index fdcd0d3e8..080691222 100644
--- a/src/guiConfigureWorld.cpp
+++ b/src/guiConfigureWorld.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiConfigureWorld.h b/src/guiConfigureWorld.h
index 2280c6dbe..8a77c5f89 100644
--- a/src/guiConfigureWorld.h
+++ b/src/guiConfigureWorld.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiConfirmMenu.cpp b/src/guiConfirmMenu.cpp
index 299110070..70e33c760 100644
--- a/src/guiConfirmMenu.cpp
+++ b/src/guiConfirmMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiConfirmMenu.h b/src/guiConfirmMenu.h
index b9fb2cd53..7d217d6a6 100644
--- a/src/guiConfirmMenu.h
+++ b/src/guiConfirmMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiCreateWorld.cpp b/src/guiCreateWorld.cpp
index a4c528b3e..8ac3fb17c 100644
--- a/src/guiCreateWorld.cpp
+++ b/src/guiCreateWorld.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiCreateWorld.h b/src/guiCreateWorld.h
index 492fcf565..d9bc3638a 100644
--- a/src/guiCreateWorld.h
+++ b/src/guiCreateWorld.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiDeathScreen.cpp b/src/guiDeathScreen.cpp
index 4a767c43c..ba329e3be 100644
--- a/src/guiDeathScreen.cpp
+++ b/src/guiDeathScreen.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiDeathScreen.h b/src/guiDeathScreen.h
index 3c0307634..261053a51 100644
--- a/src/guiDeathScreen.h
+++ b/src/guiDeathScreen.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index a1da09ee1..120d6629a 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index 86235900d..aee16736e 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp
index 3f6d03ebb..4569f3d9d 100644
--- a/src/guiKeyChangeMenu.cpp
+++ b/src/guiKeyChangeMenu.cpp
@@ -1,8 +1,8 @@
/*
- Minetest-c55
- Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
- Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
- Copyright (C) 2011 teddydestodes <derkomtur@schattengang.net>
+ Minetest
+ Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+ Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
+ Copyright (C) 2013 teddydestodes <derkomtur@schattengang.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/guiKeyChangeMenu.h b/src/guiKeyChangeMenu.h
index beb4f0b6f..2b498676b 100644
--- a/src/guiKeyChangeMenu.h
+++ b/src/guiKeyChangeMenu.h
@@ -1,8 +1,8 @@
/*
- Minetest-c55
- Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
- Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
- Copyright (C) 2011 teddydestodes <derkomtur@schattengang.net>
+ Minetest
+ Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+ Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
+ Copyright (C) 2013 teddydestodes <derkomtur@schattengang.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp
index ca334198f..c2e68579e 100644
--- a/src/guiMainMenu.cpp
+++ b/src/guiMainMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-12 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h
index 558a05d59..a21f3b32a 100644
--- a/src/guiMainMenu.h
+++ b/src/guiMainMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp
index 24d6f7f52..abb31cf2d 100644
--- a/src/guiMessageMenu.cpp
+++ b/src/guiMessageMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiMessageMenu.h b/src/guiMessageMenu.h
index af2fc44a5..8ec8e4a41 100644
--- a/src/guiMessageMenu.h
+++ b/src/guiMessageMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp
index ecae55e10..e4b77b611 100644
--- a/src/guiPasswordChange.cpp
+++ b/src/guiPasswordChange.cpp
@@ -1,7 +1,7 @@
/*
-Part of Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
+Part of Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/src/guiPasswordChange.h b/src/guiPasswordChange.h
index f5f767b5e..aecc7076f 100644
--- a/src/guiPasswordChange.h
+++ b/src/guiPasswordChange.h
@@ -1,7 +1,7 @@
/*
-Part of Minetest-c55
-Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
+Part of Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp
index 9d44b2e82..dc95eef5b 100644
--- a/src/guiPauseMenu.cpp
+++ b/src/guiPauseMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiPauseMenu.h b/src/guiPauseMenu.h
index 578f2a324..25011a34a 100644
--- a/src/guiPauseMenu.h
+++ b/src/guiPauseMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp
index 857c26a45..f4e3bb5ba 100644
--- a/src/guiTextInputMenu.cpp
+++ b/src/guiTextInputMenu.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiTextInputMenu.h b/src/guiTextInputMenu.h
index 1a55525c9..2fa7ead9e 100644
--- a/src/guiTextInputMenu.h
+++ b/src/guiTextInputMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/guiVolumeChange.cpp b/src/guiVolumeChange.cpp
index 606aa0196..cfb89da1c 100644
--- a/src/guiVolumeChange.cpp
+++ b/src/guiVolumeChange.cpp
@@ -1,7 +1,7 @@
/*
-Part of Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
+Part of Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
Copyright (C) 2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
Permission to use, copy, modify, and distribute this software for any
diff --git a/src/guiVolumeChange.h b/src/guiVolumeChange.h
index a0a50f393..1dcc7fbde 100644
--- a/src/guiVolumeChange.h
+++ b/src/guiVolumeChange.h
@@ -1,7 +1,7 @@
/*
-Part of Minetest-c55
-Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
+Part of Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
Copyright (C) 2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
Permission to use, copy, modify, and distribute this software for any
diff --git a/src/hex.h b/src/hex.h
index e54ef9634..87a6aecb4 100644
--- a/src/hex.h
+++ b/src/hex.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+Minetest
+Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/intlGUIEditBox.cpp b/src/intlGUIEditBox.cpp
index 4add61e20..32cca4866 100644
--- a/src/intlGUIEditBox.cpp
+++ b/src/intlGUIEditBox.cpp
@@ -25,7 +25,7 @@
// after program initialization....
//
-// Copyright (C) 2002-2010 Nikolaus Gebhardt
+// Copyright (C) 2002-2013 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/src/intlGUIEditBox.h b/src/intlGUIEditBox.h
index f888fb620..e3ee15a30 100644
--- a/src/intlGUIEditBox.h
+++ b/src/intlGUIEditBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2010 Nikolaus Gebhardt
+// Copyright (C) 2002-2013 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 5e39a41a6..7051b611f 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/inventory.h b/src/inventory.h
index 5f90183d2..676088b94 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 4d862de66..08cae6d40 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/inventorymanager.h b/src/inventorymanager.h
index f81f5b972..8e2abc961 100644
--- a/src/inventorymanager.h
+++ b/src/inventorymanager.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irr_aabb3d.h b/src/irr_aabb3d.h
index 3f04198ad..7ac401837 100644
--- a/src/irr_aabb3d.h
+++ b/src/irr_aabb3d.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irr_v2d.h b/src/irr_v2d.h
index 0710684ce..5c0d65a30 100644
--- a/src/irr_v2d.h
+++ b/src/irr_v2d.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irr_v3d.h b/src/irr_v3d.h
index 21051f93c..7bc73ad10 100644
--- a/src/irr_v3d.h
+++ b/src/irr_v3d.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irrlichttypes.h b/src/irrlichttypes.h
index 2db744a48..7da1a4bd2 100644
--- a/src/irrlichttypes.h
+++ b/src/irrlichttypes.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irrlichttypes_bloated.h b/src/irrlichttypes_bloated.h
index 528ee1f47..2ce19999e 100644
--- a/src/irrlichttypes_bloated.h
+++ b/src/irrlichttypes_bloated.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/irrlichttypes_extrabloated.h b/src/irrlichttypes_extrabloated.h
index f85fb6318..a541b1a02 100644
--- a/src/irrlichttypes_extrabloated.h
+++ b/src/irrlichttypes_extrabloated.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index a4f3895e0..c1ecf762f 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Kahrl <kahrl@gmx.net>
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Kahrl <kahrl@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/itemdef.h b/src/itemdef.h
index ae3600868..4a9e16966 100644
--- a/src/itemdef.h
+++ b/src/itemdef.h
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2011 Kahrl <kahrl@gmx.net>
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Kahrl <kahrl@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/itemgroup.h b/src/itemgroup.h
index c6c36dcc4..69678064f 100644
--- a/src/itemgroup.h
+++ b/src/itemgroup.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/jthread/jmutex.h b/src/jthread/jmutex.h
index 9ce013096..e528aeb4a 100644
--- a/src/jthread/jmutex.h
+++ b/src/jthread/jmutex.h
@@ -30,6 +30,9 @@
#define JMUTEX_H
#if (defined(WIN32) || defined(_WIN32_WCE))
+ #ifndef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0500
+ #endif
#ifndef _WIN32_WCE
#include <process.h>
#endif // _WIN32_WCE
@@ -67,4 +70,54 @@ private:
bool initialized;
};
+#ifdef _WIN32
+
+class Event {
+ HANDLE hEvent;
+
+public:
+ Event() {
+ hEvent = CreateEvent(NULL, 0, 0, NULL);
+ }
+
+ ~Event() {
+ CloseHandle(hEvent);
+ }
+
+ void wait() {
+ WaitForSingleObject(hEvent, INFINITE);
+ }
+
+ void signal() {
+ SetEvent(hEvent);
+ }
+};
+
+#else
+
+#include <semaphore.h>
+
+class Event {
+ sem_t sem;
+
+public:
+ Event() {
+ sem_init(&sem, 0, 0);
+ }
+
+ ~Event() {
+ sem_destroy(&sem);
+ }
+
+ void wait() {
+ sem_wait(&sem);
+ }
+
+ void signal() {
+ sem_post(&sem);
+ }
+};
+
+#endif
+
#endif // JMUTEX_H
diff --git a/src/keycode.cpp b/src/keycode.cpp
index 9aa9d300d..8aadab2f1 100644
--- a/src/keycode.cpp
+++ b/src/keycode.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/keycode.h b/src/keycode.h
index a0b1e3553..65f04d8d7 100644
--- a/src/keycode.h
+++ b/src/keycode.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/light.cpp b/src/light.cpp
index 66bceb72b..765c6303a 100644
--- a/src/light.cpp
+++ b/src/light.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/light.h b/src/light.h
index f1c458ad8..e847e1ce9 100644
--- a/src/light.h
+++ b/src/light.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 8b6d7e2f6..0554302e0 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/localplayer.h b/src/localplayer.h
index c9d010d7c..f372c787d 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/log.cpp b/src/log.cpp
index 78fa32026..366d83b64 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/log.h b/src/log.h
index 012e7e938..7d8b60b71 100644
--- a/src/log.h
+++ b/src/log.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/logoutputbuffer.h b/src/logoutputbuffer.h
index 1fb155aae..69f06c444 100644
--- a/src/logoutputbuffer.h
+++ b/src/logoutputbuffer.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/luaentity_common.h b/src/luaentity_common.h
index 74dd046cb..35b079ade 100644
--- a/src/luaentity_common.h
+++ b/src/luaentity_common.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/main.cpp b/src/main.cpp
index 7bbbf082d..cfd643ac7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/main.h b/src/main.h
index a169a45dc..daa8c70d2 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h
index dc2b287d4..ce7684f11 100644
--- a/src/mainmenumanager.h
+++ b/src/mainmenumanager.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/map.cpp b/src/map.cpp
index 7272451a4..07af2676b 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gamedef.h"
#include "util/directiontables.h"
#include "rollback_interface.h"
+#include "emerge.h"
#include "mapgen_v6.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
@@ -2320,7 +2321,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
m_mgparams = m_emerge->getParamsFromSettings(g_settings);
if (!m_mgparams)
m_mgparams = new MapgenV6Params();
-
+
m_seed = m_mgparams->seed;
if (g_settings->get("fixed_map_seed").empty())
@@ -2454,14 +2455,10 @@ ServerMap::~ServerMap()
#endif
}
-void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
+bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
{
- bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
- if(enable_mapgen_debug_info)
- infostream<<"initBlockMake(): "
- <<"("<<blockpos.X<<","<<blockpos.Y<<","<<blockpos.Z<<") - "
- <<"("<<blockpos.X<<","<<blockpos.Y<<","<<blockpos.Z<<")"
- <<std::endl;
+ bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info;
+ EMERGE_DBG_OUT("initBlockMake(): " PP(blockpos) " - " PP(blockpos));
//s16 chunksize = 3;
//v3s16 chunk_offset(-1,-1,-1);
@@ -2481,12 +2478,8 @@ void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
// Do nothing if not inside limits (+-1 because of neighbors)
if(blockpos_over_limit(blockpos_min - extra_borders) ||
blockpos_over_limit(blockpos_max + extra_borders))
- {
- data->no_op = true;
- return;
- }
+ return false;
- data->no_op = false;
data->seed = m_seed;
data->blockpos_min = blockpos_min;
data->blockpos_max = blockpos_max;
@@ -2557,8 +2550,24 @@ void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
//TimeTaker timer("initBlockMake() initialEmerge");
data->vmanip->initialEmerge(bigarea_blocks_min, bigarea_blocks_max);
}
+
+ // Ensure none of the blocks to be generated were marked as containing CONTENT_IGNORE
+/* for (s16 z = blockpos_min.Z; z <= blockpos_max.Z; z++) {
+ for (s16 y = blockpos_min.Y; y <= blockpos_max.Y; y++) {
+ for (s16 x = blockpos_min.X; x <= blockpos_max.X; x++) {
+ core::map<v3s16, u8>::Node *n;
+ n = data->vmanip->m_loaded_blocks.find(v3s16(x, y, z));
+ if (n == NULL)
+ continue;
+ u8 flags = n->getValue();
+ flags &= ~VMANIP_BLOCK_CONTAINS_CIGNORE;
+ n->setValue(flags);
+ }
+ }
+ }*/
// Data is ready now.
+ return true;
}
MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
@@ -2573,13 +2582,7 @@ MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
v3s16 extra_borders(1,1,1);
- if(data->no_op)
- {
- //infostream<<"finishBlockMake(): no-op"<<std::endl;
- return NULL;
- }
-
- bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
+ bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info;
/*infostream<<"Resulting vmanip:"<<std::endl;
data->vmanip.print(infostream);*/
@@ -2607,9 +2610,7 @@ MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
data->vmanip->blitBackAll(&changed_blocks);
}
- if(enable_mapgen_debug_info)
- infostream<<"finishBlockMake: changed_blocks.size()="
- <<changed_blocks.size()<<std::endl;
+ EMERGE_DBG_OUT("finishBlockMake: changed_blocks.size()=" << changed_blocks.size());
/*
Copy transforming liquid information
@@ -3983,8 +3984,10 @@ void MapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
for(s32 y=p_min.Y; y<=p_max.Y; y++)
for(s32 x=p_min.X; x<=p_max.X; x++)
{
+ u8 flags = 0;
+ MapBlock *block;
v3s16 p(x,y,z);
- core::map<v3s16, bool>::Node *n;
+ core::map<v3s16, u8>::Node *n;
n = m_loaded_blocks.find(p);
if(n != NULL)
continue;
@@ -4000,7 +4003,7 @@ void MapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
a.print(infostream);
infostream<<std::endl;*/
- MapBlock *block = m_map->getBlockNoCreate(p);
+ block = m_map->getBlockNoCreate(p);
if(block->isDummy())
block_data_inexistent = true;
else
@@ -4013,6 +4016,8 @@ void MapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
if(block_data_inexistent)
{
+ flags |= VMANIP_BLOCK_DATA_INEXIST;
+
VoxelArea a(p*MAP_BLOCKSIZE, (p+1)*MAP_BLOCKSIZE-v3s16(1,1,1));
// Fill with VOXELFLAG_INEXISTENT
for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++)
@@ -4022,8 +4027,13 @@ void MapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
memset(&m_flags[i], VOXELFLAG_INEXISTENT, MAP_BLOCKSIZE);
}
}
+ /*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE)
+ {
+ // Mark that block was loaded as blank
+ flags |= VMANIP_BLOCK_CONTAINS_CIGNORE;
+ }*/
- m_loaded_blocks.insert(p, !block_data_inexistent);
+ m_loaded_blocks.insert(p, flags);
}
//infostream<<"emerge done"<<std::endl;
@@ -4143,8 +4153,10 @@ void ManualMapVoxelManipulator::initialEmerge(
for(s32 y=p_min.Y; y<=p_max.Y; y++)
for(s32 x=p_min.X; x<=p_max.X; x++)
{
+ u8 flags = 0;
+ MapBlock *block;
v3s16 p(x,y,z);
- core::map<v3s16, bool>::Node *n;
+ core::map<v3s16, u8>::Node *n;
n = m_loaded_blocks.find(p);
if(n != NULL)
continue;
@@ -4154,7 +4166,7 @@ void ManualMapVoxelManipulator::initialEmerge(
{
TimeTaker timer1("emerge load", &emerge_load_time);
- MapBlock *block = m_map->getBlockNoCreate(p);
+ block = m_map->getBlockNoCreate(p);
if(block->isDummy())
block_data_inexistent = true;
else
@@ -4167,6 +4179,8 @@ void ManualMapVoxelManipulator::initialEmerge(
if(block_data_inexistent)
{
+ flags |= VMANIP_BLOCK_DATA_INEXIST;
+
/*
Mark area inexistent
*/
@@ -4179,8 +4193,13 @@ void ManualMapVoxelManipulator::initialEmerge(
memset(&m_flags[i], VOXELFLAG_INEXISTENT, MAP_BLOCKSIZE);
}
}
+ /*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE)
+ {
+ // Mark that block was loaded as blank
+ flags |= VMANIP_BLOCK_CONTAINS_CIGNORE;
+ }*/
- m_loaded_blocks.insert(p, !block_data_inexistent);
+ m_loaded_blocks.insert(p, flags);
}
}
@@ -4193,12 +4212,14 @@ void ManualMapVoxelManipulator::blitBackAll(
/*
Copy data of all blocks
*/
- for(core::map<v3s16, bool>::Iterator
+ for(core::map<v3s16, u8>::Iterator
i = m_loaded_blocks.getIterator();
i.atEnd() == false; i++)
{
v3s16 p = i.getNode()->getKey();
- bool existed = i.getNode()->getValue();
+ u8 flags = i.getNode()->getValue();
+
+ bool existed = !(flags & VMANIP_BLOCK_DATA_INEXIST);
if(existed == false)
{
// The Great Bug was found using this
@@ -4207,6 +4228,7 @@ void ManualMapVoxelManipulator::blitBackAll(
<<std::endl;*/
continue;
}
+
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
if(block == NULL)
{
@@ -4218,7 +4240,7 @@ void ManualMapVoxelManipulator::blitBackAll(
}
block->copyFrom(*this);
-
+
if(modified_blocks)
modified_blocks->insert(p, block);
}
diff --git a/src/map.h b/src/map.h
index a0305b790..d356da2d1 100644
--- a/src/map.h
+++ b/src/map.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -46,6 +46,8 @@ class MapBlock;
class NodeMetadata;
class IGameDef;
class IRollbackReportSink;
+class EmergeManager;
+class BlockMakeData;
/*
@@ -381,8 +383,8 @@ public:
/*
Blocks are generated by using these and makeBlock().
*/
- void initBlockMake(BlockMakeData *data, v3s16 blockpos);
- MapBlock* finishBlockMake(BlockMakeData *data,
+ bool initBlockMake(BlockMakeData *data, v3s16 blockpos);
+ MapBlock *finishBlockMake(BlockMakeData *data,
core::map<v3s16, MapBlock*> &changed_blocks);
// A non-threaded wrapper to the above - DEFUNCT
@@ -519,6 +521,9 @@ private:
sqlite3_stmt *m_database_list;
};
+#define VMANIP_BLOCK_DATA_INEXIST 1
+#define VMANIP_BLOCK_CONTAINS_CIGNORE 2
+
class MapVoxelManipulator : public VoxelManipulator
{
public:
@@ -534,14 +539,14 @@ public:
virtual void emerge(VoxelArea a, s32 caller_id=-1);
void blitBack(core::map<v3s16, MapBlock*> & modified_blocks);
-
-protected:
- Map *m_map;
+
/*
key = blockpos
- value = block existed when loaded
+ value = flags describing the block
*/
- core::map<v3s16, bool> m_loaded_blocks;
+ core::map<v3s16, u8> m_loaded_blocks;
+protected:
+ Map *m_map;
};
class ManualMapVoxelManipulator : public MapVoxelManipulator
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index e9c8fadff..a6e9b3951 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mapblock.h b/src/mapblock.h
index d56d93dda..692b54318 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index daebbe217..f4d57922a 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h
index c23b6cc5a..5b33990c6 100644
--- a/src/mapblock_mesh.h
+++ b/src/mapblock_mesh.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/mapchunk.h b/src/mapchunk.h
index 6b7a411d7..a70de8711 100644
--- a/src/mapchunk.h
+++ b/src/mapchunk.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index a2d920bbc..ef5da6bf1 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -46,144 +46,6 @@ FlagDesc flagdesc_mapgen[] = {
};
///////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// Emerge Manager ////////////////////////////////
-
-
-EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) {
- //register built-in mapgens
- registerMapgen("v6", new MapgenFactoryV6());
-
- //the order of these assignments is pretty important
- this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef);
- this->params = NULL;
- this->mapgen = NULL;
-}
-
-
-EmergeManager::~EmergeManager() {
- delete biomedef;
- delete mapgen;
- delete params;
-}
-
-
-void EmergeManager::initMapgens(MapgenParams *mgparams) {
- if (mapgen)
- return;
-
- this->params = mgparams;
- this->mapgen = getMapgen(); //only one mapgen for now!
-}
-
-
-Mapgen *EmergeManager::getMapgen() {
- if (!mapgen) {
- mapgen = createMapgen(params->mg_name, 0, params, this);
- if (!mapgen) {
- infostream << "EmergeManager: falling back to mapgen v6" << std::endl;
- delete params;
- params = createMapgenParams("v6");
- mapgen = createMapgen("v6", 0, params, this);
- }
- }
- return mapgen;
-}
-
-void EmergeManager::addBlockToQueue() {
- //STUB
-}
-
-
-int EmergeManager::getGroundLevelAtPoint(v2s16 p) {
- if (!mapgen)
- return 0;
- return mapgen->getGroundLevelAtPoint(p);
-}
-
-
-bool EmergeManager::isBlockUnderground(v3s16 blockpos) {
- /*
- v2s16 p = v2s16((blockpos.X * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2,
- (blockpos.Y * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2);
- int ground_level = getGroundLevelAtPoint(p);
- return blockpos.Y * (MAP_BLOCKSIZE + 1) <= min(water_level, ground_level);
- */
-
- //yuck, but then again, should i bother being accurate?
- //the height of the nodes in a single block is quite variable
- return blockpos.Y * (MAP_BLOCKSIZE + 1) <= params->water_level;
-}
-
-
-u32 EmergeManager::getBlockSeed(v3s16 p) {
- return (u32)(params->seed & 0xFFFFFFFF) +
- p.Z * 38134234 +
- p.Y * 42123 +
- p.Y * 23;
-}
-
-
-Mapgen *EmergeManager::createMapgen(std::string mgname, int mgid,
- MapgenParams *mgparams, EmergeManager *emerge) {
- std::map<std::string, MapgenFactory *>::const_iterator iter = mglist.find(mgname);
- if (iter == mglist.end()) {
- errorstream << "EmergeManager; mapgen " << mgname <<
- " not registered" << std::endl;
- return NULL;
- }
-
- MapgenFactory *mgfactory = iter->second;
- return mgfactory->createMapgen(mgid, mgparams, emerge);
-}
-
-
-MapgenParams *EmergeManager::createMapgenParams(std::string mgname) {
- std::map<std::string, MapgenFactory *>::const_iterator iter = mglist.find(mgname);
- if (iter == mglist.end()) {
- errorstream << "EmergeManager: mapgen " << mgname <<
- " not registered" << std::endl;
- return NULL;
- }
-
- MapgenFactory *mgfactory = iter->second;
- return mgfactory->createMapgenParams();
-}
-
-
-MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
- std::string mg_name = settings->get("mg_name");
- MapgenParams *mgparams = createMapgenParams(mg_name);
-
- mgparams->mg_name = mg_name;
- mgparams->seed = settings->getU64(settings == g_settings ? "fixed_map_seed" : "seed");
- mgparams->water_level = settings->getS16("water_level");
- mgparams->chunksize = settings->getS16("chunksize");
- mgparams->flags = settings->getFlagStr("mg_flags", flagdesc_mapgen);
-
- if (!mgparams->readParams(settings)) {
- delete mgparams;
- return NULL;
- }
- return mgparams;
-}
-
-
-void EmergeManager::setParamsToSettings(Settings *settings) {
- settings->set("mg_name", params->mg_name);
- settings->setU64("seed", params->seed);
- settings->setS16("water_level", params->water_level);
- settings->setS16("chunksize", params->chunksize);
- settings->setFlagStr("mg_flags", params->flags, flagdesc_mapgen);
-
- params->writeParams(settings);
-}
-
-
-void EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) {
- mglist.insert(std::make_pair(mgname, mgfactory));
- infostream << "EmergeManager: registered mapgen " << mgname << std::endl;
-}
-
/////////////////////
@@ -2986,18 +2848,3 @@ void make_block(BlockMakeData *data)
#endif ///BIG COMMENT
-BlockMakeData::BlockMakeData():
- no_op(false),
- vmanip(NULL),
- seed(0),
- nodedef(NULL)
-{}
-
-BlockMakeData::~BlockMakeData()
-{
- delete vmanip;
-}
-
-//}; // namespace mapgen
-
-
diff --git a/src/mapgen.h b/src/mapgen.h
index 4f1ab4ebd..911e87537 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -36,6 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MGV6_BIOME_BLEND 0x10
#define MG_FLAT 0x20
+extern FlagDesc flagdesc_mapgen[];
+
class BiomeDefManager;
class Biome;
class EmergeManager;
@@ -43,20 +45,7 @@ class MapBlock;
class ManualMapVoxelManipulator;
class VoxelManipulator;
class INodeDefManager;
-
-struct BlockMakeData {
- bool no_op;
- ManualMapVoxelManipulator *vmanip;
- u64 seed;
- v3s16 blockpos_min;
- v3s16 blockpos_max;
- v3s16 blockpos_requested;
- UniqueQueue<v3s16> transforming_liquid;
- INodeDefManager *nodedef;
-
- BlockMakeData();
- ~BlockMakeData();
-};
+class BlockMakeData;
struct MapgenParams {
std::string mg_name;
@@ -99,39 +88,5 @@ struct MapgenFactory {
virtual MapgenParams *createMapgenParams() = 0;
};
-class EmergeManager {
-public:
- std::map<std::string, MapgenFactory *> mglist;
-
- //settings
- MapgenParams *params;
-
- //mapgen objects here
- Mapgen *mapgen;
-
- //biome manager
- BiomeDefManager *biomedef;
-
- EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef);
- ~EmergeManager();
-
- void initMapgens(MapgenParams *mgparams);
- Mapgen *createMapgen(std::string mgname, int mgid,
- MapgenParams *mgparams, EmergeManager *emerge);
- MapgenParams *createMapgenParams(std::string mgname);
- Mapgen *getMapgen();
- void addBlockToQueue();
-
- void registerMapgen(std::string name, MapgenFactory *mgfactory);
- MapgenParams *getParamsFromSettings(Settings *settings);
- void setParamsToSettings(Settings *settings);
-
- //mapgen helper methods
- Biome *getBiomeAtPoint(v3s16 p);
- int getGroundLevelAtPoint(v2s16 p);
- bool isBlockUnderground(v3s16 blockpos);
- u32 getBlockSeed(v3s16 p);
-};
-
#endif
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index 3a5e10930..d5405876e 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "profiler.h"
#include "settings.h" // For g_settings
#include "main.h" // For g_profiler
+#include "emerge.h"
#include "mapgen_v6.h"
/////////////////// Mapgen V6 perlin noise default values
@@ -431,12 +432,6 @@ int MapgenV6::getGroundLevelAtPoint(v2s16 p) {
void MapgenV6::makeChunk(BlockMakeData *data)
{
- if(data->no_op)
- {
- //dstream<<"makeBlock: no-op"<<std::endl;
- return;
- }
-
this->generating = true;
assert(data->vmanip);
@@ -1435,4 +1430,5 @@ void MapgenV6::makeChunk(BlockMakeData *data)
vmanip.spreadLight(bank, light_sources, ndef);
}
}
+ this->generating = false;
}
diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h
index 9a2a0287d..d2f05252b 100644
--- a/src/mapgen_v6.h
+++ b/src/mapgen_v6.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 5dab93754..0513e688c 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mapnode.h b/src/mapnode.h
index 56dfa6310..1c8c5c49c 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/mapsector.cpp b/src/mapsector.cpp
index f152c38e7..108effa79 100644
--- a/src/mapsector.cpp
+++ b/src/mapsector.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mapsector.h b/src/mapsector.h
index 74539ab24..88fc76b57 100644
--- a/src/mapsector.h
+++ b/src/mapsector.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mesh.cpp b/src/mesh.cpp
index 29b853143..c2e6bcaa4 100644
--- a/src/mesh.cpp
+++ b/src/mesh.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/mesh.h b/src/mesh.h
index 5e1efcd52..cf46e7f8f 100644
--- a/src/mesh.h
+++ b/src/mesh.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/modalMenu.h b/src/modalMenu.h
index 04372167b..d19b4e27c 100644
--- a/src/modalMenu.h
+++ b/src/modalMenu.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/modifiedstate.h b/src/modifiedstate.h
index 98004619f..75518f2f5 100644
--- a/src/modifiedstate.h
+++ b/src/modifiedstate.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mods.cpp b/src/mods.cpp
index f6e3d58d7..ac2d9b17d 100644
--- a/src/mods.cpp
+++ b/src/mods.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/mods.h b/src/mods.h
index 59dffdade..9761a9103 100644
--- a/src/mods.h
+++ b/src/mods.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/nameidmapping.cpp b/src/nameidmapping.cpp
index 2a436f735..bcddb4515 100644
--- a/src/nameidmapping.cpp
+++ b/src/nameidmapping.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/nameidmapping.h b/src/nameidmapping.h
index 90d8dbed8..417c441d2 100644
--- a/src/nameidmapping.h
+++ b/src/nameidmapping.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 12d9238ad..9a1145a8e 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/nodedef.h b/src/nodedef.h
index fa0c1f2e8..b3f972b9b 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp
index 141c779f1..911d86d22 100644
--- a/src/nodemetadata.cpp
+++ b/src/nodemetadata.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/nodemetadata.h b/src/nodemetadata.h
index 262b64d74..5af10d0f0 100644
--- a/src/nodemetadata.h
+++ b/src/nodemetadata.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp
index bf1e7435d..db5fb08b6 100644
--- a/src/nodetimer.cpp
+++ b/src/nodetimer.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/nodetimer.h b/src/nodetimer.h
index c643ab888..bdbd32293 100644
--- a/src/nodetimer.h
+++ b/src/nodetimer.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/noise.cpp b/src/noise.cpp
index bfb1960c8..d250882e8 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/noise.h b/src/noise.h
index e725b4e47..c2a85771c 100644
--- a/src/noise.h
+++ b/src/noise.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/object_properties.cpp b/src/object_properties.cpp
index ec988a37d..6086bf09f 100644
--- a/src/object_properties.cpp
+++ b/src/object_properties.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/object_properties.h b/src/object_properties.h
index d7d44625e..bde38bd66 100644
--- a/src/object_properties.h
+++ b/src/object_properties.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/particles.cpp b/src/particles.cpp
index d49e33322..fef21d91b 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/particles.h b/src/particles.h
index 3ed9dfdc8..b317549e7 100644
--- a/src/particles.h
+++ b/src/particles.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/player.cpp b/src/player.cpp
index 86d3ae184..4c81887be 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/player.h b/src/player.h
index 770afdb37..496c99532 100644
--- a/src/player.h
+++ b/src/player.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/porting.cpp b/src/porting.cpp
index f8a2cca5c..84df15b30 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
@@ -131,6 +131,127 @@ void signal_handler_init(void)
#endif
+
+/*
+ Multithreading support
+*/
+int getNumberOfProcessors() {
+#if defined(_SC_NPROCESSORS_ONLN)
+
+ return sysconf(_SC_NPROCESSORS_ONLN);
+
+#elif defined(__FreeBSD__) || defined(__APPLE__)
+
+ unsigned int len, count;
+ len = sizeof(count);
+ return sysctlbyname("hw.ncpu", &count, &len, NULL, 0);
+
+#elif defined(_GNU_SOURCE)
+
+ return get_nprocs();
+
+#elif defined(_WIN32)
+
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return sysinfo.dwNumberOfProcessors;
+
+#elif defined(PTW32_VERSION) || defined(__hpux)
+
+ return pthread_num_processors_np();
+
+#else
+
+ return 1;
+
+#endif
+}
+
+
+bool threadBindToProcessor(threadid_t tid, int pnumber) {
+#if defined(_WIN32)
+
+ HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, 0, tid);
+ if (!hThread)
+ return false;
+
+ bool success = SetThreadAffinityMask(hThread, 1 << pnumber) != 0;
+
+ CloseHandle(hThread);
+ return success;
+
+#elif (defined(__FreeBSD__) && (__FreeBSD_version >= 702106)) \
+ || defined(__linux) || defined(linux)
+
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+ CPU_SET(pnumber, &cpuset);
+ return pthread_setaffinity_np(tid, sizeof(cpuset), &cpuset) == 0;
+
+#elif defined(__sun) || defined(sun)
+
+ return processor_bind(P_LWPID, MAKE_LWPID_PTHREAD(tid),
+ pnumber, NULL) == 0;
+
+#elif defined(_AIX)
+
+ return bindprocessor(BINDTHREAD, (tid_t)tid, pnumber) == 0;
+
+#elif defined(__hpux) || defined(hpux)
+
+ pthread_spu_t answer;
+
+ return pthread_processor_bind_np(PTHREAD_BIND_ADVISORY_NP,
+ &answer, pnumber, tid) == 0;
+
+#elif defined(__APPLE__)
+
+ struct thread_affinity_policy tapol;
+
+ thread_port_t threadport = pthread_mach_thread_np(tid);
+ tapol.affinity_tag = pnumber + 1;
+ return thread_policy_set(threadport, THREAD_AFFINITY_POLICY,
+ (thread_policy_t)&tapol, THREAD_AFFINITY_POLICY_COUNT) == KERN_SUCCESS;
+
+#else
+
+ return false;
+
+#endif
+}
+
+
+bool threadSetPriority(threadid_t tid, int prio) {
+#if defined(_WIN32)
+
+ HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, 0, tid);
+ if (!hThread)
+ return false;
+
+ bool success = SetThreadPriority(hThread, prio) != 0;
+
+ CloseHandle(hThread);
+ return success;
+
+#else
+
+ struct sched_param sparam;
+ int policy;
+
+ if (pthread_getschedparam(tid, &policy, &sparam) != 0)
+ return false;
+
+ int min = sched_get_priority_min(policy);
+ int max = sched_get_priority_max(policy);
+
+ sparam.sched_priority = min + prio * (max - min) / THREAD_PRIORITY_HIGHEST;
+ return pthread_setschedparam(tid, policy, &sparam) == 0;
+
+#endif
+}
+
+
/*
Path mangler
*/
diff --git a/src/porting.h b/src/porting.h
index 9ba3394bb..d7d107340 100644
--- a/src/porting.h
+++ b/src/porting.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
@@ -40,6 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
//#define ALIGNOF(type) offsetof (alignment_trick<type>, member)
#ifdef _WIN32
+ #ifndef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0500
+ #endif
#include <windows.h>
#define sleep_ms(x) Sleep(x)
@@ -47,7 +50,32 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <unistd.h>
#include <stdint.h> //for uintptr_t
+ #if (defined(linux) || defined(__linux)) && !defined(_GNU_SOURCE)
+ #define _GNU_SOURCE
+ #endif
+
+ #include <sched.h>
+
+ #ifdef __FreeBSD__
+ #include <pthread_np.h>
+ typedef cpuset_t cpu_set_t;
+ #elif defined(__sun) || defined(sun)
+ #include <sys/types.h>
+ #include <sys/processor.h>
+ #elif defined(_AIX)
+ #include <sys/processor.h>
+ #elif __APPLE__
+ #include <mach/mach_init.h>
+ #include <mach/thread_policy.h>
+ #endif
+
#define sleep_ms(x) usleep(x*1000)
+
+ #define THREAD_PRIORITY_LOWEST 0
+ #define THREAD_PRIORITY_BELOW_NORMAL 1
+ #define THREAD_PRIORITY_NORMAL 2
+ #define THREAD_PRIORITY_ABOVE_NORMAL 3
+ #define THREAD_PRIORITY_HIGHEST 4
#endif
#ifdef _MSC_VER
@@ -104,6 +132,21 @@ std::string getDataPath(const char *subpath);
void initializePaths();
/*
+ Get number of online processors in the system.
+*/
+int getNumberOfProcessors();
+
+/*
+ Set a thread's affinity to a particular processor.
+*/
+bool threadBindToProcessor(threadid_t tid, int pnumber);
+
+/*
+ Set a thread's priority.
+*/
+bool threadSetPriority(threadid_t tid, int prio);
+
+/*
Resolution is 10-20ms.
Remember to check for overflows.
Overflow can occur at any value higher than 10000000.
diff --git a/src/profiler.h b/src/profiler.h
index b1e6abe58..b9fa22485 100644
--- a/src/profiler.h
+++ b/src/profiler.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/quicktune.cpp b/src/quicktune.cpp
index acd0d721f..d3a7fcae2 100644
--- a/src/quicktune.cpp
+++ b/src/quicktune.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/quicktune.h b/src/quicktune.h
index a733ccda4..566fbfc4d 100644
--- a/src/quicktune.h
+++ b/src/quicktune.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/quicktune_shortcutter.h b/src/quicktune_shortcutter.h
index 2e3b5310b..16bcc07e8 100644
--- a/src/quicktune_shortcutter.h
+++ b/src/quicktune_shortcutter.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/rollback.cpp b/src/rollback.cpp
index f0e3c40aa..fe1d59d0c 100644
--- a/src/rollback.cpp
+++ b/src/rollback.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/rollback.h b/src/rollback.h
index 5e76042b5..46a76f583 100644
--- a/src/rollback.h
+++ b/src/rollback.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/rollback_interface.cpp b/src/rollback_interface.cpp
index b2eb2093c..70a9e9457 100644
--- a/src/rollback_interface.cpp
+++ b/src/rollback_interface.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/rollback_interface.h b/src/rollback_interface.h
index 8dd429d76..b2e8f3428 100644
--- a/src/rollback_interface.h
+++ b/src/rollback_interface.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/script.cpp b/src/script.cpp
index b238e1be7..4619fa636 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/script.h b/src/script.h
index fea132b07..dbacae5ae 100644
--- a/src/script.h
+++ b/src/script.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index b7a7f6e42..7fddcfc68 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/scriptapi.h b/src/scriptapi.h
index d71b8fe41..e94ca781f 100644
--- a/src/scriptapi.h
+++ b/src/scriptapi.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/serialization.cpp b/src/serialization.cpp
index c57e1642a..118bad467 100644
--- a/src/serialization.cpp
+++ b/src/serialization.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/serialization.h b/src/serialization.h
index 533ddc8c4..defead31e 100644
--- a/src/serialization.h
+++ b/src/serialization.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/server.cpp b/src/server.cpp
index 138f288c6..2d00cf4ac 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -38,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "itemdef.h"
#include "craftdef.h"
+#include "emerge.h"
#include "mapgen.h"
#include "biome.h"
#include "content_mapnode.h"
@@ -58,60 +59,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "rollback.h"
#include "util/serialize.h"
-#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
-
-#define BLOCK_EMERGE_FLAG_FROMDISK (1<<0)
-
-class MapEditEventIgnorer
-{
-public:
- MapEditEventIgnorer(bool *flag):
- m_flag(flag)
- {
- if(*m_flag == false)
- *m_flag = true;
- else
- m_flag = NULL;
- }
-
- ~MapEditEventIgnorer()
- {
- if(m_flag)
- {
- assert(*m_flag);
- *m_flag = false;
- }
- }
-
-private:
- bool *m_flag;
-};
-
-class MapEditEventAreaIgnorer
-{
-public:
- MapEditEventAreaIgnorer(VoxelArea *ignorevariable, const VoxelArea &a):
- m_ignorevariable(ignorevariable)
- {
- if(m_ignorevariable->getVolume() == 0)
- *m_ignorevariable = a;
- else
- m_ignorevariable = NULL;
- }
-
- ~MapEditEventAreaIgnorer()
- {
- if(m_ignorevariable)
- {
- assert(m_ignorevariable->getVolume() != 0);
- *m_ignorevariable = VoxelArea();
- }
- }
-
-private:
- VoxelArea *m_ignorevariable;
-};
-
void * ServerThread::Thread()
{
ThreadStarted();
@@ -157,265 +104,6 @@ void * ServerThread::Thread()
return NULL;
}
-void * EmergeThread::Thread()
-{
- ThreadStarted();
-
- log_register_thread("EmergeThread");
-
- DSTACK(__FUNCTION_NAME);
-
- BEGIN_DEBUG_EXCEPTION_HANDLER
-
- bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
-
- v3s16 last_tried_pos(-32768,-32768,-32768); // For error output
-
- ServerMap &map = ((ServerMap&)m_server->m_env->getMap());
- EmergeManager *emerge = m_server->m_emerge;
- Mapgen *mapgen = emerge->getMapgen();
-
- /*
- Get block info from queue, emerge them and send them
- to clients.
-
- After queue is empty, exit.
- */
- while(getRun())
- try{
- QueuedBlockEmerge *qptr = m_server->m_emerge_queue.pop();
- if(qptr == NULL)
- break;
-
- SharedPtr<QueuedBlockEmerge> q(qptr);
-
- v3s16 &p = q->pos;
- v2s16 p2d(p.X,p.Z);
-
- last_tried_pos = p;
-
- /*
- Do not generate over-limit
- */
- if(blockpos_over_limit(p))
- continue;
-
- //infostream<<"EmergeThread::Thread(): running"<<std::endl;
-
- //TimeTaker timer("block emerge");
-
- /*
- Try to emerge it from somewhere.
-
- If it is only wanted as optional, only loading from disk
- will be allowed.
- */
-
- /*
- Check if any peer wants it as non-optional. In that case it
- will be generated.
-
- Also decrement the emerge queue count in clients.
- */
-
- bool only_from_disk = true;
-
- {
- core::map<u16, u8>::Iterator i;
- for(i=q->peer_ids.getIterator(); i.atEnd()==false; i++)
- {
- //u16 peer_id = i.getNode()->getKey();
-
- // Check flags
- u8 flags = i.getNode()->getValue();
- if((flags & BLOCK_EMERGE_FLAG_FROMDISK) == false)
- only_from_disk = false;
-
- }
- }
-
- if(enable_mapgen_debug_info)
- infostream<<"EmergeThread: p="
- <<"("<<p.X<<","<<p.Y<<","<<p.Z<<") "
- <<"only_from_disk="<<only_from_disk<<std::endl;
-
-
-
- MapBlock *block = NULL;
- bool got_block = true;
- core::map<v3s16, MapBlock*> modified_blocks;
-
- /*
- Try to fetch block from memory or disk.
- If not found and asked to generate, initialize generator.
- */
-
- bool started_generate = false;
- BlockMakeData data;
-
- {
- JMutexAutoLock envlock(m_server->m_env_mutex);
-
- // Load sector if it isn't loaded
- if(map.getSectorNoGenerateNoEx(p2d) == NULL)
- map.loadSectorMeta(p2d);
-
- // Attempt to load block
- block = map.getBlockNoCreateNoEx(p);
- if(!block || block->isDummy() || !block->isGenerated())
- {
- if(enable_mapgen_debug_info)
- infostream<<"EmergeThread: not in memory, "
- <<"attempting to load from disk"<<std::endl;
-
- block = map.loadBlock(p);
- }
-
- // If could not load and allowed to generate, start generation
- // inside this same envlock
- if(only_from_disk == false &&
- (block == NULL || block->isGenerated() == false)){
- if(enable_mapgen_debug_info)
- infostream<<"EmergeThread: generating"<<std::endl;
- started_generate = true;
-
- map.initBlockMake(&data, p);
- }
- }
-
- /*
- If generator was initialized, generate now when envlock is free.
- */
- if(started_generate)
- {
- {
- ScopeProfiler sp(g_profiler, "EmergeThread: mapgen::make_block",
- SPT_AVG);
- TimeTaker t("mapgen::make_block()");
-
- mapgen->makeChunk(&data);
- //mapgen::make_block(&data);
-
- if(enable_mapgen_debug_info == false)
- t.stop(true); // Hide output
- }
-
- do{ // enable break
- // Lock environment again to access the map
- JMutexAutoLock envlock(m_server->m_env_mutex);
-
- ScopeProfiler sp(g_profiler, "EmergeThread: after "
- "mapgen::make_block (envlock)", SPT_AVG);
-
- // Blit data back on map, update lighting, add mobs and
- // whatever this does
- map.finishBlockMake(&data, modified_blocks);
-
- // Get central block
- block = map.getBlockNoCreateNoEx(p);
-
- // If block doesn't exist, don't try doing anything with it
- // This happens if the block is not in generation boundaries
- if(!block)
- break;
-
- /*
- Do some post-generate stuff
- */
-
- v3s16 minp = data.blockpos_min*MAP_BLOCKSIZE;
- v3s16 maxp = data.blockpos_max*MAP_BLOCKSIZE +
- v3s16(1,1,1)*(MAP_BLOCKSIZE-1);
-
- /*
- Ignore map edit events, they will not need to be
- sent to anybody because the block hasn't been sent
- to anybody
- */
- //MapEditEventIgnorer ign(&m_server->m_ignore_map_edit_events);
- MapEditEventAreaIgnorer ign(
- &m_server->m_ignore_map_edit_events_area,
- VoxelArea(minp, maxp));
- {
- TimeTaker timer("on_generated");
- scriptapi_environment_on_generated(m_server->m_lua,
- minp, maxp, emerge->getBlockSeed(minp));
- /*int t = timer.stop(true);
- dstream<<"on_generated took "<<t<<"ms"<<std::endl;*/
- }
-
- if(enable_mapgen_debug_info)
- infostream<<"EmergeThread: ended up with: "
- <<analyze_block(block)<<std::endl;
-
- // Activate objects and stuff
- m_server->m_env->activateBlock(block, 0);
- }while(false);
- }
-
- if(block == NULL)
- got_block = false;
-
- /*
- Set sent status of modified blocks on clients
- */
-
- // NOTE: Server's clients are also behind the connection mutex
- JMutexAutoLock lock(m_server->m_con_mutex);
-
- /*
- Add the originally fetched block to the modified list
- */
- if(got_block)
- {
- modified_blocks.insert(p, block);
- }
-
- /*
- Set the modified blocks unsent for all the clients
- */
-
- for(core::map<u16, RemoteClient*>::Iterator
- i = m_server->m_clients.getIterator();
- i.atEnd() == false; i++)
- {
- RemoteClient *client = i.getNode()->getValue();
-
- if(modified_blocks.size() > 0)
- {
- // Remove block from sent history
- client->SetBlocksNotSent(modified_blocks);
- }
- }
- }
- catch(VersionMismatchException &e)
- {
- std::ostringstream err;
- err<<"World data version mismatch in MapBlock "<<PP(last_tried_pos)<<std::endl;
- err<<"----"<<std::endl;
- err<<"\""<<e.what()<<"\""<<std::endl;
- err<<"See debug.txt."<<std::endl;
- err<<"World probably saved by a newer version of Minetest."<<std::endl;
- m_server->setAsyncFatalError(err.str());
- }
- catch(SerializationError &e)
- {
- std::ostringstream err;
- err<<"Invalid data in MapBlock "<<PP(last_tried_pos)<<std::endl;
- err<<"----"<<std::endl;
- err<<"\""<<e.what()<<"\""<<std::endl;
- err<<"See debug.txt."<<std::endl;
- err<<"You can ignore this using [ignore_world_load_errors = true]."<<std::endl;
- m_server->setAsyncFatalError(err.str());
- }
-
- END_DEBUG_EXCEPTION_HANDLER(errorstream)
-
- log_deregister_thread();
-
- return NULL;
-}
-
v3f ServerSoundParams::getPos(ServerEnvironment *env, bool *pos_exists) const
{
if(pos_exists) *pos_exists = false;
@@ -770,7 +458,7 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
*/
if(block == NULL || surely_not_found_on_disk || block_is_invalid)
{
- //TODO: Get value from somewhere
+ /* //TODO: Get value from somewhere
// Allow only one block in emerge queue
//if(server->m_emerge_queue.peerItemCount(peer_id) < 1)
// Allow two blocks in queue per client
@@ -799,7 +487,17 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
nearest_emergefull_d = d;
goto queue_full_break;
}
+ */
+ if (server->m_emerge->enqueueBlockEmerge(peer_id, p, generate)) {
+ if (nearest_emerged_d == -1)
+ nearest_emerged_d = d;
+ } else {
+ if (nearest_emergefull_d == -1)
+ nearest_emergefull_d = d;
+ goto queue_full_break;
+ }
+
// get next one.
continue;
}
@@ -953,7 +651,7 @@ Server::Server(
m_craftdef(createCraftDefManager()),
m_event(new EventManager()),
m_thread(this),
- m_emergethread(this),
+ //m_emergethread(this),
m_time_of_day_send_timer(0),
m_uptime(0),
m_shutdown_requested(false),
@@ -1281,9 +979,9 @@ void Server::stop()
// Stop threads (set run=false first so both start stopping)
m_thread.setRun(false);
- m_emergethread.setRun(false);
+ //m_emergethread.setRun(false);
m_thread.stop();
- m_emergethread.stop();
+ //m_emergethread.stop();
infostream<<"Server: Threads stopped"<<std::endl;
}
@@ -1954,7 +1652,8 @@ void Server::AsyncRunStep()
{
counter = 0.0;
- m_emergethread.trigger();
+ for (int i = 0; i != m_emerge->emergethread.size(); i++)
+ m_emerge->emergethread[i]->trigger();
// Update m_enable_rollback_recording here too
m_enable_rollback_recording =
@@ -3118,8 +2817,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
infostream<<"Server: Not punching: Node not found."
<<" Adding block to emerge queue."
<<std::endl;
- m_emerge_queue.addBlock(peer_id,
- getNodeBlockPos(p_above), BLOCK_EMERGE_FLAG_FROMDISK);
+ m_emerge->enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false);
}
if(n.getContent() != CONTENT_IGNORE)
scriptapi_node_on_punch(m_lua, p_under, n, playersao);
@@ -3175,8 +2873,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
infostream<<"Server: Not finishing digging: Node not found."
<<" Adding block to emerge queue."
<<std::endl;
- m_emerge_queue.addBlock(peer_id,
- getNodeBlockPos(p_above), BLOCK_EMERGE_FLAG_FROMDISK);
+ m_emerge->enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false);
}
/* Cheat prevention */
@@ -4731,10 +4428,7 @@ void Server::notifyPlayers(const std::wstring msg)
void Server::queueBlockEmerge(v3s16 blockpos, bool allow_generate)
{
- u8 flags = 0;
- if(!allow_generate)
- flags |= BLOCK_EMERGE_FLAG_FROMDISK;
- m_emerge_queue.addBlock(PEER_ID_INEXISTENT, blockpos, flags);
+ m_emerge->enqueueBlockEmerge(PEER_ID_INEXISTENT, blockpos, allow_generate);
}
Inventory* Server::createDetachedInventory(const std::string &name)
diff --git a/src/server.h b/src/server.h
index 16bda4372..d7700791c 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
@@ -39,6 +39,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "rollback_interface.h" // Needed for rollbackRevertActions()
#include <list> // Needed for rollbackRevertActions()
+#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
+
struct LuaState;
typedef struct lua_State lua_State;
class IWritableItemDefManager;
@@ -47,6 +49,7 @@ class IWritableCraftDefManager;
class EventManager;
class PlayerSAO;
class IRollbackManager;
+class EmergeManager;
class ServerError : public std::exception
{
@@ -70,117 +73,55 @@ public:
*/
v3f findSpawnPos(ServerMap &map);
-/*
- A structure containing the data needed for queueing the fetching
- of blocks.
-*/
-struct QueuedBlockEmerge
-{
- v3s16 pos;
- // key = peer_id, value = flags
- core::map<u16, u8> peer_ids;
-};
-/*
- This is a thread-safe class.
-*/
-class BlockEmergeQueue
+class MapEditEventIgnorer
{
public:
- BlockEmergeQueue()
- {
- m_mutex.Init();
- }
-
- ~BlockEmergeQueue()
+ MapEditEventIgnorer(bool *flag):
+ m_flag(flag)
{
- JMutexAutoLock lock(m_mutex);
-
- core::list<QueuedBlockEmerge*>::Iterator i;
- for(i=m_queue.begin(); i!=m_queue.end(); i++)
- {
- QueuedBlockEmerge *q = *i;
- delete q;
- }
+ if(*m_flag == false)
+ *m_flag = true;
+ else
+ m_flag = NULL;
}
- /*
- peer_id=0 adds with nobody to send to
- */
- void addBlock(u16 peer_id, v3s16 pos, u8 flags)
+ ~MapEditEventIgnorer()
{
- DSTACK(__FUNCTION_NAME);
-
- JMutexAutoLock lock(m_mutex);
-
- if(peer_id != 0)
+ if(m_flag)
{
- /*
- Find if block is already in queue.
- If it is, update the peer to it and quit.
- */
- core::list<QueuedBlockEmerge*>::Iterator i;
- for(i=m_queue.begin(); i!=m_queue.end(); i++)
- {
- QueuedBlockEmerge *q = *i;
- if(q->pos == pos)
- {
- q->peer_ids[peer_id] = flags;
- return;
- }
- }
+ assert(*m_flag);
+ *m_flag = false;
}
-
- /*
- Add the block
- */
- QueuedBlockEmerge *q = new QueuedBlockEmerge;
- q->pos = pos;
- if(peer_id != 0)
- q->peer_ids[peer_id] = flags;
- m_queue.push_back(q);
}
- // Returned pointer must be deleted
- // Returns NULL if queue is empty
- QueuedBlockEmerge * pop()
- {
- JMutexAutoLock lock(m_mutex);
-
- core::list<QueuedBlockEmerge*>::Iterator i = m_queue.begin();
- if(i == m_queue.end())
- return NULL;
- QueuedBlockEmerge *q = *i;
- m_queue.erase(i);
- return q;
- }
+private:
+ bool *m_flag;
+};
- u32 size()
+class MapEditEventAreaIgnorer
+{
+public:
+ MapEditEventAreaIgnorer(VoxelArea *ignorevariable, const VoxelArea &a):
+ m_ignorevariable(ignorevariable)
{
- JMutexAutoLock lock(m_mutex);
- return m_queue.size();
+ if(m_ignorevariable->getVolume() == 0)
+ *m_ignorevariable = a;
+ else
+ m_ignorevariable = NULL;
}
- u32 peerItemCount(u16 peer_id)
+ ~MapEditEventAreaIgnorer()
{
- JMutexAutoLock lock(m_mutex);
-
- u32 count = 0;
-
- core::list<QueuedBlockEmerge*>::Iterator i;
- for(i=m_queue.begin(); i!=m_queue.end(); i++)
+ if(m_ignorevariable)
{
- QueuedBlockEmerge *q = *i;
- if(q->peer_ids.find(peer_id) != NULL)
- count++;
+ assert(m_ignorevariable->getVolume() != 0);
+ *m_ignorevariable = VoxelArea();
}
-
- return count;
}
private:
- core::list<QueuedBlockEmerge*> m_queue;
- JMutex m_mutex;
+ VoxelArea *m_ignorevariable;
};
class Server;
@@ -200,30 +141,6 @@ public:
void * Thread();
};
-class EmergeThread : public SimpleThread
-{
- Server *m_server;
-
-public:
-
- EmergeThread(Server *server):
- SimpleThread(),
- m_server(server)
- {
- }
-
- void * Thread();
-
- void trigger()
- {
- setRun(true);
- if(IsRunning() == false)
- {
- Start();
- }
- }
-};
-
struct PlayerInfo
{
u16 id;
@@ -785,10 +702,6 @@ private:
// The server mainly operates in this thread
ServerThread m_thread;
- // This thread fetches and generates map
- EmergeThread m_emergethread;
- // Queue of block coordinates to be processed by the emerge thread
- BlockEmergeQueue m_emerge_queue;
/*
Time related stuff
diff --git a/src/serverlist.cpp b/src/serverlist.cpp
index b2f49ae72..b5e6aad4e 100644
--- a/src/serverlist.cpp
+++ b/src/serverlist.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/serverlist.h b/src/serverlist.h
index 52549e97a..e81e64c5b 100644
--- a/src/serverlist.h
+++ b/src/serverlist.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/serverobject.cpp b/src/serverobject.cpp
index deaa94f2c..beb17d31f 100644
--- a/src/serverobject.cpp
+++ b/src/serverobject.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/serverobject.h b/src/serverobject.h
index 14752878f..6525270f6 100644
--- a/src/serverobject.h
+++ b/src/serverobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/settings.h b/src/settings.h
index addd9980c..7ac308cc0 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/shader.cpp b/src/shader.cpp
index 9e1a51f23..7e3d16e8b 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2012 Kahrl <kahrl@gmx.net>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Kahrl <kahrl@gmx.net>
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
diff --git a/src/shader.h b/src/shader.h
index 774a17b20..a7367eaff 100644
--- a/src/shader.h
+++ b/src/shader.h
@@ -1,7 +1,7 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2012 Kahrl <kahrl@gmx.net>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2013 Kahrl <kahrl@gmx.net>
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
diff --git a/src/sky.h b/src/sky.h
index 65170dad5..7b7295e4e 100644
--- a/src/sky.h
+++ b/src/sky.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/socket.cpp b/src/socket.cpp
index f8afed229..9e289baa2 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/socket.h b/src/socket.h
index 06ec2843a..994a07e45 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/sound.cpp b/src/sound.cpp
index f5203bbb3..707065043 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/sound.h b/src/sound.h
index d74acd550..c21401e8b 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp
index c78f6288f..cc5261eae 100644
--- a/src/sound_openal.cpp
+++ b/src/sound_openal.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
OpenAL support based on work by:
Copyright (C) 2011 Sebastian 'Bahamada' Rühl
Copyright (C) 2011 Cyriaque 'Cisoun' Skrapits <cysoun@gmail.com>
diff --git a/src/sound_openal.h b/src/sound_openal.h
index 876c45e69..13d01a5d6 100644
--- a/src/sound_openal.h
+++ b/src/sound_openal.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/staticobject.cpp b/src/staticobject.cpp
index 2183f2ffe..48fadaf06 100644
--- a/src/staticobject.cpp
+++ b/src/staticobject.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/staticobject.h b/src/staticobject.h
index 6fccbdd4f..c8427fe47 100644
--- a/src/staticobject.h
+++ b/src/staticobject.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/strfnd.h b/src/strfnd.h
index 71a9a8cd9..d28aa73b2 100644
--- a/src/strfnd.h
+++ b/src/strfnd.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/subgame.cpp b/src/subgame.cpp
index 2f5340373..3c8bf53c5 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/subgame.h b/src/subgame.h
index dd725caf7..8561c1a52 100644
--- a/src/subgame.h
+++ b/src/subgame.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/test.cpp b/src/test.cpp
index bc0692a78..f988b34f7 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/test.h b/src/test.h
index f69888214..547e9a986 100644
--- a/src/test.h
+++ b/src/test.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/threads.h b/src/threads.h
index e79404aa2..a3717a1de 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/tile.cpp b/src/tile.cpp
index 7cad1b836..7286293d8 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/tile.h b/src/tile.h
index b00c1c6c6..07e5bcb56 100644
--- a/src/tile.h
+++ b/src/tile.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/tool.cpp b/src/tool.cpp
index c1e268ff1..04f19749c 100644
--- a/src/tool.cpp
+++ b/src/tool.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/tool.h b/src/tool.h
index 18c09dca3..e812a9e36 100644
--- a/src/tool.h
+++ b/src/tool.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/treegen.cpp b/src/treegen.cpp
index 948716dcf..7b6152329 100644
--- a/src/treegen.cpp
+++ b/src/treegen.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>,
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>,
2012-2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/treegen.h b/src/treegen.h
index 0068219dd..ca4d3e23d 100644
--- a/src/treegen.h
+++ b/src/treegen.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>,
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>,
2012-2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
diff --git a/src/util/container.h b/src/util/container.h
index 8c1ae02fb..775372649 100644
--- a/src/util/container.h
+++ b/src/util/container.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/directiontables.cpp b/src/util/directiontables.cpp
index a5d2faa7c..d6c154842 100644
--- a/src/util/directiontables.cpp
+++ b/src/util/directiontables.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/directiontables.h b/src/util/directiontables.h
index 5bebd2fdb..0dd3aab09 100644
--- a/src/util/directiontables.h
+++ b/src/util/directiontables.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/numeric.cpp b/src/util/numeric.cpp
index 0ac812eb7..a79454628 100644
--- a/src/util/numeric.cpp
+++ b/src/util/numeric.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/numeric.h b/src/util/numeric.h
index a028f1ff2..450a98e40 100644
--- a/src/util/numeric.h
+++ b/src/util/numeric.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/pointedthing.cpp b/src/util/pointedthing.cpp
index d1be2d6b6..dc39e313a 100644
--- a/src/util/pointedthing.cpp
+++ b/src/util/pointedthing.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/pointedthing.h b/src/util/pointedthing.h
index e61e2f4f3..2b2703e98 100644
--- a/src/util/pointedthing.h
+++ b/src/util/pointedthing.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/pointer.h b/src/util/pointer.h
index 775f0a336..f65683332 100644
--- a/src/util/pointer.h
+++ b/src/util/pointer.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/serialize.cpp b/src/util/serialize.cpp
index 16825b677..f32813551 100644
--- a/src/util/serialize.cpp
+++ b/src/util/serialize.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/serialize.h b/src/util/serialize.h
index b356c484e..b297786e6 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/string.cpp b/src/util/string.cpp
index 61b307c60..3bd8b7364 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/string.h b/src/util/string.h
index a469a074a..2f0264bd4 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/thread.h b/src/util/thread.h
index 8e8c74ac5..949bb4204 100644
--- a/src/util/thread.h
+++ b/src/util/thread.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/timetaker.cpp b/src/util/timetaker.cpp
index 52c618931..910fea822 100644
--- a/src/util/timetaker.cpp
+++ b/src/util/timetaker.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/util/timetaker.h b/src/util/timetaker.h
index 8aad97d0f..0b9d9ca04 100644
--- a/src/util/timetaker.h
+++ b/src/util/timetaker.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/voxel.cpp b/src/voxel.cpp
index 8fdae79e1..c55f3f539 100644
--- a/src/voxel.cpp
+++ b/src/voxel.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
@@ -244,7 +244,13 @@ void VoxelManipulator::copyTo(MapNode *dst, VoxelArea dst_area,
{
s32 i_dst = dst_area.index(dst_pos.X, dst_pos.Y+y, dst_pos.Z+z);
s32 i_local = m_area.index(from_pos.X, from_pos.Y+y, from_pos.Z+z);
- memcpy(&dst[i_dst], &m_data[i_local], size.X*sizeof(MapNode));
+ for (s16 x = 0; x < size.X; x++) {
+ if (m_data[i_local].getContent() != CONTENT_IGNORE)
+ dst[i_dst] = m_data[i_local];
+ i_dst++;
+ i_local++;
+ }
+ //memcpy(&dst[i_dst], &m_data[i_local], size.X*sizeof(MapNode));
}
}
diff --git a/src/voxel.h b/src/voxel.h
index c2a5efb4b..b48943624 100644
--- a/src/voxel.h
+++ b/src/voxel.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 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 Lesser General Public License as published by
diff --git a/src/voxelalgorithms.cpp b/src/voxelalgorithms.cpp
index 795530d40..bd8f816b8 100644
--- a/src/voxelalgorithms.cpp
+++ b/src/voxelalgorithms.cpp
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/src/voxelalgorithms.h b/src/voxelalgorithms.h
index 4360ef731..2a5fc394e 100644
--- a/src/voxelalgorithms.h
+++ b/src/voxelalgorithms.h
@@ -1,6 +1,6 @@
/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 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 Lesser General Public License as published by
diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh
index 52d2aa182..fc42db8a7 100755
--- a/util/buildbot/buildwin32.sh
+++ b/util/buildbot/buildwin32.sh
@@ -50,11 +50,11 @@ cd $builddir
-c -O $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1
[ -e $packagedir/libcurl-$curl_version-win32-msvc.zip ] || wget http://curl.haxx.se/download/libcurl-$curl_version-win32-msvc.zip \
-c -O $packagedir/libcurl-$curl_version-win32-msvc.zip || exit 1
-wget http://github.com/celeron55/minetest/zipball/master \
- -c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/celeron55/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
+wget http://github.com/minetest/minetest/zipball/master \
+ -c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
[ -e $packagedir/minetest.zip ] || (echo "minetest.zip not found"; exit 1)
-wget http://github.com/celeron55/minetest_game/zipball/master \
- -c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/celeron55/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
+wget http://github.com/minetest/minetest_game/zipball/master \
+ -c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
[ -e $packagedir/minetest_game.zip ] || (echo "minetest_game.zip not found"; exit 1)
[ -e $packagedir/openal_stripped.zip ] || wget http://minetest.ru/bin/openal_stripped.zip \
-c -O $packagedir/openal_stripped.zip || exit 1
@@ -63,10 +63,10 @@ wget http://github.com/celeron55/minetest_game/zipball/master \
# Figure out some path names from the packages
-minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^c]*//' -e 's/\/.*$//'`
+minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
minetestdir=$builddir/$minetestdirname || exit 1
-git_hash=`echo $minetestdirname | sed -e 's/celeron55-minetest-//'`
-minetest_gamedirname=`unzip -l $packagedir/minetest_game.zip | head -n 7 | tail -n 1 | sed -e 's/^[^c]*//' -e 's/\/.*$//'`
+git_hash=`echo $minetestdirname | sed -e 's/minetest-minetest-//'`
+minetest_gamedirname=`unzip -l $packagedir/minetest_game.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
# Extract stuff
cd $libdir || exit 1
diff --git a/util/wireshark/minetest.lua b/util/wireshark/minetest.lua
index acc95e5f4..908cc5633 100644
--- a/util/wireshark/minetest.lua
+++ b/util/wireshark/minetest.lua
@@ -4,7 +4,7 @@
--
--- Minetest-c55
+-- Minetest
-- Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify