constants.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #define RESEND_TIMEOUT_MIN 0.1
  34. #define RESEND_TIMEOUT_MAX 3.0
  35. // resend_timeout = avg_rtt * this
  36. #define RESEND_TIMEOUT_FACTOR 4
  37. /*
  38. Server
  39. */
  40. // This many blocks are sent when player is building
  41. #define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
  42. // Override for the previous one when distance of block is very low
  43. #define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
  44. /*
  45. Map-related things
  46. */
  47. // The absolute working limit is (2^15 - viewing_range).
  48. // I really don't want to make every algorithm to check if it's going near
  49. // the limit or not, so this is lower.
  50. // This is the maximum value the setting map_generation_limit can be
  51. #define MAX_MAP_GENERATION_LIMIT (31007)
  52. // Size of node in floating-point units
  53. // The original idea behind this is to disallow plain casts between
  54. // floating-point and integer positions, which potentially give wrong
  55. // results. (negative coordinates, values between nodes, ...)
  56. // Use floatToInt(p, BS) and intToFloat(p, BS).
  57. #define BS 10.0f
  58. // Dimension of a MapBlock
  59. #define MAP_BLOCKSIZE 16
  60. // This makes mesh updates too slow, as many meshes are updated during
  61. // the main loop (related to TempMods and day/night)
  62. //#define MAP_BLOCKSIZE 32
  63. // Player step height in nodes
  64. #define PLAYER_DEFAULT_STEPHEIGHT 0.6f
  65. /*
  66. Old stuff that shouldn't be hardcoded
  67. */
  68. // Size of player's main inventory
  69. #define PLAYER_INVENTORY_SIZE (8 * 4)
  70. // Default maximum health points of a player
  71. #define PLAYER_MAX_HP_DEFAULT 20
  72. // Default maximal breath of a player
  73. #define PLAYER_MAX_BREATH_DEFAULT 10
  74. // Number of different files to try to save a player to if the first fails
  75. // (because of a case-insensitive filesystem)
  76. // TODO: Use case-insensitive player names instead of this hack.
  77. #define PLAYER_FILE_ALTERNATE_TRIES 1000
  78. // For screenshots a serial number is appended to the filename + datetimestamp
  79. // if filename + datetimestamp is not unique.
  80. // This is the maximum number of attempts to try and add a serial to the end of
  81. // the file attempting to ensure a unique filename
  82. #define SCREENSHOT_MAX_SERIAL_TRIES 1000
  83. /*
  84. GUI related things
  85. */
  86. #define TTF_DEFAULT_FONT_SIZE (16)