]> git.lizzy.rs Git - minetest.git/blob - src/constants.h
Clean up constants.h a bit
[minetest.git] / src / constants.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010 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 #define PI 3.14159
32
33 /*
34     Build-time stuff
35 */
36
37 // Whether to catch all std::exceptions.
38 // Assert will be called on such an event.
39 // In debug mode, leave these for the debugger and don't catch them.
40 #ifdef NDEBUG
41         #define CATCH_UNHANDLED_EXCEPTIONS 1
42 #else
43         #define CATCH_UNHANDLED_EXCEPTIONS 0
44 #endif
45
46 /*
47     Connection
48 */
49
50 // Define for simulating the quirks of sending through internet.
51 // Causes the socket class to deliberately drop random packets.
52 // This disables unit testing of socket and connection.
53 #define INTERNET_SIMULATOR 0
54
55 #define CONNECTION_TIMEOUT 30
56
57 #define RESEND_TIMEOUT_MIN 0.333
58 #define RESEND_TIMEOUT_MAX 3.0
59 // resend_timeout = avg_rtt * this
60 #define RESEND_TIMEOUT_FACTOR 4
61
62 /*
63     Server
64 */
65
66 // This many blocks are sent when player is building
67 #define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
68 // Override for the previous one when distance of block is very low
69 #define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
70
71 /*
72     Map-related things
73 */
74
75 // The absolute working limit is (2^15 - viewing_range).
76 // I really don't want to make every algorithm to check if it's going near
77 // the limit or not, so this is lower.
78 #define MAP_GENERATION_LIMIT (31000)
79
80 // Size of node in floating-point units
81 // The original idea behind this is to disallow plain casts between
82 // floating-point and integer positions, which potentially give wrong
83 // results. (negative coordinates, values between nodes, ...)
84 // Use floatToInt(p, BS) and intToFloat(p, BS).
85 #define BS (10.0)
86
87 // Dimension of a MapBlock
88 #define MAP_BLOCKSIZE 16
89 // This makes mesh updates too slow, as many meshes are updated during
90 // the main loop (related to TempMods and day/night)
91 //#define MAP_BLOCKSIZE 32
92
93 /*
94     Old stuff that shouldn't be hardcoded
95 */
96
97 // Size of player's main inventory
98 #define PLAYER_INVENTORY_SIZE (8*4)
99
100 /*
101         This is good to be a bit different than 0 so that water level is not
102     between two MapBlocks
103 */
104 #define WATER_LEVEL 1
105
106 // Maximum hit points of a player
107 #define PLAYER_MAX_HP 20
108
109 #endif
110