strict_protocol_version_checking setting; PROTOCOL_VERSION in clientserver.h; clean...
authorPerttu Ahola <celeron55@gmail.com>
Sat, 15 Oct 2011 12:02:28 +0000 (15:02 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 15 Oct 2011 12:02:28 +0000 (15:02 +0300)
CMakeLists.txt
minetest.conf.example
src/clientserver.h
src/defaultsettings.cpp
src/server.cpp

index efab516dc5908098e8f3a3e73e0cf3193c5736e7..da569191b66e3fe85f89d81b13b1910bdf0e938f 100644 (file)
@@ -7,6 +7,7 @@ endif(${CMAKE_VERSION} STREQUAL "2.8.2")
 # This can be read from ${PROJECT_NAME} after project() is called
 project(minetest)
 
+# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
 set(VERSION_MAJOR 0)
 set(VERSION_MINOR 3)
 set(VERSION_PATCH dev-201110xx)
index c47ac77ce3e8e03fb568b7d9d7f774aac2872d17..13015825418cdd0b850c2cc9198214fe3f91f318 100644 (file)
@@ -109,27 +109,33 @@ screenH# = 600
 #
 
 # Map directory (everything in the world is stored here)
-#map-#dir = /custom/map
+#map-dir = /custom/map
 # Message of the Day
 #motd = Welcome to this awesome Minetest server!
+# Maximum number of players connected simultaneously
+#max_users = 20
+# Set to false to allow old clients to connect
+#strict_protocol_version_checking = true
 # Set to true to enable creative mode (unlimited inventory)
 #creative_mode = false
+# Enable players getting damage and dying
 #enable_damage = false
+# A chosen map seed for a new map, leave empty for random
+#fixed_map_seed =
 # Gives some stuff to players at the beginning
 #give_initial_stuff = false
+# New users need to input this password
 #default_password = 
 # Available privileges: build, teleport, settime, privs, shout
 #default_privs = build, shout
 
-# Set to true to enable experimental features or stuff that is tested
-# (varies from version to version, usually not useful at all)
-#enable_experimental = false
 # Profiler data print interval. #0 = disable.
 #profiler_print_interval = 0
 #enable_mapgen_debug_info = false
 # Player and object positions are sent at intervals specified by this
 #objectdata_interval = 0.2
-#active_object_range = 2
+#active_object_send_range_blocks = 3
+#active_block_range = 5
 #max_simultaneous_block_sends_per_client = 2
 #max_simultaneous_block_sends_server_total = 8
 #max_block_send_distance = 8
@@ -140,4 +146,7 @@ screenH# = 600
 #server_unload_unused_data_timeout = 60
 #server_map_save_interval = 60
 #full_block_send_enable_min_time_from_building = 2.0
+# Set to true to enable experimental features or stuff that is tested
+# (varies from version to version, usually not useful at all)
+#enable_experimental = false
 
index b96cc61aa15421a150494e212ab10f8842762a35..0f6925696c636c418671b14884874174b38095bf 100644 (file)
@@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "utility.h"
 
+#define PROTOCOL_VERSION 3
+
 #define PROTOCOL_ID 0x4f457403
 
 #define PASSWORD_SIZE 28       // Maximum password length. Allows for
index 05b0611e9b78c136332eb6cc5b22272bbb508b6a..2f4147a99c7b97966d412ff61894b9fcd1dddc83 100644 (file)
@@ -76,18 +76,19 @@ void set_default_settings(Settings *settings)
        settings->setDefault("screenshot_path", ".");
 
        // Server stuff
+       // "map-dir" doesn't exist by default.
        settings->setDefault("motd", "");
        settings->setDefault("max_users", "20");
-       settings->setDefault("enable_experimental", "false");
+       settings->setDefault("strict_protocol_version_checking", "true");
        settings->setDefault("creative_mode", "false");
        settings->setDefault("enable_damage", "true");
+       settings->setDefault("fixed_map_seed", "");
        settings->setDefault("give_initial_stuff", "false");
        settings->setDefault("default_password", "");
        settings->setDefault("default_privs", "build, shout");
+
        settings->setDefault("profiler_print_interval", "0");
        settings->setDefault("enable_mapgen_debug_info", "false");
-       settings->setDefault("fixed_map_seed", "");
-
        settings->setDefault("objectdata_interval", "0.2");
        settings->setDefault("active_object_send_range_blocks", "3");
        settings->setDefault("active_block_range", "5");
@@ -100,8 +101,8 @@ void set_default_settings(Settings *settings)
        settings->setDefault("time_send_interval", "20");
        settings->setDefault("time_speed", "96");
        settings->setDefault("server_unload_unused_data_timeout", "60");
-       settings->setDefault("server_map_save_interval", "60");
+       settings->setDefault("server_map_save_interval", "10");
        settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
-       //settings->setDefault("dungeon_rarity", "0.025");
+       settings->setDefault("enable_experimental", "false");
 }
 
index 59f7477a9e3749ef90056996381f53cde5de2e4c..828eadbf3499cb08940d4ce3436e3c7aabb3fc37 100644 (file)
@@ -1927,11 +1927,14 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                }
                
                /* Uhh... this should actually be a warning but let's do it like this */
-               if(net_proto_version < 2)
+               if(g_settings->getBool("strict_protocol_version_checking"))
                {
-                       SendAccessDenied(m_con, peer_id,
-                                       L"Your client is too old. Please upgrade.");
-                       return;
+                       if(net_proto_version < PROTOCOL_VERSION)
+                       {
+                               SendAccessDenied(m_con, peer_id,
+                                               L"Your client is too old. Please upgrade.");
+                               return;
+                       }
                }
 
                /*
@@ -2110,9 +2113,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                }
                
                // Warnings about protocol version can be issued here
-               if(getClient(peer->id)->net_proto_version < 3)
+               if(getClient(peer->id)->net_proto_version < PROTOCOL_VERSION)
                {
-                       SendChatMessage(peer_id, L"# Server: WARNING: YOUR CLIENT IS OLD AND DOES NOT WORK PROPERLY WITH THIS SERVER");
+                       SendChatMessage(peer_id, L"# Server: WARNING: YOUR CLIENT IS OLD AND MAY WORK PROPERLY WITH THIS SERVER");
                }
 
                /*