Minetest  5.4.0
constants.h
Go to the documentation of this file.
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #pragma once
21 
22 /*
23  All kinds of constants.
24 
25  Cross-platform compatibility stuff should go in porting.h.
26 
27  Some things here are legacy.
28 */
29 
30 /*
31  Connection
32 */
33 
34 #define PEER_ID_INEXISTENT 0
35 #define PEER_ID_SERVER 1
36 
37 // Define for simulating the quirks of sending through internet.
38 // Causes the socket class to deliberately drop random packets.
39 // This disables unit testing of socket and connection.
40 #define INTERNET_SIMULATOR 0
41 #define INTERNET_SIMULATOR_PACKET_LOSS 10 // 10 = easy, 4 = hard
42 
43 #define CONNECTION_TIMEOUT 30
44 
45 #define RESEND_TIMEOUT_MIN 0.1
46 #define RESEND_TIMEOUT_MAX 3.0
47 // resend_timeout = avg_rtt * this
48 #define RESEND_TIMEOUT_FACTOR 4
49 
50 /*
51  Server
52 */
53 
54 // This many blocks are sent when player is building
55 #define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
56 // Override for the previous one when distance of block is very low
57 #define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
58 
59 /*
60  Map-related things
61 */
62 
63 // The absolute working limit is (2^15 - viewing_range).
64 // I really don't want to make every algorithm to check if it's going near
65 // the limit or not, so this is lower.
66 // This is the maximum value the setting map_generation_limit can be
67 #define MAX_MAP_GENERATION_LIMIT (31000)
68 
69 // Size of node in floating-point units
70 // The original idea behind this is to disallow plain casts between
71 // floating-point and integer positions, which potentially give wrong
72 // results. (negative coordinates, values between nodes, ...)
73 // Use floatToInt(p, BS) and intToFloat(p, BS).
74 #define BS 10.0f
75 
76 // Dimension of a MapBlock
77 #define MAP_BLOCKSIZE 16
78 // This makes mesh updates too slow, as many meshes are updated during
79 // the main loop (related to TempMods and day/night)
80 //#define MAP_BLOCKSIZE 32
81 
82 // Player step height in nodes
83 #define PLAYER_DEFAULT_STEPHEIGHT 0.6f
84 
85 /*
86  Old stuff that shouldn't be hardcoded
87 */
88 
89 // Size of player's main inventory
90 #define PLAYER_INVENTORY_SIZE (8 * 4)
91 
92 // Default maximum health points of a player
93 #define PLAYER_MAX_HP_DEFAULT 20
94 
95 // Default maximal breath of a player
96 #define PLAYER_MAX_BREATH_DEFAULT 10
97 
98 // Number of different files to try to save a player to if the first fails
99 // (because of a case-insensitive filesystem)
100 // TODO: Use case-insensitive player names instead of this hack.
101 #define PLAYER_FILE_ALTERNATE_TRIES 1000
102 
103 // For screenshots a serial number is appended to the filename + datetimestamp
104 // if filename + datetimestamp is not unique.
105 // This is the maximum number of attempts to try and add a serial to the end of
106 // the file attempting to ensure a unique filename
107 #define SCREENSHOT_MAX_SERIAL_TRIES 1000
108 
109 /*
110  GUI related things
111 */
112 
113 #define TTF_DEFAULT_FONT_SIZE (16)
114 #define DEFAULT_FONT_SIZE (10)