constants.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef CONSTANTS_HEADER
  17. #define CONSTANTS_HEADER
  18. /*
  19. All kinds of constants.
  20. Cross-platform compatibility crap should go in porting.h.
  21. Some things here are legacy crap.
  22. */
  23. /*
  24. Connection
  25. */
  26. #define PEER_ID_INEXISTENT 0
  27. #define PEER_ID_SERVER 1
  28. // Define for simulating the quirks of sending through internet.
  29. // Causes the socket class to deliberately drop random packets.
  30. // This disables unit testing of socket and connection.
  31. #define INTERNET_SIMULATOR 0
  32. #define INTERNET_SIMULATOR_PACKET_LOSS 10 // 10 = easy, 4 = hard
  33. #define CONNECTION_TIMEOUT 30
  34. #define RESEND_TIMEOUT_MIN 0.1
  35. #define RESEND_TIMEOUT_MAX 3.0
  36. // resend_timeout = avg_rtt * this
  37. #define RESEND_TIMEOUT_FACTOR 4
  38. /*
  39. Server
  40. */
  41. // This many blocks are sent when player is building
  42. #define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
  43. // Override for the previous one when distance of block is very low
  44. #define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
  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. #define MAP_GENERATION_LIMIT (31000)
  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.0)
  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. /*
  64. Old stuff that shouldn't be hardcoded
  65. */
  66. // Size of player's main inventory
  67. #define PLAYER_INVENTORY_SIZE (8*4)
  68. // Maximum hit points of a player
  69. #define PLAYER_MAX_HP 20
  70. // Number of different files to try to save a player to if the first fails
  71. // (because of a case-insensitive filesystem)
  72. // TODO: Use case-insensitive player names instead of this hack.
  73. #define PLAYER_FILE_ALTERNATE_TRIES 1000
  74. /*
  75. * GUI related things
  76. */
  77. #define LEGACY_SCALING (2./3.)
  78. #define DEFAULT_FONT_SIZE (13.0 / LEGACY_SCALING)
  79. #define DEFAULT_IMGSIZE (48.0)
  80. #define DEFAULT_XSPACING ((15.0 + (1.0 / 3.0)))
  81. #define DEFAULT_YSPACING (9.0)
  82. #endif