Source:NetHack 3.6.4/src/sys.c
Jump to navigation
Jump to search
Below is the full text to sys.c from the source code of NetHack 3.6.4. To link to a particular line, write [[Source:NetHack 3.6.4/src/sys.c#line12]], for example.
The NetHack General Public License applies to screenshots, source code and other content from NetHack.
This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.
1. /* NetHack 3.6 sys.c $NHDT-Date: 1575665952 2019/12/06 20:59:12 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.46 $ */ 2. /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #include "hack.h" 6. 7. #ifndef SYSCF 8. /* !SYSCF configurations need '#define DEBUGFILES "foo.c bar.c"' 9. * to enable debugging feedback for source files foo.c and bar.c; 10. * to activate debugpline(), set an appropriate value and uncomment 11. */ 12. /* # define DEBUGFILES "*" */ 13. 14. /* note: DEBUGFILES value here or in sysconf.DEBUGFILES can be overridden 15. at runtime by setting up a value for "DEBUGFILES" in the environment */ 16. #endif 17. 18. struct sysopt sysopt; 19. 20. void 21. sys_early_init() 22. { 23. sysopt.support = (char *) 0; 24. sysopt.recover = (char *) 0; 25. #ifdef SYSCF 26. sysopt.wizards = (char *) 0; 27. #else 28. sysopt.wizards = dupstr(WIZARD_NAME); 29. #endif 30. #if defined(SYSCF) || !defined(DEBUGFILES) 31. sysopt.debugfiles = (char *) 0; 32. #else 33. sysopt.debugfiles = dupstr(DEBUGFILES); 34. #endif 35. #ifdef DUMPLOG 36. sysopt.dumplogfile = (char *) 0; 37. #endif 38. sysopt.env_dbgfl = 0; /* haven't checked getenv("DEBUGFILES") yet */ 39. sysopt.shellers = (char *) 0; 40. sysopt.explorers = (char *) 0; 41. sysopt.genericusers = (char *) 0; 42. sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */ 43. sysopt.bones_pools = 0; 44. 45. /* record file */ 46. sysopt.persmax = PERSMAX; 47. sysopt.entrymax = ENTRYMAX; 48. sysopt.pointsmin = POINTSMIN; 49. sysopt.pers_is_uid = PERS_IS_UID; 50. sysopt.tt_oname_maxrank = 10; 51. 52. /* sanity checks */ 53. if (PERSMAX < 1) 54. sysopt.persmax = 1; 55. if (ENTRYMAX < 10) 56. sysopt.entrymax = 10; 57. if (POINTSMIN < 1) 58. sysopt.pointsmin = 1; 59. if (PERS_IS_UID != 0 && PERS_IS_UID != 1) 60. panic("config error: PERS_IS_UID must be either 0 or 1"); 61. 62. #ifdef PANICTRACE 63. /* panic options */ 64. sysopt.gdbpath = dupstr(GDBPATH); 65. sysopt.greppath = dupstr(GREPPATH); 66. #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) 67. sysopt.panictrace_gdb = 1; 68. #ifdef PANICTRACE_LIBC 69. sysopt.panictrace_libc = 2; 70. #endif 71. #else 72. sysopt.panictrace_gdb = 0; 73. #ifdef PANICTRACE_LIBC 74. sysopt.panictrace_libc = 0; 75. #endif 76. #endif 77. #endif 78. 79. sysopt.check_save_uid = 1; 80. sysopt.check_plname = 0; 81. sysopt.seduce = 1; /* if it's compiled in, default to on */ 82. sysopt_seduce_set(sysopt.seduce); 83. sysopt.accessibility = 0; 84. #ifdef WIN32 85. sysopt.portable_device_paths = 0; 86. #endif 87. return; 88. } 89. 90. void 91. sysopt_release() 92. { 93. if (sysopt.support) 94. free((genericptr_t) sysopt.support), sysopt.support = (char *) 0; 95. if (sysopt.recover) 96. free((genericptr_t) sysopt.recover), sysopt.recover = (char *) 0; 97. if (sysopt.wizards) 98. free((genericptr_t) sysopt.wizards), sysopt.wizards = (char *) 0; 99. if (sysopt.explorers) 100. free((genericptr_t) sysopt.explorers), sysopt.explorers = (char *) 0; 101. if (sysopt.shellers) 102. free((genericptr_t) sysopt.shellers), sysopt.shellers = (char *) 0; 103. if (sysopt.debugfiles) 104. free((genericptr_t) sysopt.debugfiles), 105. sysopt.debugfiles = (char *) 0; 106. #ifdef DUMPLOG 107. if (sysopt.dumplogfile) 108. free((genericptr_t)sysopt.dumplogfile), sysopt.dumplogfile=(char *)0; 109. #endif 110. if (sysopt.genericusers) 111. free((genericptr_t) sysopt.genericusers), 112. sysopt.genericusers = (char *) 0; 113. if (sysopt.gdbpath) 114. free((genericptr_t) sysopt.gdbpath), sysopt.gdbpath = (char *) 0; 115. if (sysopt.greppath) 116. free((genericptr_t) sysopt.greppath), sysopt.greppath = (char *) 0; 117. 118. /* this one's last because it might be used in panic feedback, although 119. none of the preceding ones are likely to trigger a controlled panic */ 120. if (sysopt.fmtd_wizard_list) 121. free((genericptr_t) sysopt.fmtd_wizard_list), 122. sysopt.fmtd_wizard_list = (char *) 0; 123. return; 124. } 125. 126. extern const struct attack sa_yes[NATTK]; 127. extern const struct attack sa_no[NATTK]; 128. 129. void 130. sysopt_seduce_set(val) 131. int val; 132. { 133. #if 0 134. /* 135. * Attack substitution is now done on the fly in getmattk(mhitu.c). 136. */ 137. struct attack *setval = val ? sa_yes : sa_no; 138. int x; 139. 140. for (x = 0; x < NATTK; x++) { 141. mons[PM_INCUBUS].mattk[x] = setval[x]; 142. mons[PM_SUCCUBUS].mattk[x] = setval[x]; 143. } 144. #else 145. nhUse(val); 146. #endif /*0*/ 147. return; 148. } 149. 150. /*sys.c*/