]> git.lizzy.rs Git - dragonfireclient.git/blob - src/constants.h
Add map limit config option
[dragonfireclient.git] / src / constants.h
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 #ifndef CONSTANTS_HEADER
21 #define CONSTANTS_HEADER
22
23 /*
24         All kinds of constants.
25
26         Cross-platform compatibility crap should go in porting.h.
27
28     Some things here are legacy crap.
29 */
30
31 /*
32     Connection
33 */
34
35 #define PEER_ID_INEXISTENT 0
36 #define PEER_ID_SERVER 1
37
38 // Define for simulating the quirks of sending through internet.
39 // Causes the socket class to deliberately drop random packets.
40 // This disables unit testing of socket and connection.
41 #define INTERNET_SIMULATOR 0
42 #define INTERNET_SIMULATOR_PACKET_LOSS 10 // 10 = easy, 4 = hard
43
44 #define CONNECTION_TIMEOUT 30
45
46 #define RESEND_TIMEOUT_MIN 0.1
47 #define RESEND_TIMEOUT_MAX 3.0
48 // resend_timeout = avg_rtt * this
49 #define RESEND_TIMEOUT_FACTOR 4
50
51 /*
52     Server
53 */
54
55 // This many blocks are sent when player is building
56 #define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
57 // Override for the previous one when distance of block is very low
58 #define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
59
60 /*
61     Map-related things
62 */
63
64 // The absolute working limit is (2^15 - viewing_range).
65 // I really don't want to make every algorithm to check if it's going near
66 // the limit or not, so this is lower.
67 // This is the maximum value the setting map_generation_limit can be
68 #define MAX_MAP_GENERATION_LIMIT (31000)
69
70 // Size of node in floating-point units
71 // The original idea behind this is to disallow plain casts between
72 // floating-point and integer positions, which potentially give wrong
73 // results. (negative coordinates, values between nodes, ...)
74 // Use floatToInt(p, BS) and intToFloat(p, BS).
75 #define BS (10.0)
76
77 // Dimension of a MapBlock
78 #define MAP_BLOCKSIZE 16
79 // This makes mesh updates too slow, as many meshes are updated during
80 // the main loop (related to TempMods and day/night)
81 //#define MAP_BLOCKSIZE 32
82
83 /*
84     Old stuff that shouldn't be hardcoded
85 */
86
87 // Size of player's main inventory
88 #define PLAYER_INVENTORY_SIZE (8*4)
89
90 // Maximum hit points of a player
91 #define PLAYER_MAX_HP 20
92
93 // Maximal breath of a player
94 #define PLAYER_MAX_BREATH 11
95
96 // Number of different files to try to save a player to if the first fails
97 // (because of a case-insensitive filesystem)
98 // TODO: Use case-insensitive player names instead of this hack.
99 #define PLAYER_FILE_ALTERNATE_TRIES 1000
100
101 // For screenshots a serial number is appended to the filename + datetimestamp
102 // if filename + datetimestamp is not unique.
103 // This is the maximum number of attempts to try and add a serial to the end of
104 // the file attempting to ensure a unique filename
105 #define SCREENSHOT_MAX_SERIAL_TRIES 1000
106
107 /*
108     GUI related things
109 */
110
111 // TODO: implement dpi-based scaling for windows and remove this hack
112 #if defined(_WIN32)
113         #define TTF_DEFAULT_FONT_SIZE   (18)
114 #else
115         #define TTF_DEFAULT_FONT_SIZE   (15)
116 #endif
117 #define DEFAULT_FONT_SIZE       (10)
118
119 #endif