About: Source:NetHack 2.2a/search.c   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Below is the full text to search.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/search.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code

AttributesValues
rdfs:label
  • Source:NetHack 2.2a/search.c
rdfs:comment
  • Below is the full text to search.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/search.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code
dcterms:subject
dbkwik:nethack/pro...iPageUsesTemplate
abstract
  • Below is the full text to search.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/search.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)search.c 2.1 87/11/10 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. 4. #include "hack.h" 5. char *rndmonnam(), *defmonnam(); 6. 7. extern struct monst *makemon(); 8. 9. findit() /* returns number of things found */ 10. { 11. int num; 12. register xchar zx,zy; 13. register struct trap *ttmp; 14. register struct monst *mtmp; 15. xchar lx,hx,ly,hy; 16. 17. if(u.uswallow) return(0); 18. for(lx = u.ux; (num = levl[lx-1][u.uy].typ) && num != CORR; lx--) ; 19. for(hx = u.ux; (num = levl[hx+1][u.uy].typ) && num != CORR; hx++) ; 20. for(ly = u.uy; (num = levl[u.ux][ly-1].typ) && num != CORR; ly--) ; 21. for(hy = u.uy; (num = levl[u.ux][hy+1].typ) && num != CORR; hy++) ; 22. num = 0; 23. for(zy = ly; zy <= hy; zy++) 24. for(zx = lx; zx <= hx; zx++) { 25. if(levl[zx][zy].typ == SDOOR) { 26. levl[zx][zy].typ = DOOR; 27. atl(zx, zy, DOOR_SYM); 28. num++; 29. } else if(levl[zx][zy].typ == SCORR) { 30. levl[zx][zy].typ = CORR; 31. atl(zx, zy, CORR_SYM); 32. num++; 33. } else if(ttmp = t_at(zx, zy)) { 34. if(ttmp->ttyp == PIERC){ 35. (void) makemon(PM_PIERCER, zx, zy); 36. num++; 37. deltrap(ttmp); 38. } else if(!ttmp->tseen) { 39. ttmp->tseen = 1; 40. if(!vism_at(zx, zy)) 41. atl(zx,zy,TRAP_SYM); 42. num++; 43. } 44. } else if(mtmp = m_at(zx,zy)) if(mtmp->mimic){ 45. seemimic(mtmp); 46. num++; 47. } 48. } 49. return(num); 50. } 51. 52. dosearch() 53. { 54. register xchar x,y; 55. register struct trap *trap; 56. register struct monst *mtmp; 57. #ifdef BVH /* if weapon is Excalibur give the user the sword's 58. * magic bonus (+ or -) to search for hidden objects. 59. */ 60. int fund = (uwep && !strcmp(ONAME(uwep),"Excalibur")) ? 61. ((uwep->spe > 5) ? 5 : uwep->spe) : 0; 62. #endif 63. 64. if(u.uswallow) 65. pline("What are you looking for? The exit?"); 66. else 67. for(x = u.ux-1; x < u.ux+2; x++) 68. for(y = u.uy-1; y < u.uy+2; y++) if(x != u.ux || y != u.uy) { 69. if(levl[x][y].typ == SDOOR) { 70. if(rn2(7-fund)) continue; 71. levl[x][y].typ = DOOR; 72. levl[x][y].seen = 0; /* force prl */ 73. prl(x,y); 74. nomul(0); 75. } else if(levl[x][y].typ == SCORR) { 76. if(rn2(7-fund)) continue; 77. levl[x][y].typ = CORR; 78. levl[x][y].seen = 0; /* force prl */ 79. prl(x,y); 80. nomul(0); 81. } else { 82. /* Be careful not to find anything in an SCORR or SDOOR */ 83. if(mtmp = m_at(x,y)) if(mtmp->mimic){ 84. seemimic(mtmp); 85. pline("You find %s.",defmonnam(mtmp)); 86. return(1); 87. } 88. for(trap = ftrap; trap; trap = trap->ntrap) 89. if(trap->tx == x && trap->ty == y && 90. !trap->tseen && !rn2(8)) { 91. nomul(0); 92. if (trap->ttyp != PIERC) 93. pline("You find a%s.", traps[Hallucination ? 94. rn2(TRAPNUM-2) : trap->ttyp ]); 95. 96. if(trap->ttyp == PIERC) { 97. deltrap(trap); 98. if((mtmp=makemon(PM_PIERCER,x,y))) 99. pline("You find %s.", defmonnam(mtmp)); 100. return(1); 101. } 102. trap->tseen = 1; 103. if(!vism_at(x,y)) atl(x,y,TRAP_SYM); 104. } 105. } 106. } 107. return(1); 108. } 109. 110. doidtrap() { 111. register struct trap *trap; 112. register int x,y; 113. if(!getdir(1)) return(0); 114. x = u.ux + u.dx; 115. y = u.uy + u.dy; 116. for(trap = ftrap; trap; trap = trap->ntrap) 117. if(trap->tx == x && trap->ty == y && trap->tseen) { 118. if(u.dz) 119. if((u.dz < 0) != (!xdnstair && trap->ttyp == TRAPDOOR)) 120. continue; 121. pline("That is a%s.",traps[ Hallucination ? rn2(TRAPNUM-2) : 122. trap->ttyp]); 123. return(0); 124. } 125. pline("I can't see a trap there."); 126. return(0); 127. } 128. 129. wakeup(mtmp) 130. register struct monst *mtmp; 131. { 132. mtmp->msleep = 0; 133. setmangry(mtmp); 134. if(mtmp->mimic) seemimic(mtmp); 135. } 136. 137. /* NOTE: we must check if(mtmp->mimic) before calling this routine */ 138. seemimic(mtmp) 139. register struct monst *mtmp; 140. { 141. mtmp->mimic = 0; 142. mtmp->mappearance = 0; 143. unpmon(mtmp); 144. pmon(mtmp); 145. }
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software