strict_protocol_version_checking setting; PROTOCOL_VERSION in clientserver.h; clean up defaultsettings.cpp and minetest.conf.example

This commit is contained in:
Perttu Ahola 2011-10-15 15:02:28 +03:00
parent 74febd5c31
commit 94dfececf6
5 changed files with 32 additions and 16 deletions

@ -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)

@ -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

@ -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

@ -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");
}

@ -1927,12 +1927,15 @@ 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"))
{
if(net_proto_version < PROTOCOL_VERSION)
{
SendAccessDenied(m_con, peer_id,
L"Your client is too old. Please upgrade.");
return;
}
}
/*
Set up player
@ -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");
}
/*