Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7/*
8 All kinds of constants.
9
10 Cross-platform compatibility stuff should go in porting.h.
11
12 Some things here are legacy.
13*/
14
15/*
16 Connection
17*/
18
19#define PEER_ID_INEXISTENT 0
20#define PEER_ID_SERVER 1
21
22// Define for simulating the quirks of sending through internet.
23// Causes the socket class to deliberately drop random packets.
24// This disables unit testing of socket and connection.
25#define INTERNET_SIMULATOR 0
26#define INTERNET_SIMULATOR_PACKET_LOSS 10 // 10 = easy, 4 = hard
27
28#define CONNECTION_TIMEOUT 30
29
30/*
31 Server
32*/
33
34// This many blocks are sent when player is building
35#define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
36// Override for the previous one when distance of block is very low
37#define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
38
39/*
40 Client/Server
41*/
42
43// Limit maximum dtime in client/server step(...) and for collision detection
44#define DTIME_LIMIT 2.5f
45
46/*
47 Map-related things
48*/
49
50// The absolute working limit is (2^15 - viewing_range).
51// I really don't want to make every algorithm to check if it's going near
52// the limit or not, so this is lower.
53// This is the maximum value the setting map_generation_limit can be
54#define MAX_MAP_GENERATION_LIMIT (31007)
55
56// Size of node in floating-point units
57// The original idea behind this is to disallow plain casts between
58// floating-point and integer positions, which potentially give wrong
59// results. (negative coordinates, values between nodes, ...)
60// Use floatToInt(p, BS) and intToFloat(p, BS).
61#define BS 10.0f
62
63// Dimension of a MapBlock
64#define MAP_BLOCKSIZE 16
65// This makes mesh updates too slow, as many meshes are updated during
66// the main loop (related to TempMods and day/night)
67//#define MAP_BLOCKSIZE 32
68
69// Player step height in nodes
70#define PLAYER_DEFAULT_STEPHEIGHT 0.6f
71
72/*
73 Old stuff that shouldn't be hardcoded
74*/
75
76// Size of player's main inventory
77#define PLAYER_INVENTORY_SIZE (8 * 4)
78
79// Default maximum health points of a player
80#define PLAYER_MAX_HP_DEFAULT 20
81
82// Default maximal breath of a player
83#define PLAYER_MAX_BREATH_DEFAULT 10
84
85// Number of different files to try to save a player to if the first fails
86// (because of a case-insensitive filesystem)
87// TODO: Use case-insensitive player names instead of this hack.
88#define PLAYER_FILE_ALTERNATE_TRIES 1000
89
90// For screenshots a serial number is appended to the filename + datetimestamp
91// if filename + datetimestamp is not unique.
92// This is the maximum number of attempts to try and add a serial to the end of
93// the file attempting to ensure a unique filename
94#define SCREENSHOT_MAX_SERIAL_TRIES 1000
95
96/*
97 GUI related things
98*/
99
100#define TTF_DEFAULT_FONT_SIZE (16)