constants.h 3.4 KB

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