diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-01-08 17:34:25 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-01-08 17:34:25 +0200 |
commit | 9fbb0889a7a73d3e879f76aa4c398dcb78c532ed (patch) | |
tree | 9169e3659112cc35166c2122aaa4ef07c5366415 | |
parent | 426c206d7e08ac4c5b45ec51450d02aa26b8eebd (diff) | |
download | minetest-9fbb0889a7a73d3e879f76aa4c398dcb78c532ed.tar.gz minetest-9fbb0889a7a73d3e879f76aa4c398dcb78c532ed.tar.bz2 minetest-9fbb0889a7a73d3e879f76aa4c398dcb78c532ed.zip |
CMake stuff works now on linux and windows... and should be possible to make to work on OS X.
-rw-r--r-- | CMakeLists.txt | 64 | ||||
-rw-r--r-- | cmake/Modules/FindIrrlicht.cmake | 58 | ||||
-rw-r--r-- | cmake/Modules/misc.cmake | 16 | ||||
-rw-r--r-- | doc/README.txt | 86 | ||||
-rw-r--r-- | minetest.conf.example | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 177 | ||||
-rw-r--r-- | src/main.cpp | 20 | ||||
-rw-r--r-- | src/porting.cpp | 17 | ||||
-rw-r--r-- | src/servermain.cpp | 21 |
9 files changed, 363 insertions, 98 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 53999e022..24cb78f39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,72 @@ if(${CMAKE_VERSION} STREQUAL "2.8.2") message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!") endif(${CMAKE_VERSION} STREQUAL "2.8.2") -set(CMAKE_BUILD_TYPE Debug) +# This can be read from ${PROJECT_NAME} after project() is called +project(minetest) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake) + +# Default to Release +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) +endif() + +# Configuration + +set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure") -# This is done here so that IRRDIR is relative to the typical cmake call directory +set(BUILD_CLIENT 1 CACHE BOOL "Build client") +set(BUILD_SERVER 1 CACHE BOOL "Build server") + +# Get date and time +GETDATETIME(BUILD_DATE) +MESSAGE(STATUS "BUILD_DATE = ${BUILD_DATE}") + +# This is done here so that relative search paths are more reasnable find_package(Irrlicht) # This way the CMakeLists.txt file in src/ is processed add_subdirectory(src) +install(FILES "doc/README.txt" DESTINATION "share/minetest/doc") + +# CPack + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game") +set(CPACK_PACKAGE_VERSION_MAJOR 0) +set(CPACK_PACKAGE_VERSION_MINOR 0) +set(CPACK_PACKAGE_VERSION_PATCH 0) +set(CPACK_PACKAGE_VENDOR "celeron55") +set(CPACK_PACKAGE_FILE_NAME "minetest-${BUILD_DATE}") + +if(WIN32) + # For some reason these aren't copied otherwise + if(BUILD_CLIENT) + install(FILES bin/minetest.exe DESTINATION bin) + endif() + if(BUILD_SERVER) + install(FILES bin/minetestserver.exe DESTINATION bin) + endif() + + set(CPACK_GENERATOR ZIP) + + # This might be needed for some installer + #set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server") +elseif(APPLE) + # TODO + # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29 + set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}) + set(CPACK_PACKAGE_ICON "") + set(CPACK_BUNDLE_NAME ${PROJECT_NAME}) + set(CPACK_BUNDLE_ICON "") + set(CPACK_BUNDLE_PLIST "") + set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest") + set(CPACK_GENERATOR BUNDLE) +else() + set(CPACK_GENERATOR TGZ) + set(CPACK_SOURCE_GENERATOR TGZ) +endif() + +include(CPack) + diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake index c39a8cbfb..246e72cfb 100644 --- a/cmake/Modules/FindIrrlicht.cmake +++ b/cmake/Modules/FindIrrlicht.cmake @@ -1,28 +1,54 @@ -MESSAGE(STATUS "IRRDIR = $ENV{IRRDIR}") +#FindIrrlicht.cmake + +set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)") + +if( UNIX ) + # Unix +else( UNIX ) + # Windows +endif( UNIX ) + +# Find include directory FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h - PATHS - $ENV{IRRDIR}/include - /usr/local/include/irrlicht - /usr/include/irrlicht + PATHS + /usr/local/include/irrlicht + /usr/include/irrlicht + "${IRRLICHT_SOURCE_DIR}/include" ) -MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") +# Find library directory FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht - PATHS - $ENV{IRRDIR}/lib - $ENV{IRRDIR}/lib/Linux - $ENV{IRRDIR}/lib/MacOSX - $ENV{IRRDIR}/lib/Win32-gcc - $ENV{IRRDIR}/lib/Win32-visualstudio - $ENV{IRRDIR}/lib/Win64-visualstudio - /usr/local/lib - /usr/lib + PATHS + /usr/local/lib + /usr/lib + #${IRRLICHT_PLATFORM_DIR} + "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio" + "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc" ) +MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}") +# On windows, find the dll for installation +if(WIN32) + if(MSVC) + FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll + PATHS + "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio" + DOC "Path of the Irrlicht dll (for installation)" + ) + else() + FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll + PATHS + "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc" + DOC "Path of the Irrlicht dll (for installation)" + ) + endif() + MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}") +endif(WIN32) + # handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) @@ -34,5 +60,5 @@ ELSE(IRRLICHT_FOUND) SET(IRRLICHT_LIBRARIES) ENDIF(IRRLICHT_FOUND) -MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) +MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) diff --git a/cmake/Modules/misc.cmake b/cmake/Modules/misc.cmake new file mode 100644 index 000000000..61a7d1407 --- /dev/null +++ b/cmake/Modules/misc.cmake @@ -0,0 +1,16 @@ +MACRO (GETDATETIME RESULT) + IF (WIN32) + EXECUTE_PROCESS(COMMAND "cmd" /C echo %date% %time% OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}") + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d_%H:%M:%S" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}") + ELSE (WIN32) + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} "Unknown") + ENDIF (WIN32) + + string(REGEX REPLACE " " "_" ${RESULT} "${${RESULT}}") + +ENDMACRO (GETDATETIME) + diff --git a/doc/README.txt b/doc/README.txt index 8cfddb2b6..09e5fea05 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -5,67 +5,81 @@ Copyright (c) 2010 Perttu Ahola <celeron55@gmail.com> An InfiniMiner/Minecraft inspired game. +NOTE: This file is somewhat outdated most of the time. + This is a development version: - Don't expect it to work as well as a finished game will. - Please report any bugs to me. That way I can fix them to the next release. - - debug.txt is very useful when the game crashes. + - debug.txt is useful when the game crashes. Public servers: - kray.dy.fi :30000 (friend's server - recommended) - celeron.55.lt :30000 (my own server, kind of unused) -- If you want to run a server, I can list you on my website and in here. + kray.dy.fi :30000 (friend's server) + celeron.55.lt :30000 (my own server) Controls: -- WASD+mouse: Move -- Mouse L: Dig -- Mouse R: Place block -- Mouse Wheel: Change item -- F: Change item -- R: Toggle full view range +- See the in-game pause menu Configuration file: - An optional configuration file can be used. See minetest.conf.example. - Path to file can be passed as a parameter to the executable: --config <path-to-file> -- If not given as a parameter, these are checked, in order: - ../minetest.conf +- Defaults: + - If built with -DRUN_IN_PLACE: + ../minetest.conf + ../../minetest.conf + - Otherwise something like this: + Windows: C:\Documents and Settings\user\Application Data\minetest\minetest.conf + Linux: ~/.minetest/minetest.conf + OS X: ~/Library/Application Support/minetest.conf Command-line options: - Use --help -Running on Windows: -- The working directory should be ./bin - -Running on GNU/Linux: -- fasttest is a linux binary compiled on a recent Arch Linux installation. - It should run on most recent GNU/Linux distributions. -- Browse to the game ./bin directory and type: - LD_LIBRARY_PATH=. ./fasttest -- If it doesn't work, use wine. I aim at 100% compatibility with wine. - Compiling on GNU/Linux: + - You need: -* Irrlicht: - http://downloads.sourceforge.net/irrlicht/irrlicht-1.7.2.zip -* JThread: - http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jthread -* zlib: - - Get the -dev package from your package manager. -- Irrlicht and JThread are very likely not to be found from your distro's - repository. -- Compiling each of them should be fairly unproblematic, though. + * CMake + * Irrlicht + * Zlib + - You can probably find these in your distro's package manager + +- Check possible options: + $ cd whatever/minetest + $ cmake . -LH + +- A system-wide install: + $ cd whatever/minetest + $ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local + $ make -j2 + $ sudo make install + + $ minetest + +- For running in the source directory: + $ cd whatever/minetest + $ cmake . -DRUN_IN_PLACE + $ make -j2 + + $ ./bin/minetest Compiling on Windows: -- You need Irrlicht, JThread and zlib, see above -- Be sure to - #define JMUTEX_CRITICALSECTION - in jmutex.h before compiling it. Otherwise mutexes will be very slow. +- You need CMake, Irrlicht, zlib and Visual Studio or MinGW +- NOTE: Probably it will not work easily and you will need to fix some stuff. +- Steps: + - Start up the CMake GUI + - Select your compiler + - Hit "Configure" + - Set up some options and paths + - Hit "Configure" + - Hit "Generate" + - VC: Open the generated .sln and build it + - MinGW: Browse to the build directory and run 'make' License of Minetest-c55 ----------------------- Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com> +Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/minetest.conf.example b/minetest.conf.example index 48754c57f..4ce3b81e2 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -27,6 +27,8 @@ # Server side stuff +#map-dir = /home/palle/custom_map + # - The possible generators are: # (Indeed you can do all of them with only "power" 8)) # H=value: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72a159f16..083395271 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,19 +1,37 @@ project(minetest) cmake_minimum_required( VERSION 2.6 ) -set ( CMAKE_BUILD_TYPE Debug ) -add_definitions ( -Wall -DRUN_IN_PLACE -O2) -find_package(ZLIB REQUIRED) -find_package(X11 REQUIRED) -find_package(OpenGL REQUIRED) -find_package(JPEG REQUIRED) -find_package(BZip2 REQUIRED) -if( UNIX ) - #set( platform_SRCS some_necessary_linux_file.cpp ) -else( UNIX ) - #windows - #set( platform_SRCS dllmain.cpp stdafx.cpp ) -endif( UNIX ) +if(RUN_IN_PLACE) + add_definitions ( -DRUN_IN_PLACE ) +endif(RUN_IN_PLACE) + +if(UNIX) + # Unix + if(BUILD_CLIENT) + find_package(X11 REQUIRED) + find_package(OpenGL REQUIRED) + find_package(JPEG REQUIRED) + find_package(BZip2 REQUIRED) + endif(BUILD_CLIENT) + find_package(ZLIB REQUIRED) + set(SERVER_PLATFORM_LIBS -lpthread) +elseif(WIN32) + # Windows + # Surpress some warnings + add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 ) + # Zlib stuff + set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5" + CACHE PATH "Zlib include directory") + set(ZLIB_LIBRARIES "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.lib" + CACHE PATH "Path to zlibwapi.lib") + set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll" + CACHE PATH "Path to zlibwapi.dll (for installation)") +endif() + +configure_file( + "${PROJECT_SOURCE_DIR}/config.h.in" + "${PROJECT_BINARY_DIR}/config.h" +) set(minetest_SRCS porting.cpp @@ -48,26 +66,135 @@ set(minetest_SRCS test.cpp ) +set(minetestserver_SRCS + porting.cpp + materials.cpp + defaultsettings.cpp + mapnode.cpp + voxel.cpp + mapblockobject.cpp + inventory.cpp + debug.cpp + serialization.cpp + light.cpp + filesys.cpp + connection.cpp + environment.cpp + server.cpp + socket.cpp + mapblock.cpp + mapsector.cpp + heightmap.cpp + map.cpp + player.cpp + utility.cpp + servermain.cpp + test.cpp +) + include_directories( - ${ZLIB_INCLUDE_DIR} + ${PROJECT_BINARY_DIR} ${IRRLICHT_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} + ${CMAKE_BUILD_TYPE} "${PROJECT_SOURCE_DIR}/jthread" ) set(EXECUTABLE_OUTPUT_PATH ../bin) -add_executable(minetest ${minetest_SRCS}) +if(BUILD_CLIENT) + add_executable(minetest ${minetest_SRCS}) + target_link_libraries( + minetest + ${ZLIB_LIBRARIES} + ${IRRLICHT_LIBRARY} + ${OPENGL_LIBRARIES} + ${JPEG_LIBRARIES} + ${BZIP2_LIBRARIES} + jthread + ) +endif(BUILD_CLIENT) +if(BUILD_SERVER) + add_executable(minetestserver ${minetestserver_SRCS}) + target_link_libraries( + minetestserver + ${ZLIB_LIBRARIES} + jthread + ${SERVER_PLATFORM_LIBS} + ) +endif(BUILD_SERVER) -target_link_libraries( - minetest - ${ZLIB_LIBRARIES} - ${IRRLICHT_LIBRARY} - ${OPENGL_LIBRARIES} - ${JPEG_LIBRARIES} - ${BZIP2_LIBRARIES} - jthread -) +# Set some optimizations and tweaks +if( UNIX ) + # Unix + + set(UNIX_FLAGS "-Wall") + + if(BUILD_CLIENT) + set_target_properties(minetest PROPERTIES COMPILE_FLAGS + "${UNIX_FLAGS}") + endif(BUILD_CLIENT) + + if(BUILD_SERVER) + set_target_properties(minetestserver PROPERTIES COMPILE_FLAGS + "${UNIX_FLAGS} -DSERVER") + endif(BUILD_SERVER) + +else( UNIX ) + # Windows + + if(BUILD_CLIENT) + # EHa enables SEH exceptions (used for catching segfaults) + set_target_properties(minetest PROPERTIES COMPILE_FLAGS + "/O2 /Ob2 /Oi /Ot /Oy /GL /EHa") + endif(BUILD_CLIENT) + + if(BUILD_SERVER) + # EHa enables SEH exceptions (used for catching segfaults) + set_target_properties(minetestserver PROPERTIES COMPILE_FLAGS + "/O2 /Ob2 /Oi /Ot /Oy /GL /EHa /D SERVER") + endif(BUILD_SERVER) + +endif( UNIX ) + +# +# Installation +# + +if(WIN32) + set(DATADIR "data") + set(BINDIR "bin") +elseif(APPLE) + set(DATADIR "share/minetest") + set(BINDIR "bin") +elseif(UNIX) + set(DATADIR "share/minetest") + set(BINDIR "bin") +endif() + +if(BUILD_CLIENT) + install(TARGETS minetest DESTINATION ${BINDIR}) + + file(GLOB images "${CMAKE_CURRENT_SOURCE_DIR}/../data/*.png") + + install(FILES ${images} DESTINATION ${DATADIR}) + + if(WIN32) + if(DEFINED IRRLICHT_DLL) + install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) + endif() + if(DEFINED ZLIB_DLL) + install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) + endif() + endif() +endif(BUILD_CLIENT) + +if(BUILD_SERVER) + install(TARGETS minetestserver DESTINATION ${BINDIR}) +endif(BUILD_SERVER) + +# Subdirectories add_subdirectory(jthread) -#END +#end diff --git a/src/main.cpp b/src/main.cpp index 9ec49feb3..a0da103c9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -212,7 +212,7 @@ Doing now: */
#define FIELD_OF_VIEW_TEST 0
-#ifdef UNITTEST_DISABLE
+#ifdef NDEBUG
#ifdef _WIN32
#pragma message ("Disabling unit tests")
#else
@@ -259,6 +259,7 @@ Doing now: #include "materials.h"
#include "guiMessageMenu.h"
#include "filesys.h"
+#include "config.h"
IrrlichtWrapper *g_irrlicht;
@@ -1110,6 +1111,12 @@ int main(int argc, char *argv[]) BEGIN_DEBUG_EXCEPTION_HANDLER
+ // Print startup message
+ dstream<<DTIME<<"minetest-c55"
+ " with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
+ <<", "<<BUILD_INFO
+ <<std::endl;
+
try
{
@@ -1170,12 +1177,6 @@ int main(int argc, char *argv[]) // Initialize default settings
set_default_settings();
- // Print startup message
- dstream<<DTIME<<"minetest-c55"
- " with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
- <<", ENABLE_TESTS="<<ENABLE_TESTS
- <<std::endl;
-
// Set locale. This is for forcing '.' as the decimal point.
std::locale::global(std::locale("C"));
// This enables printing all characters in bitmap font
@@ -1211,6 +1212,9 @@ int main(int argc, char *argv[]) {
core::array<std::string> filenames;
filenames.push_back(porting::path_userdata + "/minetest.conf");
+#ifdef RUN_IN_PLACE
+ filenames.push_back(porting::path_userdata + "/../minetest.conf");
+#endif
for(u32 i=0; i<filenames.size(); i++)
{
@@ -1282,6 +1286,8 @@ int main(int argc, char *argv[]) std::string map_dir = porting::path_userdata+"/map";
if(cmd_args.exists("map-dir"))
map_dir = cmd_args.get("map-dir");
+ else if(g_settings.exists("map-dir"))
+ map_dir = g_settings.get("map-dir");
if(cmd_args.getFlag("server"))
{
diff --git a/src/porting.cpp b/src/porting.cpp index bff865c53..6686a657e 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "porting.h" +#include "config.h" namespace porting { @@ -103,7 +104,9 @@ void initializePaths() path_userdata = std::string("../"); #endif -#else + +#else // RUN_IN_PLACE + /* Use platform-specific paths otherwise */ @@ -127,6 +130,7 @@ void initializePaths() // Use "./bin/../data" path_data = std::string(buf) + "/../data"; + //path_data = std::string(buf) + "/../share/" + APPNAME; // Use "C:\Documents and Settings\user\Application Data\<APPNAME>" len = GetEnvironmentVariable("APPDATA", buf, buflen); @@ -137,20 +141,23 @@ void initializePaths() Linux */ #elif defined(linux) + #include <unistd.h> - path_userdata = std::string("~/.") + APPNAME; - path_data = std::string("/usr/share/") + APPNAME; + path_userdata = std::string(getenv("HOME")) + "/." + APPNAME; + path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME; /* OS X */ #elif defined(__APPLE__) + #include <unistd.h> - path_userdata = std::string("~/Library/Application Support/") + APPNAME; + path_userdata = std::string(getenv("HOME")) + "/Library/Application Support/" + APPNAME; path_data = std::string("minetest-mac.app/Contents/Resources/data/"); #endif -#endif + +#endif // RUN_IN_PLACE dstream<<"path_data = "<<path_data<<std::endl; dstream<<"path_userdata = "<<path_userdata<<std::endl; diff --git a/src/servermain.cpp b/src/servermain.cpp index d9b8af402..8fcefaae7 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SERVER #ifdef _WIN32 + #pragma error ("For a server build, SERVER must be defined globally") #else #error "For a server build, SERVER must be defined globally" #endif #endif -#ifdef UNITTEST_DISABLE +#ifdef NDEBUG #ifdef _WIN32 #pragma message ("Disabling unit tests") #else @@ -66,6 +67,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "strfnd.h" #include "porting.h" #include "materials.h" +#include "config.h" /* Settings. @@ -129,6 +131,12 @@ int main(int argc, char *argv[]) BEGIN_DEBUG_EXCEPTION_HANDLER + // Print startup message + dstream<<DTIME<<"minetest-c55" + " with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST + <<", "<<BUILD_INFO + <<std::endl; + try { @@ -185,12 +193,6 @@ int main(int argc, char *argv[]) // Initialize default settings set_default_settings(); - // Print startup message - dstream<<DTIME<<"minetest-c55 server" - " with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST - <<", ENABLE_TESTS="<<ENABLE_TESTS - <<std::endl; - // Set locale. This is for forcing '.' as the decimal point. std::locale::global(std::locale("C")); // This enables printing all characters in bitmap font @@ -226,6 +228,9 @@ int main(int argc, char *argv[]) { core::array<std::string> filenames; filenames.push_back(porting::path_userdata + "/minetest.conf"); +#ifdef RUN_IN_PLACE + filenames.push_back(porting::path_userdata + "/../minetest.conf"); +#endif for(u32 i=0; i<filenames.size(); i++) { @@ -308,6 +313,8 @@ int main(int argc, char *argv[]) std::string map_dir = porting::path_userdata+"/map"; if(cmd_args.exists("map-dir")) map_dir = cmd_args.get("map-dir"); + else if(g_settings.exists("map-dir")) + map_dir = g_settings.get("map-dir"); Server server(map_dir.c_str(), hm_params, map_params); server.start(port); |