From df3c925b3ccae3bdba125e6dc3ecc740739baeab Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Fri, 8 Feb 2013 22:54:01 +0200 Subject: Improved Player Physics --- src/server.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index a8640ad10..572ef4d82 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2344,6 +2344,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) infostream<<"Server: Sending content to " <getFloat("movement_acceleration_default")); + writeF1000(os, g_settings->getFloat("movement_acceleration_air")); + writeF1000(os, g_settings->getFloat("movement_acceleration_fast")); + writeF1000(os, g_settings->getFloat("movement_speed_walk")); + writeF1000(os, g_settings->getFloat("movement_speed_crouch")); + writeF1000(os, g_settings->getFloat("movement_speed_fast")); + writeF1000(os, g_settings->getFloat("movement_speed_climb")); + writeF1000(os, g_settings->getFloat("movement_speed_jump")); + writeF1000(os, g_settings->getFloat("movement_liquid_fluidity")); + writeF1000(os, g_settings->getFloat("movement_liquid_fluidity_smooth")); + writeF1000(os, g_settings->getFloat("movement_liquid_sink")); + writeF1000(os, g_settings->getFloat("movement_gravity")); + + // Make data buffer + std::string s = os.str(); + SharedBuffer data((u8*)s.c_str(), s.size()); + // Send as reliable + con.Send(peer_id, 0, data, true); +} + void Server::SendHP(con::Connection &con, u16 peer_id, u8 hp) { DSTACK(__FUNCTION_NAME); -- cgit v1.2.3 From 89b88917a89923b37b629557fdeb54fa0b442bb9 Mon Sep 17 00:00:00 2001 From: Jürgen Doser Date: Wed, 20 Feb 2013 20:06:39 +0100 Subject: Print missing mod dependencies on server start i.e., not only the mod with missing dependencies, but also the missing dependencies itself. (This already used to be the case before the mod selection gui was added) Also, mods with unsatisfied dependencies are no longer reported as mods that could not be found. --- src/server.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 572ef4d82..ec8f8a5e8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -998,17 +998,20 @@ Server::Server( ModConfiguration modconf(m_path_world); m_mods = modconf.getMods(); + std::list unsatisfied_mods = modconf.getUnsatisfiedMods(); // complain about mods with unsatisfied dependencies if(!modconf.isConsistent()) { - errorstream << "The following mods have unsatisfied dependencies: "; - std::list modlist = modconf.getUnsatisfiedMods(); - for(std::list::iterator it = modlist.begin(); - it != modlist.end(); ++it) + for(std::list::iterator it = unsatisfied_mods.begin(); + it != unsatisfied_mods.end(); ++it) { - errorstream << (*it).name << " "; + ModSpec mod = *it; + errorstream << "mod \"" << mod.name << "\" has unsatisfied dependencies: "; + for(std::set::iterator dep_it = mod.unsatisfied_depends.begin(); + dep_it != mod.unsatisfied_depends.end(); ++dep_it) + errorstream << " \"" << *dep_it << "\""; + errorstream << std::endl; } - errorstream << std::endl; } Settings worldmt_settings; @@ -1033,12 +1036,15 @@ Server::Server( for(std::vector::iterator it = m_mods.begin(); it != m_mods.end(); ++it) load_mod_names.erase((*it).name); + for(std::list::iterator it = unsatisfied_mods.begin(); + it != unsatisfied_mods.end(); ++it) + load_mod_names.erase((*it).name); if(!load_mod_names.empty()) { - errorstream << "The following mods could not be found: "; + errorstream << "The following mods could not be found:"; for(std::set::iterator it = load_mod_names.begin(); it != load_mod_names.end(); ++it) - errorstream << (*it) << " "; + errorstream << " \"" << (*it) << "\""; errorstream << std::endl; } -- cgit v1.2.3 From ee07c3f7cf638e854518d2cfcb9c11a64412cc72 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 22 Feb 2013 02:00:44 +0400 Subject: new auto masterserver --- .gitignore | 2 + cmake/Modules/FindJson.cmake | 18 + minetest.conf.example | 12 +- src/CMakeLists.txt | 29 +- src/defaultsettings.cpp | 7 +- src/guiMainMenu.cpp | 64 +- src/guiMainMenu.h | 2 + src/json/CMakeLists.txt | 14 + src/json/UPDATING | 16 + src/json/json.h | 1914 ++++++++++++++++++ src/json/jsoncpp.cpp | 4367 ++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 10 +- src/server.cpp | 24 +- src/server.h | 2 + src/serverlist.cpp | 119 +- src/serverlist.h | 14 +- util/master/index.html | 11 + util/master/list.js | 72 + util/master/master.cgi | 257 +++ util/master/style.css | 14 + 20 files changed, 6919 insertions(+), 49 deletions(-) create mode 100644 cmake/Modules/FindJson.cmake create mode 100644 src/json/CMakeLists.txt create mode 100644 src/json/UPDATING create mode 100644 src/json/json.h create mode 100644 src/json/jsoncpp.cpp create mode 100644 util/master/index.html create mode 100644 util/master/list.js create mode 100755 util/master/master.cgi create mode 100644 util/master/style.css (limited to 'src/server.cpp') diff --git a/.gitignore b/.gitignore index e282ec130..353032637 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,8 @@ src/cguittfont/CMakeFiles/ src/cguittfont/libcguittfont.a src/cguittfont/cmake_install.cmake src/cguittfont/Makefile +src/json/CMakeFiles/ +src/json/libjson.a CMakeCache.txt CPackConfig.cmake CPackSourceConfig.cmake diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake new file mode 100644 index 000000000..bc4e71a29 --- /dev/null +++ b/cmake/Modules/FindJson.cmake @@ -0,0 +1,18 @@ +# Look for json, use our own if not found + +#FIND_PATH(JSON_INCLUDE_DIR json.h) + +#FIND_LIBRARY(JSON_LIBRARY NAMES json) + +#IF(JSON_LIBRARY AND JSON_INCLUDE_DIR) +# SET( JSON_FOUND TRUE ) +#ENDIF(JSON_LIBRARY AND JSON_INCLUDE_DIR) + +#IF(JSON_FOUND) +# MESSAGE(STATUS "Found system json header file in ${JSON_INCLUDE_DIR}") +# MESSAGE(STATUS "Found system json library ${JSON_LIBRARY}") +#ELSE(JSON_FOUND) + SET(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json) + SET(JSON_LIBRARY json) + MESSAGE(STATUS "Using project json library") +#ENDIF(JSON_FOUND) diff --git a/minetest.conf.example b/minetest.conf.example index 30d0dbd5c..c36fe05ff 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -159,7 +159,7 @@ #media_fetch_threads = 8 # Url to the server list displayed in the Multiplayer Tab -#serverlist_url = servers.minetest.ru/server.list +#serverlist_url = servers.minetest.net # File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab #serverlist_file = favoriteservers.txt @@ -172,6 +172,16 @@ # Server stuff # +# Name of server +#server_name = Minetest server +# Description of server +#server_description = mine here +# Domain name of server +#server_address = game.minetest.net +# Homepage of server +#server_url = http://minetest.net +# Automaticaly report to masterserver +#server_announce = 0 # Default game (default when creating a new world) #default_game = minetest # World directory (everything in the world is stored here) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b96f53fa..17102e848 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,7 @@ cmake_minimum_required( VERSION 2.6 ) mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) mark_as_advanced(JTHREAD_INCLUDE_DIR JTHREAD_LIBRARY) mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY) +mark_as_advanced(JSON_INCLUDE_DIR JSON_LIBRARY) option(ENABLE_CURL "Enable cURL support for fetching media" 1) @@ -170,6 +171,7 @@ endif() find_package(Jthread REQUIRED) find_package(Sqlite3 REQUIRED) +find_package(Json REQUIRED) if(USE_FREETYPE) find_package(Freetype REQUIRED) @@ -242,6 +244,7 @@ set(common_SRCS biome.cpp clientserver.cpp staticobject.cpp + serverlist.cpp util/serialize.cpp util/directiontables.cpp util/numeric.cpp @@ -303,7 +306,6 @@ set(minetest_SRCS filecache.cpp tile.cpp shader.cpp - serverlist.cpp game.cpp main.cpp ) @@ -332,6 +334,7 @@ include_directories( ${JTHREAD_INCLUDE_DIR} ${SQLITE3_INCLUDE_DIR} ${LUA_INCLUDE_DIR} + ${JSON_INCLUDE_DIR} ) if(USE_FREETYPE) @@ -341,6 +344,12 @@ if(USE_FREETYPE) ) endif(USE_FREETYPE) +if(USE_CURL) + include_directories( + ${CURL_INCLUDE_DIR} + ) +endif(USE_CURL) + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin") if(BUILD_CLIENT) @@ -359,18 +368,15 @@ if(BUILD_CLIENT) ${JTHREAD_LIBRARY} ${SQLITE3_LIBRARY} ${LUA_LIBRARY} + ${JSON_LIBRARY} ${PLATFORM_LIBS} ${CLIENT_PLATFORM_LIBS} ) - if(USE_CURL) target_link_libraries( ${PROJECT_NAME} ${CURL_LIBRARY} ) - include_directories( - ${CURL_INCLUDE_DIR} - ) endif(USE_CURL) if(USE_FREETYPE) target_link_libraries( @@ -388,12 +394,20 @@ if(BUILD_SERVER) ${ZLIB_LIBRARIES} ${JTHREAD_LIBRARY} ${SQLITE3_LIBRARY} + ${JSON_LIBRARY} ${GETTEXT_LIBRARY} ${LUA_LIBRARY} ${PLATFORM_LIBS} ) + if(USE_CURL) + target_link_libraries( + ${PROJECT_NAME}server + ${CURL_LIBRARY} + ) + endif(USE_CURL) endif(BUILD_SERVER) + # # Set some optimizations and tweaks # @@ -569,4 +583,9 @@ else (LUA_FOUND) add_subdirectory(lua) endif (LUA_FOUND) +if (JSON_FOUND) +else (JSON_FOUND) + add_subdirectory(json) +endif (JSON_FOUND) + #end diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index e3c6b2f7d..d3a455ccb 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -130,8 +130,13 @@ void set_default_settings(Settings *settings) settings->setDefault("media_fetch_threads", "8"); - settings->setDefault("serverlist_url", "servers.minetest.ru/server.list"); + settings->setDefault("serverlist_url", "servers.minetest.net"); settings->setDefault("serverlist_file", "favoriteservers.txt"); + settings->setDefault("server_announce", "false"); + settings->setDefault("server_url", ""); + settings->setDefault("server_address", ""); + settings->setDefault("server_name", ""); + settings->setDefault("server_description", ""); settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "liberationsans.ttf")); settings->setDefault("font_size", "13"); diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 343369643..ca334198f 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -108,6 +108,7 @@ enum GUI_ID_ENABLE_PARTICLES_CB, GUI_ID_DAMAGE_CB, GUI_ID_CREATIVE_CB, + GUI_ID_PUBLIC_CB, GUI_ID_JOIN_GAME_BUTTON, GUI_ID_CHANGE_KEYS_BUTTON, GUI_ID_DELETE_WORLD_BUTTON, @@ -562,6 +563,14 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) Environment->addCheckBox(m_data->enable_damage, rect, this, GUI_ID_DAMAGE_CB, wgettext("Enable Damage")); } + #if USE_CURL + { + core::rect rect(0, 0, 250, 30); + rect += m_topleft_server + v2s32(30+20+250+20, 60); + Environment->addCheckBox(m_data->enable_public, rect, this, GUI_ID_PUBLIC_CB, + wgettext("Public")); + } + #endif // Delete world button { core::rect rect(0, 0, 130, 30); @@ -841,6 +850,11 @@ void GUIMainMenu::readInput(MainMenuData *dst) if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) dst->enable_damage = ((gui::IGUICheckBox*)e)->isChecked(); } + { + gui::IGUIElement *e = getElementFromId(GUI_ID_PUBLIC_CB); + if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) + dst->enable_public = ((gui::IGUICheckBox*)e)->isChecked(); + } { gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) @@ -912,8 +926,8 @@ void GUIMainMenu::readInput(MainMenuData *dst) { ServerListSpec server = getServerListSpec(wide_to_narrow(dst->address), wide_to_narrow(dst->port)); - dst->servername = server.name; - dst->serverdescription = server.description; + dst->servername = server["name"].asString(); + dst->serverdescription = server["description"].asString(); } } @@ -1174,13 +1188,31 @@ void GUIMainMenu::updateGuiServerList() i != m_data->servers.end(); i++) { std::string text; - if (i->name != "" && i->description != "") - text = i->name + " (" + i->description + ")"; - else if (i->name !="") - text = i->name; - else - text = i->address + ":" + i->port; + if ((*i)["clients"].asString().size()) + text += (*i)["clients"].asString(); + if ((*i)["clients_max"].asString().size()) + text += "/" + (*i)["clients_max"].asString(); + text += " "; + if ((*i)["version"].asString().size()) + text += (*i)["version"].asString() + " "; + if ((*i)["password"].asString().size()) + text += "*"; + if ((*i)["creative"].asString().size()) + text += "C"; + if ((*i)["damage"].asString().size()) + text += "D"; + if ((*i)["pvp"].asString().size()) + text += "P"; + text += " "; + + if ((*i)["name"] != "" && (*i)["description"] != "") + text += (*i)["name"].asString() + " (" + (*i)["description"].asString() + ")"; + else if ((*i)["name"] !="") + text += (*i)["name"].asString(); + else + text += (*i)["address"].asString() + ":" + (*i)["port"].asString(); + serverlist->addItem(narrow_to_wide(text).c_str()); } } @@ -1191,26 +1223,26 @@ void GUIMainMenu::serverListOnSelected() { gui::IGUIListBox *serverlist = (gui::IGUIListBox*)getElementFromId(GUI_ID_SERVERLIST); u16 id = serverlist->getSelected(); - if (id < 0) return; + //if (id < 0) return; // u16>0! ((gui::IGUIEditBox*)getElementFromId(GUI_ID_ADDRESS_INPUT)) - ->setText(narrow_to_wide(m_data->servers[id].address).c_str()); + ->setText(narrow_to_wide(m_data->servers[id]["address"].asString()).c_str()); ((gui::IGUIEditBox*)getElementFromId(GUI_ID_PORT_INPUT)) - ->setText(narrow_to_wide(m_data->servers[id].port).c_str()); + ->setText(narrow_to_wide(m_data->servers[id]["port"].asString()).c_str()); } } ServerListSpec GUIMainMenu::getServerListSpec(std::string address, std::string port) { ServerListSpec server; - server.address = address; - server.port = port; + server["address"] = address; + server["port"] = port; for(std::vector::iterator i = m_data->servers.begin(); i != m_data->servers.end(); i++) { - if (i->address == address && i->port == port) + if ((*i)["address"] == address && (*i)["port"] == port) { - server.description = i->description; - server.name = i->name; + server["description"] = (*i)["description"]; + server["name"] = (*i)["name"]; break; } } diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h index 2c657cb23..558a05d59 100644 --- a/src/guiMainMenu.h +++ b/src/guiMainMenu.h @@ -55,6 +55,7 @@ struct MainMenuData // Server options bool creative_mode; bool enable_damage; + bool enable_public; int selected_world; bool simple_singleplayer_mode; // Actions @@ -77,6 +78,7 @@ struct MainMenuData // Server opts creative_mode(false), enable_damage(false), + enable_public(false), selected_world(0), simple_singleplayer_mode(false), // Actions diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt new file mode 100644 index 000000000..0957799aa --- /dev/null +++ b/src/json/CMakeLists.txt @@ -0,0 +1,14 @@ +if( UNIX ) + set(json_SRCS jsoncpp.cpp) + set(json_platform_LIBS "") +else( UNIX ) + set(json_SRCS jsoncpp.cpp) + set(json_platform_LIBS "") +endif( UNIX ) + +add_library(json ${json_SRCS}) + +target_link_libraries( + json + ${json_platform_LIBS} +) diff --git a/src/json/UPDATING b/src/json/UPDATING new file mode 100644 index 000000000..d00076601 --- /dev/null +++ b/src/json/UPDATING @@ -0,0 +1,16 @@ +#!/bin/sh +cd .. +svn co https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/jsoncpp jsoncpp +svn up jsoncpp +cd jsoncpp +python amalgamate.py +cp -R dist/json .. +cp dist/jsoncpp.cpp ../json + +# maybe you need to patch: +# src/json/jsoncpp.cpp: +# -#include +# +#include "json/json.h" + +#svn export --force https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/jsoncpp/src/lib_json json +#svn export --force https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/jsoncpp/include/json json diff --git a/src/json/json.h b/src/json/json.h new file mode 100644 index 000000000..396aafa82 --- /dev/null +++ b/src/json/json.h @@ -0,0 +1,1914 @@ +/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). +/// It is intented to be used with #include + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + +#ifndef JSON_AMALGATED_H_INCLUDED +# define JSON_AMALGATED_H_INCLUDED +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +#define JSON_IS_AMALGAMATION + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +# define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 +/// If defined, indicates that Json specific container should be used +/// (hash table & simple deque container with customizable allocator). +/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332 +//# define JSON_VALUE_USE_INTERNAL_MAP 1 +/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. +/// The memory pools allocator used optimization (initializing Value and ValueInternalLink +/// as if it was a POD) that may cause some validation tool to report errors. +/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. +//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +# ifndef JSON_USE_EXCEPTION +# define JSON_USE_EXCEPTION 1 +# endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + + +# ifdef JSON_IN_CPPTL +# include +# ifndef JSON_USE_CPPTL +# define JSON_USE_CPPTL 1 +# endif +# endif + +# ifdef JSON_IN_CPPTL +# define JSON_API CPPTL_API +# elif defined(JSON_DLL_BUILD) +# define JSON_API __declspec(dllexport) +# elif defined(JSON_DLL) +# define JSON_API __declspec(dllimport) +# else +# define JSON_API +# endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 +// Microsoft Visual Studio 6 only support conversion from __int64 to double +// (no conversion from unsigned __int64). +#define JSON_USE_INT64_DOUBLE_CONVERSION 1 +#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 + +#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 +/// Indicates that the following function is deprecated. +# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +#endif + +#if !defined(JSONCPP_DEPRECATED) +# define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { + typedef int Int; + typedef unsigned int UInt; +# if defined(JSON_NO_INT64) + typedef int LargestInt; + typedef unsigned int LargestUInt; +# undef JSON_HAS_INT64 +# else // if defined(JSON_NO_INT64) + // For Microsoft Visual use specific types as long long is not supported +# if defined(_MSC_VER) // Microsoft Visual Studio + typedef __int64 Int64; + typedef unsigned __int64 UInt64; +# else // if defined(_MSC_VER) // Other platforms, use long long + typedef long long int Int64; + typedef unsigned long long int UInt64; +# endif // if defined(_MSC_VER) + typedef Int64 LargestInt; + typedef UInt64 LargestUInt; +# define JSON_HAS_INT64 +# endif // if defined(JSON_NO_INT64) +} // end namespace Json + + +#endif // JSON_CONFIG_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +# define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +# include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + + // writer.h + class FastWriter; + class StyledWriter; + + // reader.h + class Reader; + + // features.h + class Features; + + // value.h + typedef unsigned int ArrayIndex; + class StaticString; + class Path; + class PathArgument; + class Value; + class ValueIteratorBase; + class ValueIterator; + class ValueConstIterator; +#ifdef JSON_VALUE_USE_INTERNAL_MAP + class ValueMapAllocator; + class ValueInternalLink; + class ValueInternalArray; + class ValueInternalMap; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + +} // namespace Json + + +#endif // JSON_FORWARDS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED +# define CPPTL_JSON_FEATURES_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +# include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + + /** \brief Configuration passed to reader and writer. + * This configuration object can be used to force the Reader or Writer + * to behave in a standard conforming way. + */ + class JSON_API Features + { + public: + /** \brief A configuration that allows all features and assumes all strings are UTF-8. + * - C & C++ comments are allowed + * - Root object can be any JSON value + * - Assumes Value strings are encoded in UTF-8 + */ + static Features all(); + + /** \brief A configuration that is strictly compatible with the JSON specification. + * - Comments are forbidden. + * - Root object must be either an array or an object value. + * - Assumes Value strings are encoded in UTF-8 + */ + static Features strictMode(); + + /** \brief Initialize the configuration like JsonConfig::allFeatures; + */ + Features(); + + /// \c true if comments are allowed. Default: \c true. + bool allowComments_; + + /// \c true if root must be either an array or an object value. Default: \c false. + bool strictRoot_; + }; + +} // namespace Json + +#endif // CPPTL_JSON_FEATURES_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_H_INCLUDED +# define CPPTL_JSON_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +# include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +# include +# include + +# ifndef JSON_USE_CPPTL_SMALLMAP +# include +# else +# include +# endif +# ifdef JSON_USE_CPPTL +# include +# endif + +/** \brief JSON (JavaScript Object Notation). + */ +namespace Json { + + /** \brief Type of the value held by a Value object. + */ + enum ValueType + { + nullValue = 0, ///< 'null' value + intValue, ///< signed integer value + uintValue, ///< unsigned integer value + realValue, ///< double value + stringValue, ///< UTF-8 string value + booleanValue, ///< bool value + arrayValue, ///< array value (ordered list) + objectValue ///< object value (collection of name/value pairs). + }; + + enum CommentPlacement + { + commentBefore = 0, ///< a comment placed on the line before a value + commentAfterOnSameLine, ///< a comment just after a value on the same line + commentAfter, ///< a comment on the line after a value (only make sense for root value) + numberOfCommentPlacement + }; + +//# ifdef JSON_USE_CPPTL +// typedef CppTL::AnyEnumerator EnumMemberNames; +// typedef CppTL::AnyEnumerator EnumValues; +//# endif + + /** \brief Lightweight wrapper to tag static string. + * + * Value constructor and objectValue member assignement takes advantage of the + * StaticString and avoid the cost of string duplication when storing the + * string or the member name. + * + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + class JSON_API StaticString + { + public: + explicit StaticString( const char *czstring ) + : str_( czstring ) + { + } + + operator const char *() const + { + return str_; + } + + const char *c_str() const + { + return str_; + } + + private: + const char *str_; + }; + + /** \brief Represents a JSON value. + * + * This class is a discriminated union wrapper that can represents a: + * - signed integer [range: Value::minInt - Value::maxInt] + * - unsigned integer (range: 0 - Value::maxUInt) + * - double + * - UTF-8 string + * - boolean + * - 'null' + * - an ordered list of Value + * - collection of name/value pairs (javascript object) + * + * The type of the held value is represented by a #ValueType and + * can be obtained using type(). + * + * values of an #objectValue or #arrayValue can be accessed using operator[]() methods. + * Non const methods will automatically create the a #nullValue element + * if it does not exist. + * The sequence of an #arrayValue will be automatically resize and initialized + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. + * + * The get() methods can be used to obtanis default value in the case the required element + * does not exist. + * + * It is possible to iterate over the list of a #objectValue values using + * the getMemberNames() method. + */ + class JSON_API Value + { + friend class ValueIteratorBase; +# ifdef JSON_VALUE_USE_INTERNAL_MAP + friend class ValueInternalLink; + friend class ValueInternalMap; +# endif + public: + typedef std::vector Members; + typedef ValueIterator iterator; + typedef ValueConstIterator const_iterator; + typedef Json::UInt UInt; + typedef Json::Int Int; +# if defined(JSON_HAS_INT64) + typedef Json::UInt64 UInt64; + typedef Json::Int64 Int64; +#endif // defined(JSON_HAS_INT64) + typedef Json::LargestInt LargestInt; + typedef Json::LargestUInt LargestUInt; + typedef Json::ArrayIndex ArrayIndex; + + static const Value null; + /// Minimum signed integer value that can be stored in a Json::Value. + static const LargestInt minLargestInt; + /// Maximum signed integer value that can be stored in a Json::Value. + static const LargestInt maxLargestInt; + /// Maximum unsigned integer value that can be stored in a Json::Value. + static const LargestUInt maxLargestUInt; + + /// Minimum signed int value that can be stored in a Json::Value. + static const Int minInt; + /// Maximum signed int value that can be stored in a Json::Value. + static const Int maxInt; + /// Maximum unsigned int value that can be stored in a Json::Value. + static const UInt maxUInt; + +# if defined(JSON_HAS_INT64) + /// Minimum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 minInt64; + /// Maximum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 maxInt64; + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. + static const UInt64 maxUInt64; +#endif // defined(JSON_HAS_INT64) + + private: +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION +# ifndef JSON_VALUE_USE_INTERNAL_MAP + class CZString + { + public: + enum DuplicationPolicy + { + noDuplication = 0, + duplicate, + duplicateOnCopy + }; + CZString( ArrayIndex index ); + CZString( const char *cstr, DuplicationPolicy allocate ); + CZString( const CZString &other ); + ~CZString(); + CZString &operator =( const CZString &other ); + bool operator<( const CZString &other ) const; + bool operator==( const CZString &other ) const; + ArrayIndex index() const; + const char *c_str() const; + bool isStaticString() const; + private: + void swap( CZString &other ); + const char *cstr_; + ArrayIndex index_; + }; + + public: +# ifndef JSON_USE_CPPTL_SMALLMAP + typedef std::map ObjectValues; +# else + typedef CppTL::SmallMap ObjectValues; +# endif // ifndef JSON_USE_CPPTL_SMALLMAP +# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + public: + /** \brief Create a default Value of the given type. + + This is a very useful constructor. + To create an empty array, pass arrayValue. + To create an empty object, pass objectValue. + Another Value can then be set to this one by assignment. + This is useful since clear() and resize() will not alter types. + + Examples: + \code + Json::Value null_value; // null + Json::Value arr_value(Json::arrayValue); // [] + Json::Value obj_value(Json::objectValue); // {} + \endcode + */ + Value( ValueType type = nullValue ); + Value( Int value ); + Value( UInt value ); +#if defined(JSON_HAS_INT64) + Value( Int64 value ); + Value( UInt64 value ); +#endif // if defined(JSON_HAS_INT64) + Value( double value ); + Value( const char *value ); + Value( const char *beginValue, const char *endValue ); + /** \brief Constructs a value from a static string. + + * Like other value string constructor but do not duplicate the string for + * internal storage. The given string must remain alive after the call to this + * constructor. + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * \endcode + */ + Value( const StaticString &value ); + Value( const std::string &value ); +# ifdef JSON_USE_CPPTL + Value( const CppTL::ConstString &value ); +# endif + Value( bool value ); + Value( const Value &other ); + ~Value(); + + Value &operator=( const Value &other ); + /// Swap values. + /// \note Currently, comments are intentionally not swapped, for + /// both logic and efficiency. + void swap( Value &other ); + + ValueType type() const; + + bool operator <( const Value &other ) const; + bool operator <=( const Value &other ) const; + bool operator >=( const Value &other ) const; + bool operator >( const Value &other ) const; + + bool operator ==( const Value &other ) const; + bool operator !=( const Value &other ) const; + + int compare( const Value &other ) const; + + const char *asCString() const; + std::string asString() const; +# ifdef JSON_USE_CPPTL + CppTL::ConstString asConstString() const; +# endif + Int asInt() const; + UInt asUInt() const; +#if defined(JSON_HAS_INT64) + Int64 asInt64() const; + UInt64 asUInt64() const; +#endif // if defined(JSON_HAS_INT64) + LargestInt asLargestInt() const; + LargestUInt asLargestUInt() const; + float asFloat() const; + double asDouble() const; + bool asBool() const; + + bool isNull() const; + bool isBool() const; + bool isInt() const; + bool isInt64() const; + bool isUInt() const; + bool isUInt64() const; + bool isIntegral() const; + bool isDouble() const; + bool isNumeric() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + + bool isConvertibleTo( ValueType other ) const; + + /// Number of values in array or object + ArrayIndex size() const; + + /// \brief Return true if empty array, empty object, or null; + /// otherwise, false. + bool empty() const; + + /// Return isNull() + bool operator!() const; + + /// Remove all object members and array elements. + /// \pre type() is arrayValue, objectValue, or nullValue + /// \post type() is unchanged + void clear(); + + /// Resize the array to size elements. + /// New elements are initialized to null. + /// May only be called on nullValue or arrayValue. + /// \pre type() is arrayValue or nullValue + /// \post type() is arrayValue + void resize( ArrayIndex size ); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[]( ArrayIndex index ); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[]( int index ); + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[]( ArrayIndex index ) const; + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[]( int index ) const; + + /// If the array contains at least index+1 elements, returns the element value, + /// otherwise returns defaultValue. + Value get( ArrayIndex index, + const Value &defaultValue ) const; + /// Return true if index < size(). + bool isValidIndex( ArrayIndex index ) const; + /// \brief Append value to array at the end. + /// + /// Equivalent to jsonvalue[jsonvalue.size()] = value; + Value &append( const Value &value ); + + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const char *key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const char *key ) const; + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const std::string &key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const std::string &key ) const; + /** \brief Access an object value by name, create a null member if it does not exist. + + * If the object as no entry for that name, then the member name used to store + * the new entry is not duplicated. + * Example of use: + * \code + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + Value &operator[]( const StaticString &key ); +# ifdef JSON_USE_CPPTL + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const CppTL::ConstString &key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const CppTL::ConstString &key ) const; +# endif + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const char *key, + const Value &defaultValue ) const; + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const std::string &key, + const Value &defaultValue ) const; +# ifdef JSON_USE_CPPTL + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const CppTL::ConstString &key, + const Value &defaultValue ) const; +# endif + /// \brief Remove and return the named member. + /// + /// Do nothing if it did not exist. + /// \return the removed Value, or null. + /// \pre type() is objectValue or nullValue + /// \post type() is unchanged + Value removeMember( const char* key ); + /// Same as removeMember(const char*) + Value removeMember( const std::string &key ); + + /// Return true if the object has a member named key. + bool isMember( const char *key ) const; + /// Return true if the object has a member named key. + bool isMember( const std::string &key ) const; +# ifdef JSON_USE_CPPTL + /// Return true if the object has a member named key. + bool isMember( const CppTL::ConstString &key ) const; +# endif + + /// \brief Return a list of the member names. + /// + /// If null, return an empty list. + /// \pre type() is objectValue or nullValue + /// \post if type() was nullValue, it remains nullValue + Members getMemberNames() const; + +//# ifdef JSON_USE_CPPTL +// EnumMemberNames enumMemberNames() const; +// EnumValues enumValues() const; +//# endif + + /// Comments must be //... or /* ... */ + void setComment( const char *comment, + CommentPlacement placement ); + /// Comments must be //... or /* ... */ + void setComment( const std::string &comment, + CommentPlacement placement ); + bool hasComment( CommentPlacement placement ) const; + /// Include delimiters and embedded newlines. + std::string getComment( CommentPlacement placement ) const; + + std::string toStyledString() const; + + const_iterator begin() const; + const_iterator end() const; + + iterator begin(); + iterator end(); + + private: + Value &resolveReference( const char *key, + bool isStatic ); + +# ifdef JSON_VALUE_USE_INTERNAL_MAP + inline bool isItemAvailable() const + { + return itemIsUsed_ == 0; + } + + inline void setItemUsed( bool isUsed = true ) + { + itemIsUsed_ = isUsed ? 1 : 0; + } + + inline bool isMemberNameStatic() const + { + return memberNameIsStatic_ == 0; + } + + inline void setMemberNameIsStatic( bool isStatic ) + { + memberNameIsStatic_ = isStatic ? 1 : 0; + } +# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP + + private: + struct CommentInfo + { + CommentInfo(); + ~CommentInfo(); + + void setComment( const char *text ); + + char *comment_; + }; + + //struct MemberNamesTransform + //{ + // typedef const char *result_type; + // const char *operator()( const CZString &name ) const + // { + // return name.c_str(); + // } + //}; + + union ValueHolder + { + LargestInt int_; + LargestUInt uint_; + double real_; + bool bool_; + char *string_; +# ifdef JSON_VALUE_USE_INTERNAL_MAP + ValueInternalArray *array_; + ValueInternalMap *map_; +#else + ObjectValues *map_; +# endif + } value_; + ValueType type_ : 8; + int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. +# ifdef JSON_VALUE_USE_INTERNAL_MAP + unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. + int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. +# endif + CommentInfo *comments_; + }; + + + /** \brief Experimental and untested: represents an element of the "path" to access a node. + */ + class PathArgument + { + public: + friend class Path; + + PathArgument(); + PathArgument( ArrayIndex index ); + PathArgument( const char *key ); + PathArgument( const std::string &key ); + + private: + enum Kind + { + kindNone = 0, + kindIndex, + kindKey + }; + std::string key_; + ArrayIndex index_; + Kind kind_; + }; + + /** \brief Experimental and untested: represents a "path" to access a node. + * + * Syntax: + * - "." => root node + * - ".[n]" => elements at index 'n' of root node (an array value) + * - ".name" => member named 'name' of root node (an object value) + * - ".name1.name2.name3" + * - ".[0][1][2].name1[3]" + * - ".%" => member name is provided as parameter + * - ".[%]" => index is provied as parameter + */ + class Path + { + public: + Path( const std::string &path, + const PathArgument &a1 = PathArgument(), + const PathArgument &a2 = PathArgument(), + const PathArgument &a3 = PathArgument(), + const PathArgument &a4 = PathArgument(), + const PathArgument &a5 = PathArgument() ); + + const Value &resolve( const Value &root ) const; + Value resolve( const Value &root, + const Value &defaultValue ) const; + /// Creates the "path" to access the specified node and returns a reference on the node. + Value &make( Value &root ) const; + + private: + typedef std::vector InArgs; + typedef std::vector Args; + + void makePath( const std::string &path, + const InArgs &in ); + void addPathInArg( const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind ); + void invalidPath( const std::string &path, + int location ); + + Args args_; + }; + + + +#ifdef JSON_VALUE_USE_INTERNAL_MAP + /** \brief Allocator to customize Value internal map. + * Below is an example of a simple implementation (default implementation actually + * use memory pool for speed). + * \code + class DefaultValueMapAllocator : public ValueMapAllocator + { + public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + return new ValueInternalMap(); + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + return new ValueInternalMap( other ); + } + + virtual void destructMap( ValueInternalMap *map ) + { + delete map; + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + return new ValueInternalLink(); + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + delete link; + } + }; + * \endcode + */ + class JSON_API ValueMapAllocator + { + public: + virtual ~ValueMapAllocator(); + virtual ValueInternalMap *newMap() = 0; + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0; + virtual void destructMap( ValueInternalMap *map ) = 0; + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0; + virtual void releaseMapBuckets( ValueInternalLink *links ) = 0; + virtual ValueInternalLink *allocateMapLink() = 0; + virtual void releaseMapLink( ValueInternalLink *link ) = 0; + }; + + /** \brief ValueInternalMap hash-map bucket chain link (for internal use only). + * \internal previous_ & next_ allows for bidirectional traversal. + */ + class JSON_API ValueInternalLink + { + public: + enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture. + enum InternalFlags { + flagAvailable = 0, + flagUsed = 1 + }; + + ValueInternalLink(); + + ~ValueInternalLink(); + + Value items_[itemPerLink]; + char *keys_[itemPerLink]; + ValueInternalLink *previous_; + ValueInternalLink *next_; + }; + + + /** \brief A linked page based hash-table implementation used internally by Value. + * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked + * list in each bucket to handle collision. There is an addional twist in that + * each node of the collision linked list is a page containing a fixed amount of + * value. This provides a better compromise between memory usage and speed. + * + * Each bucket is made up of a chained list of ValueInternalLink. The last + * link of a given bucket can be found in the 'previous_' field of the following bucket. + * The last link of the last bucket is stored in tailLink_ as it has no following bucket. + * Only the last link of a bucket may contains 'available' item. The last link always + * contains at least one element unless is it the bucket one very first link. + */ + class JSON_API ValueInternalMap + { + friend class ValueIteratorBase; + friend class Value; + public: + typedef unsigned int HashKey; + typedef unsigned int BucketIndex; + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState + { + IteratorState() + : map_(0) + , link_(0) + , itemIndex_(0) + , bucketIndex_(0) + { + } + ValueInternalMap *map_; + ValueInternalLink *link_; + BucketIndex itemIndex_; + BucketIndex bucketIndex_; + }; +# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalMap(); + ValueInternalMap( const ValueInternalMap &other ); + ValueInternalMap &operator =( const ValueInternalMap &other ); + ~ValueInternalMap(); + + void swap( ValueInternalMap &other ); + + BucketIndex size() const; + + void clear(); + + bool reserveDelta( BucketIndex growth ); + + bool reserve( BucketIndex newItemCount ); + + const Value *find( const char *key ) const; + + Value *find( const char *key ); + + Value &resolveReference( const char *key, + bool isStatic ); + + void remove( const char *key ); + + void doActualRemove( ValueInternalLink *link, + BucketIndex index, + BucketIndex bucketIndex ); + + ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex ); + + Value &setNewItem( const char *key, + bool isStatic, + ValueInternalLink *link, + BucketIndex index ); + + Value &unsafeAdd( const char *key, + bool isStatic, + HashKey hashedKey ); + + HashKey hash( const char *key ) const; + + int compare( const ValueInternalMap &other ) const; + + private: + void makeBeginIterator( IteratorState &it ) const; + void makeEndIterator( IteratorState &it ) const; + static bool equals( const IteratorState &x, const IteratorState &other ); + static void increment( IteratorState &iterator ); + static void incrementBucket( IteratorState &iterator ); + static void decrement( IteratorState &iterator ); + static const char *key( const IteratorState &iterator ); + static const char *key( const IteratorState &iterator, bool &isStatic ); + static Value &value( const IteratorState &iterator ); + static int distance( const IteratorState &x, const IteratorState &y ); + + private: + ValueInternalLink *buckets_; + ValueInternalLink *tailLink_; + BucketIndex bucketsSize_; + BucketIndex itemCount_; + }; + + /** \brief A simplified deque implementation used internally by Value. + * \internal + * It is based on a list of fixed "page", each page contains a fixed number of items. + * Instead of using a linked-list, a array of pointer is used for fast item look-up. + * Look-up for an element is as follow: + * - compute page index: pageIndex = itemIndex / itemsPerPage + * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage] + * + * Insertion is amortized constant time (only the array containing the index of pointers + * need to be reallocated when items are appended). + */ + class JSON_API ValueInternalArray + { + friend class Value; + friend class ValueIteratorBase; + public: + enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo. + typedef Value::ArrayIndex ArrayIndex; + typedef unsigned int PageIndex; + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState // Must be a POD + { + IteratorState() + : array_(0) + , currentPageIndex_(0) + , currentItemIndex_(0) + { + } + ValueInternalArray *array_; + Value **currentPageIndex_; + unsigned int currentItemIndex_; + }; +# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalArray(); + ValueInternalArray( const ValueInternalArray &other ); + ValueInternalArray &operator =( const ValueInternalArray &other ); + ~ValueInternalArray(); + void swap( ValueInternalArray &other ); + + void clear(); + void resize( ArrayIndex newSize ); + + Value &resolveReference( ArrayIndex index ); + + Value *find( ArrayIndex index ) const; + + ArrayIndex size() const; + + int compare( const ValueInternalArray &other ) const; + + private: + static bool equals( const IteratorState &x, const IteratorState &other ); + static void increment( IteratorState &iterator ); + static void decrement( IteratorState &iterator ); + static Value &dereference( const IteratorState &iterator ); + static Value &unsafeDereference( const IteratorState &iterator ); + static int distance( const IteratorState &x, const IteratorState &y ); + static ArrayIndex indexOf( const IteratorState &iterator ); + void makeBeginIterator( IteratorState &it ) const; + void makeEndIterator( IteratorState &it ) const; + void makeIterator( IteratorState &it, ArrayIndex index ) const; + + void makeIndexValid( ArrayIndex index ); + + Value **pages_; + ArrayIndex size_; + PageIndex pageCount_; + }; + + /** \brief Experimental: do not use. Allocator to customize Value internal array. + * Below is an example of a simple implementation (actual implementation use + * memory pool). + \code +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + return new ValueInternalArray(); + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + return new ValueInternalArray( other ); + } + + virtual void destruct( ValueInternalArray *array ) + { + delete array; + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + if ( !newIndexes ) + throw std::bad_alloc(); + indexCount = newIndexCount; + indexes = static_cast( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + free( value ); + } +}; + \endcode + */ + class JSON_API ValueArrayAllocator + { + public: + virtual ~ValueArrayAllocator(); + virtual ValueInternalArray *newArray() = 0; + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0; + virtual void destructArray( ValueInternalArray *array ) = 0; + /** \brief Reallocate array page index. + * Reallocates an array of pointer on each page. + * \param indexes [input] pointer on the current index. May be \c NULL. + * [output] pointer on the new index of at least + * \a minNewIndexCount pages. + * \param indexCount [input] current number of pages in the index. + * [output] number of page the reallocated index can handle. + * \b MUST be >= \a minNewIndexCount. + * \param minNewIndexCount Minimum number of page the new index must be able to + * handle. + */ + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) = 0; + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) = 0; + virtual Value *allocateArrayPage() = 0; + virtual void releaseArrayPage( Value *value ) = 0; + }; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + + + /** \brief base class for Value iterators. + * + */ + class ValueIteratorBase + { + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef ValueIteratorBase SelfType; + + ValueIteratorBase(); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIteratorBase( const Value::ObjectValues::iterator ¤t ); +#else + ValueIteratorBase( const ValueInternalArray::IteratorState &state ); + ValueIteratorBase( const ValueInternalMap::IteratorState &state ); +#endif + + bool operator ==( const SelfType &other ) const + { + return isEqual( other ); + } + + bool operator !=( const SelfType &other ) const + { + return !isEqual( other ); + } + + difference_type operator -( const SelfType &other ) const + { + return computeDistance( other ); + } + + /// Return either the index or the member name of the referenced value as a Value. + Value key() const; + + /// Return the index of the referenced Value. -1 if it is not an arrayValue. + UInt index() const; + + /// Return the member name of the referenced Value. "" if it is not an objectValue. + const char *memberName() const; + + protected: + Value &deref() const; + + void increment(); + + void decrement(); + + difference_type computeDistance( const SelfType &other ) const; + + bool isEqual( const SelfType &other ) const; + + void copy( const SelfType &other ); + + private: +#ifndef JSON_VALUE_USE_INTERNAL_MAP + Value::ObjectValues::iterator current_; + // Indicates that iterator is for a null value. + bool isNull_; +#else + union + { + ValueInternalArray::IteratorState array_; + ValueInternalMap::IteratorState map_; + } iterator_; + bool isArray_; +#endif + }; + + /** \brief const iterator for object and array value. + * + */ + class ValueConstIterator : public ValueIteratorBase + { + friend class Value; + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef const Value &reference; + typedef const Value *pointer; + typedef ValueConstIterator SelfType; + + ValueConstIterator(); + private: + /*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueConstIterator( const Value::ObjectValues::iterator ¤t ); +#else + ValueConstIterator( const ValueInternalArray::IteratorState &state ); + ValueConstIterator( const ValueInternalMap::IteratorState &state ); +#endif + public: + SelfType &operator =( const ValueIteratorBase &other ); + + SelfType operator++( int ) + { + SelfType temp( *this ); + ++*this; + return temp; + } + + SelfType operator--( int ) + { + SelfType temp( *this ); + --*this; + return temp; + } + + SelfType &operator--() + { + decrement(); + return *this; + } + + SelfType &operator++() + { + increment(); + return *this; + } + + reference operator *() const + { + return deref(); + } + }; + + + /** \brief Iterator for object and array value. + */ + class ValueIterator : public ValueIteratorBase + { + friend class Value; + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef Value &reference; + typedef Value *pointer; + typedef ValueIterator SelfType; + + ValueIterator(); + ValueIterator( const ValueConstIterator &other ); + ValueIterator( const ValueIterator &other ); + private: + /*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIterator( const Value::ObjectValues::iterator ¤t ); +#else + ValueIterator( const ValueInternalArray::IteratorState &state ); + ValueIterator( const ValueInternalMap::IteratorState &state ); +#endif + public: + + SelfType &operator =( const SelfType &other ); + + SelfType operator++( int ) + { + SelfType temp( *this ); + ++*this; + return temp; + } + + SelfType operator--( int ) + { + SelfType temp( *this ); + --*this; + return temp; + } + + SelfType &operator--() + { + decrement(); + return *this; + } + + SelfType &operator++() + { + increment(); + return *this; + } + + reference operator *() const + { + return deref(); + } + }; + + +} // namespace Json + + +#endif // CPPTL_JSON_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_READER_H_INCLUDED +# define CPPTL_JSON_READER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +# include "features.h" +# include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +# include +# include +# include + +namespace Json { + + /** \brief Unserialize a JSON document into a Value. + * + */ + class JSON_API Reader + { + public: + typedef char Char; + typedef const Char *Location; + + /** \brief Constructs a Reader allowing all features + * for parsing. + */ + Reader(); + + /** \brief Constructs a Reader allowing the specified feature set + * for parsing. + */ + Reader( const Features &features ); + + /** \brief Read a Value from a JSON document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them back during + * serialization, \c false to discard comments. + * This parameter is ignored if Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an error occurred. + */ + bool parse( const std::string &document, + Value &root, + bool collectComments = true ); + + /** \brief Read a Value from a JSON document. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read. + \ Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them back during + * serialization, \c false to discard comments. + * This parameter is ignored if Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an error occurred. + */ + bool parse( const char *beginDoc, const char *endDoc, + Value &root, + bool collectComments = true ); + + /// \brief Parse from input stream. + /// \see Json::operator>>(std::istream&, Json::Value&). + bool parse( std::istream &is, + Value &root, + bool collectComments = true ); + + /** \brief Returns a user friendly string that list errors in the parsed document. + * \return Formatted error message with the list of errors with their location in + * the parsed document. An empty string is returned if no error occurred + * during parsing. + * \deprecated Use getFormattedErrorMessages() instead (typo fix). + */ + JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead") + std::string getFormatedErrorMessages() const; + + /** \brief Returns a user friendly string that list errors in the parsed document. + * \return Formatted error message with the list of errors with their location in + * the parsed document. An empty string is returned if no error occurred + * during parsing. + */ + std::string getFormattedErrorMessages() const; + + private: + enum TokenType + { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token + { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo + { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool expectToken( TokenType type, Token &token, const char *message ); + bool readToken( Token &token ); + void skipSpaces(); + bool match( Location pattern, + int patternLength ); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + void readNumber(); + bool readValue(); + bool readObject( Token &token ); + bool readArray( Token &token ); + bool decodeNumber( Token &token ); + bool decodeString( Token &token ); + bool decodeString( Token &token, std::string &decoded ); + bool decodeDouble( Token &token ); + bool decodeUnicodeCodePoint( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ); + bool decodeUnicodeEscapeSequence( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ); + bool addError( const std::string &message, + Token &token, + Location extra = 0 ); + bool recoverFromError( TokenType skipUntilToken ); + bool addErrorAndRecover( const std::string &message, + Token &token, + TokenType skipUntilToken ); + void skipUntilSpace(); + Value ¤tValue(); + Char getNextChar(); + void getLocationLineAndColumn( Location location, + int &line, + int &column ) const; + std::string getLocationLineAndColumn( Location location ) const; + void addComment( Location begin, + Location end, + CommentPlacement placement ); + void skipCommentTokens( Token &token ); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value *lastValue_; + std::string commentsBefore_; + Features features_; + bool collectComments_; + }; + + /** \brief Read from 'sin' into 'root'. + + Always keep comments from the input JSON. + + This can be used to read a file into a particular sub-object. + For example: + \code + Json::Value root; + cin >> root["dir"]["file"]; + cout << root; + \endcode + Result: + \verbatim + { + "dir": { + "file": { + // The input stream JSON would be nested here. + } + } + } + \endverbatim + \throw std::exception on parse error. + \see Json::operator<<() + */ + std::istream& operator>>( std::istream&, Value& ); + +} // namespace Json + +#endif // CPPTL_JSON_READER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_WRITER_H_INCLUDED +# define JSON_WRITER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +# include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +# include +# include + +namespace Json { + + class Value; + + /** \brief Abstract class for writers. + */ + class JSON_API Writer + { + public: + virtual ~Writer(); + + virtual std::string write( const Value &root ) = 0; + }; + + /** \brief Outputs a Value in JSON format without formatting (not human friendly). + * + * The JSON document is written in a single line. It is not intended for 'human' consumption, + * but may be usefull to support feature such as RPC where bandwith is limited. + * \sa Reader, Value + */ + class JSON_API FastWriter : public Writer + { + public: + FastWriter(); + virtual ~FastWriter(){} + + void enableYAMLCompatibility(); + + /** \brief Drop the "null" string from the writer's output for nullValues. + * Strictly speaking, this is not valid JSON. But when the output is being + * fed to a browser's Javascript, it makes for smaller output and the + * browser can handle the output just fine. + */ + void dropNullPlaceholders(); + + public: // overridden from Writer + virtual std::string write( const Value &root ); + + private: + void writeValue( const Value &value ); + + std::string document_; + bool yamlCompatiblityEnabled_; + bool dropNullPlaceholders_; + }; + + /** \brief Writes a Value in JSON format in a human friendly way. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value types, + * and all the values fit on one lines, then print the array on a single line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their #CommentPlacement. + * + * \sa Reader, Value, Value::setComment() + */ + class JSON_API StyledWriter: public Writer + { + public: + StyledWriter(); + virtual ~StyledWriter(){} + + public: // overridden from Writer + /** \brief Serialize a Value in JSON format. + * \param root Value to serialize. + * \return String containing the JSON document that represents the root value. + */ + virtual std::string write( const Value &root ); + + private: + void writeValue( const Value &value ); + void writeArrayValue( const Value &value ); + bool isMultineArray( const Value &value ); + void pushValue( const std::string &value ); + void writeIndent(); + void writeWithIndent( const std::string &value ); + void indent(); + void unindent(); + void writeCommentBeforeValue( const Value &root ); + void writeCommentAfterValueOnSameLine( const Value &root ); + bool hasCommentForValue( const Value &value ); + static std::string normalizeEOL( const std::string &text ); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string document_; + std::string indentString_; + int rightMargin_; + int indentSize_; + bool addChildValues_; + }; + + /** \brief Writes a Value in JSON format in a human friendly way, + to a stream rather than to a string. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value types, + * and all the values fit on one lines, then print the array on a single line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their #CommentPlacement. + * + * \param indentation Each level will be indented by this amount extra. + * \sa Reader, Value, Value::setComment() + */ + class JSON_API StyledStreamWriter + { + public: + StyledStreamWriter( std::string indentation="\t" ); + ~StyledStreamWriter(){} + + public: + /** \brief Serialize a Value in JSON format. + * \param out Stream to write to. (Can be ostringstream, e.g.) + * \param root Value to serialize. + * \note There is no point in deriving from Writer, since write() should not return a value. + */ + void write( std::ostream &out, const Value &root ); + + private: + void writeValue( const Value &value ); + void writeArrayValue( const Value &value ); + bool isMultineArray( const Value &value ); + void pushValue( const std::string &value ); + void writeIndent(); + void writeWithIndent( const std::string &value ); + void indent(); + void unindent(); + void writeCommentBeforeValue( const Value &root ); + void writeCommentAfterValueOnSameLine( const Value &root ); + bool hasCommentForValue( const Value &value ); + static std::string normalizeEOL( const std::string &text ); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::ostream* document_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + bool addChildValues_; + }; + +# if defined(JSON_HAS_INT64) + std::string JSON_API valueToString( Int value ); + std::string JSON_API valueToString( UInt value ); +# endif // if defined(JSON_HAS_INT64) + std::string JSON_API valueToString( LargestInt value ); + std::string JSON_API valueToString( LargestUInt value ); + std::string JSON_API valueToString( double value ); + std::string JSON_API valueToString( bool value ); + std::string JSON_API valueToQuotedString( const char *value ); + + /// \brief Output using the StyledStreamWriter. + /// \see Json::operator>>() + std::ostream& operator<<( std::ostream&, const Value &root ); + +} // namespace Json + + + +#endif // JSON_WRITER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED +# define CPPTL_JSON_ASSERTIONS_H_INCLUDED + +#include + +#if !defined(JSON_IS_AMALGAMATION) +# include +#endif // if !defined(JSON_IS_AMALGAMATION) + +#if JSON_USE_EXCEPTION +#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw +#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message ); +#else // JSON_USE_EXCEPTION +#define JSON_ASSERT( condition ) assert( condition ); + +// The call to assert() will show the failure message in debug builds. In +// release bugs we write to invalid memory in order to crash hard, so that a +// debugger or crash reporter gets the chance to take over. We still call exit() +// afterward in order to tell the compiler that this macro doesn't return. +#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast(666), message); exit(123); } + +#endif + +#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) } + +#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + + + + + +#endif //ifndef JSON_AMALGATED_H_INCLUDED diff --git a/src/json/jsoncpp.cpp b/src/json/jsoncpp.cpp new file mode 100644 index 000000000..dbe5a349f --- /dev/null +++ b/src/json/jsoncpp.cpp @@ -0,0 +1,4367 @@ +/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/). +/// It is intented to be used with #include + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + + +#include "json/json.h" + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED +# define LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +/* This header provides common string manipulation support, such as UTF-8, + * portable conversion from/to string... + * + * It is an internal header that must not be exposed. + */ + +namespace Json { + +/// Converts a unicode code-point to UTF-8. +static inline std::string +codePointToUTF8(unsigned int cp) +{ + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) + { + result.resize(1); + result[0] = static_cast(cp); + } + else if (cp <= 0x7FF) + { + result.resize(2); + result[1] = static_cast(0x80 | (0x3f & cp)); + result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); + } + else if (cp <= 0xFFFF) + { + result.resize(3); + result[2] = static_cast(0x80 | (0x3f & cp)); + result[1] = 0x80 | static_cast((0x3f & (cp >> 6))); + result[0] = 0xE0 | static_cast((0xf & (cp >> 12))); + } + else if (cp <= 0x10FFFF) + { + result.resize(4); + result[3] = static_cast(0x80 | (0x3f & cp)); + result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + + +/// Returns true if ch is a control character (in range [0,32[). +static inline bool +isControlCharacter(char ch) +{ + return ch > 0 && ch <= 0x1F; +} + + +enum { + /// Constant that specify the size of the buffer that must be passed to uintToString. + uintToStringBufferSize = 3*sizeof(LargestUInt)+1 +}; + +// Defines a char buffer for use with uintToString(). +typedef char UIntToStringBuffer[uintToStringBufferSize]; + + +/** Converts an unsigned integer to string. + * @param value Unsigned interger to convert to string + * @param current Input/Output string buffer. + * Must have at least uintToStringBufferSize chars free. + */ +static inline void +uintToString( LargestUInt value, + char *¤t ) +{ + *--current = 0; + do + { + *--current = char(value % 10) + '0'; + value /= 10; + } + while ( value != 0 ); +} + +} // namespace Json { + +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +# include +# include +# include +# include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_( true ) + , strictRoot_( false ) +{ +} + + +Features +Features::all() +{ + return Features(); +} + + +Features +Features::strictMode() +{ + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4; +} + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; +} + + +static bool +containsNewLine( Reader::Location begin, + Reader::Location end ) +{ + for ( ;begin < end; ++begin ) + if ( *begin == '\n' || *begin == '\r' ) + return true; + return false; +} + + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : errors_(), + document_(), + begin_(), + end_(), + current_(), + lastValueEnd_(), + lastValue_(), + commentsBefore_(), + features_( Features::all() ), + collectComments_() +{ +} + + +Reader::Reader( const Features &features ) + : errors_(), + document_(), + begin_(), + end_(), + current_(), + lastValueEnd_(), + lastValue_(), + commentsBefore_(), + features_( features ), + collectComments_() +{ +} + + +bool +Reader::parse( const std::string &document, + Value &root, + bool collectComments ) +{ + document_ = document; + const char *begin = document_.c_str(); + const char *end = begin + document_.length(); + return parse( begin, end, root, collectComments ); +} + + +bool +Reader::parse( std::istream& sin, + Value &root, + bool collectComments ) +{ + //std::istream_iterator begin(sin); + //std::istream_iterator end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse( doc, root, collectComments ); +} + +bool +Reader::parse( const char *beginDoc, const char *endDoc, + Value &root, + bool collectComments ) +{ + if ( !features_.allowComments_ ) + { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while ( !nodes_.empty() ) + nodes_.pop(); + nodes_.push( &root ); + + bool successful = readValue(); + Token token; + skipCommentTokens( token ); + if ( collectComments_ && !commentsBefore_.empty() ) + root.setComment( commentsBefore_, commentAfter ); + if ( features_.strictRoot_ ) + { + if ( !root.isArray() && !root.isObject() ) + { + // Set error location to start of doc, ideally should be first token found in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( "A valid JSON document must be either an array or an object value.", + token ); + return false; + } + } + return successful; +} + + +bool +Reader::readValue() +{ + Token token; + skipCommentTokens( token ); + bool successful = true; + + if ( collectComments_ && !commentsBefore_.empty() ) + { + currentValue().setComment( commentsBefore_, commentBefore ); + commentsBefore_ = ""; + } + + + switch ( token.type_ ) + { + case tokenObjectBegin: + successful = readObject( token ); + break; + case tokenArrayBegin: + successful = readArray( token ); + break; + case tokenNumber: + successful = decodeNumber( token ); + break; + case tokenString: + successful = decodeString( token ); + break; + case tokenTrue: + currentValue() = true; + break; + case tokenFalse: + currentValue() = false; + break; + case tokenNull: + currentValue() = Value(); + break; + default: + return addError( "Syntax error: value, object or array expected.", token ); + } + + if ( collectComments_ ) + { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + return successful; +} + + +void +Reader::skipCommentTokens( Token &token ) +{ + if ( features_.allowComments_ ) + { + do + { + readToken( token ); + } + while ( token.type_ == tokenComment ); + } + else + { + readToken( token ); + } +} + + +bool +Reader::expectToken( TokenType type, Token &token, const char *message ) +{ + readToken( token ); + if ( token.type_ != type ) + return addError( message, token ); + return true; +} + + +bool +Reader::readToken( Token &token ) +{ + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch ( c ) + { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match( "rue", 3 ); + break; + case 'f': + token.type_ = tokenFalse; + ok = match( "alse", 4 ); + break; + case 'n': + token.type_ = tokenNull; + ok = match( "ull", 3 ); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if ( !ok ) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + + +void +Reader::skipSpaces() +{ + while ( current_ != end_ ) + { + Char c = *current_; + if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) + ++current_; + else + break; + } +} + + +bool +Reader::match( Location pattern, + int patternLength ) +{ + if ( end_ - current_ < patternLength ) + return false; + int index = patternLength; + while ( index-- ) + if ( current_[index] != pattern[index] ) + return false; + current_ += patternLength; + return true; +} + + +bool +Reader::readComment() +{ + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if ( c == '*' ) + successful = readCStyleComment(); + else if ( c == '/' ) + successful = readCppStyleComment(); + if ( !successful ) + return false; + + if ( collectComments_ ) + { + CommentPlacement placement = commentBefore; + if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) + { + if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) + placement = commentAfterOnSameLine; + } + + addComment( commentBegin, current_, placement ); + } + return true; +} + + +void +Reader::addComment( Location begin, + Location end, + CommentPlacement placement ) +{ + assert( collectComments_ ); + if ( placement == commentAfterOnSameLine ) + { + assert( lastValue_ != 0 ); + lastValue_->setComment( std::string( begin, end ), placement ); + } + else + { + if ( !commentsBefore_.empty() ) + commentsBefore_ += "\n"; + commentsBefore_ += std::string( begin, end ); + } +} + + +bool +Reader::readCStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '*' && *current_ == '/' ) + break; + } + return getNextChar() == '/'; +} + + +bool +Reader::readCppStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '\r' || c == '\n' ) + break; + } + return true; +} + + +void +Reader::readNumber() +{ + while ( current_ != end_ ) + { + if ( !(*current_ >= '0' && *current_ <= '9') && + !in( *current_, '.', 'e', 'E', '+', '-' ) ) + break; + ++current_; + } +} + +bool +Reader::readString() +{ + Char c = 0; + while ( current_ != end_ ) + { + c = getNextChar(); + if ( c == '\\' ) + getNextChar(); + else if ( c == '"' ) + break; + } + return c == '"'; +} + + +bool +Reader::readObject( Token &/*tokenStart*/ ) +{ + Token tokenName; + std::string name; + currentValue() = Value( objectValue ); + while ( readToken( tokenName ) ) + { + bool initialTokenOk = true; + while ( tokenName.type_ == tokenComment && initialTokenOk ) + initialTokenOk = readToken( tokenName ); + if ( !initialTokenOk ) + break; + if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object + return true; + if ( tokenName.type_ != tokenString ) + break; + + name = ""; + if ( !decodeString( tokenName, name ) ) + return recoverFromError( tokenObjectEnd ); + + Token colon; + if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) + { + return addErrorAndRecover( "Missing ':' after object member name", + colon, + tokenObjectEnd ); + } + Value &value = currentValue()[ name ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenObjectEnd ); + + Token comma; + if ( !readToken( comma ) + || ( comma.type_ != tokenObjectEnd && + comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment ) ) + { + return addErrorAndRecover( "Missing ',' or '}' in object declaration", + comma, + tokenObjectEnd ); + } + bool finalizeTokenOk = true; + while ( comma.type_ == tokenComment && + finalizeTokenOk ) + finalizeTokenOk = readToken( comma ); + if ( comma.type_ == tokenObjectEnd ) + return true; + } + return addErrorAndRecover( "Missing '}' or object member name", + tokenName, + tokenObjectEnd ); +} + + +bool +Reader::readArray( Token &/*tokenStart*/ ) +{ + currentValue() = Value( arrayValue ); + skipSpaces(); + if ( *current_ == ']' ) // empty array + { + Token endArray; + readToken( endArray ); + return true; + } + int index = 0; + for (;;) + { + Value &value = currentValue()[ index++ ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenArrayEnd ); + + Token token; + // Accept Comment after last item in the array. + ok = readToken( token ); + while ( token.type_ == tokenComment && ok ) + { + ok = readToken( token ); + } + bool badTokenType = ( token.type_ != tokenArraySeparator && + token.type_ != tokenArrayEnd ); + if ( !ok || badTokenType ) + { + return addErrorAndRecover( "Missing ',' or ']' in array declaration", + token, + tokenArrayEnd ); + } + if ( token.type_ == tokenArrayEnd ) + break; + } + return true; +} + + +bool +Reader::decodeNumber( Token &token ) +{ + bool isDouble = false; + for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) + { + isDouble = isDouble + || in( *inspect, '.', 'e', 'E', '+' ) + || ( *inspect == '-' && inspect != token.start_ ); + } + if ( isDouble ) + return decodeDouble( token ); + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if ( isNegative ) + ++current; + Value::LargestUInt maxIntegerValue = isNegative ? Value::LargestUInt(-Value::minLargestInt) + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while ( current < token.end_ ) + { + Char c = *current++; + if ( c < '0' || c > '9' ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + Value::UInt digit(c - '0'); + if ( value >= threshold ) + { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || + current != token.end_ || + digit > maxIntegerValue % 10) + { + return decodeDouble( token ); + } + } + value = value * 10 + digit; + } + if ( isNegative ) + currentValue() = -Value::LargestInt( value ); + else if ( value <= Value::LargestUInt(Value::maxInt) ) + currentValue() = Value::LargestInt( value ); + else + currentValue() = value; + return true; +} + + +bool +Reader::decodeDouble( Token &token ) +{ + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + + // Sanity check to avoid buffer overflow exploits. + if (length < 0) { + return addError( "Unable to parse token length", token ); + } + + // Avoid using a string constant for the format control string given to + // sscanf, as this can cause hard to debug crashes on OS X. See here for more + // info: + // + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html + char format[] = "%lf"; + + if ( length <= bufferSize ) + { + Char buffer[bufferSize+1]; + memcpy( buffer, token.start_, length ); + buffer[length] = 0; + count = sscanf( buffer, format, &value ); + } + else + { + std::string buffer( token.start_, token.end_ ); + count = sscanf( buffer.c_str(), format, &value ); + } + + if ( count != 1 ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + currentValue() = value; + return true; +} + + +bool +Reader::decodeString( Token &token ) +{ + std::string decoded; + if ( !decodeString( token, decoded ) ) + return false; + currentValue() = decoded; + return true; +} + + +bool +Reader::decodeString( Token &token, std::string &decoded ) +{ + decoded.reserve( token.end_ - token.start_ - 2 ); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while ( current != end ) + { + Char c = *current++; + if ( c == '"' ) + break; + else if ( c == '\\' ) + { + if ( current == end ) + return addError( "Empty escape sequence in string", token, current ); + Char escape = *current++; + switch ( escape ) + { + case '"': decoded += '"'; break; + case '/': decoded += '/'; break; + case '\\': decoded += '\\'; break; + case 'b': decoded += '\b'; break; + case 'f': decoded += '\f'; break; + case 'n': decoded += '\n'; break; + case 'r': decoded += '\r'; break; + case 't': decoded += '\t'; break; + case 'u': + { + unsigned int unicode; + if ( !decodeUnicodeCodePoint( token, current, end, unicode ) ) + return false; + decoded += codePointToUTF8(unicode); + } + break; + default: + return addError( "Bad escape sequence in string", token, current ); + } + } + else + { + decoded += c; + } + } + return true; +} + +bool +Reader::decodeUnicodeCodePoint( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + + if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) + { + // surrogate pairs + if (end - current < 6) + return addError( "additional six characters expected to parse unicode surrogate pair.", token, current ); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++)== 'u') + { + if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair )) + { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } + else + return false; + } + else + return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current ); + } + return true; +} + +bool +Reader::decodeUnicodeEscapeSequence( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + if ( end - current < 4 ) + return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); + unicode = 0; + for ( int index =0; index < 4; ++index ) + { + Char c = *current++; + unicode *= 16; + if ( c >= '0' && c <= '9' ) + unicode += c - '0'; + else if ( c >= 'a' && c <= 'f' ) + unicode += c - 'a' + 10; + else if ( c >= 'A' && c <= 'F' ) + unicode += c - 'A' + 10; + else + return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); + } + return true; +} + + +bool +Reader::addError( const std::string &message, + Token &token, + Location extra ) +{ + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back( info ); + return false; +} + + +bool +Reader::recoverFromError( TokenType skipUntilToken ) +{ + int errorCount = int(errors_.size()); + Token skip; + for (;;) + { + if ( !readToken(skip) ) + errors_.resize( errorCount ); // discard errors caused by recovery + if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) + break; + } + errors_.resize( errorCount ); + return false; +} + + +bool +Reader::addErrorAndRecover( const std::string &message, + Token &token, + TokenType skipUntilToken ) +{ + addError( message, token ); + return recoverFromError( skipUntilToken ); +} + + +Value & +Reader::currentValue() +{ + return *(nodes_.top()); +} + + +Reader::Char +Reader::getNextChar() +{ + if ( current_ == end_ ) + return 0; + return *current_++; +} + + +void +Reader::getLocationLineAndColumn( Location location, + int &line, + int &column ) const +{ + Location current = begin_; + Location lastLineStart = current; + line = 0; + while ( current < location && current != end_ ) + { + Char c = *current++; + if ( c == '\r' ) + { + if ( *current == '\n' ) + ++current; + lastLineStart = current; + ++line; + } + else if ( c == '\n' ) + { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + + +std::string +Reader::getLocationLineAndColumn( Location location ) const +{ + int line, column; + getLocationLineAndColumn( location, line, column ); + char buffer[18+16+16+1]; + sprintf( buffer, "Line %d, Column %d", line, column ); + return buffer; +} + + +// Deprecated. Preserved for backward compatibility +std::string +Reader::getFormatedErrorMessages() const +{ + return getFormattedErrorMessages(); +} + + +std::string +Reader::getFormattedErrorMessages() const +{ + std::string formattedMessage; + for ( Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError ) + { + const ErrorInfo &error = *itError; + formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if ( error.extra_ ) + formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; + } + return formattedMessage; +} + + +std::istream& operator>>( std::istream &sin, Value &root ) +{ + Json::Reader reader; + bool ok = reader.parse(sin, root, true); + if (!ok) { + fprintf( + stderr, + "Error from reader: %s", + reader.getFormattedErrorMessages().c_str()); + + JSON_FAIL_MESSAGE("reader error"); + } + return sin; +} + + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_batchallocator.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED +# define JSONCPP_BATCHALLOCATOR_H_INCLUDED + +# include +# include + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +namespace Json { + +/* Fast memory allocator. + * + * This memory allocator allocates memory for a batch of object (specified by + * the page size, the number of object in each page). + * + * It does not allow the destruction of a single object. All the allocated objects + * can be destroyed at once. The memory can be either released or reused for future + * allocation. + * + * The in-place new operator must be used to construct the object using the pointer + * returned by allocate. + */ +template +class BatchAllocator +{ +public: + BatchAllocator( unsigned int objectsPerPage = 255 ) + : freeHead_( 0 ) + , objectsPerPage_( objectsPerPage ) + { +// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() ); + assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space. + assert( objectsPerPage >= 16 ); + batches_ = allocateBatch( 0 ); // allocated a dummy page + currentBatch_ = batches_; + } + + ~BatchAllocator() + { + for ( BatchInfo *batch = batches_; batch; ) + { + BatchInfo *nextBatch = batch->next_; + free( batch ); + batch = nextBatch; + } + } + + /// allocate space for an array of objectPerAllocation object. + /// @warning it is the responsability of the caller to call objects constructors. + AllocatedType *allocate() + { + if ( freeHead_ ) // returns node from free list. + { + AllocatedType *object = freeHead_; + freeHead_ = *(AllocatedType **)object; + return object; + } + if ( currentBatch_->used_ == currentBatch_->end_ ) + { + currentBatch_ = currentBatch_->next_; + while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ ) + currentBatch_ = currentBatch_->next_; + + if ( !currentBatch_ ) // no free batch found, allocate a new one + { + currentBatch_ = allocateBatch( objectsPerPage_ ); + currentBatch_->next_ = batches_; // insert at the head of the list + batches_ = currentBatch_; + } + } + AllocatedType *allocated = currentBatch_->used_; + currentBatch_->used_ += objectPerAllocation; + return allocated; + } + + /// Release the object. + /// @warning it is the responsability of the caller to actually destruct the object. + void release( AllocatedType *object ) + { + assert( object != 0 ); + *(AllocatedType **)object = freeHead_; + freeHead_ = object; + } + +private: + struct BatchInfo + { + BatchInfo *next_; + AllocatedType *used_; + AllocatedType *end_; + AllocatedType buffer_[objectPerAllocation]; + }; + + // disabled copy constructor and assignement operator. + BatchAllocator( const BatchAllocator & ); + void operator =( const BatchAllocator &); + + static BatchInfo *allocateBatch( unsigned int objectsPerPage ) + { + const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation + + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage; + BatchInfo *batch = static_cast( malloc( mallocSize ) ); + batch->next_ = 0; + batch->used_ = batch->buffer_; + batch->end_ = batch->buffer_ + objectsPerPage; + return batch; + } + + BatchInfo *batches_; + BatchInfo *currentBatch_; + /// Head of a single linked list within the allocated space of freeed object + AllocatedType *freeHead_; + unsigned int objectsPerPage_; +}; + + +} // namespace Json + +# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION + +#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_batchallocator.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() +#ifndef JSON_VALUE_USE_INTERNAL_MAP + : current_() + , isNull_( true ) +{ +} +#else + : isArray_( true ) + , isNull_( true ) +{ + iterator_.array_ = ValueInternalArray::IteratorState(); +} +#endif + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator ¤t ) + : current_( current ) + , isNull_( false ) +{ +} +#else +ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state ) + : isArray_( true ) +{ + iterator_.array_ = state; +} + + +ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state ) + : isArray_( false ) +{ + iterator_.map_ = state; +} +#endif + +Value & +ValueIteratorBase::deref() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + return current_->second; +#else + if ( isArray_ ) + return ValueInternalArray::dereference( iterator_.array_ ); + return ValueInternalMap::value( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::increment() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ++current_; +#else + if ( isArray_ ) + ValueInternalArray::increment( iterator_.array_ ); + ValueInternalMap::increment( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::decrement() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + --current_; +#else + if ( isArray_ ) + ValueInternalArray::decrement( iterator_.array_ ); + ValueInternalMap::decrement( iterator_.map_ ); +#endif +} + + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP +# ifdef JSON_USE_CPPTL_SMALLMAP + return current_ - other.current_; +# else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if ( isNull_ && other.isNull_ ) + { + return 0; + } + + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it ) + { + ++myDistance; + } + return myDistance; +# endif +#else + if ( isArray_ ) + return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +bool +ValueIteratorBase::isEqual( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + if ( isNull_ ) + { + return other.isNull_; + } + return current_ == other.current_; +#else + if ( isArray_ ) + return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::copy( const SelfType &other ) +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + current_ = other.current_; +#else + if ( isArray_ ) + iterator_.array_ = other.iterator_.array_; + iterator_.map_ = other.iterator_.map_; +#endif +} + + +Value +ValueIteratorBase::key() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( czstring.c_str() ) + { + if ( czstring.isStaticString() ) + return Value( StaticString( czstring.c_str() ) ); + return Value( czstring.c_str() ); + } + return Value( czstring.index() ); +#else + if ( isArray_ ) + return Value( ValueInternalArray::indexOf( iterator_.array_ ) ); + bool isStatic; + const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic ); + if ( isStatic ) + return Value( StaticString( memberName ) ); + return Value( memberName ); +#endif +} + + +UInt +ValueIteratorBase::index() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( !czstring.c_str() ) + return czstring.index(); + return Value::UInt( -1 ); +#else + if ( isArray_ ) + return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) ); + return Value::UInt( -1 ); +#endif +} + + +const char * +ValueIteratorBase::memberName() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const char *name = (*current_).first.c_str(); + return name ? name : ""; +#else + if ( !isArray_ ) + return ValueInternalMap::key( iterator_.map_ ); + return ""; +#endif +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueConstIterator & +ValueConstIterator::operator =( const ValueIteratorBase &other ) +{ + copy( other ); + return *this; +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIterator::ValueIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueIterator::ValueIterator( const ValueConstIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator::ValueIterator( const ValueIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator & +ValueIterator::operator =( const SelfType &other ) +{ + copy( other ); + return *this; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +# include +# include +# include +# ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +# include "json_batchallocator.h" +# endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include +#ifdef JSON_USE_CPPTL +# include +#endif +#include // size_t + +#define JSON_ASSERT_UNREACHABLE assert( false ) + +namespace Json { + +const Value Value::null; +const Int Value::minInt = Int( ~(UInt(-1)/2) ); +const Int Value::maxInt = Int( UInt(-1)/2 ); +const UInt Value::maxUInt = UInt(-1); +# if defined(JSON_HAS_INT64) +const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) ); +const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 ); +const UInt64 Value::maxUInt64 = UInt64(-1); +// The constant is hard-coded because some compiler have trouble +// converting Value::maxUInt64 to a double correctly (AIX/xlC). +// Assumes that UInt64 is a 64 bits integer. +static const double maxUInt64AsDouble = 18446744073709551615.0; +#endif // defined(JSON_HAS_INT64) +const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) ); +const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 ); +const LargestUInt Value::maxLargestUInt = LargestUInt(-1); + + +/// Unknown size marker +static const unsigned int unknown = (unsigned)-1; + +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +template +static inline bool InRange(double d, T min, U max) { + return d >= min && d <= max; +} +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +static inline double integerToDouble( Json::UInt64 value ) +{ + return static_cast( Int64(value/2) ) * 2.0 + Int64(value & 1); +} + +template +static inline double integerToDouble( T value ) +{ + return static_cast( value ); +} + +template +static inline bool InRange(double d, T min, U max) { + return d >= integerToDouble(min) && d <= integerToDouble(max); +} +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + + +/** Duplicates the specified string value. + * @param value Pointer to the string to duplicate. Must be zero-terminated if + * length is "unknown". + * @param length Length of the value. if equals to unknown, then it will be + * computed using strlen(value). + * @return Pointer on the duplicate instance of string. + */ +static inline char * +duplicateStringValue( const char *value, + unsigned int length = unknown ) +{ + if ( length == unknown ) + length = (unsigned int)strlen(value); + + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + if (length >= (unsigned)Value::maxInt) + length = Value::maxInt - 1; + + char *newString = static_cast( malloc( length + 1 ) ); + JSON_ASSERT_MESSAGE( newString != 0, "Failed to allocate string value buffer" ); + memcpy( newString, value, length ); + newString[length] = 0; + return newString; +} + + +/** Free the string duplicated by duplicateStringValue(). + */ +static inline void +releaseStringValue( char *value ) +{ + if ( value ) + free( value ); +} + +} // namespace Json + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#if !defined(JSON_IS_AMALGAMATION) +# ifdef JSON_VALUE_USE_INTERNAL_MAP +# include "json_internalarray.inl" +# include "json_internalmap.inl" +# endif // JSON_VALUE_USE_INTERNAL_MAP + +# include "json_valueiterator.inl" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + + +Value::CommentInfo::CommentInfo() + : comment_( 0 ) +{ +} + +Value::CommentInfo::~CommentInfo() +{ + if ( comment_ ) + releaseStringValue( comment_ ); +} + + +void +Value::CommentInfo::setComment( const char *text ) +{ + if ( comment_ ) + releaseStringValue( comment_ ); + JSON_ASSERT( text != 0 ); + JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); + // It seems that /**/ style comments are acceptable as well. + comment_ = duplicateStringValue( text ); +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +# ifndef JSON_VALUE_USE_INTERNAL_MAP + +// Notes: index_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString( ArrayIndex index ) + : cstr_( 0 ) + , index_( index ) +{ +} + +Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) + : cstr_( allocate == duplicate ? duplicateStringValue(cstr) + : cstr ) + , index_( allocate ) +{ +} + +Value::CZString::CZString( const CZString &other ) +: cstr_( other.index_ != noDuplication && other.cstr_ != 0 + ? duplicateStringValue( other.cstr_ ) + : other.cstr_ ) + , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) + : other.index_ ) +{ +} + +Value::CZString::~CZString() +{ + if ( cstr_ && index_ == duplicate ) + releaseStringValue( const_cast( cstr_ ) ); +} + +void +Value::CZString::swap( CZString &other ) +{ + std::swap( cstr_, other.cstr_ ); + std::swap( index_, other.index_ ); +} + +Value::CZString & +Value::CZString::operator =( const CZString &other ) +{ + CZString temp( other ); + swap( temp ); + return *this; +} + +bool +Value::CZString::operator<( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) < 0; + return index_ < other.index_; +} + +bool +Value::CZString::operator==( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) == 0; + return index_ == other.index_; +} + + +ArrayIndex +Value::CZString::index() const +{ + return index_; +} + + +const char * +Value::CZString::c_str() const +{ + return cstr_; +} + +bool +Value::CZString::isStaticString() const +{ + return index_ == noDuplication; +} + +#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value( ValueType type ) + : type_( type ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + switch ( type ) + { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArray(); + break; + case objectValue: + value_.map_ = mapAllocator()->newMap(); + break; +#endif + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + + +Value::Value( UInt value ) + : type_( uintValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.uint_ = value; +} + +Value::Value( Int value ) + : type_( intValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.int_ = value; +} + + +# if defined(JSON_HAS_INT64) +Value::Value( Int64 value ) + : type_( intValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.int_ = value; +} + + +Value::Value( UInt64 value ) + : type_( uintValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.uint_ = value; +} +#endif // defined(JSON_HAS_INT64) + +Value::Value( double value ) + : type_( realValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.real_ = value; +} + +Value::Value( const char *value ) + : type_( stringValue ) + , allocated_( true ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.string_ = duplicateStringValue( value ); +} + + +Value::Value( const char *beginValue, + const char *endValue ) + : type_( stringValue ) + , allocated_( true ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.string_ = duplicateStringValue( beginValue, + (unsigned int)(endValue - beginValue) ); +} + + +Value::Value( const std::string &value ) + : type_( stringValue ) + , allocated_( true ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.string_ = duplicateStringValue( value.c_str(), + (unsigned int)value.length() ); + +} + +Value::Value( const StaticString &value ) + : type_( stringValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.string_ = const_cast( value.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +Value::Value( const CppTL::ConstString &value ) + : type_( stringValue ) + , allocated_( true ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.string_ = duplicateStringValue( value, value.length() ); +} +# endif + +Value::Value( bool value ) + : type_( booleanValue ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + value_.bool_ = value; +} + + +Value::Value( const Value &other ) + : type_( other.type_ ) + , allocated_( false ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif + , comments_( 0 ) +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if ( other.value_.string_ ) + { + value_.string_ = duplicateStringValue( other.value_.string_ ); + allocated_ = true; + } + else + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues( *other.value_.map_ ); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); + break; + case objectValue: + value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + if ( other.comments_ ) + { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for ( int comment =0; comment < numberOfCommentPlacement; ++comment ) + { + const CommentInfo &otherComment = other.comments_[comment]; + if ( otherComment.comment_ ) + comments_[comment].setComment( otherComment.comment_ ); + } + } +} + + +Value::~Value() +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if ( allocated_ ) + releaseStringValue( value_.string_ ); + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + delete value_.map_; + break; +#else + case arrayValue: + arrayAllocator()->destructArray( value_.array_ ); + break; + case objectValue: + mapAllocator()->destructMap( value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + + if ( comments_ ) + delete[] comments_; +} + +Value & +Value::operator=( const Value &other ) +{ + Value temp( other ); + swap( temp ); + return *this; +} + +void +Value::swap( Value &other ) +{ + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap( value_, other.value_ ); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2; +} + +ValueType +Value::type() const +{ + return type_; +} + + +int +Value::compare( const Value &other ) const +{ + if ( *this < other ) + return -1; + if ( *this > other ) + return 1; + return 0; +} + + +bool +Value::operator <( const Value &other ) const +{ + int typeDelta = type_ - other.type_; + if ( typeDelta ) + return typeDelta < 0 ? true : false; + switch ( type_ ) + { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + return ( value_.string_ == 0 && other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) < 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + { + int delta = int( value_.map_->size() - other.value_.map_->size() ); + if ( delta ) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) < 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) < 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool +Value::operator <=( const Value &other ) const +{ + return !(other < *this); +} + +bool +Value::operator >=( const Value &other ) const +{ + return !(*this < other); +} + +bool +Value::operator >( const Value &other ) const +{ + return other < *this; +} + +bool +Value::operator ==( const Value &other ) const +{ + //if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if ( type_ != temp ) + return false; + switch ( type_ ) + { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + return ( value_.string_ == other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) == 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() + && (*value_.map_) == (*other.value_.map_); +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) == 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) == 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool +Value::operator !=( const Value &other ) const +{ + return !( *this == other ); +} + +const char * +Value::asCString() const +{ + JSON_ASSERT( type_ == stringValue ); + return value_.string_; +} + + +std::string +Value::asString() const +{ + switch ( type_ ) + { + case nullValue: + return ""; + case stringValue: + return value_.string_ ? value_.string_ : ""; + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + return valueToString( value_.int_ ); + case uintValue: + return valueToString( value_.uint_ ); + case realValue: + return valueToString( value_.real_ ); + default: + JSON_FAIL_MESSAGE( "Type is not convertible to string" ); + } +} + +# ifdef JSON_USE_CPPTL +CppTL::ConstString +Value::asConstString() const +{ + return CppTL::ConstString( asString().c_str() ); +} +# endif + + +Value::Int +Value::asInt() const +{ + switch ( type_ ) + { + case intValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range"); + return Int(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range"); + return Int(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), "double out of Int range"); + return Int(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int."); +} + + +Value::UInt +Value::asUInt() const +{ + switch ( type_ ) + { + case intValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range"); + return UInt(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range"); + return UInt(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt), "double out of UInt range"); + return UInt( value_.real_ ); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt."); +} + + +# if defined(JSON_HAS_INT64) + +Value::Int64 +Value::asInt64() const +{ + switch ( type_ ) + { + case intValue: + return Int64(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); + return Int64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), "double out of Int64 range"); + return Int64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int64."); +} + + +Value::UInt64 +Value::asUInt64() const +{ + switch ( type_ ) + { + case intValue: + JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); + return UInt64(value_.int_); + case uintValue: + return UInt64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), "double out of UInt64 range"); + return UInt64( value_.real_ ); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); +} +# endif // if defined(JSON_HAS_INT64) + + +LargestInt +Value::asLargestInt() const +{ +#if defined(JSON_NO_INT64) + return asInt(); +#else + return asInt64(); +#endif +} + + +LargestUInt +Value::asLargestUInt() const +{ +#if defined(JSON_NO_INT64) + return asUInt(); +#else + return asUInt64(); +#endif +} + + +double +Value::asDouble() const +{ + switch ( type_ ) + { + case intValue: + return static_cast( value_.int_ ); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast( value_.uint_ ); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble( value_.uint_ ); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return value_.real_; + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to double."); +} + +float +Value::asFloat() const +{ + switch ( type_ ) + { + case intValue: + return static_cast( value_.int_ ); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast( value_.uint_ ); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble( value_.uint_ ); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return static_cast( value_.real_ ); + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0f : 0.0f; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to float."); +} + +bool +Value::asBool() const +{ + switch ( type_ ) + { + case booleanValue: + return value_.bool_; + case nullValue: + return false; + case intValue: + return value_.int_ ? true : false; + case uintValue: + return value_.uint_ ? true : false; + case realValue: + return value_.real_ ? true : false; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to bool."); +} + + +bool +Value::isConvertibleTo( ValueType other ) const +{ + switch ( other ) + { + case nullValue: + return ( isNumeric() && asDouble() == 0.0 ) + || ( type_ == booleanValue && value_.bool_ == false ) + || ( type_ == stringValue && asString() == "" ) + || ( type_ == arrayValue && value_.map_->size() == 0 ) + || ( type_ == objectValue && value_.map_->size() == 0 ) + || type_ == nullValue; + case intValue: + return isInt() + || (type_ == realValue && InRange(value_.real_, minInt, maxInt)) + || type_ == booleanValue + || type_ == nullValue; + case uintValue: + return isUInt() + || (type_ == realValue && InRange(value_.real_, 0, maxUInt)) + || type_ == booleanValue + || type_ == nullValue; + case realValue: + return isNumeric() + || type_ == booleanValue + || type_ == nullValue; + case booleanValue: + return isNumeric() + || type_ == booleanValue + || type_ == nullValue; + case stringValue: + return isNumeric() + || type_ == booleanValue + || type_ == stringValue + || type_ == nullValue; + case arrayValue: + return type_ == arrayValue + || type_ == nullValue; + case objectValue: + return type_ == objectValue + || type_ == nullValue; + } + JSON_ASSERT_UNREACHABLE; + return false; +} + + +/// Number of values in array or object +ArrayIndex +Value::size() const +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: // size of the array is highest index + 1 + if ( !value_.map_->empty() ) + { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index()+1; + } + return 0; + case objectValue: + return ArrayIndex( value_.map_->size() ); +#else + case arrayValue: + return Int( value_.array_->size() ); + case objectValue: + return Int( value_.map_->size() ); +#endif + } + JSON_ASSERT_UNREACHABLE; + return 0; // unreachable; +} + + +bool +Value::empty() const +{ + if ( isNull() || isArray() || isObject() ) + return size() == 0u; + else + return false; +} + + +bool +Value::operator!() const +{ + return isNull(); +} + + +void +Value::clear() +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); + + switch ( type_ ) + { +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_->clear(); + break; +#else + case arrayValue: + value_.array_->clear(); + break; + case objectValue: + value_.map_->clear(); + break; +#endif + default: + break; + } +} + +void +Value::resize( ArrayIndex newSize ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ArrayIndex oldSize = size(); + if ( newSize == 0 ) + clear(); + else if ( newSize > oldSize ) + (*this)[ newSize - 1 ]; + else + { + for ( ArrayIndex index = newSize; index < oldSize; ++index ) + { + value_.map_->erase( index ); + } + assert( size() == newSize ); + } +#else + value_.array_->resize( newSize ); +#endif +} + + +Value & +Value::operator[]( ArrayIndex index ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::iterator it = value_.map_->lower_bound( key ); + if ( it != value_.map_->end() && (*it).first == key ) + return (*it).second; + + ObjectValues::value_type defaultValue( key, null ); + it = value_.map_->insert( it, defaultValue ); + return (*it).second; +#else + return value_.array_->resolveReference( index ); +#endif +} + + +Value & +Value::operator[]( int index ) +{ + JSON_ASSERT( index >= 0 ); + return (*this)[ ArrayIndex(index) ]; +} + + +const Value & +Value::operator[]( ArrayIndex index ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::const_iterator it = value_.map_->find( key ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + Value *value = value_.array_->find( index ); + return value ? *value : null; +#endif +} + + +const Value & +Value::operator[]( int index ) const +{ + JSON_ASSERT( index >= 0 ); + return (*this)[ ArrayIndex(index) ]; +} + + +Value & +Value::operator[]( const char *key ) +{ + return resolveReference( key, false ); +} + + +Value & +Value::resolveReference( const char *key, + bool isStatic ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + *this = Value( objectValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, isStatic ? CZString::noDuplication + : CZString::duplicateOnCopy ); + ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); + if ( it != value_.map_->end() && (*it).first == actualKey ) + return (*it).second; + + ObjectValues::value_type defaultValue( actualKey, null ); + it = value_.map_->insert( it, defaultValue ); + Value &value = (*it).second; + return value; +#else + return value_.map_->resolveReference( key, isStatic ); +#endif +} + + +Value +Value::get( ArrayIndex index, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[index]); + return value == &null ? defaultValue : *value; +} + + +bool +Value::isValidIndex( ArrayIndex index ) const +{ + return index < size(); +} + + + +const Value & +Value::operator[]( const char *key ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::const_iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + const Value *value = value_.map_->find( key ); + return value ? *value : null; +#endif +} + + +Value & +Value::operator[]( const std::string &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const std::string &key ) const +{ + return (*this)[ key.c_str() ]; +} + +Value & +Value::operator[]( const StaticString &key ) +{ + return resolveReference( key, true ); +} + + +# ifdef JSON_USE_CPPTL +Value & +Value::operator[]( const CppTL::ConstString &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const CppTL::ConstString &key ) const +{ + return (*this)[ key.c_str() ]; +} +# endif + + +Value & +Value::append( const Value &value ) +{ + return (*this)[size()] = value; +} + + +Value +Value::get( const char *key, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[key]); + return value == &null ? defaultValue : *value; +} + + +Value +Value::get( const std::string &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} + +Value +Value::removeMember( const char* key ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + Value old(it->second); + value_.map_->erase(it); + return old; +#else + Value *value = value_.map_->find( key ); + if (value){ + Value old(*value); + value_.map_.remove( key ); + return old; + } else { + return null; + } +#endif +} + +Value +Value::removeMember( const std::string &key ) +{ + return removeMember( key.c_str() ); +} + +# ifdef JSON_USE_CPPTL +Value +Value::get( const CppTL::ConstString &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} +# endif + +bool +Value::isMember( const char *key ) const +{ + const Value *value = &((*this)[key]); + return value != &null; +} + + +bool +Value::isMember( const std::string &key ) const +{ + return isMember( key.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +bool +Value::isMember( const CppTL::ConstString &key ) const +{ + return isMember( key.c_str() ); +} +#endif + +Value::Members +Value::getMemberNames() const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return Value::Members(); + Members members; + members.reserve( value_.map_->size() ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for ( ; it != itEnd; ++it ) + members.push_back( std::string( (*it).first.c_str() ) ); +#else + ValueInternalMap::IteratorState it; + ValueInternalMap::IteratorState itEnd; + value_.map_->makeBeginIterator( it ); + value_.map_->makeEndIterator( itEnd ); + for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) + members.push_back( std::string( ValueInternalMap::key( it ) ) ); +#endif + return members; +} +// +//# ifdef JSON_USE_CPPTL +//EnumMemberNames +//Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +//EnumValues +//Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type() ); +// return EnumValues(); +//} +// +//# endif + +static bool IsIntegral(double d) { + double integral_part; + return modf(d, &integral_part) == 0.0; +} + + +bool +Value::isNull() const +{ + return type_ == nullValue; +} + + +bool +Value::isBool() const +{ + return type_ == booleanValue; +} + + +bool +Value::isInt() const +{ + switch ( type_ ) + { + case intValue: + return value_.int_ >= minInt && value_.int_ <= maxInt; + case uintValue: + return value_.uint_ <= UInt(maxInt); + case realValue: + return value_.real_ >= minInt && + value_.real_ <= maxInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + + +bool +Value::isUInt() const +{ + switch ( type_ ) + { + case intValue: + return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt); + case uintValue: + return value_.uint_ <= maxUInt; + case realValue: + return value_.real_ >= 0 && + value_.real_ <= maxUInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool +Value::isInt64() const +{ +# if defined(JSON_HAS_INT64) + switch ( type_ ) + { + case intValue: + return true; + case uintValue: + return value_.uint_ <= UInt64(maxInt64); + case realValue: + // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a + // double, so double(maxInt64) will be rounded up to 2^63. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= double(minInt64) && + value_.real_ < double(maxInt64) && + IsIntegral(value_.real_); + default: + break; + } +# endif // JSON_HAS_INT64 + return false; +} + +bool +Value::isUInt64() const +{ +# if defined(JSON_HAS_INT64) + switch ( type_ ) + { + case intValue: + return value_.int_ >= 0; + case uintValue: + return true; + case realValue: + // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a + // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= 0 && + value_.real_ < maxUInt64AsDouble && + IsIntegral(value_.real_); + default: + break; + } +# endif // JSON_HAS_INT64 + return false; +} + + +bool +Value::isIntegral() const +{ +#if defined(JSON_HAS_INT64) + return isInt64() || isUInt64(); +#else + return isInt() || isUInt(); +#endif +} + + +bool +Value::isDouble() const +{ + return type_ == realValue || isIntegral(); +} + + +bool +Value::isNumeric() const +{ + return isIntegral() || isDouble(); +} + + +bool +Value::isString() const +{ + return type_ == stringValue; +} + + +bool +Value::isArray() const +{ + return type_ == arrayValue; +} + + +bool +Value::isObject() const +{ + return type_ == objectValue; +} + + +void +Value::setComment( const char *comment, + CommentPlacement placement ) +{ + if ( !comments_ ) + comments_ = new CommentInfo[numberOfCommentPlacement]; + comments_[placement].setComment( comment ); +} + + +void +Value::setComment( const std::string &comment, + CommentPlacement placement ) +{ + setComment( comment.c_str(), placement ); +} + + +bool +Value::hasComment( CommentPlacement placement ) const +{ + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string +Value::getComment( CommentPlacement placement ) const +{ + if ( hasComment(placement) ) + return comments_[placement].comment_; + return ""; +} + + +std::string +Value::toStyledString() const +{ + StyledWriter writer; + return writer.write( *this ); +} + + +Value::const_iterator +Value::begin() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + +Value::const_iterator +Value::end() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + + +Value::iterator +Value::begin() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return iterator(); +} + +Value::iterator +Value::end() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return iterator(); +} + + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() + : key_() + , index_() + , kind_( kindNone ) +{ +} + + +PathArgument::PathArgument( ArrayIndex index ) + : key_() + , index_( index ) + , kind_( kindIndex ) +{ +} + + +PathArgument::PathArgument( const char *key ) + : key_( key ) + , index_() + , kind_( kindKey ) +{ +} + + +PathArgument::PathArgument( const std::string &key ) + : key_( key.c_str() ) + , index_() + , kind_( kindKey ) +{ +} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path( const std::string &path, + const PathArgument &a1, + const PathArgument &a2, + const PathArgument &a3, + const PathArgument &a4, + const PathArgument &a5 ) +{ + InArgs in; + in.push_back( &a1 ); + in.push_back( &a2 ); + in.push_back( &a3 ); + in.push_back( &a4 ); + in.push_back( &a5 ); + makePath( path, in ); +} + + +void +Path::makePath( const std::string &path, + const InArgs &in ) +{ + const char *current = path.c_str(); + const char *end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while ( current != end ) + { + if ( *current == '[' ) + { + ++current; + if ( *current == '%' ) + addPathInArg( path, in, itInArg, PathArgument::kindIndex ); + else + { + ArrayIndex index = 0; + for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) + index = index * 10 + ArrayIndex(*current - '0'); + args_.push_back( index ); + } + if ( current == end || *current++ != ']' ) + invalidPath( path, int(current - path.c_str()) ); + } + else if ( *current == '%' ) + { + addPathInArg( path, in, itInArg, PathArgument::kindKey ); + ++current; + } + else if ( *current == '.' ) + { + ++current; + } + else + { + const char *beginName = current; + while ( current != end && !strchr( "[.", *current ) ) + ++current; + args_.push_back( std::string( beginName, current ) ); + } + } +} + + +void +Path::addPathInArg( const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind ) +{ + if ( itInArg == in.end() ) + { + // Error: missing argument %d + } + else if ( (*itInArg)->kind_ != kind ) + { + // Error: bad argument type + } + else + { + args_.push_back( **itInArg ); + } +} + + +void +Path::invalidPath( const std::string &path, + int location ) +{ + // Error: invalid path. +} + + +const Value & +Path::resolve( const Value &root ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || !node->isValidIndex( arg.index_ ) ) + { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + { + // Error: unable to resolve path (object has no member named '' at position...) + } + } + } + return *node; +} + + +Value +Path::resolve( const Value &root, + const Value &defaultValue ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || !node->isValidIndex( arg.index_ ) ) + return defaultValue; + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + return defaultValue; + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + return defaultValue; + } + } + return *node; +} + + +Value & +Path::make( Value &root ) const +{ + Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() ) + { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +# include +# include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +static bool containsControlCharacter( const char* str ) +{ + while ( *str ) + { + if ( isControlCharacter( *(str++) ) ) + return true; + } + return false; +} + + +std::string valueToString( LargestInt value ) +{ + UIntToStringBuffer buffer; + char *current = buffer + sizeof(buffer); + bool isNegative = value < 0; + if ( isNegative ) + value = -value; + uintToString( LargestUInt(value), current ); + if ( isNegative ) + *--current = '-'; + assert( current >= buffer ); + return current; +} + + +std::string valueToString( LargestUInt value ) +{ + UIntToStringBuffer buffer; + char *current = buffer + sizeof(buffer); + uintToString( value, current ); + assert( current >= buffer ); + return current; +} + +#if defined(JSON_HAS_INT64) + +std::string valueToString( Int value ) +{ + return valueToString( LargestInt(value) ); +} + + +std::string valueToString( UInt value ) +{ + return valueToString( LargestUInt(value) ); +} + +#endif // # if defined(JSON_HAS_INT64) + + +std::string valueToString( double value ) +{ + char buffer[32]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning. + sprintf_s(buffer, sizeof(buffer), "%#.16g", value); +#else + sprintf(buffer, "%#.16g", value); +#endif + char* ch = buffer + strlen(buffer) - 1; + if (*ch != '0') return buffer; // nothing to truncate, so save time + while(ch > buffer && *ch == '0'){ + --ch; + } + char* last_nonzero = ch; + while(ch >= buffer){ + switch(*ch){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + --ch; + continue; + case '.': + // Truncate zeroes to save bytes in output, but keep one. + *(last_nonzero+2) = '\0'; + return buffer; + default: + return buffer; + } + } + return buffer; +} + + +std::string valueToString( bool value ) +{ + return value ? "true" : "false"; +} + +std::string valueToQuotedString( const char *value ) +{ + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char* c=value; *c != 0; ++c) + { + switch(*c) + { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + //case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } + else + { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() +{ +} + + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_( false ), + dropNullPlaceholders_( false ) +{ +} + + +void +FastWriter::enableYAMLCompatibility() +{ + yamlCompatiblityEnabled_ = true; +} + + +void +FastWriter::dropNullPlaceholders() +{ + dropNullPlaceholders_ = true; +} + + +std::string +FastWriter::write( const Value &root ) +{ + document_ = ""; + writeValue( root ); + document_ += "\n"; + return document_; +} + + +void +FastWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + if (!dropNullPlaceholders_) document_ += "null"; + break; + case intValue: + document_ += valueToString( value.asLargestInt() ); + break; + case uintValue: + document_ += valueToString( value.asLargestUInt() ); + break; + case realValue: + document_ += valueToString( value.asDouble() ); + break; + case stringValue: + document_ += valueToQuotedString( value.asCString() ); + break; + case booleanValue: + document_ += valueToString( value.asBool() ); + break; + case arrayValue: + { + document_ += "["; + int size = value.size(); + for ( int index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ","; + writeValue( value[index] ); + } + document_ += "]"; + } + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + document_ += "{"; + for ( Value::Members::iterator it = members.begin(); + it != members.end(); + ++it ) + { + const std::string &name = *it; + if ( it != members.begin() ) + document_ += ","; + document_ += valueToQuotedString( name.c_str() ); + document_ += yamlCompatiblityEnabled_ ? ": " + : ":"; + writeValue( value[name] ); + } + document_ += "}"; + } + break; + } +} + + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_( 74 ) + , indentSize_( 3 ) + , addChildValues_() +{ +} + + +std::string +StyledWriter::write( const Value &root ) +{ + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + document_ += "\n"; + return document_; +} + + +void +StyledWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asLargestInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asLargestUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + document_ += " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + for (;;) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + document_ += "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + + +bool +StyledWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + document_ += value; +} + + +void +StyledWriter::writeIndent() +{ + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + + +void +StyledWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + document_ += value; +} + + +void +StyledWriter::indent() +{ + indentString_ += std::string( indentSize_, ' ' ); +} + + +void +StyledWriter::unindent() +{ + assert( int(indentString_.size()) >= indentSize_ ); + indentString_.resize( indentString_.size() - indentSize_ ); +} + + +void +StyledWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + document_ += normalizeEOL( root.getComment( commentBefore ) ); + document_ += "\n"; +} + + +void +StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + document_ += "\n"; + document_ += normalizeEOL( root.getComment( commentAfter ) ); + document_ += "\n"; + } +} + + +bool +StyledWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter( std::string indentation ) + : document_(NULL) + , rightMargin_( 74 ) + , indentation_( indentation ) + , addChildValues_() +{ +} + + +void +StyledStreamWriter::write( std::ostream &out, const Value &root ) +{ + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + + +void +StyledStreamWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asLargestInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asLargestUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + *document_ << " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledStreamWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + for (;;) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + *document_ << "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + + +bool +StyledStreamWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledStreamWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + *document_ << value; +} + + +void +StyledStreamWriter::writeIndent() +{ + /* + Some comments in this method would have been nice. ;-) + + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + *document_ << '\n'; + } + */ + *document_ << '\n' << indentString_; +} + + +void +StyledStreamWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + *document_ << value; +} + + +void +StyledStreamWriter::indent() +{ + indentString_ += indentation_; +} + + +void +StyledStreamWriter::unindent() +{ + assert( indentString_.size() >= indentation_.size() ); + indentString_.resize( indentString_.size() - indentation_.size() ); +} + + +void +StyledStreamWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + *document_ << normalizeEOL( root.getComment( commentBefore ) ); + *document_ << "\n"; +} + + +void +StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + *document_ << "\n"; + *document_ << normalizeEOL( root.getComment( commentAfter ) ); + *document_ << "\n"; + } +} + + +bool +StyledStreamWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledStreamWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +std::ostream& operator<<( std::ostream &sout, const Value &root ) +{ + Json::StyledStreamWriter writer; + writer.write(sout, root); + return sout; +} + + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + diff --git a/src/main.cpp b/src/main.cpp index 968dc8d60..fd3643e60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1095,6 +1095,7 @@ int main(int argc, char *argv[]) #else bool run_dedicated_server = cmd_args.getFlag("server"); #endif + g_settings->set("server_dedicated", run_dedicated_server ? "true" : "false"); if(run_dedicated_server) { DSTACK("Dedicated server branch"); @@ -1593,6 +1594,7 @@ int main(int argc, char *argv[]) g_settings->set("creative_mode", itos(menudata.creative_mode)); g_settings->set("enable_damage", itos(menudata.enable_damage)); + g_settings->set("server_announce", itos(menudata.enable_public)); g_settings->set("name", playername); g_settings->set("address", address); g_settings->set("port", itos(port)); @@ -1619,10 +1621,10 @@ int main(int argc, char *argv[]) else if (address != "") { ServerListSpec server; - server.name = menudata.servername; - server.address = wide_to_narrow(menudata.address); - server.port = wide_to_narrow(menudata.port); - server.description = menudata.serverdescription; + server["name"] = menudata.servername; + server["address"] = wide_to_narrow(menudata.address); + server["port"] = wide_to_narrow(menudata.port); + server["description"] = menudata.serverdescription; ServerList::insert(server); } diff --git a/src/server.cpp b/src/server.cpp index ec8f8a5e8..94a4787f8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -51,6 +51,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "sound.h" // dummySoundManager #include "event_manager.h" #include "hex.h" +#include "serverlist.h" #include "util/string.h" #include "util/pointedthing.h" #include "util/mathconstants.h" @@ -961,9 +962,11 @@ Server::Server( { m_liquid_transform_timer = 0.0; m_print_info_timer = 0.0; + m_masterserver_timer = 0.0; m_objectdata_timer = 0.0; m_emergethread_trigger_timer = 0.0; m_savemap_timer = 0.0; + m_clients_number = 0; m_env_mutex.Init(); m_con_mutex.Init(); @@ -1505,7 +1508,7 @@ void Server::AsyncRunStep() counter = 0.0; JMutexAutoLock lock2(m_con_mutex); - + m_clients_number = 0; if(m_clients.size() != 0) infostream<<"Players:"<::Iterator @@ -1519,10 +1522,25 @@ void Server::AsyncRunStep() continue; infostream<<"* "<getName()<<"\t"; client->PrintInfo(infostream); + ++m_clients_number; } } } + +#if USE_CURL + // send masterserver announce + { + float &counter = m_masterserver_timer; + if((!counter || counter >= 300.0) && g_settings->getBool("server_announce") == true) + { + ServerList::sendAnnounce(!counter ? "start" : "update", m_clients_number); + counter = 0.01; + } + counter += dtime; + } +#endif + //if(g_settings->getBool("enable_experimental")) { @@ -5186,6 +5204,10 @@ void dedicated_server_loop(Server &server, bool &kill) if(server.getShutdownRequested() || kill) { infostream<<"Dedicated server quitting"<getBool("server_announce") == true) + ServerList::sendAnnounce("delete"); +#endif break; } diff --git a/src/server.h b/src/server.h index 29d47337d..22c7cf2bb 100644 --- a/src/server.h +++ b/src/server.h @@ -720,6 +720,7 @@ private: // Some timers float m_liquid_transform_timer; float m_print_info_timer; + float m_masterserver_timer; float m_objectdata_timer; float m_emergethread_trigger_timer; float m_savemap_timer; @@ -737,6 +738,7 @@ private: JMutex m_con_mutex; // Connected clients (behind the con mutex) core::map m_clients; + u16 m_clients_number; //for announcing masterserver // Bann checking BanManager m_banmanager; diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 88a213db1..b2f49ae72 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "porting.h" #include "log.h" +#include "json/json.h" #if USE_CURL #include #endif @@ -83,7 +84,7 @@ std::vector getOnline() { CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, g_settings->get("serverlist_url").c_str()); + curl_easy_setopt(curl, CURLOPT_URL, (g_settings->get("serverlist_url")+"/list").c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ServerList::WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring); @@ -92,8 +93,7 @@ std::vector getOnline() errorstream<<"Serverlist at url "<get("serverlist_url")<<" not found (internet connection?)"< serverlist = ServerList::getLocal(); for(unsigned i = 0; i < serverlist.size(); i++) { - if (serverlist[i].address == server.address - && serverlist[i].port == server.port) + if (serverlist[i]["address"] == server["address"] + && serverlist[i]["port"] == server["port"]) { serverlist.erase(serverlist.begin() + i); } @@ -150,17 +150,21 @@ std::vector deSerialize(std::string liststring) { std::vector serverlist; std::istringstream stream(liststring); - std::string line; + std::string line, tmp; while (std::getline(stream, line)) { std::transform(line.begin(), line.end(),line.begin(), ::toupper); if (line == "[SERVER]") { ServerListSpec thisserver; - std::getline(stream, thisserver.name); - std::getline(stream, thisserver.address); - std::getline(stream, thisserver.port); - std::getline(stream, thisserver.description); + std::getline(stream, tmp); + thisserver["name"] = tmp; + std::getline(stream, tmp); + thisserver["address"] = tmp; + std::getline(stream, tmp); + thisserver["port"] = tmp; + std::getline(stream, tmp); + thisserver["description"] = tmp; serverlist.push_back(thisserver); } } @@ -173,13 +177,100 @@ std::string serialize(std::vector serverlist) for(std::vector::iterator i = serverlist.begin(); i != serverlist.end(); i++) { liststring += "[server]\n"; - liststring += i->name + "\n"; - liststring += i->address + "\n"; - liststring += i->port + "\n"; - liststring += i->description + "\n"; + liststring += (*i)["name"].asString() + "\n"; + liststring += (*i)["address"].asString() + "\n"; + liststring += (*i)["port"].asString() + "\n"; + liststring += (*i)["description"].asString() + "\n"; liststring += "\n"; } return liststring; } +std::vector deSerializeJson(std::string liststring) +{ + std::vector serverlist; + Json::Value root; + Json::Reader reader; + std::istringstream stream(liststring); + if (!liststring.size()) { + return serverlist; + } + if (!reader.parse( stream, root ) ) + { + errorstream << "Failed to parse server list " << reader.getFormattedErrorMessages(); + return serverlist; + } + if (root["list"].isArray()) + for (unsigned int i = 0; i < root["list"].size(); i++) + { + if (root["list"][i].isObject()) { + serverlist.push_back(root["list"][i]); + } + } + return serverlist; +} + +std::string serializeJson(std::vector serverlist) +{ + Json::Value root; + Json::Value list(Json::arrayValue); + for(std::vector::iterator i = serverlist.begin(); i != serverlist.end(); i++) + { + list.append(*i); + } + root["list"] = list; + Json::StyledWriter writer; + return writer.write( root ); +} + + +#if USE_CURL +static size_t ServerAnnounceCallback(void *contents, size_t size, size_t nmemb, void *userp) +{ + return 0; + //((std::string*)userp)->append((char*)contents, size * nmemb); + //return size * nmemb; +} +void sendAnnounce(std::string action, u16 clients) { + Json::Value server; + if (action.size()) + server["action"] = action; + server["port"] = g_settings->get("port"); + if (action != "del") { + server["name"] = g_settings->get("server_name"); + server["description"] = g_settings->get("server_description"); + server["address"] = g_settings->get("server_address"); + server["version"] = VERSION_STRING; + server["url"] = g_settings->get("server_url"); + server["creative"] = g_settings->get("creative_mode"); + server["damage"] = g_settings->get("enable_damage"); + server["dedicated"] = g_settings->get("server_dedicated"); + server["password"] = g_settings->getBool("disallow_empty_password"); + server["pvp"] = g_settings->getBool("enable_pvp"); + server["clients"] = clients; + server["clients_max"] = g_settings->get("max_users"); + } + if(server["action"] == "start") + actionstream << "announcing to " << g_settings->get("serverlist_url") << std::endl; + Json::StyledWriter writer; + CURL *curl; + curl = curl_easy_init(); + if (curl) + { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, (g_settings->get("serverlist_url")+std::string("/announce?json=")+curl_easy_escape(curl, writer.write( server ).c_str(), 0)).c_str()); + //curl_easy_setopt(curl, CURLOPT_USERAGENT, "minetest"); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ServerList::ServerAnnounceCallback); + //curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1); + res = curl_easy_perform(curl); + //if (res != CURLE_OK) + // errorstream<<"Serverlist at url "<get("serverlist_url")<<" not found (internet connection?)"< #include "config.h" +#include "json/json.h" #ifndef SERVERLIST_HEADER #define SERVERLIST_HEADER -struct ServerListSpec -{ - std::string name; - std::string address; - std::string port; - std::string description; -}; +typedef Json::Value ServerListSpec; namespace ServerList { @@ -41,6 +36,11 @@ namespace ServerList bool insert(ServerListSpec server); std::vector deSerialize(std::string liststring); std::string serialize(std::vector); + std::vector deSerializeJson(std::string liststring); + std::string serializeJson(std::vector); + #if USE_CURL + void sendAnnounce(std::string action = "", u16 clients = 0); + #endif } //ServerList namespace #endif diff --git a/util/master/index.html b/util/master/index.html new file mode 100644 index 000000000..63ee5c70f --- /dev/null +++ b/util/master/index.html @@ -0,0 +1,11 @@ + + + + + Minetest server list + + +
+ + + diff --git a/util/master/list.js b/util/master/list.js new file mode 100644 index 000000000..dcc30e091 --- /dev/null +++ b/util/master/list.js @@ -0,0 +1,72 @@ +function e(s) { + if (typeof s === "undefined") s = ''; + return s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); //mc" +} +function human_time(t) { + var n = 's'; + if (!t || t < 0) t = 0; + var f = 0; + var s = parseInt((new Date().getTime() / 1000 - (t || 0))); + if (!s || s <= 0) s = 0; + if (s == 0) return 'now'; + if (s >= 60) { + s /= 60; + n = 'm'; + if (s >= 60) { + s /= 60; + n = 'h'; + f = 1; + if (s >= 24) { + s /= 24; + n = 'd'; + f = 1; + if (s >= 30) { + s /= 30; + n = 'M'; + f = 1; + if (s >= 12) { + s /= 12; + n = 'y'; + f = 1; + } + } + } + } + } + return ((f ? parseFloat(s).toFixed(1) : parseInt(s)) + n); +} +function success(r) { + if (!r || !r.list) return; + var h = ''; + for (var i = 0; i < r.list.length; ++i) { + var s = r.list[i]; + if (!s) continue; + h += ''; + h += ''; + h += ''; + h += ''; + h += ''; + h += ''; + h += ''; + if (!s.time || s.time < 0) s.time = 0; + if (!s.start || s.start < 0) s.start = 0; + h += ''; + h += ''; + h += ''; + } + h += '
ip:portclients, maxversionnamedescflagsupdated/startedping
' + e(s.address) + ':' + e(s.port) + '' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '' + e(s.version) + ''; + if (s.url) h += ''; + h += e(s.name || s.url); + if (s.url) h += ''; + h += '' + e(s.description) + '' + e(s.password ? 'Pwd ' : '') + (s.creative ? 'Cre ' : '') + (s.damage ? 'Dmg ' : '') + (s.pvp ? 'Pvp ' : '') + (s.dedicated ? 'Ded ' : '') + '' + human_time(s.time) + (s.start ? '/' + human_time(s.start) : '') + '' + (s.ping ? parseFloat(s.ping).toFixed(3)*1000 : '') + '
' + jQuery('#table').html(h); +} +function get() { + jQuery.ajax({ + url: 'list', + dataType: 'json', + success: success + }); + setTimeout(get, 60000); +} +get(); \ No newline at end of file diff --git a/util/master/master.cgi b/util/master/master.cgi new file mode 100755 index 000000000..b918876bd --- /dev/null +++ b/util/master/master.cgi @@ -0,0 +1,257 @@ +#!/usr/bin/perl + +=info +install: + cpan JSON JSON::XS + touch list_full list + chmod a+rw list_full list + +freebsd: + www/fcgiwrap www/nginx + +rc.conf.local: +nginx_enable="YES" +fcgiwrap_enable="YES" +fcgiwrap_user="www" + +nginx: + + location / { + index index.html; + } + location /announce { + fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; + fastcgi_param SCRIPT_FILENAME $document_root/master.cgi; + include fastcgi_params; + } + + +apache .htaccess: + AddHandler cgi-script .cgi + DirectoryIndex index.html + Options +ExecCGI +FollowSymLinks + Order allow,deny + + Allow from all + + Deny from all + + +=cut + +use strict; +no strict qw(refs); +use warnings "NONFATAL" => "all"; +no warnings qw(uninitialized); +use utf8; +use Socket; +use Time::HiRes qw(time sleep); +use IO::Socket::INET; +use JSON; +use Net::Ping; +our $root_path; +($ENV{'SCRIPT_FILENAME'} || $0) =~ m|^(.+)[/\\].+?$|; #v0w +$root_path = $1 . '/' if $1; +$root_path =~ s|\\|/|g; + +our %config = ( + #debug => 1, + list_full => $root_path . 'list_full', + list_pub => $root_path . 'list', + time_purge => 86400 * 30, + time_alive => 650, + source_check => 1, + ping_timeout => 3, + ping => 1, + mineping => 1, + pingable => 1, + trusted => [qw( 176.9.122.10 )], #masterserver self ip - if server on same ip with masterserver doesnt announced + #blacklist => [], # [qw(2.3.4.5 4.5.6.7 8.9.0.1), '1.2.3.4', qr/^10\.20\.30\./, ], # list, or quoted, ips, or regex +); +do($root_path . 'config.pl'); +our $ping = Net::Ping->new("udp", $config{ping_timeout}); +$ping->hires(); + +sub get_params_one(@) { + local %_ = %{ref $_[0] eq 'HASH' ? shift : {}}; + for (@_) { + tr/+/ /, s/%([a-f\d]{2})/pack 'H*', $1/gei for my ($k, $v) = /^([^=]+=?)=(.+)$/ ? ($1, $2) : (/^([^=]*)=?$/, /^-/); + $_{$k} = $v; + } + wantarray ? %_ : \%_; +} + +sub get_params(;$$) { #v7 + my ($string, $delim) = @_; + $delim ||= '&'; + read(STDIN, local $_ = '', $ENV{'CONTENT_LENGTH'}) if !$string and $ENV{'CONTENT_LENGTH'}; + local %_ = + $string + ? get_params_one split $delim, $string + : (get_params_one(@ARGV), map { get_params_one split $delim, $_ } split(/;\s*/, $ENV{'HTTP_COOKIE'}), $ENV{'QUERY_STRING'}, $_); + wantarray ? %_ : \%_; +} + +sub get_params_utf8(;$$) { + local $_ = &get_params; + utf8::decode $_ for %$_; + wantarray ? %$_ : $_; +} + +sub file_rewrite(;$@) { + local $_ = shift; + return unless open my $fh, '>', $_; + print $fh @_; +} + +sub file_read ($) { + open my $f, '<', $_[0] or return; + local $/ = undef; + my $ret = <$f>; + close $f; + return \$ret; +} + +sub read_json { + my $ret = {}; + eval { $ret = JSON->new->utf8->relaxed(1)->decode(${ref $_[0] ? $_[0] : file_read($_[0]) or \''} || '{}'); }; #'mc + warn "json error [$@] on [", ${ref $_[0] ? $_[0] : \$_[0]}, "]" if $@; + $ret; +} + +sub printu (@) { + for (@_) { + print($_), next unless utf8::is_utf8($_); + my $s = $_; + utf8::encode($s); + print($s); + } +} + +sub name_to_ip_noc($) { + my ($name) = @_; + unless ($name =~ /^\d+\.\d+\.\d+\.\d+$/) { + local $_ = (gethostbyname($name))[4]; + return ($name, 1) unless length($_) == 4; + $name = inet_ntoa($_); + } + return $name; +} + +sub float { + return ($_[0] < 8 and $_[0] - int($_[0])) + ? sprintf('%.' . ($_[0] < 1 ? 3 : ($_[0] < 3 ? 2 : 1)) . 'f', $_[0]) + : int($_[0]); + +} + +sub mineping ($$) { + my ($addr, $port) = @_; + warn "mineping($addr, $port)" if $config{debug}; + my $data; + my $time = time; + eval { + my $socket = IO::Socket::INET->new( + 'PeerAddr' => $addr, + 'PeerPort' => $port, + 'Proto' => 'udp', + 'Timeout' => $config{ping_timeout}, + ); + $socket->send("\x4f\x45\x74\x03\x00\x00\x00\x01"); + local $SIG{ALRM} = sub { die "alarm time out"; }; + alarm $config{ping_timeout}; + $socket->recv($data, POSIX::BUFSIZ) or die "recv: $!"; + alarm 0; + 1; # return value from eval on normalcy + } or return 0; + return 0 unless length $data; + $time = float(time - $time); + warn "recvd: ", length $data, " [$time]" if $config{debug}; + return $time; +} + +sub request (;$) { + my ($r) = @_; + $r ||= \%ENV; + my $param = get_params_utf8; + my $after = sub { + if ($param->{json}) { + my $j = {}; + eval { $j = JSON->new->decode($param->{json}) || {} }; + $param->{$_} = $j->{$_} for keys %$j; + delete $param->{json}; + } + if (%$param) { + s/^false$// for values %$param; + $param->{ip} = $r->{REMOTE_ADDR}; + for (@{$config{blacklist}}) { + return if $param->{ip} ~~ $_; + } + $param->{address} ||= $param->{ip}; + if ($config{source_check} and name_to_ip_noc($param->{address}) ne $param->{ip} and !($param->{ip} ~~ $config{trusted})) { + warn("bad address [$param->{address}] ne [$param->{ip}]") if $config{debug}; + return; + } + $param->{port} ||= 30000; + $param->{key} = "$param->{ip}:$param->{port}"; + $param->{off} = time if $param->{action} ~~ 'delete'; + + if ($config{ping} and $param->{action} ne 'delete') { + if ($config{mineping}) { + $param->{ping} = mineping($param->{ip}, $param->{port}); + } else { + $ping->port_number($param->{port}); + $ping->service_check(0); + my ($pingret, $duration, $ip) = $ping->ping($param->{address}); + if ($ip ne $param->{ip} and !($param->{ip} ~~ $config{trusted})) { + warn "strange ping ip [$ip] != [$param->{ip}]" if $config{debug}; + return if $config{source_check} and !($param->{ip} ~~ $config{trusted}); + } + $param->{ping} = $duration if $pingret; + warn " PING t=$config{ping_timeout}, $param->{address}:$param->{port} = ( $pingret, $duration, $ip )" if $config{debug}; + } + } + my $list = read_json($config{list_full}) || {}; + warn "readed[$config{list_full}] list size=", scalar @{$list->{list}}; + my $listk = {map { $_->{key} => $_ } @{$list->{list}}}; + my $old = $listk->{$param->{key}}; + $param->{time} = $old->{time} if $param->{off}; + $param->{time} ||= int time; + $param->{start} = $param->{action} ~~ 'start' ? $param->{time} : $old->{start} || $param->{time}; + delete $param->{start} if $param->{off}; + $param->{first} ||= $old->{first} || $old->{time} || $param->{time}; + $param->{clients_top} = $old->{clients_top} if $old->{clients_top} > $param->{clients}; + $param->{clients_top} ||= $param->{clients} || 0; + delete $param->{action}; + $listk->{$param->{key}} = $param; + $list->{list} = [grep { $_->{time} > time - $config{time_purge} } values %$listk]; + file_rewrite($config{list_full}, JSON->new->encode($list)); + warn "writed[$config{list_full}] list size=", scalar @{$list->{list}}; + $list->{list} = [ + sort { $b->{clients} <=> $a->{clients} || $a->{start} <=> $b->{start} } + grep { $_->{time} > time - $config{time_alive} and !$_->{off} and (!$config{ping} or !$config{pingable} or $_->{ping}) } + @{$list->{list}} + ]; + file_rewrite($config{list_pub}, JSON->new->encode($list)); + warn "writed[$config{list_pub}] list size=", scalar @{$list->{list}}; + } + }; + return [200, ["Content-type", "application/json"], [JSON->new->encode({})]], $after; +} + +sub request_cgi { + my ($p, $after) = request(@_); + shift @$p; + printu join "\n", map { join ': ', @$_ } shift @$p; + printu "\n\n"; + printu join '', map { join '', @$_ } @$p; + if (fork) { + unless ($config{debug}) { + close STDOUT; + close STDERR; + } + } else { + $after->() if ref $after ~~ 'CODE'; + } +} +request_cgi() unless caller; diff --git a/util/master/style.css b/util/master/style.css new file mode 100644 index 000000000..638b51f80 --- /dev/null +++ b/util/master/style.css @@ -0,0 +1,14 @@ +table { + max-width: 100%; + background-color: transparent; + border-collapse: collapse; + border-spacing: 0; +} + +td, th { + border: 1px solid gray; +} + +div#table table { + width: 100%; +} \ No newline at end of file -- cgit v1.2.3 From b90e431fc785961e7913023999d1f570ad7ca151 Mon Sep 17 00:00:00 2001 From: proller Date: Sun, 24 Feb 2013 18:39:07 +0400 Subject: new adjustable finite liquid --- games/minimal/mods/default/mapgen.lua | 10 +- minetest.conf.example | 8 + src/content_abm.cpp | 36 +++- src/content_mapblock.cpp | 4 +- src/defaultsettings.cpp | 5 + src/map.cpp | 312 ++++++++++++++++++++++++++++++++++ src/map.h | 4 + src/mapnode.h | 5 + src/server.cpp | 7 +- src/server.h | 1 + 10 files changed, 384 insertions(+), 8 deletions(-) (limited to 'src/server.cpp') diff --git a/games/minimal/mods/default/mapgen.lua b/games/minimal/mods/default/mapgen.lua index af94505a0..115bb1458 100644 --- a/games/minimal/mods/default/mapgen.lua +++ b/games/minimal/mods/default/mapgen.lua @@ -27,7 +27,7 @@ minetest.register_alias("mapgen_mese", "default:mese") -- Ore generation -- -local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) +local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max, param2) if maxp.y < height_min or minp.y > height_max then return end @@ -57,7 +57,7 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, local z2 = z0+z1 local p2 = {x=x2, y=y2, z=z2} if minetest.env:get_node(p2).name == wherein then - minetest.env:set_node(p2, {name=name}) + minetest.env:set_node(p2, {name=name, param2=param2}) end end end @@ -110,5 +110,11 @@ minetest.register_on_generated(function(minp, maxp, seed) end end end + if minetest.setting_get("liquid_finite") then + generate_ore("default:water_source", "default:stone", minp, maxp, seed+42, 1/24/24/24, 4, -100, -10, 128) + generate_ore("default:water_source", "default:stone", minp, maxp, seed+42, 1/28/28/28, 3, -10000, -101, 128) + generate_ore("default:lava_source", "default:stone", minp, maxp, seed+43, 1/38/38/38, 2, -500, -100, 128) + generate_ore("default:lava_source", "default:stone", minp, maxp, seed+43, 1/30/30/30, 4, -31000, -501, 128) + end end) diff --git a/minetest.conf.example b/minetest.conf.example index c36fe05ff..8e95d7e60 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -90,6 +90,14 @@ #enable_fog = true # Enable a bit lower water surface; disable for speed (not quite optimized) #new_style_water = false +# Constant volume liquids +#liquid_finite = false +# Update liquids every .. recommend for finite: 0.2 +#liquid_update = 1.0 +# When finite liquid: relax flowing blocks to source if level near max and N nearby source blocks, more realistic, but not true constant. values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive +#liquid_relax = 1 +# optimization: faster cave flood (and not true constant) +#liquid_fast_flood = 1 # Enable nice leaves; disable for speed #new_style_leaves = true # Enable smooth lighting with simple ambient occlusion; diff --git a/src/content_abm.cpp b/src/content_abm.cpp index 0dcf862fc..971ac4f34 100644 --- a/src/content_abm.cpp +++ b/src/content_abm.cpp @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "mapblock.h" // For getNodeBlockPos #include "treegen.h" // For treegen::make_tree +#include "main.h" // for g_settings #include "map.h" #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")" @@ -146,11 +147,42 @@ public: } }; +class LiquidFlowABM : public ActiveBlockModifier +{ +private: + std::set contents; + +public: + LiquidFlowABM(ServerEnvironment *env, INodeDefManager *nodemgr) + { + std::set liquids; + nodemgr->getIds("group:liquid", liquids); + for(std::set::const_iterator k = liquids.begin(); k != liquids.end(); k++) + contents.insert(nodemgr->get(*k).liquid_alternative_flowing); + + } + virtual std::set getTriggerContents() + { + return contents; + } + virtual float getTriggerInterval() + { return 10.0; } + virtual u32 getTriggerChance() + { return 10; } + virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n) + { + ServerMap *map = &env->getServerMap(); + if (map->transforming_liquid_size() < 500) + map->transforming_liquid_add(p); + //if ((*map).m_transforming_liquid.size() < 500) (*map).m_transforming_liquid.push_back(p); + } +}; + void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef) { env->addActiveBlockModifier(new GrowGrassABM()); env->addActiveBlockModifier(new RemoveGrassABM()); env->addActiveBlockModifier(new MakeTreesFromSaplingsABM()); + if (g_settings->getBool("liquid_finite")) + env->addActiveBlockModifier(new LiquidFlowABM(env, nodedef)); } - - diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 290890490..e224f0b06 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -261,7 +261,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data, level = (-0.5+node_liquid_level) * BS; else if(n2.getContent() == c_flowing) level = (-0.5 + ((float)(n2.param2&LIQUID_LEVEL_MASK) - + 0.5) / 8.0 * node_liquid_level) * BS; + + 0.5) / (float)LIQUID_LEVEL_SOURCE * node_liquid_level) * BS; // Check node above neighbor. // NOTE: This doesn't get executed if neighbor @@ -324,7 +324,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data, } } if(air_count >= 2) - cornerlevel = -0.5*BS; + cornerlevel = -0.5*BS+0.1; else if(valid_count > 0) cornerlevel /= valid_count; corner_levels[i] = cornerlevel; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 6cdaaa496..f2c9886b4 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -201,6 +201,11 @@ void set_default_settings(Settings *settings) //mapgen related things settings->setDefault("mg_name", "v6"); settings->setDefault("water_level", "1"); + settings->setDefault("liquid_finite", "false"); + settings->setDefault("liquid_update", "1.0"); + settings->setDefault("liquid_relax", "1"); + settings->setDefault("liquid_fast_flood", "1"); + settings->setDefault("chunksize", "5"); settings->setDefault("mg_flags", "trees, caves, v6_biome_blend"); settings->setDefault("mgv6_freq_desert", "0.45"); diff --git a/src/map.cpp b/src/map.cpp index 717b0cf9b..7272451a4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1613,10 +1613,322 @@ struct NodeNeighbor { MapNode n; NeighborType t; v3s16 p; + bool l; //can liquid + bool i; //infinity }; +void Map::transforming_liquid_add(v3s16 p) { + m_transforming_liquid.push_back(p); +} + +s32 Map::transforming_liquid_size() { + return m_transforming_liquid.size(); +} + +const v3s16 g_7dirs[7] = +{ + // +right, +top, +back + v3s16( 0,-1, 0), // bottom + v3s16( 0, 0, 0), // self + v3s16( 0, 0, 1), // back + v3s16( 0, 0,-1), // front + v3s16( 1, 0, 0), // right + v3s16(-1, 0, 0), // left + v3s16( 0, 1, 0) // top +}; + +#define D_BOTTOM 0 +#define D_TOP 6 +#define D_SELF 1 + +void Map::transformLiquidsFinite(core::map & modified_blocks) +{ + INodeDefManager *nodemgr = m_gamedef->ndef(); + + DSTACK(__FUNCTION_NAME); + //TimeTaker timer("transformLiquids()"); + + u32 loopcount = 0; + u32 initial_size = m_transforming_liquid.size(); + + u8 relax = g_settings->getS16("liquid_relax"); + bool fast_flood = g_settings->getS16("liquid_fast_flood"); + int water_level = g_settings->getS16("water_level"); + + /*if(initial_size != 0) + infostream<<"transformLiquids(): initial_size="< must_reflow, must_reflow_second; + + // List of MapBlocks that will require a lighting update (due to lava) + core::map lighting_modified_blocks; + + while(m_transforming_liquid.size() > 0) + { + // This should be done here so that it is done when continue is used + if(loopcount >= initial_size || loopcount >= 1000) + break; + loopcount++; + /* + Get a queued transforming liquid node + */ + v3s16 p0 = m_transforming_liquid.pop_front(); + u16 total_level = 0; + NodeNeighbor neighbors[7]; // surrounding flowing liquid nodes + s8 liquid_levels[7] = {-1, -1, -1, -1, -1, -1, -1}; // current level of every block + s8 liquid_levels_want[7] = {-1, -1, -1, -1, -1, -1, -1}; // target levels + s8 can_liquid_same_level = 0; + content_t liquid_kind = CONTENT_IGNORE; + content_t liquid_kind_flowing = CONTENT_IGNORE; + /* + Collect information about the environment + */ + const v3s16 *dirs = g_7dirs; + for (u16 i = 0; i < 7; i++) { + NeighborType nt = NEIGHBOR_SAME_LEVEL; + switch (i) { + case D_TOP: + nt = NEIGHBOR_UPPER; + break; + case D_BOTTOM: + nt = NEIGHBOR_LOWER; + break; + } + v3s16 npos = p0 + dirs[i]; + + neighbors[i].n = getNodeNoEx(npos); + neighbors[i].t = nt; + neighbors[i].p = npos; + neighbors[i].l = 0; + neighbors[i].i = 0; + NodeNeighbor & nb = neighbors[i]; + + switch (nodemgr->get(nb.n.getContent()).liquid_type) { + case LIQUID_NONE: + if (nb.n.getContent() == CONTENT_AIR) { + liquid_levels[i] = 0; + nb.l = 1; + } + break; + case LIQUID_SOURCE: + // if this node is not (yet) of a liquid type, choose the first liquid type we encounter + if (liquid_kind_flowing == CONTENT_IGNORE) + liquid_kind_flowing = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing); + if (liquid_kind == CONTENT_IGNORE) + liquid_kind = nb.n.getContent(); + if (nb.n.getContent() == liquid_kind) { + liquid_levels[i] = LIQUID_LEVEL_SOURCE; + nb.l = 1; + nb.i = (nb.n.param2 & LIQUID_INFINITY_MASK); + } + break; + case LIQUID_FLOWING: + // if this node is not (yet) of a liquid type, choose the first liquid type we encounter + if (liquid_kind_flowing == CONTENT_IGNORE) + liquid_kind_flowing = nb.n.getContent(); + if (liquid_kind == CONTENT_IGNORE) + liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_source); + if (nb.n.getContent() == liquid_kind_flowing) { + liquid_levels[i] = (nb.n.param2 & LIQUID_LEVEL_MASK); + nb.l = 1; + } + break; + } + if (nb.l && nb.t == NEIGHBOR_SAME_LEVEL) ++can_liquid_same_level; + if (liquid_levels[i] > 0) total_level += liquid_levels[i]; + + /* + infostream << "get node i=" <<(int)i<<" " << PP(npos) << " c="<ndef(); DSTACK(__FUNCTION_NAME); diff --git a/src/map.h b/src/map.h index 420fc29ca..a0305b790 100644 --- a/src/map.h +++ b/src/map.h @@ -300,6 +300,7 @@ public: virtual void PrintInfo(std::ostream &out); void transformLiquids(core::map & modified_blocks); + void transformLiquidsFinite(core::map & modified_blocks); /* Node metadata @@ -328,6 +329,9 @@ public: Variables */ + void transforming_liquid_add(v3s16 p); + s32 transforming_liquid_size(); + protected: std::ostream &m_dout; // A bit deprecated, could be removed diff --git a/src/mapnode.h b/src/mapnode.h index de2529e4d..56dfa6310 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -67,10 +67,15 @@ enum LightBank #define LIQUID_LEVEL_MASK 0x07 #define LIQUID_FLOW_DOWN_MASK 0x08 +//#define LIQUID_LEVEL_MASK 0x3f // better finite water +//#define LIQUID_FLOW_DOWN_MASK 0x40 // not used when finite water + /* maximum amount of liquid in a block */ #define LIQUID_LEVEL_MAX LIQUID_LEVEL_MASK #define LIQUID_LEVEL_SOURCE (LIQUID_LEVEL_MAX+1) +#define LIQUID_INFINITY_MASK 0x80 //0b10000000 + /* This is the stuff what the whole world consists of. */ diff --git a/src/server.cpp b/src/server.cpp index 94a4787f8..138f288c6 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -961,6 +961,7 @@ Server::Server( m_ignore_map_edit_events_peer_id(0) { m_liquid_transform_timer = 0.0; + m_liquid_transform_every = 1.0; m_print_info_timer = 0.0; m_masterserver_timer = 0.0; m_objectdata_timer = 0.0; @@ -1136,6 +1137,8 @@ Server::Server( Add some test ActiveBlockModifiers to environment */ add_legacy_abms(m_env, m_nodedef); + + m_liquid_transform_every = g_settings->getFloat("liquid_update"); } Server::~Server() @@ -1452,9 +1455,9 @@ void Server::AsyncRunStep() /* Transform liquids */ m_liquid_transform_timer += dtime; - if(m_liquid_transform_timer >= 1.00) + if(m_liquid_transform_timer >= m_liquid_transform_every) { - m_liquid_transform_timer -= 1.00; + m_liquid_transform_timer -= m_liquid_transform_every; JMutexAutoLock lock(m_env_mutex); diff --git a/src/server.h b/src/server.h index 22c7cf2bb..16bda4372 100644 --- a/src/server.h +++ b/src/server.h @@ -719,6 +719,7 @@ private: // Some timers float m_liquid_transform_timer; + float m_liquid_transform_every; float m_print_info_timer; float m_masterserver_timer; float m_objectdata_timer; -- cgit v1.2.3 From 497ff1ecd64c8908f988e15ca879824f2781e3fd Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Sun, 24 Feb 2013 18:40:43 +0100 Subject: Change Minetest-c55 to Minetest --- doc/protocol.txt | 2 +- old/changelog.txt | 2 +- src/activeobject.h | 2 +- src/ban.cpp | 2 +- src/ban.h | 2 +- src/biome.cpp | 2 +- src/biome.h | 2 +- src/camera.cpp | 2 +- src/camera.h | 2 +- src/chat.cpp | 2 +- src/chat.h | 2 +- src/client.cpp | 2 +- src/client.h | 2 +- src/clientmap.cpp | 2 +- src/clientmap.h | 2 +- src/clientobject.cpp | 2 +- src/clientobject.h | 2 +- src/clientserver.cpp | 2 +- src/clientserver.h | 2 +- src/clientsimpleobject.h | 2 +- src/clouds.cpp | 2 +- src/clouds.h | 2 +- src/collision.cpp | 2 +- src/collision.h | 2 +- src/connection.cpp | 2 +- src/connection.h | 2 +- src/constants.h | 2 +- src/content_abm.cpp | 2 +- src/content_abm.h | 2 +- src/content_cao.cpp | 2 +- src/content_cao.h | 2 +- src/content_cso.cpp | 2 +- src/content_cso.h | 2 +- src/content_mapblock.cpp | 2 +- src/content_mapblock.h | 2 +- src/content_mapnode.cpp | 2 +- src/content_mapnode.h | 2 +- src/content_nodemeta.cpp | 2 +- src/content_nodemeta.h | 2 +- src/content_object.h | 2 +- src/content_sao.cpp | 2 +- src/content_sao.h | 2 +- src/craftdef.cpp | 2 +- src/craftdef.h | 2 +- src/daynightratio.h | 2 +- src/debug.cpp | 2 +- src/debug.h | 2 +- src/defaultsettings.cpp | 2 +- src/defaultsettings.h | 2 +- src/environment.cpp | 2 +- src/environment.h | 2 +- src/event.h | 2 +- src/event_manager.h | 2 +- src/exceptions.h | 2 +- src/farmesh.cpp | 2 +- src/farmesh.h | 2 +- src/filecache.cpp | 2 +- src/filecache.h | 2 +- src/filesys.cpp | 2 +- src/filesys.h | 2 +- src/game.cpp | 2 +- src/game.h | 2 +- src/gamedef.h | 2 +- src/genericobject.cpp | 2 +- src/genericobject.h | 2 +- src/gettime.h | 2 +- src/guiChatConsole.cpp | 2 +- src/guiChatConsole.h | 2 +- src/guiConfigureWorld.cpp | 2 +- src/guiConfigureWorld.h | 2 +- src/guiConfirmMenu.cpp | 2 +- src/guiConfirmMenu.h | 2 +- src/guiCreateWorld.cpp | 2 +- src/guiCreateWorld.h | 2 +- src/guiDeathScreen.cpp | 2 +- src/guiDeathScreen.h | 2 +- src/guiFormSpecMenu.cpp | 2 +- src/guiFormSpecMenu.h | 2 +- src/guiKeyChangeMenu.cpp | 2 +- src/guiKeyChangeMenu.h | 2 +- src/guiMainMenu.cpp | 2 +- src/guiMainMenu.h | 2 +- src/guiMessageMenu.cpp | 2 +- src/guiMessageMenu.h | 2 +- src/guiPasswordChange.cpp | 2 +- src/guiPasswordChange.h | 2 +- src/guiPauseMenu.cpp | 2 +- src/guiPauseMenu.h | 2 +- src/guiTextInputMenu.cpp | 2 +- src/guiTextInputMenu.h | 2 +- src/guiVolumeChange.cpp | 2 +- src/guiVolumeChange.h | 2 +- src/hex.h | 2 +- src/inventory.cpp | 2 +- src/inventory.h | 2 +- src/inventorymanager.cpp | 2 +- src/inventorymanager.h | 2 +- src/irr_aabb3d.h | 2 +- src/irr_v2d.h | 2 +- src/irr_v3d.h | 2 +- src/irrlichttypes.h | 2 +- src/irrlichttypes_bloated.h | 2 +- src/irrlichttypes_extrabloated.h | 2 +- src/itemdef.cpp | 2 +- src/itemdef.h | 2 +- src/itemgroup.h | 2 +- src/keycode.cpp | 2 +- src/keycode.h | 2 +- src/light.cpp | 2 +- src/light.h | 2 +- src/localplayer.cpp | 2 +- src/localplayer.h | 2 +- src/log.cpp | 2 +- src/log.h | 2 +- src/logoutputbuffer.h | 2 +- src/luaentity_common.h | 2 +- src/main.cpp | 2 +- src/main.h | 2 +- src/mainmenumanager.h | 2 +- src/map.cpp | 2 +- src/map.h | 2 +- src/mapblock.cpp | 2 +- src/mapblock.h | 2 +- src/mapblock_mesh.cpp | 2 +- src/mapblock_mesh.h | 2 +- src/mapchunk.h | 2 +- src/mapgen.cpp | 2 +- src/mapgen.h | 2 +- src/mapgen_v6.cpp | 2 +- src/mapgen_v6.h | 2 +- src/mapnode.cpp | 2 +- src/mapnode.h | 2 +- src/mapsector.cpp | 2 +- src/mapsector.h | 2 +- src/mesh.cpp | 2 +- src/mesh.h | 2 +- src/modalMenu.h | 2 +- src/modifiedstate.h | 2 +- src/mods.cpp | 2 +- src/mods.h | 2 +- src/nameidmapping.cpp | 2 +- src/nameidmapping.h | 2 +- src/nodedef.cpp | 2 +- src/nodedef.h | 2 +- src/nodemetadata.cpp | 2 +- src/nodemetadata.h | 2 +- src/nodetimer.cpp | 2 +- src/nodetimer.h | 2 +- src/noise.cpp | 2 +- src/noise.h | 2 +- src/object_properties.cpp | 2 +- src/object_properties.h | 2 +- src/particles.cpp | 2 +- src/particles.h | 2 +- src/player.cpp | 2 +- src/player.h | 2 +- src/porting.cpp | 2 +- src/porting.h | 2 +- src/profiler.h | 2 +- src/quicktune.cpp | 2 +- src/quicktune.h | 2 +- src/quicktune_shortcutter.h | 2 +- src/rollback.cpp | 2 +- src/rollback.h | 2 +- src/rollback_interface.cpp | 2 +- src/rollback_interface.h | 2 +- src/script.cpp | 2 +- src/script.h | 2 +- src/scriptapi.cpp | 2 +- src/scriptapi.h | 2 +- src/serialization.cpp | 2 +- src/serialization.h | 2 +- src/server.cpp | 2 +- src/server.h | 2 +- src/serverlist.cpp | 2 +- src/serverlist.h | 2 +- src/serverobject.cpp | 2 +- src/serverobject.h | 2 +- src/settings.h | 2 +- src/shader.cpp | 2 +- src/shader.h | 2 +- src/sky.h | 2 +- src/socket.cpp | 2 +- src/socket.h | 2 +- src/sound.cpp | 2 +- src/sound.h | 2 +- src/sound_openal.cpp | 2 +- src/sound_openal.h | 2 +- src/staticobject.cpp | 2 +- src/staticobject.h | 2 +- src/strfnd.h | 2 +- src/subgame.cpp | 2 +- src/subgame.h | 2 +- src/test.cpp | 2 +- src/test.h | 2 +- src/threads.h | 2 +- src/tile.cpp | 2 +- src/tile.h | 2 +- src/tool.cpp | 2 +- src/tool.h | 2 +- src/treegen.cpp | 2 +- src/treegen.h | 2 +- src/util/container.h | 2 +- src/util/directiontables.cpp | 2 +- src/util/directiontables.h | 2 +- src/util/numeric.cpp | 2 +- src/util/numeric.h | 2 +- src/util/pointedthing.cpp | 2 +- src/util/pointedthing.h | 2 +- src/util/pointer.h | 2 +- src/util/serialize.cpp | 2 +- src/util/serialize.h | 2 +- src/util/string.cpp | 2 +- src/util/string.h | 2 +- src/util/thread.h | 2 +- src/util/timetaker.cpp | 2 +- src/util/timetaker.h | 2 +- src/voxel.cpp | 2 +- src/voxel.h | 2 +- src/voxelalgorithms.cpp | 2 +- src/voxelalgorithms.h | 2 +- util/wireshark/minetest.lua | 2 +- 222 files changed, 222 insertions(+), 222 deletions(-) (limited to 'src/server.cpp') 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/activeobject.h b/src/activeobject.h index 1108a19de..d131bcc33 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/ban.cpp b/src/ban.cpp index e080586a3..6bc84a3e8 100644 --- a/src/ban.cpp +++ b/src/ban.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/ban.h b/src/ban.h index f5b9c4440..8132c3a38 100644 --- a/src/ban.h +++ b/src/ban.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/biome.cpp b/src/biome.cpp index 34d51839f..67e5a9de7 100644 --- a/src/biome.cpp +++ b/src/biome.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 kwolekr, Ryan Kwolek This program is free software; you can redistribute it and/or modify diff --git a/src/biome.h b/src/biome.h index 265f1df44..6b40b9f81 100644 --- a/src/biome.h +++ b/src/biome.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 kwolekr, Ryan Kwolek This program is free software; you can redistribute it and/or modify diff --git a/src/camera.cpp b/src/camera.cpp index 33e85d069..7916affbd 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/camera.h b/src/camera.h index 642b8d2d0..5b06da322 100644 --- a/src/camera.h +++ b/src/camera.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/chat.cpp b/src/chat.cpp index b9d115bd0..0efda7eac 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/chat.h b/src/chat.h index 49de52985..5ba4af800 100644 --- a/src/chat.h +++ b/src/chat.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/client.cpp b/src/client.cpp index 415f07311..f02c14bc8 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/client.h b/src/client.h index 43fac9c9a..e3cc98c5b 100644 --- a/src/client.h +++ b/src/client.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientmap.cpp b/src/clientmap.cpp index 0b30453b8..e48aef190 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientmap.h b/src/clientmap.h index f8a69630e..a9a365c05 100644 --- a/src/clientmap.h +++ b/src/clientmap.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientobject.cpp b/src/clientobject.cpp index e1dbaf627..809357fc1 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientobject.h b/src/clientobject.h index 852d2c76b..1d88f991f 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientserver.cpp b/src/clientserver.cpp index bd0a8ede0..dee0a68e2 100644 --- a/src/clientserver.cpp +++ b/src/clientserver.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientserver.h b/src/clientserver.h index 7fb3e83d2..6a135a139 100644 --- a/src/clientserver.h +++ b/src/clientserver.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clientsimpleobject.h b/src/clientsimpleobject.h index 9dd8cc472..b91727492 100644 --- a/src/clientsimpleobject.h +++ b/src/clientsimpleobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clouds.cpp b/src/clouds.cpp index 5b980a5ba..67dd550f4 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/clouds.h b/src/clouds.h index a7cde42bc..d65f19385 100644 --- a/src/clouds.h +++ b/src/clouds.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/collision.cpp b/src/collision.cpp index eb948e3c3..ccd91be94 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/collision.h b/src/collision.h index 52a7bbb7d..331ff8f9d 100644 --- a/src/collision.h +++ b/src/collision.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/connection.cpp b/src/connection.cpp index ed5a752be..b8bde1872 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/connection.h b/src/connection.h index f99cd1bf9..4ccbfdd16 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/constants.h b/src/constants.h index 97e94b361..39537c83b 100644 --- a/src/constants.h +++ b/src/constants.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_abm.cpp b/src/content_abm.cpp index 0dcf862fc..a71dddfab 100644 --- a/src/content_abm.cpp +++ b/src/content_abm.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_abm.h b/src/content_abm.h index beb9b2e16..d837b7f3c 100644 --- a/src/content_abm.h +++ b/src/content_abm.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_cao.cpp b/src/content_cao.cpp index d71911b95..57cdbc912 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_cao.h b/src/content_cao.h index 566117716..81fd84f3d 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_cso.cpp b/src/content_cso.cpp index 666f17734..f85c23ed2 100644 --- a/src/content_cso.cpp +++ b/src/content_cso.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_cso.h b/src/content_cso.h index 0b467f6c4..bb4ce6100 100644 --- a/src/content_cso.h +++ b/src/content_cso.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 290890490..7a14d0bc8 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_mapblock.h b/src/content_mapblock.h index 142c00edf..7e87835f7 100644 --- a/src/content_mapblock.h +++ b/src/content_mapblock.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index c3fdb4a42..49ce57c21 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_mapnode.h b/src/content_mapnode.h index 45c2b0763..89c7a9a63 100644 --- a/src/content_mapnode.h +++ b/src/content_mapnode.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp index 0e4c3dd75..0a56db396 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_nodemeta.h b/src/content_nodemeta.h index d206c35ad..fdd6524e8 100644 --- a/src/content_nodemeta.h +++ b/src/content_nodemeta.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_object.h b/src/content_object.h index e4690d295..913337eb4 100644 --- a/src/content_object.h +++ b/src/content_object.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 196c10e61..5eed17eaf 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/content_sao.h b/src/content_sao.h index 065c6a039..894fe9699 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/craftdef.cpp b/src/craftdef.cpp index b15443607..143c295f5 100644 --- a/src/craftdef.cpp +++ b/src/craftdef.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/craftdef.h b/src/craftdef.h index a2258c6e8..aa71f1a1e 100644 --- a/src/craftdef.h +++ b/src/craftdef.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/daynightratio.h b/src/daynightratio.h index 96c6729eb..46acab60c 100644 --- a/src/daynightratio.h +++ b/src/daynightratio.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/debug.cpp b/src/debug.cpp index 8b25cc22d..9af7a5a9f 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/debug.h b/src/debug.h index 3e8066f4d..9b9385983 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 6cdaaa496..73a0893e1 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/defaultsettings.h b/src/defaultsettings.h index faac7a886..1fecf8cf7 100644 --- a/src/defaultsettings.h +++ b/src/defaultsettings.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/environment.cpp b/src/environment.cpp index ebf5e9a63..b8bcc5af8 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/environment.h b/src/environment.h index d1e61967f..1242506a3 100644 --- a/src/environment.h +++ b/src/environment.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/event.h b/src/event.h index 9e7a0dbf5..41be9622b 100644 --- a/src/event.h +++ b/src/event.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/event_manager.h b/src/event_manager.h index 9bc8e35eb..c2e9f792f 100644 --- a/src/event_manager.h +++ b/src/event_manager.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/exceptions.h b/src/exceptions.h index 35a57d070..476699ecb 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/farmesh.cpp b/src/farmesh.cpp index 23f3db5f6..ef1e6a0ae 100644 --- a/src/farmesh.cpp +++ b/src/farmesh.cpp @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/farmesh.h b/src/farmesh.h index 2eaf7d486..03b727d30 100644 --- a/src/farmesh.h +++ b/src/farmesh.h @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/filecache.cpp b/src/filecache.cpp index 716c769aa..ec076ce23 100644 --- a/src/filecache.cpp +++ b/src/filecache.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola Copyright (C) 2012 Jonathan Neuschäfer diff --git a/src/filecache.h b/src/filecache.h index da7e59f6a..96ea7a963 100644 --- a/src/filecache.h +++ b/src/filecache.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola Copyright (C) 2012 Jonathan Neuschäfer diff --git a/src/filesys.cpp b/src/filesys.cpp index bf26c8dac..b956412b5 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/filesys.h b/src/filesys.h index b7e6f3715..2d2ad9f3d 100644 --- a/src/filesys.h +++ b/src/filesys.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/game.cpp b/src/game.cpp index 86909ccf0..d4f2a70af 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/game.h b/src/game.h index b74a7a8da..e69714486 100644 --- a/src/game.h +++ b/src/game.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/gamedef.h b/src/gamedef.h index 6fc99b9f1..76de9f777 100644 --- a/src/gamedef.h +++ b/src/gamedef.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/genericobject.cpp b/src/genericobject.cpp index 398b07feb..6946dff71 100644 --- a/src/genericobject.cpp +++ b/src/genericobject.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/genericobject.h b/src/genericobject.h index b69c24b48..b4d5125c5 100644 --- a/src/genericobject.h +++ b/src/genericobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/gettime.h b/src/gettime.h index b5cb830cc..daeec0e46 100644 --- a/src/gettime.h +++ b/src/gettime.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 13883901e..24c302b24 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h index 033a26244..6e73f1dc6 100644 --- a/src/guiChatConsole.h +++ b/src/guiChatConsole.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiConfigureWorld.cpp b/src/guiConfigureWorld.cpp index fdcd0d3e8..c97acabd2 100644 --- a/src/guiConfigureWorld.cpp +++ b/src/guiConfigureWorld.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiConfigureWorld.h b/src/guiConfigureWorld.h index 2280c6dbe..450aacc4c 100644 --- a/src/guiConfigureWorld.h +++ b/src/guiConfigureWorld.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiConfirmMenu.cpp b/src/guiConfirmMenu.cpp index 299110070..33ed93fb8 100644 --- a/src/guiConfirmMenu.cpp +++ b/src/guiConfirmMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiConfirmMenu.h b/src/guiConfirmMenu.h index b9fb2cd53..a23bb7c55 100644 --- a/src/guiConfirmMenu.h +++ b/src/guiConfirmMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiCreateWorld.cpp b/src/guiCreateWorld.cpp index a4c528b3e..d34850844 100644 --- a/src/guiCreateWorld.cpp +++ b/src/guiCreateWorld.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiCreateWorld.h b/src/guiCreateWorld.h index 492fcf565..60a8f7553 100644 --- a/src/guiCreateWorld.h +++ b/src/guiCreateWorld.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiDeathScreen.cpp b/src/guiDeathScreen.cpp index 4a767c43c..2a3e7e335 100644 --- a/src/guiDeathScreen.cpp +++ b/src/guiDeathScreen.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiDeathScreen.h b/src/guiDeathScreen.h index 3c0307634..82ee1eb46 100644 --- a/src/guiDeathScreen.h +++ b/src/guiDeathScreen.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index a1da09ee1..ae399a1b8 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 86235900d..578dd6e01 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index 3f6d03ebb..a5b82f612 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -1,5 +1,5 @@ /* - Minetest-c55 + Minetest Copyright (C) 2010-11 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks Copyright (C) 2011 teddydestodes diff --git a/src/guiKeyChangeMenu.h b/src/guiKeyChangeMenu.h index beb4f0b6f..104af9502 100644 --- a/src/guiKeyChangeMenu.h +++ b/src/guiKeyChangeMenu.h @@ -1,5 +1,5 @@ /* - Minetest-c55 + Minetest Copyright (C) 2010-11 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks Copyright (C) 2011 teddydestodes diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index ca334198f..eead3da92 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-12 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h index 558a05d59..0a4292b06 100644 --- a/src/guiMainMenu.h +++ b/src/guiMainMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp index 24d6f7f52..ce3bfe713 100644 --- a/src/guiMessageMenu.cpp +++ b/src/guiMessageMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiMessageMenu.h b/src/guiMessageMenu.h index af2fc44a5..2eef1d8cd 100644 --- a/src/guiMessageMenu.h +++ b/src/guiMessageMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index ecae55e10..4ce1a3636 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2011 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks diff --git a/src/guiPasswordChange.h b/src/guiPasswordChange.h index f5f767b5e..05b145202 100644 --- a/src/guiPasswordChange.h +++ b/src/guiPasswordChange.h @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2010-11 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index 9d44b2e82..2ca9a80fb 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiPauseMenu.h b/src/guiPauseMenu.h index 578f2a324..8a4ef931e 100644 --- a/src/guiPauseMenu.h +++ b/src/guiPauseMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp index 857c26a45..56844228d 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiTextInputMenu.h b/src/guiTextInputMenu.h index 1a55525c9..a532ec008 100644 --- a/src/guiTextInputMenu.h +++ b/src/guiTextInputMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/guiVolumeChange.cpp b/src/guiVolumeChange.cpp index 606aa0196..99b302dd7 100644 --- a/src/guiVolumeChange.cpp +++ b/src/guiVolumeChange.cpp @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2011 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks Copyright (C) 2013 RealBadAngel, Maciej Kasatkin diff --git a/src/guiVolumeChange.h b/src/guiVolumeChange.h index a0a50f393..6571640e9 100644 --- a/src/guiVolumeChange.h +++ b/src/guiVolumeChange.h @@ -1,5 +1,5 @@ /* -Part of Minetest-c55 +Part of Minetest Copyright (C) 2010-11 celeron55, Perttu Ahola Copyright (C) 2011 Ciaran Gultnieks Copyright (C) 2013 RealBadAngel, Maciej Kasatkin diff --git a/src/hex.h b/src/hex.h index e54ef9634..88703878e 100644 --- a/src/hex.h +++ b/src/hex.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 Jonathan Neuschäfer This program is free software; you can redistribute it and/or modify diff --git a/src/inventory.cpp b/src/inventory.cpp index 5e39a41a6..82896f3c0 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/inventory.h b/src/inventory.h index 5f90183d2..ffe944a13 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index 4d862de66..5042376c6 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/inventorymanager.h b/src/inventorymanager.h index f81f5b972..eec461f2c 100644 --- a/src/inventorymanager.h +++ b/src/inventorymanager.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irr_aabb3d.h b/src/irr_aabb3d.h index 3f04198ad..3cc8c33a2 100644 --- a/src/irr_aabb3d.h +++ b/src/irr_aabb3d.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irr_v2d.h b/src/irr_v2d.h index 0710684ce..9a0492866 100644 --- a/src/irr_v2d.h +++ b/src/irr_v2d.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irr_v3d.h b/src/irr_v3d.h index 21051f93c..f5c7a1bfb 100644 --- a/src/irr_v3d.h +++ b/src/irr_v3d.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irrlichttypes.h b/src/irrlichttypes.h index 2db744a48..195c3cc0c 100644 --- a/src/irrlichttypes.h +++ b/src/irrlichttypes.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irrlichttypes_bloated.h b/src/irrlichttypes_bloated.h index 528ee1f47..6576335ba 100644 --- a/src/irrlichttypes_bloated.h +++ b/src/irrlichttypes_bloated.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/irrlichttypes_extrabloated.h b/src/irrlichttypes_extrabloated.h index f85fb6318..17f2e298a 100644 --- a/src/irrlichttypes_extrabloated.h +++ b/src/irrlichttypes_extrabloated.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/itemdef.cpp b/src/itemdef.cpp index a4f3895e0..6c3bdb5e3 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola Copyright (C) 2011 Kahrl diff --git a/src/itemdef.h b/src/itemdef.h index ae3600868..a3054518d 100644 --- a/src/itemdef.h +++ b/src/itemdef.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola Copyright (C) 2011 Kahrl diff --git a/src/itemgroup.h b/src/itemgroup.h index c6c36dcc4..3a07e9e02 100644 --- a/src/itemgroup.h +++ b/src/itemgroup.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/keycode.cpp b/src/keycode.cpp index 9aa9d300d..7b3c16332 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/keycode.h b/src/keycode.h index a0b1e3553..7fe5f42d1 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/light.cpp b/src/light.cpp index 66bceb72b..549603495 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/light.h b/src/light.h index f1c458ad8..bafd10914 100644 --- a/src/light.h +++ b/src/light.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 8b6d7e2f6..ddb38fffa 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/localplayer.h b/src/localplayer.h index c9d010d7c..81b6eb808 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/log.cpp b/src/log.cpp index 78fa32026..14c49857b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/log.h b/src/log.h index 012e7e938..5c9bb1b26 100644 --- a/src/log.h +++ b/src/log.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/logoutputbuffer.h b/src/logoutputbuffer.h index 1fb155aae..316da7856 100644 --- a/src/logoutputbuffer.h +++ b/src/logoutputbuffer.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/luaentity_common.h b/src/luaentity_common.h index 74dd046cb..ee6ef00a0 100644 --- a/src/luaentity_common.h +++ b/src/luaentity_common.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/main.cpp b/src/main.cpp index 7bbbf082d..1774641f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/main.h b/src/main.h index a169a45dc..126445b03 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h index dc2b287d4..8915dd933 100644 --- a/src/mainmenumanager.h +++ b/src/mainmenumanager.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/map.cpp b/src/map.cpp index 717b0cf9b..f57aeee88 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/map.h b/src/map.h index 420fc29ca..7078dedc0 100644 --- a/src/map.h +++ b/src/map.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapblock.cpp b/src/mapblock.cpp index e9c8fadff..a84fdeb6a 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapblock.h b/src/mapblock.h index d56d93dda..2c8d6de66 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index daebbe217..1797db22e 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index c23b6cc5a..7d8abbb8d 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapchunk.h b/src/mapchunk.h index 6b7a411d7..a45dcdc3d 100644 --- a/src/mapchunk.h +++ b/src/mapchunk.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapgen.cpp b/src/mapgen.cpp index a2d920bbc..14981f12c 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapgen.h b/src/mapgen.h index 4f1ab4ebd..13d17bd58 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 3a5e10930..aad25c6da 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index 9a2a0287d..4171ec534 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 5dab93754..d9bc67081 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapnode.h b/src/mapnode.h index de2529e4d..f89d8b0ed 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapsector.cpp b/src/mapsector.cpp index f152c38e7..2cba9444f 100644 --- a/src/mapsector.cpp +++ b/src/mapsector.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mapsector.h b/src/mapsector.h index 74539ab24..0f4bcdd3a 100644 --- a/src/mapsector.h +++ b/src/mapsector.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mesh.cpp b/src/mesh.cpp index 29b853143..4bfbc40c8 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mesh.h b/src/mesh.h index 5e1efcd52..062363bb7 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/modalMenu.h b/src/modalMenu.h index 04372167b..43f559062 100644 --- a/src/modalMenu.h +++ b/src/modalMenu.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/modifiedstate.h b/src/modifiedstate.h index 98004619f..0beebcfbf 100644 --- a/src/modifiedstate.h +++ b/src/modifiedstate.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mods.cpp b/src/mods.cpp index f6e3d58d7..cd3840edd 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/mods.h b/src/mods.h index 59dffdade..35894b339 100644 --- a/src/mods.h +++ b/src/mods.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nameidmapping.cpp b/src/nameidmapping.cpp index 2a436f735..0e6090745 100644 --- a/src/nameidmapping.cpp +++ b/src/nameidmapping.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nameidmapping.h b/src/nameidmapping.h index 90d8dbed8..3cb87987d 100644 --- a/src/nameidmapping.h +++ b/src/nameidmapping.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 12d9238ad..5b9c64cd4 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodedef.h b/src/nodedef.h index fa0c1f2e8..ade56dadf 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index 141c779f1..56391a39c 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodemetadata.h b/src/nodemetadata.h index 262b64d74..1602ef937 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp index bf1e7435d..d1043fa51 100644 --- a/src/nodetimer.cpp +++ b/src/nodetimer.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/nodetimer.h b/src/nodetimer.h index c643ab888..1f2f2e6f3 100644 --- a/src/nodetimer.h +++ b/src/nodetimer.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/noise.cpp b/src/noise.cpp index bfb1960c8..c0d3fe163 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/noise.h b/src/noise.h index e725b4e47..74e89a90f 100644 --- a/src/noise.h +++ b/src/noise.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/object_properties.cpp b/src/object_properties.cpp index ec988a37d..c02203a81 100644 --- a/src/object_properties.cpp +++ b/src/object_properties.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/object_properties.h b/src/object_properties.h index d7d44625e..e1604b487 100644 --- a/src/object_properties.h +++ b/src/object_properties.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/particles.cpp b/src/particles.cpp index d49e33322..a1f5739de 100644 --- a/src/particles.cpp +++ b/src/particles.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/particles.h b/src/particles.h index 3ed9dfdc8..a9d189e4e 100644 --- a/src/particles.h +++ b/src/particles.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/player.cpp b/src/player.cpp index 86d3ae184..2a4f3747a 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/player.h b/src/player.h index 770afdb37..8c9e7e725 100644 --- a/src/player.h +++ b/src/player.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/porting.cpp b/src/porting.cpp index f8a2cca5c..0f702810d 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/porting.h b/src/porting.h index 9ba3394bb..f98980460 100644 --- a/src/porting.h +++ b/src/porting.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/profiler.h b/src/profiler.h index b1e6abe58..a3ac41a25 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/quicktune.cpp b/src/quicktune.cpp index acd0d721f..ba0e0c654 100644 --- a/src/quicktune.cpp +++ b/src/quicktune.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/quicktune.h b/src/quicktune.h index a733ccda4..a0aa28d8e 100644 --- a/src/quicktune.h +++ b/src/quicktune.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/quicktune_shortcutter.h b/src/quicktune_shortcutter.h index 2e3b5310b..0ec80e48b 100644 --- a/src/quicktune_shortcutter.h +++ b/src/quicktune_shortcutter.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/rollback.cpp b/src/rollback.cpp index f0e3c40aa..fd60e0302 100644 --- a/src/rollback.cpp +++ b/src/rollback.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/rollback.h b/src/rollback.h index 5e76042b5..8da03b588 100644 --- a/src/rollback.h +++ b/src/rollback.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/rollback_interface.cpp b/src/rollback_interface.cpp index b2eb2093c..74f3e691c 100644 --- a/src/rollback_interface.cpp +++ b/src/rollback_interface.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/rollback_interface.h b/src/rollback_interface.h index 8dd429d76..c18af3076 100644 --- a/src/rollback_interface.h +++ b/src/rollback_interface.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/script.cpp b/src/script.cpp index b238e1be7..a27ac3c9f 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/script.h b/src/script.h index fea132b07..51ed4a02d 100644 --- a/src/script.h +++ b/src/script.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index b7a7f6e42..4d02fc965 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/scriptapi.h b/src/scriptapi.h index d71b8fe41..8c48c756f 100644 --- a/src/scriptapi.h +++ b/src/scriptapi.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serialization.cpp b/src/serialization.cpp index c57e1642a..e79342432 100644 --- a/src/serialization.cpp +++ b/src/serialization.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serialization.h b/src/serialization.h index 533ddc8c4..b89997155 100644 --- a/src/serialization.h +++ b/src/serialization.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/server.cpp b/src/server.cpp index 94a4787f8..b1d0b8d46 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/server.h b/src/server.h index 22c7cf2bb..157ade086 100644 --- a/src/server.h +++ b/src/server.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serverlist.cpp b/src/serverlist.cpp index b2f49ae72..77b0ceef1 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serverlist.h b/src/serverlist.h index 52549e97a..7aae32de1 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serverobject.cpp b/src/serverobject.cpp index deaa94f2c..af77d466c 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/serverobject.h b/src/serverobject.h index 14752878f..c5ae6aa8e 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/settings.h b/src/settings.h index addd9980c..db4f07eea 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/shader.cpp b/src/shader.cpp index 9e1a51f23..b05aad7a4 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola Copyright (C) 2012 Kahrl diff --git a/src/shader.h b/src/shader.h index 774a17b20..c39602cc0 100644 --- a/src/shader.h +++ b/src/shader.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola Copyright (C) 2012 Kahrl diff --git a/src/sky.h b/src/sky.h index 65170dad5..6b9168fc6 100644 --- a/src/sky.h +++ b/src/sky.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/socket.cpp b/src/socket.cpp index f8afed229..997a80c44 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/socket.h b/src/socket.h index 06ec2843a..2617c03bd 100644 --- a/src/socket.h +++ b/src/socket.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/sound.cpp b/src/sound.cpp index f5203bbb3..1e884e43a 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/sound.h b/src/sound.h index d74acd550..1f9b7d6e1 100644 --- a/src/sound.h +++ b/src/sound.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp index c78f6288f..069641b74 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola OpenAL support based on work by: Copyright (C) 2011 Sebastian 'Bahamada' Rühl diff --git a/src/sound_openal.h b/src/sound_openal.h index 876c45e69..d3ddfb766 100644 --- a/src/sound_openal.h +++ b/src/sound_openal.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/staticobject.cpp b/src/staticobject.cpp index 2183f2ffe..00d846ba5 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/staticobject.h b/src/staticobject.h index 6fccbdd4f..ca358236c 100644 --- a/src/staticobject.h +++ b/src/staticobject.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/strfnd.h b/src/strfnd.h index 71a9a8cd9..dcd65f6cd 100644 --- a/src/strfnd.h +++ b/src/strfnd.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/subgame.cpp b/src/subgame.cpp index 2f5340373..a22f03bc2 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/subgame.h b/src/subgame.h index dd725caf7..fa6d70cee 100644 --- a/src/subgame.h +++ b/src/subgame.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/test.cpp b/src/test.cpp index bc0692a78..c7c97989f 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/test.h b/src/test.h index f69888214..606a1c289 100644 --- a/src/test.h +++ b/src/test.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/threads.h b/src/threads.h index e79404aa2..2ffc5eb1b 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/tile.cpp b/src/tile.cpp index 7cad1b836..0936ba8e9 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/tile.h b/src/tile.h index b00c1c6c6..068defbb2 100644 --- a/src/tile.h +++ b/src/tile.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/tool.cpp b/src/tool.cpp index c1e268ff1..b452a00f6 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/tool.h b/src/tool.h index 18c09dca3..315a51bac 100644 --- a/src/tool.h +++ b/src/tool.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/treegen.cpp b/src/treegen.cpp index 948716dcf..400377838 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola , 2012-2013 RealBadAngel, Maciej Kasatkin This program is free software; you can redistribute it and/or modify diff --git a/src/treegen.h b/src/treegen.h index 0068219dd..18adff859 100644 --- a/src/treegen.h +++ b/src/treegen.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola , 2012-2013 RealBadAngel, Maciej Kasatkin This program is free software; you can redistribute it and/or modify diff --git a/src/util/container.h b/src/util/container.h index 8c1ae02fb..15c877fde 100644 --- a/src/util/container.h +++ b/src/util/container.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/directiontables.cpp b/src/util/directiontables.cpp index a5d2faa7c..54f8edf9e 100644 --- a/src/util/directiontables.cpp +++ b/src/util/directiontables.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/directiontables.h b/src/util/directiontables.h index 5bebd2fdb..4e26eae3e 100644 --- a/src/util/directiontables.h +++ b/src/util/directiontables.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/numeric.cpp b/src/util/numeric.cpp index 0ac812eb7..2d6afc3c6 100644 --- a/src/util/numeric.cpp +++ b/src/util/numeric.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/numeric.h b/src/util/numeric.h index a028f1ff2..5ef014ff9 100644 --- a/src/util/numeric.h +++ b/src/util/numeric.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/pointedthing.cpp b/src/util/pointedthing.cpp index d1be2d6b6..d5cc81003 100644 --- a/src/util/pointedthing.cpp +++ b/src/util/pointedthing.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/pointedthing.h b/src/util/pointedthing.h index e61e2f4f3..aab7a1043 100644 --- a/src/util/pointedthing.h +++ b/src/util/pointedthing.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/pointer.h b/src/util/pointer.h index 775f0a336..96f4c656b 100644 --- a/src/util/pointer.h +++ b/src/util/pointer.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/serialize.cpp b/src/util/serialize.cpp index 16825b677..c1e99c7eb 100644 --- a/src/util/serialize.cpp +++ b/src/util/serialize.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/serialize.h b/src/util/serialize.h index b356c484e..b0e93ad26 100644 --- a/src/util/serialize.h +++ b/src/util/serialize.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/string.cpp b/src/util/string.cpp index 61b307c60..e151abefc 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/string.h b/src/util/string.h index a469a074a..b655ce25c 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/thread.h b/src/util/thread.h index 8e8c74ac5..db8e0b89e 100644 --- a/src/util/thread.h +++ b/src/util/thread.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/timetaker.cpp b/src/util/timetaker.cpp index 52c618931..42a248dc6 100644 --- a/src/util/timetaker.cpp +++ b/src/util/timetaker.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/util/timetaker.h b/src/util/timetaker.h index 8aad97d0f..75542f433 100644 --- a/src/util/timetaker.h +++ b/src/util/timetaker.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/voxel.cpp b/src/voxel.cpp index 8fdae79e1..be504f983 100644 --- a/src/voxel.cpp +++ b/src/voxel.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/voxel.h b/src/voxel.h index c2a5efb4b..79155a0f6 100644 --- a/src/voxel.h +++ b/src/voxel.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/voxelalgorithms.cpp b/src/voxelalgorithms.cpp index 795530d40..c9aff019e 100644 --- a/src/voxelalgorithms.cpp +++ b/src/voxelalgorithms.cpp @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify diff --git a/src/voxelalgorithms.h b/src/voxelalgorithms.h index 4360ef731..7a88caf2f 100644 --- a/src/voxelalgorithms.h +++ b/src/voxelalgorithms.h @@ -1,5 +1,5 @@ /* -Minetest-c55 +Minetest Copyright (C) 2010-2012 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify 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 -- -- This program is free software; you can redistribute it and/or modify -- cgit v1.2.3 From 6d0ea26c2d62c3774ff384cf1bfc2a3372b49a3b Mon Sep 17 00:00:00 2001 From: Sfan5 Date: Sun, 24 Feb 2013 19:38:45 +0100 Subject: Update Copyright Years --- README.txt | 4 ++-- src/activeobject.h | 2 +- src/ban.cpp | 2 +- src/ban.h | 2 +- src/biome.cpp | 2 +- src/biome.h | 2 +- src/camera.cpp | 2 +- src/camera.h | 2 +- src/chat.cpp | 2 +- src/chat.h | 2 +- src/client.cpp | 2 +- src/client.h | 2 +- src/clientmap.cpp | 2 +- src/clientmap.h | 2 +- src/clientobject.cpp | 2 +- src/clientobject.h | 2 +- src/clientserver.cpp | 2 +- src/clientserver.h | 2 +- src/clientsimpleobject.h | 2 +- src/clouds.cpp | 2 +- src/clouds.h | 2 +- src/collision.cpp | 2 +- src/collision.h | 2 +- src/connection.cpp | 2 +- src/connection.h | 2 +- src/constants.h | 2 +- src/content_abm.cpp | 2 +- src/content_abm.h | 2 +- src/content_cao.cpp | 2 +- src/content_cao.h | 2 +- src/content_cso.cpp | 2 +- src/content_cso.h | 2 +- src/content_mapblock.cpp | 2 +- src/content_mapblock.h | 2 +- src/content_mapnode.cpp | 2 +- src/content_mapnode.h | 2 +- src/content_nodemeta.cpp | 2 +- src/content_nodemeta.h | 2 +- src/content_object.h | 2 +- src/content_sao.cpp | 2 +- src/content_sao.h | 2 +- src/craftdef.cpp | 2 +- src/craftdef.h | 2 +- src/daynightratio.h | 2 +- src/debug.cpp | 2 +- src/debug.h | 2 +- src/defaultsettings.cpp | 2 +- src/defaultsettings.h | 2 +- src/environment.cpp | 2 +- src/environment.h | 2 +- src/event.h | 2 +- src/event_manager.h | 2 +- src/exceptions.h | 2 +- src/farmesh.cpp | 2 +- src/farmesh.h | 2 +- src/filecache.cpp | 4 ++-- src/filecache.h | 4 ++-- src/filesys.cpp | 2 +- src/filesys.h | 2 +- src/game.cpp | 2 +- src/game.h | 2 +- src/gamedef.h | 2 +- src/genericobject.cpp | 2 +- src/genericobject.h | 2 +- src/gettime.h | 2 +- src/guiChatConsole.cpp | 2 +- src/guiChatConsole.h | 2 +- src/guiConfigureWorld.cpp | 2 +- src/guiConfigureWorld.h | 2 +- src/guiConfirmMenu.cpp | 2 +- src/guiConfirmMenu.h | 2 +- src/guiCreateWorld.cpp | 2 +- src/guiCreateWorld.h | 2 +- src/guiDeathScreen.cpp | 2 +- src/guiDeathScreen.h | 2 +- src/guiFormSpecMenu.cpp | 2 +- src/guiFormSpecMenu.h | 2 +- src/guiKeyChangeMenu.cpp | 6 +++--- src/guiKeyChangeMenu.h | 6 +++--- src/guiMainMenu.cpp | 2 +- src/guiMainMenu.h | 2 +- src/guiMessageMenu.cpp | 2 +- src/guiMessageMenu.h | 2 +- src/guiPasswordChange.cpp | 4 ++-- src/guiPasswordChange.h | 4 ++-- src/guiPauseMenu.cpp | 2 +- src/guiPauseMenu.h | 2 +- src/guiTextInputMenu.cpp | 2 +- src/guiTextInputMenu.h | 2 +- src/guiVolumeChange.cpp | 4 ++-- src/guiVolumeChange.h | 4 ++-- src/hex.h | 2 +- src/intlGUIEditBox.cpp | 2 +- src/intlGUIEditBox.h | 2 +- src/inventory.cpp | 2 +- src/inventory.h | 2 +- src/inventorymanager.cpp | 2 +- src/inventorymanager.h | 2 +- src/irr_aabb3d.h | 2 +- src/irr_v2d.h | 2 +- src/irr_v3d.h | 2 +- src/irrlichttypes.h | 2 +- src/irrlichttypes_bloated.h | 2 +- src/irrlichttypes_extrabloated.h | 2 +- src/itemdef.cpp | 4 ++-- src/itemdef.h | 4 ++-- src/itemgroup.h | 2 +- src/keycode.cpp | 2 +- src/keycode.h | 2 +- src/light.cpp | 2 +- src/light.h | 2 +- src/localplayer.cpp | 2 +- src/localplayer.h | 2 +- src/log.cpp | 2 +- src/log.h | 2 +- src/logoutputbuffer.h | 2 +- src/luaentity_common.h | 2 +- src/main.cpp | 2 +- src/main.h | 2 +- src/mainmenumanager.h | 2 +- src/map.cpp | 2 +- src/map.h | 2 +- src/mapblock.cpp | 2 +- src/mapblock.h | 2 +- src/mapblock_mesh.cpp | 2 +- src/mapblock_mesh.h | 2 +- src/mapchunk.h | 2 +- src/mapgen.cpp | 2 +- src/mapgen.h | 2 +- src/mapgen_v6.cpp | 2 +- src/mapgen_v6.h | 2 +- src/mapnode.cpp | 2 +- src/mapnode.h | 2 +- src/mapsector.cpp | 2 +- src/mapsector.h | 2 +- src/mesh.cpp | 2 +- src/mesh.h | 2 +- src/modalMenu.h | 2 +- src/modifiedstate.h | 2 +- src/mods.cpp | 2 +- src/mods.h | 2 +- src/nameidmapping.cpp | 2 +- src/nameidmapping.h | 2 +- src/nodedef.cpp | 2 +- src/nodedef.h | 2 +- src/nodemetadata.cpp | 2 +- src/nodemetadata.h | 2 +- src/nodetimer.cpp | 2 +- src/nodetimer.h | 2 +- src/noise.cpp | 2 +- src/noise.h | 2 +- src/object_properties.cpp | 2 +- src/object_properties.h | 2 +- src/particles.cpp | 2 +- src/particles.h | 2 +- src/player.cpp | 2 +- src/player.h | 2 +- src/porting.cpp | 2 +- src/porting.h | 2 +- src/profiler.h | 2 +- src/quicktune.cpp | 2 +- src/quicktune.h | 2 +- src/quicktune_shortcutter.h | 2 +- src/rollback.cpp | 2 +- src/rollback.h | 2 +- src/rollback_interface.cpp | 2 +- src/rollback_interface.h | 2 +- src/script.cpp | 2 +- src/script.h | 2 +- src/scriptapi.cpp | 2 +- src/scriptapi.h | 2 +- src/serialization.cpp | 2 +- src/serialization.h | 2 +- src/server.cpp | 2 +- src/server.h | 2 +- src/serverlist.cpp | 2 +- src/serverlist.h | 2 +- src/serverobject.cpp | 2 +- src/serverobject.h | 2 +- src/settings.h | 2 +- src/shader.cpp | 4 ++-- src/shader.h | 4 ++-- src/sky.h | 2 +- src/socket.cpp | 2 +- src/socket.h | 2 +- src/sound.cpp | 2 +- src/sound.h | 2 +- src/sound_openal.cpp | 2 +- src/sound_openal.h | 2 +- src/staticobject.cpp | 2 +- src/staticobject.h | 2 +- src/strfnd.h | 2 +- src/subgame.cpp | 2 +- src/subgame.h | 2 +- src/test.cpp | 2 +- src/test.h | 2 +- src/threads.h | 2 +- src/tile.cpp | 2 +- src/tile.h | 2 +- src/tool.cpp | 2 +- src/tool.h | 2 +- src/treegen.cpp | 2 +- src/treegen.h | 2 +- src/util/container.h | 2 +- src/util/directiontables.cpp | 2 +- src/util/directiontables.h | 2 +- src/util/numeric.cpp | 2 +- src/util/numeric.h | 2 +- src/util/pointedthing.cpp | 2 +- src/util/pointedthing.h | 2 +- src/util/pointer.h | 2 +- src/util/serialize.cpp | 2 +- src/util/serialize.h | 2 +- src/util/string.cpp | 2 +- src/util/string.h | 2 +- src/util/thread.h | 2 +- src/util/timetaker.cpp | 2 +- src/util/timetaker.h | 2 +- src/voxel.cpp | 2 +- src/voxel.h | 2 +- src/voxelalgorithms.cpp | 2 +- src/voxelalgorithms.h | 2 +- 222 files changed, 237 insertions(+), 237 deletions(-) (limited to 'src/server.cpp') diff --git a/README.txt b/README.txt index edd11f3fe..20917d772 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ Minetest An InfiniMiner/Minecraft inspired game. -Copyright (c) 2010-2012 Perttu Ahola +Copyright (c) 2010-2013 Perttu Ahola and contributors (see source file comments and the version control log) In case you downloaded the source code: @@ -258,7 +258,7 @@ License of Minetest source code ------------------------------- Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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/activeobject.h b/src/activeobject.h index d131bcc33..e454f2c8c 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 6bc84a3e8..75bae746f 100644 --- a/src/ban.cpp +++ b/src/ban.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 8132c3a38..529635c26 100644 --- a/src/ban.h +++ b/src/ban.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 67e5a9de7..86af75310 100644 --- a/src/biome.cpp +++ b/src/biome.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 kwolekr, Ryan Kwolek +Copyright (C) 2010-2013 kwolekr, Ryan Kwolek 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 6b40b9f81..c30af46ad 100644 --- a/src/biome.h +++ b/src/biome.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 kwolekr, Ryan Kwolek +Copyright (C) 2010-2013 kwolekr, Ryan Kwolek 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 7916affbd..b1e588415 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 5b06da322..fc43d1176 100644 --- a/src/camera.h +++ b/src/camera.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 0efda7eac..c3509ae49 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 5ba4af800..27863922c 100644 --- a/src/chat.h +++ b/src/chat.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 f02c14bc8..be35db5de 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 e3cc98c5b..809e98b81 100644 --- a/src/client.h +++ b/src/client.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 e48aef190..aa92dfdee 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 a9a365c05..786f35b77 100644 --- a/src/clientmap.h +++ b/src/clientmap.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 809357fc1..e7c735dac 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 1d88f991f..d1ee366cf 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 dee0a68e2..591a95542 100644 --- a/src/clientserver.cpp +++ b/src/clientserver.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 6a135a139..769272a68 100644 --- a/src/clientserver.h +++ b/src/clientserver.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 b91727492..c94db22f1 100644 --- a/src/clientsimpleobject.h +++ b/src/clientsimpleobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 67dd550f4..9f0bc06d8 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 d65f19385..72923c2c5 100644 --- a/src/clouds.h +++ b/src/clouds.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 ccd91be94..58517b779 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 331ff8f9d..38cc3efb3 100644 --- a/src/collision.h +++ b/src/collision.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 b8bde1872..7a3018bfd 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 4ccbfdd16..05b1ca2e8 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 39537c83b..8246c8c21 100644 --- a/src/constants.h +++ b/src/constants.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a71dddfab..cbfdd2e9f 100644 --- a/src/content_abm.cpp +++ b/src/content_abm.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 d837b7f3c..0a91a96a2 100644 --- a/src/content_abm.h +++ b/src/content_abm.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 57cdbc912..5e5cb38ae 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 81fd84f3d..441c74922 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 f85c23ed2..20eb88b7d 100644 --- a/src/content_cso.cpp +++ b/src/content_cso.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 bb4ce6100..5007d2526 100644 --- a/src/content_cso.h +++ b/src/content_cso.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 7a14d0bc8..4a5c001d5 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 7e87835f7..bb1e129da 100644 --- a/src/content_mapblock.h +++ b/src/content_mapblock.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 49ce57c21..44d0b8e38 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 89c7a9a63..5c9c0b66d 100644 --- a/src/content_mapnode.h +++ b/src/content_mapnode.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 0a56db396..a9a8cc60c 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 fdd6524e8..907649b5f 100644 --- a/src/content_nodemeta.h +++ b/src/content_nodemeta.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 913337eb4..65a829773 100644 --- a/src/content_object.h +++ b/src/content_object.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 5eed17eaf..718a42dff 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 894fe9699..2fd1034eb 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 143c295f5..99e3fcc3d 100644 --- a/src/craftdef.cpp +++ b/src/craftdef.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 aa71f1a1e..eb3cd7e39 100644 --- a/src/craftdef.h +++ b/src/craftdef.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 46acab60c..3375133ef 100644 --- a/src/daynightratio.h +++ b/src/daynightratio.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 9af7a5a9f..e32cceb86 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 9b9385983..69a215a42 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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/defaultsettings.cpp b/src/defaultsettings.cpp index 73a0893e1..610dd65a4 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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/defaultsettings.h b/src/defaultsettings.h index 1fecf8cf7..37e3f717f 100644 --- a/src/defaultsettings.h +++ b/src/defaultsettings.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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.cpp b/src/environment.cpp index b8bcc5af8..e939672e7 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 1242506a3..a79ccc63d 100644 --- a/src/environment.h +++ b/src/environment.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.h b/src/event.h index 41be9622b..cfc222d5d 100644 --- a/src/event.h +++ b/src/event.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 c2e9f792f..33d99b28c 100644 --- a/src/event_manager.h +++ b/src/event_manager.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 476699ecb..458fb50b1 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ef1e6a0ae..443e2b3bf 100644 --- a/src/farmesh.cpp +++ b/src/farmesh.cpp @@ -1,6 +1,6 @@ /* Part of Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 03b727d30..47147fa8f 100644 --- a/src/farmesh.h +++ b/src/farmesh.h @@ -1,6 +1,6 @@ /* Part of Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 ec076ce23..23df1d7d0 100644 --- a/src/filecache.cpp +++ b/src/filecache.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola -Copyright (C) 2012 Jonathan Neuschäfer +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Jonathan Neuschäfer 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 96ea7a963..cf59a8e5b 100644 --- a/src/filecache.h +++ b/src/filecache.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola -Copyright (C) 2012 Jonathan Neuschäfer +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Jonathan Neuschäfer 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 b956412b5..256c8f16a 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2d2ad9f3d..263eb796f 100644 --- a/src/filesys.h +++ b/src/filesys.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 d4f2a70af..8ab0f3fe3 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 e69714486..fef777fea 100644 --- a/src/game.h +++ b/src/game.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 76de9f777..1d46b028e 100644 --- a/src/gamedef.h +++ b/src/gamedef.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 6946dff71..f7b272b00 100644 --- a/src/genericobject.cpp +++ b/src/genericobject.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 b4d5125c5..9a21baa67 100644 --- a/src/genericobject.h +++ b/src/genericobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 daeec0e46..611906559 100644 --- a/src/gettime.h +++ b/src/gettime.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 24c302b24..f522af01f 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 6e73f1dc6..c896aae28 100644 --- a/src/guiChatConsole.h +++ b/src/guiChatConsole.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 c97acabd2..080691222 100644 --- a/src/guiConfigureWorld.cpp +++ b/src/guiConfigureWorld.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 450aacc4c..8a77c5f89 100644 --- a/src/guiConfigureWorld.h +++ b/src/guiConfigureWorld.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 33ed93fb8..70e33c760 100644 --- a/src/guiConfirmMenu.cpp +++ b/src/guiConfirmMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a23bb7c55..7d217d6a6 100644 --- a/src/guiConfirmMenu.h +++ b/src/guiConfirmMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 d34850844..8ac3fb17c 100644 --- a/src/guiCreateWorld.cpp +++ b/src/guiCreateWorld.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 60a8f7553..d9bc3638a 100644 --- a/src/guiCreateWorld.h +++ b/src/guiCreateWorld.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2a3e7e335..ba329e3be 100644 --- a/src/guiDeathScreen.cpp +++ b/src/guiDeathScreen.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 82ee1eb46..261053a51 100644 --- a/src/guiDeathScreen.h +++ b/src/guiDeathScreen.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ae399a1b8..120d6629a 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 578dd6e01..aee16736e 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a5b82f612..4569f3d9d 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -1,8 +1,8 @@ /* Minetest - Copyright (C) 2010-11 celeron55, Perttu Ahola - Copyright (C) 2011 Ciaran Gultnieks - Copyright (C) 2011 teddydestodes + Copyright (C) 2010-2013 celeron55, Perttu Ahola + Copyright (C) 2013 Ciaran Gultnieks + Copyright (C) 2013 teddydestodes 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 104af9502..2b498676b 100644 --- a/src/guiKeyChangeMenu.h +++ b/src/guiKeyChangeMenu.h @@ -1,8 +1,8 @@ /* Minetest - Copyright (C) 2010-11 celeron55, Perttu Ahola - Copyright (C) 2011 Ciaran Gultnieks - Copyright (C) 2011 teddydestodes + Copyright (C) 2010-2013 celeron55, Perttu Ahola + Copyright (C) 2013 Ciaran Gultnieks + Copyright (C) 2013 teddydestodes 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 eead3da92..c2e68579e 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-12 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 0a4292b06..a21f3b32a 100644 --- a/src/guiMainMenu.h +++ b/src/guiMainMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 ce3bfe713..abb31cf2d 100644 --- a/src/guiMessageMenu.cpp +++ b/src/guiMessageMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2eef1d8cd..8ec8e4a41 100644 --- a/src/guiMessageMenu.h +++ b/src/guiMessageMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 4ce1a3636..e4b77b611 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -1,7 +1,7 @@ /* Part of Minetest -Copyright (C) 2011 celeron55, Perttu Ahola -Copyright (C) 2011 Ciaran Gultnieks +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Ciaran Gultnieks 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 05b145202..aecc7076f 100644 --- a/src/guiPasswordChange.h +++ b/src/guiPasswordChange.h @@ -1,7 +1,7 @@ /* Part of Minetest -Copyright (C) 2010-11 celeron55, Perttu Ahola -Copyright (C) 2011 Ciaran Gultnieks +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013 Ciaran Gultnieks 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 2ca9a80fb..dc95eef5b 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 8a4ef931e..25011a34a 100644 --- a/src/guiPauseMenu.h +++ b/src/guiPauseMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 56844228d..f4e3bb5ba 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a532ec008..2fa7ead9e 100644 --- a/src/guiTextInputMenu.h +++ b/src/guiTextInputMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 99b302dd7..cfb89da1c 100644 --- a/src/guiVolumeChange.cpp +++ b/src/guiVolumeChange.cpp @@ -1,7 +1,7 @@ /* Part of Minetest -Copyright (C) 2011 celeron55, Perttu Ahola -Copyright (C) 2011 Ciaran Gultnieks +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Ciaran Gultnieks Copyright (C) 2013 RealBadAngel, Maciej Kasatkin Permission to use, copy, modify, and distribute this software for any diff --git a/src/guiVolumeChange.h b/src/guiVolumeChange.h index 6571640e9..1dcc7fbde 100644 --- a/src/guiVolumeChange.h +++ b/src/guiVolumeChange.h @@ -1,7 +1,7 @@ /* Part of Minetest -Copyright (C) 2010-11 celeron55, Perttu Ahola -Copyright (C) 2011 Ciaran Gultnieks +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013 Ciaran Gultnieks Copyright (C) 2013 RealBadAngel, Maciej Kasatkin Permission to use, copy, modify, and distribute this software for any diff --git a/src/hex.h b/src/hex.h index 88703878e..87a6aecb4 100644 --- a/src/hex.h +++ b/src/hex.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 Jonathan Neuschäfer +Copyright (C) 2013 Jonathan Neuschäfer 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 82896f3c0..7051b611f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 ffe944a13..676088b94 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 5042376c6..08cae6d40 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 eec461f2c..8e2abc961 100644 --- a/src/inventorymanager.h +++ b/src/inventorymanager.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 3cc8c33a2..7ac401837 100644 --- a/src/irr_aabb3d.h +++ b/src/irr_aabb3d.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 9a0492866..5c0d65a30 100644 --- a/src/irr_v2d.h +++ b/src/irr_v2d.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 f5c7a1bfb..7bc73ad10 100644 --- a/src/irr_v3d.h +++ b/src/irr_v3d.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 195c3cc0c..7da1a4bd2 100644 --- a/src/irrlichttypes.h +++ b/src/irrlichttypes.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 6576335ba..2ce19999e 100644 --- a/src/irrlichttypes_bloated.h +++ b/src/irrlichttypes_bloated.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 17f2e298a..a541b1a02 100644 --- a/src/irrlichttypes_extrabloated.h +++ b/src/irrlichttypes_extrabloated.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 6c3bdb5e3..c1ecf762f 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola -Copyright (C) 2011 Kahrl +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013 Kahrl 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 a3054518d..4a9e16966 100644 --- a/src/itemdef.h +++ b/src/itemdef.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola -Copyright (C) 2011 Kahrl +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013 Kahrl 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 3a07e9e02..69678064f 100644 --- a/src/itemgroup.h +++ b/src/itemgroup.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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.cpp b/src/keycode.cpp index 7b3c16332..8aadab2f1 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 7fe5f42d1..65f04d8d7 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 549603495..765c6303a 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 bafd10914..e847e1ce9 100644 --- a/src/light.h +++ b/src/light.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ddb38fffa..0554302e0 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 81b6eb808..f372c787d 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 14c49857b..366d83b64 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 5c9bb1b26..7d8b60b71 100644 --- a/src/log.h +++ b/src/log.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 316da7856..69f06c444 100644 --- a/src/logoutputbuffer.h +++ b/src/logoutputbuffer.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ee6ef00a0..35b079ade 100644 --- a/src/luaentity_common.h +++ b/src/luaentity_common.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 1774641f1..cfd643ac7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 126445b03..daa8c70d2 100644 --- a/src/main.h +++ b/src/main.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 8915dd933..ce7684f11 100644 --- a/src/mainmenumanager.h +++ b/src/mainmenumanager.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 f57aeee88..696d73182 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.h b/src/map.h index 7078dedc0..1c91745c0 100644 --- a/src/map.h +++ b/src/map.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.cpp b/src/mapblock.cpp index a84fdeb6a..a6e9b3951 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2c8d6de66..692b54318 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 1797db22e..f4d57922a 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 7d8abbb8d..5b33990c6 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 a45dcdc3d..a70de8711 100644 --- a/src/mapchunk.h +++ b/src/mapchunk.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 14981f12c..73fe63318 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.h b/src/mapgen.h index 13d17bd58..765ac3bb2 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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_v6.cpp b/src/mapgen_v6.cpp index aad25c6da..dd4452928 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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_v6.h b/src/mapgen_v6.h index 4171ec534..d2f05252b 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 d9bc67081..0513e688c 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 f89d8b0ed..d70764e0e 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 2cba9444f..108effa79 100644 --- a/src/mapsector.cpp +++ b/src/mapsector.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 0f4bcdd3a..88fc76b57 100644 --- a/src/mapsector.h +++ b/src/mapsector.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 4bfbc40c8..c2e6bcaa4 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 062363bb7..cf46e7f8f 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 43f559062..d19b4e27c 100644 --- a/src/modalMenu.h +++ b/src/modalMenu.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 0beebcfbf..75518f2f5 100644 --- a/src/modifiedstate.h +++ b/src/modifiedstate.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 cd3840edd..ac2d9b17d 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 35894b339..9761a9103 100644 --- a/src/mods.h +++ b/src/mods.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 0e6090745..bcddb4515 100644 --- a/src/nameidmapping.cpp +++ b/src/nameidmapping.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 3cb87987d..417c441d2 100644 --- a/src/nameidmapping.h +++ b/src/nameidmapping.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 5b9c64cd4..9a1145a8e 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ade56dadf..b3f972b9b 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 56391a39c..911d86d22 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 1602ef937..5af10d0f0 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 d1043fa51..db5fb08b6 100644 --- a/src/nodetimer.cpp +++ b/src/nodetimer.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 1f2f2e6f3..bdbd32293 100644 --- a/src/nodetimer.h +++ b/src/nodetimer.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 c0d3fe163..d250882e8 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 74e89a90f..c2a85771c 100644 --- a/src/noise.h +++ b/src/noise.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 c02203a81..6086bf09f 100644 --- a/src/object_properties.cpp +++ b/src/object_properties.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 e1604b487..bde38bd66 100644 --- a/src/object_properties.h +++ b/src/object_properties.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a1f5739de..fef21d91b 100644 --- a/src/particles.cpp +++ b/src/particles.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a9d189e4e..b317549e7 100644 --- a/src/particles.h +++ b/src/particles.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2a4f3747a..4c81887be 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 8c9e7e725..496c99532 100644 --- a/src/player.h +++ b/src/player.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 0f702810d..7ad557833 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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.h b/src/porting.h index f98980460..13b715557 100644 --- a/src/porting.h +++ b/src/porting.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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/profiler.h b/src/profiler.h index a3ac41a25..b9fa22485 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 ba0e0c654..d3a7fcae2 100644 --- a/src/quicktune.cpp +++ b/src/quicktune.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a0aa28d8e..566fbfc4d 100644 --- a/src/quicktune.h +++ b/src/quicktune.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 0ec80e48b..16bcc07e8 100644 --- a/src/quicktune_shortcutter.h +++ b/src/quicktune_shortcutter.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 fd60e0302..fe1d59d0c 100644 --- a/src/rollback.cpp +++ b/src/rollback.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 8da03b588..46a76f583 100644 --- a/src/rollback.h +++ b/src/rollback.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 74f3e691c..70a9e9457 100644 --- a/src/rollback_interface.cpp +++ b/src/rollback_interface.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 c18af3076..b2e8f3428 100644 --- a/src/rollback_interface.h +++ b/src/rollback_interface.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a27ac3c9f..4619fa636 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 51ed4a02d..dbacae5ae 100644 --- a/src/script.h +++ b/src/script.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 4d02fc965..7fddcfc68 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 8c48c756f..e94ca781f 100644 --- a/src/scriptapi.h +++ b/src/scriptapi.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 e79342432..118bad467 100644 --- a/src/serialization.cpp +++ b/src/serialization.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 b89997155..defead31e 100644 --- a/src/serialization.h +++ b/src/serialization.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 b1d0b8d46..686a3fea1 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.h b/src/server.h index 157ade086..26973643a 100644 --- a/src/server.h +++ b/src/server.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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.cpp b/src/serverlist.cpp index 77b0ceef1..b5e6aad4e 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 7aae32de1..e81e64c5b 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 af77d466c..beb17d31f 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 c5ae6aa8e..6525270f6 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 db4f07eea..7ac308cc0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 b05aad7a4..7e3d16e8b 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola -Copyright (C) 2012 Kahrl +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Kahrl 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 c39602cc0..a7367eaff 100644 --- a/src/shader.h +++ b/src/shader.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola -Copyright (C) 2012 Kahrl +Copyright (C) 2013 celeron55, Perttu Ahola +Copyright (C) 2013 Kahrl 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 6b9168fc6..7b7295e4e 100644 --- a/src/sky.h +++ b/src/sky.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 997a80c44..9e289baa2 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2617c03bd..994a07e45 100644 --- a/src/socket.h +++ b/src/socket.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 1e884e43a..707065043 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 1f9b7d6e1..c21401e8b 100644 --- a/src/sound.h +++ b/src/sound.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 069641b74..cc5261eae 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola OpenAL support based on work by: Copyright (C) 2011 Sebastian 'Bahamada' Rühl Copyright (C) 2011 Cyriaque 'Cisoun' Skrapits diff --git a/src/sound_openal.h b/src/sound_openal.h index d3ddfb766..13d01a5d6 100644 --- a/src/sound_openal.h +++ b/src/sound_openal.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 00d846ba5..48fadaf06 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 ca358236c..c8427fe47 100644 --- a/src/staticobject.h +++ b/src/staticobject.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 dcd65f6cd..d28aa73b2 100644 --- a/src/strfnd.h +++ b/src/strfnd.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 a22f03bc2..3c8bf53c5 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2012 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 fa6d70cee..8561c1a52 100644 --- a/src/subgame.h +++ b/src/subgame.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 c7c97989f..f988b34f7 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 606a1c289..547e9a986 100644 --- a/src/test.h +++ b/src/test.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 2ffc5eb1b..a3717a1de 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 0936ba8e9..7286293d8 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 068defbb2..07e5bcb56 100644 --- a/src/tile.h +++ b/src/tile.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 b452a00f6..04f19749c 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2011 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 315a51bac..e812a9e36 100644 --- a/src/tool.h +++ b/src/tool.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 400377838..7b6152329 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola , +Copyright (C) 2010-2013 celeron55, Perttu Ahola , 2012-2013 RealBadAngel, Maciej Kasatkin 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 18adff859..ca4d3e23d 100644 --- a/src/treegen.h +++ b/src/treegen.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola , +Copyright (C) 2010-2013 celeron55, Perttu Ahola , 2012-2013 RealBadAngel, Maciej Kasatkin 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 15c877fde..775372649 100644 --- a/src/util/container.h +++ b/src/util/container.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 54f8edf9e..d6c154842 100644 --- a/src/util/directiontables.cpp +++ b/src/util/directiontables.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 4e26eae3e..0dd3aab09 100644 --- a/src/util/directiontables.h +++ b/src/util/directiontables.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 2d6afc3c6..a79454628 100644 --- a/src/util/numeric.cpp +++ b/src/util/numeric.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 5ef014ff9..450a98e40 100644 --- a/src/util/numeric.h +++ b/src/util/numeric.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 d5cc81003..dc39e313a 100644 --- a/src/util/pointedthing.cpp +++ b/src/util/pointedthing.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 aab7a1043..2b2703e98 100644 --- a/src/util/pointedthing.h +++ b/src/util/pointedthing.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 96f4c656b..f65683332 100644 --- a/src/util/pointer.h +++ b/src/util/pointer.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 c1e99c7eb..f32813551 100644 --- a/src/util/serialize.cpp +++ b/src/util/serialize.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 b0e93ad26..b297786e6 100644 --- a/src/util/serialize.h +++ b/src/util/serialize.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 e151abefc..3bd8b7364 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 b655ce25c..2f0264bd4 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 db8e0b89e..949bb4204 100644 --- a/src/util/thread.h +++ b/src/util/thread.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 42a248dc6..910fea822 100644 --- a/src/util/timetaker.cpp +++ b/src/util/timetaker.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 75542f433..0b9d9ca04 100644 --- a/src/util/timetaker.h +++ b/src/util/timetaker.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 be504f983..0ff5305fa 100644 --- a/src/voxel.cpp +++ b/src/voxel.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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.h b/src/voxel.h index 79155a0f6..b48943624 100644 --- a/src/voxel.h +++ b/src/voxel.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2013 celeron55, Perttu Ahola 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 c9aff019e..bd8f816b8 100644 --- a/src/voxelalgorithms.cpp +++ b/src/voxelalgorithms.cpp @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 7a88caf2f..2a5fc394e 100644 --- a/src/voxelalgorithms.h +++ b/src/voxelalgorithms.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Copyright (C) 2010-2013 celeron55, Perttu Ahola 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 -- cgit v1.2.3 From b9d8e59bbf727fcc1a073bbf27e5d1703b9490ef Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 13 Feb 2013 22:43:15 -0500 Subject: Add emerge.cpp, initial EmergeThread changes - Neatly placed all emerge related code into a new file, emerge.cpp - Greatly cleaned up the code in EmergeThread::Thread() - Reworked Emerge queue. Now an actual std::queue of v3s16 block positions - Removed the completely unnecessary map of peer ids requesting blocks --- src/CMakeLists.txt | 1 + src/emerge.cpp | 677 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/emerge.h | 122 ++++++++++ src/environment.h | 1 - src/jthread/jmutex.h | 50 ++++ src/map.cpp | 1 + src/map.h | 4 +- src/mapgen.cpp | 153 ------------ src/mapgen.h | 52 +--- src/mapgen_v6.cpp | 1 + src/server.cpp | 345 ++------------------------ src/server.h | 39 +-- 12 files changed, 886 insertions(+), 560 deletions(-) create mode 100644 src/emerge.cpp create mode 100644 src/emerge.h (limited to 'src/server.cpp') 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/emerge.cpp b/src/emerge.cpp new file mode 100644 index 000000000..728ea7196 --- /dev/null +++ b/src/emerge.cpp @@ -0,0 +1,677 @@ +/* +Minetest-c55 +Copyright (C) 2010-2011 celeron55, Perttu Ahola + +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 +#include +#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" + + +EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) { + //register built-in mapgens + registerMapgen("v6", new MapgenFactoryV6()); + + this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef); + this->params = NULL; + this->mapgen = NULL; + + queuemutex.Init(); + emergethread = new EmergeThread((Server *)gamedef); +} + + +EmergeManager::~EmergeManager() { + emergethread->setRun(false); + emergethread->stop(); + + delete emergethread; + 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; +} + + +bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate) { ///return false if adding failed, or queue full! + u8 flags = 0; + + if (allow_generate) + flags |= BLOCK_EMERGE_ALLOWGEN; + + //TODO: + // add logic to select which emergethread to add it to + // - one with the least queue contents? + // - if a queue is too full, move onto another one + // - use the peer id sometime + + { + JMutexAutoLock queuelock(queuemutex); + + std::map::const_iterator iter = blocks_enqueued.find(p); + if (iter != blocks_enqueued.end()) { + flags |= iter->second; + blocks_enqueued[p] = flags; + return true; + } + + blocks_enqueued.insert(std::make_pair(p, flags)); + emergethread->blockqueue.push(p); + } + emergethread->qevent.signal(); + + return true; +} + + +bool EmergeManager::popBlockEmerge(v3s16 *pos, u8 *flags) { + JMutexAutoLock queuelock(queuemutex); + + if (emergethread->blockqueue.empty()) + return false; + v3s16 p = emergethread->blockqueue.front(); + emergethread->blockqueue.pop(); + + *pos = p; + + std::map::iterator iter = blocks_enqueued.find(p); + if (iter == blocks_enqueued.end()) //uh oh, this isn't right!!!!!!!!!!!!!!!!!! + return false; + + *flags = iter->second; + blocks_enqueued.erase(iter); + + return true; +} + + +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::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::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->getS32("mg_flags"); + + 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; +} + + + +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; +}; + + +#if 1 + +#define EMERGE_DBG_OUT(x) \ + { if (enable_mapgen_debug_info) \ + infostream << "EmergeThread: " x << std::endl; } + +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"); + map->initBlockMake(data, p); + return true; + } + + *b = block; + return false; +} + + +void *EmergeThread::Thread() { + ThreadStarted(); + log_register_thread("EmergeThread"); + 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->getMapgen(); + + while (getRun()) + try { + while (!emerge->popBlockEmerge(&p, &flags)) + qevent.wait(); + + 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 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::make_block (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::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 "<setAsyncFatalError(err.str()); + } + catch (SerializationError &e) { + std::ostringstream err; + err << "Invalid data in MapBlock "<setAsyncFatalError(err.str()); + } + + END_DEBUG_EXCEPTION_HANDLER(errorstream) + log_deregister_thread(); + return NULL; +} + +#else + +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(); + + while(getRun()) + try { + QueuedBlockEmerge *qptr = m_server->m_emerge_queue.pop(); + if(qptr == NULL) + break; + SharedPtr 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"<::Iterator i; + for (i=q->s.getIterator(); !i.atEnd(); i++) { + u8 flags = i.getNode()->getValue(); + if (!(flags & BLOCK_EMERGE_FLAG_FROMDISK)) { + only_from_disk = false; + break; + } + } + } + + if (enable_mapgen_debug_info) + infostream<<"EmergeThread: p=" + <<"("<isGenerated() == false)){ + if(enable_mapgen_debug_info) + infostream<<"EmergeThread: generating"<makeChunk(&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 + */ + 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 "<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::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); + } + } + + +niters++; + } + catch (VersionMismatchException &e) { + std::ostringstream err; + err << "World data version mismatch in MapBlock "<setAsyncFatalError(err.str()); + } + catch (SerializationError &e) { + std::ostringstream err; + err << "Invalid data in MapBlock "<setAsyncFatalError(err.str()); + } +printf("emergethread iterated %d times\n", niters); + END_DEBUG_EXCEPTION_HANDLER(errorstream) + log_deregister_thread(); + return NULL; +} + +#endif diff --git a/src/emerge.h b/src/emerge.h new file mode 100644 index 000000000..0acc89a6d --- /dev/null +++ b/src/emerge.h @@ -0,0 +1,122 @@ +#ifndef EMERGE_HEADER +#define EMERGE_HEADER + +#include +#include +#include "util/thread.h" + +#define BLOCK_EMERGE_ALLOWGEN (1<<0) + +class Mapgen; +class MapgenParams; +class MapgenFactory; +class Biome; +class BiomeDefManager; +class EmergeThread; +class ManualMapVoxelManipulator; +//class ServerMap; +//class MapBlock; + +#include "server.h" + +struct BlockMakeData { + bool no_op; + ManualMapVoxelManipulator *vmanip; + u64 seed; + v3s16 blockpos_min; + v3s16 blockpos_max; + v3s16 blockpos_requested; + UniqueQueue transforming_liquid; + INodeDefManager *nodedef; + +// BlockMakeData(); +// ~BlockMakeData(); + +BlockMakeData(): + no_op(false), + vmanip(NULL), + seed(0), + nodedef(NULL) +{} + +~BlockMakeData() +{ + delete vmanip; +} +}; + +class EmergeManager { +public: + std::map mglist; + + //settings + MapgenParams *params; + + JMutex queuemutex; + std::map blocks_enqueued; //change to a hashtable later + Mapgen *mapgen; + EmergeThread *emergethread; + + //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(); + bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate); + bool popBlockEmerge(v3s16 *pos, u8 *flags); + + 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; + +public: + Event qevent; + std::queue blockqueue; + + EmergeThread(Server *server): + SimpleThread(), + m_server(server), + map(NULL), + emerge(NULL), + mapgen(NULL) + { + enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info"); + } + + void *Thread(); + + void trigger() + { + setRun(true); + if(IsRunning() == false) + { + Start(); + } + } + + bool getBlockOrStartGen(v3s16 p, MapBlock **b, + BlockMakeData *data, bool allow_generate); +}; + +#endif diff --git a/src/environment.h b/src/environment.h index a79ccc63d..07a4d7635 100644 --- a/src/environment.h +++ b/src/environment.h @@ -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/jthread/jmutex.h b/src/jthread/jmutex.h index 9ce013096..6675162a5 100644 --- a/src/jthread/jmutex.h +++ b/src/jthread/jmutex.h @@ -67,4 +67,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 + +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/map.cpp b/src/map.cpp index 696d73182..7eb45463f 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -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<<")" diff --git a/src/map.h b/src/map.h index 1c91745c0..0b2311f39 100644 --- a/src/map.h +++ b/src/map.h @@ -46,6 +46,8 @@ class MapBlock; class NodeMetadata; class IGameDef; class IRollbackReportSink; +class EmergeManager; +class BlockMakeData; /* @@ -378,7 +380,7 @@ public: Blocks are generated by using these and makeBlock(). */ void initBlockMake(BlockMakeData *data, v3s16 blockpos); - MapBlock* finishBlockMake(BlockMakeData *data, + MapBlock *finishBlockMake(BlockMakeData *data, core::map &changed_blocks); // A non-threaded wrapper to the above - DEFUNCT diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 73fe63318..ef5da6bf1 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -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::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::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 765ac3bb2..c3c209ad1 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapnode.h" #include "noise.h" #include "settings.h" +//#include "emerge.h" #include /////////////////// Mapgen flags @@ -36,6 +37,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 +46,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 transforming_liquid; - INodeDefManager *nodedef; - - BlockMakeData(); - ~BlockMakeData(); -}; +class BlockMakeData; struct MapgenParams { std::string mg_name; @@ -99,39 +89,5 @@ struct MapgenFactory { virtual MapgenParams *createMapgenParams() = 0; }; -class EmergeManager { -public: - std::map 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 dd4452928..ef2cf5f52 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -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 diff --git a/src/server.cpp b/src/server.cpp index 686a3fea1..f2897d46d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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 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"<::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=" - <<"("<isGenerated() == false)){ - if(enable_mapgen_debug_info) - infostream<<"EmergeThread: generating"<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 "<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::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 "<setAsyncFatalError(err.str()); - } - catch(SerializationError &e) - { - std::ostringstream err; - err<<"Invalid data in MapBlock "<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), @@ -1278,9 +976,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"<emergethread->trigger(); // Update m_enable_rollback_recording here too m_enable_rollback_recording = @@ -3115,8 +2813,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) infostream<<"Server: Not punching: Node not found." <<" Adding block to emerge queue." <enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false); } if(n.getContent() != CONTENT_IGNORE) scriptapi_node_on_punch(m_lua, p_under, n, playersao); @@ -3172,8 +2869,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) infostream<<"Server: Not finishing digging: Node not found." <<" Adding block to emerge queue." <enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false); } /* Cheat prevention */ @@ -4728,10 +4424,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 26973643a..e92cbb564 100644 --- a/src/server.h +++ b/src/server.h @@ -39,6 +39,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "rollback_interface.h" // Needed for rollbackRevertActions() #include // 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 { @@ -120,11 +123,9 @@ public: If it is, update the peer to it and quit. */ core::list::Iterator i; - for(i=m_queue.begin(); i!=m_queue.end(); i++) - { + for(i=m_queue.begin(); i!=m_queue.end(); i++) { QueuedBlockEmerge *q = *i; - if(q->pos == pos) - { + if (q->pos == pos) { q->peer_ids[peer_id] = flags; return; } @@ -136,7 +137,7 @@ public: */ QueuedBlockEmerge *q = new QueuedBlockEmerge; q->pos = pos; - if(peer_id != 0) + if (peer_id != 0) q->peer_ids[peer_id] = flags; m_queue.push_back(q); } @@ -200,30 +201,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,9 +762,9 @@ private: // The server mainly operates in this thread ServerThread m_thread; // This thread fetches and generates map - EmergeThread m_emergethread; + //EmergeThread m_emergethread; // Queue of block coordinates to be processed by the emerge thread - BlockEmergeQueue m_emerge_queue; + //BlockEmergeQueue m_emerge_queue; /* Time related stuff -- cgit v1.2.3 From 5ec5b1cbd64a22e628be2cf03391883c44074811 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 17 Feb 2013 01:47:49 -0500 Subject: Add multi-Emerge thread support --- src/defaultsettings.cpp | 1 + src/emerge.cpp | 99 ++++++++++++++++++++++++++++++------------------- src/emerge.h | 15 ++++---- src/map.cpp | 65 +++++++++++++++++++++++++------- src/map.h | 13 ++++--- src/porting.cpp | 23 ++++++++++++ src/porting.h | 5 +++ src/server.cpp | 3 +- 8 files changed, 160 insertions(+), 64 deletions(-) (limited to 'src/server.cpp') diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index f18e9b1e0..219cda9e7 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -187,6 +187,7 @@ void set_default_settings(Settings *settings) settings->setDefault("emergequeue_limit_total", "256"); settings->setDefault("emergequeue_limit_diskonly", "5"); settings->setDefault("emergequeue_limit_generate", "1"); + settings->setDefault("num_emerge_threads", ""); // physics stuff settings->setDefault("movement_acceleration_default", "3"); diff --git a/src/emerge.cpp b/src/emerge.cpp index b785c8688..ee6650f9c 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -47,49 +47,56 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) { this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef); this->params = NULL; - this->mapgen = NULL; qlimit_total = g_settings->getU16("emergequeue_limit_total"); qlimit_diskonly = g_settings->getU16("emergequeue_limit_diskonly"); qlimit_generate = g_settings->getU16("emergequeue_limit_generate"); queuemutex.Init(); - emergethread = new EmergeThread((Server *)gamedef); + int nthreads = g_settings->get("num_emerge_threads").empty() ? + porting::getNumberOfProcessors() : + g_settings->getU16("num_emerge_threads"); + if (nthreads < 1) + nthreads = 1; + + for (int i = 0; i != nthreads; i++) + emergethread.push_back(new EmergeThread((Server *)gamedef, i)); + + infostream << "EmergeManager: using " << nthreads << " threads" << std::endl; } EmergeManager::~EmergeManager() { - emergethread->setRun(false); - emergethread->qevent.signal(); - emergethread->stop(); + 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 emergethread; delete biomedef; - delete mapgen; delete params; } void EmergeManager::initMapgens(MapgenParams *mgparams) { - if (mapgen) + Mapgen *mg; + + if (mapgen.size()) 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) { + 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"); - mapgen = createMapgen("v6", 0, params, this); + mg = createMapgen("v6", 0, params); } + mapgen.push_back(mg); } - return mapgen; } @@ -98,6 +105,7 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate BlockEmergeData *bedata; u16 count; u8 flags = 0; + int idx = 0; if (allow_generate) flags |= BLOCK_EMERGE_ALLOWGEN; @@ -128,45 +136,58 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate peer_queue_count[peer_id] = count + 1; - emergethread->blockqueue.push(p); + 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->qevent.signal(); + emergethread[idx]->qevent.signal(); return true; } -bool EmergeManager::popBlockEmerge(v3s16 *pos, u8 *flags) { +bool EmergeThread::popBlockEmerge(v3s16 *pos, u8 *flags) { std::map::iterator iter; - JMutexAutoLock queuelock(queuemutex); + JMutexAutoLock queuelock(emerge->queuemutex); - if (emergethread->blockqueue.empty()) + if (blockqueue.empty()) return false; - v3s16 p = emergethread->blockqueue.front(); - emergethread->blockqueue.pop(); + v3s16 p = blockqueue.front(); + blockqueue.pop(); *pos = p; - iter = blocks_enqueued.find(p); - if (iter == blocks_enqueued.end()) + 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; - peer_queue_count[bedata->peer_requested]--; + emerge->peer_queue_count[bedata->peer_requested]--; delete bedata; - blocks_enqueued.erase(iter); + emerge->blocks_enqueued.erase(iter); return true; } int EmergeManager::getGroundLevelAtPoint(v2s16 p) { - if (!mapgen) + if (!mapgen[0]) { + errorstream << "EmergeManager: getGroundLevelAtPoint() called" + " before mapgen initialized" << std::endl; return 0; - return mapgen->getGroundLevelAtPoint(p); + } + + return mapgen[0]->getGroundLevelAtPoint(p); } @@ -193,8 +214,9 @@ u32 EmergeManager::getBlockSeed(v3s16 p) { Mapgen *EmergeManager::createMapgen(std::string mgname, int mgid, - MapgenParams *mgparams, EmergeManager *emerge) { - std::map::const_iterator iter = mglist.find(mgname); + MapgenParams *mgparams) { + std::map::const_iterator iter; + iter = mglist.find(mgname); if (iter == mglist.end()) { errorstream << "EmergeManager; mapgen " << mgname << " not registered" << std::endl; @@ -202,12 +224,13 @@ Mapgen *EmergeManager::createMapgen(std::string mgname, int mgid, } MapgenFactory *mgfactory = iter->second; - return mgfactory->createMapgen(mgid, mgparams, emerge); + return mgfactory->createMapgen(mgid, mgparams, this); } MapgenParams *EmergeManager::createMapgenParams(std::string mgname) { - std::map::const_iterator iter = mglist.find(mgname); + std::map::const_iterator iter; + iter = mglist.find(mgname); if (iter == mglist.end()) { errorstream << "EmergeManager: mapgen " << mgname << " not registered" << std::endl; @@ -227,7 +250,7 @@ MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) { 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->getS32("mg_flags"); + mgparams->flags = settings->getFlagStr("mg_flags", flagdesc_mapgen); if (!mgparams->readParams(settings)) { delete mgparams; @@ -354,11 +377,11 @@ void *EmergeThread::Thread() { map = (ServerMap *)&(m_server->m_env->getMap()); emerge = m_server->m_emerge; - mapgen = emerge->getMapgen(); + mapgen = emerge->mapgen[id]; //emerge->getMapgen(); while (getRun()) try { - while (!emerge->popBlockEmerge(&p, &flags)) { + while (!popBlockEmerge(&p, &flags)) { qevent.wait(); if (!getRun()) goto exit_emerge_loop; diff --git a/src/emerge.h b/src/emerge.h index b4461ae61..7e0cc4850 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -46,8 +46,8 @@ class EmergeManager { public: std::map mglist; - Mapgen *mapgen; - EmergeThread *emergethread; + std::vector mapgen; + std::vector emergethread; //settings MapgenParams *params; @@ -68,11 +68,9 @@ public: void initMapgens(MapgenParams *mgparams); Mapgen *createMapgen(std::string mgname, int mgid, - MapgenParams *mgparams, EmergeManager *emerge); + MapgenParams *mgparams); MapgenParams *createMapgenParams(std::string mgname); - Mapgen *getMapgen(); bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate); - bool popBlockEmerge(v3s16 *pos, u8 *flags); bool registerMapgen(std::string name, MapgenFactory *mgfactory); MapgenParams *getParamsFromSettings(Settings *settings); @@ -92,17 +90,19 @@ class EmergeThread : public SimpleThread EmergeManager *emerge; Mapgen *mapgen; bool enable_mapgen_debug_info; + int id; public: Event qevent; std::queue blockqueue; - EmergeThread(Server *server): + EmergeThread(Server *server, int ethreadid): SimpleThread(), m_server(server), map(NULL), emerge(NULL), - mapgen(NULL) + mapgen(NULL), + id(ethreadid) { enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info"); } @@ -118,6 +118,7 @@ public: } } + bool popBlockEmerge(v3s16 *pos, u8 *flags); bool getBlockOrStartGen(v3s16 p, MapBlock **b, BlockMakeData *data, bool allow_generate); }; diff --git a/src/map.cpp b/src/map.cpp index 7eb45463f..a8928d864 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2009,7 +2009,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()) @@ -2246,6 +2246,21 @@ 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::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. } @@ -3672,8 +3687,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::Node *n; + core::map::Node *n; n = m_loaded_blocks.find(p); if(n != NULL) continue; @@ -3689,7 +3706,7 @@ void MapVoxelManipulator::emerge(VoxelArea a, s32 caller_id) a.print(infostream); infostream<getBlockNoCreate(p); + block = m_map->getBlockNoCreate(p); if(block->isDummy()) block_data_inexistent = true; else @@ -3702,6 +3719,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++) @@ -3711,8 +3730,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"<::Node *n; + core::map::Node *n; n = m_loaded_blocks.find(p); if(n != NULL) continue; @@ -3843,7 +3869,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 @@ -3856,6 +3882,8 @@ void ManualMapVoxelManipulator::initialEmerge( if(block_data_inexistent) { + flags |= VMANIP_BLOCK_DATA_INEXIST; + /* Mark area inexistent */ @@ -3868,8 +3896,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); } } @@ -3882,12 +3915,14 @@ void ManualMapVoxelManipulator::blitBackAll( /* Copy data of all blocks */ - for(core::map::Iterator + for(core::map::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 @@ -3896,6 +3931,7 @@ void ManualMapVoxelManipulator::blitBackAll( <getBlockNoCreateNoEx(p); if(block == NULL) { @@ -3906,10 +3942,13 @@ void ManualMapVoxelManipulator::blitBackAll( continue; } - block->copyFrom(*this); - - if(modified_blocks) - modified_blocks->insert(p, block); + bool no_content_ignore = !(flags & VMANIP_BLOCK_CONTAINS_CIGNORE); + if (no_content_ignore) + { + block->copyFrom(*this); + if(modified_blocks) + modified_blocks->insert(p, block); + } } } diff --git a/src/map.h b/src/map.h index 0b2311f39..1062f8301 100644 --- a/src/map.h +++ b/src/map.h @@ -517,6 +517,9 @@ private: sqlite3_stmt *m_database_list; }; +#define VMANIP_BLOCK_DATA_INEXIST 1 +#define VMANIP_BLOCK_CONTAINS_CIGNORE 2 + class MapVoxelManipulator : public VoxelManipulator { public: @@ -532,14 +535,14 @@ public: virtual void emerge(VoxelArea a, s32 caller_id=-1); void blitBack(core::map & modified_blocks); - -protected: - Map *m_map; + /* key = blockpos - value = block existed when loaded + value = flags describing the block */ - core::map m_loaded_blocks; + core::map m_loaded_blocks; +protected: + Map *m_map; }; class ManualMapVoxelManipulator : public MapVoxelManipulator diff --git a/src/porting.cpp b/src/porting.cpp index 7ad557833..58d71e4aa 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -131,6 +131,29 @@ 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 +} + /* Path mangler */ diff --git a/src/porting.h b/src/porting.h index 13b715557..53aad6171 100644 --- a/src/porting.h +++ b/src/porting.h @@ -103,6 +103,11 @@ std::string getDataPath(const char *subpath); */ void initializePaths(); +/* + Get number of online processors in the system. +*/ +int getNumberOfProcessors(); + /* Resolution is 10-20ms. Remember to check for overflows. diff --git a/src/server.cpp b/src/server.cpp index f2897d46d..5021718a3 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1649,7 +1649,8 @@ void Server::AsyncRunStep() { counter = 0.0; - m_emerge->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 = -- cgit v1.2.3 From d31f07bd4b83f858cce589faac56922e12ba670f Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 26 Feb 2013 01:57:59 -0500 Subject: Fix most warnings, re-fix MSVC compile error --- src/base64.h | 2 +- src/content_cso.cpp | 2 ++ src/emerge.cpp | 10 +++++----- src/emerge.h | 2 +- src/game.cpp | 4 ++-- src/map.cpp | 2 +- src/noise.cpp | 4 ++-- src/server.cpp | 2 +- src/test.cpp | 2 +- src/util/serialize.h | 11 ++++++----- 10 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src/server.cpp') diff --git a/src/base64.h b/src/base64.h index 5f2d6743d..1cb175518 100644 --- a/src/base64.h +++ b/src/base64.h @@ -7,4 +7,4 @@ bool base64_is_valid(std::string const& s); std::string base64_encode(unsigned char const* , unsigned int len); std::string base64_decode(std::string const& s); -#endif // BASE64_HEADER \ No newline at end of file +#endif // BASE64_HEADER diff --git a/src/content_cso.cpp b/src/content_cso.cpp index 20eb88b7d..73d5f2b48 100644 --- a/src/content_cso.cpp +++ b/src/content_cso.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #include "map.h" +/* static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill, float txs, float tys, int col, int row) { @@ -33,6 +34,7 @@ static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill, matrix.setTextureTranslate(txs*col, tys*row); matrix.setTextureScale(txs, tys); } +*/ class SmokePuffCSO: public ClientSimpleObject { diff --git a/src/emerge.cpp b/src/emerge.cpp index 250c44fbb..6c6863eff 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -58,7 +58,7 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) { 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; + nthreads = (nprocs > 2) ? nprocs - 2 : 1; } else { nthreads = g_settings->getU16("num_emerge_threads"); } @@ -81,7 +81,7 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) { EmergeManager::~EmergeManager() { - for (int i = 0; i != emergethread.size(); i++) { + for (unsigned int i = 0; i != emergethread.size(); i++) { emergethread[i]->setRun(false); emergethread[i]->qevent.signal(); emergethread[i]->stop(); @@ -101,7 +101,7 @@ void EmergeManager::initMapgens(MapgenParams *mgparams) { return; this->params = mgparams; - for (int i = 0; i != emergethread.size(); i++) { + for (unsigned 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; @@ -152,7 +152,7 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate // insert into the EmergeThread queue with the least items int lowestitems = emergethread[0]->blockqueue.size(); - for (int i = 1; i != emergethread.size(); i++) { + for (unsigned int i = 1; i != emergethread.size(); i++) { int nitems = emergethread[i]->blockqueue.size(); if (nitems < lowestitems) { idx = i; @@ -259,7 +259,7 @@ void EmergeManager::setParamsToSettings(Settings *settings) { } -bool EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) { +void EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) { mglist.insert(std::make_pair(mgname, mgfactory)); infostream << "EmergeManager: registered mapgen " << mgname << std::endl; } diff --git a/src/emerge.h b/src/emerge.h index e5014df58..70b67e731 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -75,7 +75,7 @@ public: MapgenParams *createMapgenParams(std::string mgname); bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate); - bool registerMapgen(std::string name, MapgenFactory *mgfactory); + void registerMapgen(std::string name, MapgenFactory *mgfactory); MapgenParams *getParamsFromSettings(Settings *settings); void setParamsToSettings(Settings *settings); diff --git a/src/game.cpp b/src/game.cpp index 8ab0f3fe3..1ae29b13b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2816,12 +2816,12 @@ void the_game( char temptext[300]; snprintf(temptext, 300, "(% .1f, % .1f, % .1f)" - " (yaw = %.1f) (seed = %lli)", + " (yaw = %.1f) (seed = %llu)", player_position.X/BS, player_position.Y/BS, player_position.Z/BS, wrapDegrees_0_360(camera_yaw), - client.getMapSeed()); + (unsigned long long)client.getMapSeed()); guitext2->setText(narrow_to_wide(temptext).c_str()); guitext2->setVisible(true); diff --git a/src/map.cpp b/src/map.cpp index 07af2676b..4be094326 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3283,7 +3283,7 @@ void ServerMap::save(ModifiedState save_level) block_count_all++; - if(block->getModified() >= save_level) + if(block->getModified() >= (u32)save_level) { // Lazy beginSave() if(!save_started){ diff --git a/src/noise.cpp b/src/noise.cpp index d250882e8..49b5f7e58 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -507,7 +507,7 @@ void Noise::gradientMap3D(float x, float y, float z, float *Noise::perlinMap2D(float x, float y) { - float a = 0.0, f = 1.0, g = 1.0; + float f = 1.0, g = 1.0; int i, j, index, oct; x /= np->spread.X; @@ -537,7 +537,7 @@ float *Noise::perlinMap2D(float x, float y) { float *Noise::perlinMap3D(float x, float y, float z) { - float a = 0.0, f = 1.0, g = 1.0; + float f = 1.0, g = 1.0; int i, j, k, index, oct; x /= np->spread.X; diff --git a/src/server.cpp b/src/server.cpp index 2d00cf4ac..41a7a4289 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1652,7 +1652,7 @@ void Server::AsyncRunStep() { counter = 0.0; - for (int i = 0; i != m_emerge->emergethread.size(); i++) + for (unsigned int i = 0; i != m_emerge->emergethread.size(); i++) m_emerge->emergethread[i]->trigger(); // Update m_enable_rollback_recording here too diff --git a/src/test.cpp b/src/test.cpp index f988b34f7..d86868118 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -462,7 +462,7 @@ struct TestCompress: public TestBase <