hack.objnam.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. /* $NetBSD: hack.objnam.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */
  2. /*
  3. * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
  4. * Amsterdam
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are
  9. * met:
  10. *
  11. * - Redistributions of source code must retain the above copyright notice,
  12. * this list of conditions and the following disclaimer.
  13. *
  14. * - Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. *
  18. * - Neither the name of the Stichting Centrum voor Wiskunde en
  19. * Informatica, nor the names of its contributors may be used to endorse or
  20. * promote products derived from this software without specific prior
  21. * written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  24. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  25. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  26. * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  27. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  28. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  29. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  30. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  31. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. /*
  36. * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
  37. * All rights reserved.
  38. *
  39. * Redistribution and use in source and binary forms, with or without
  40. * modification, are permitted provided that the following conditions
  41. * are met:
  42. * 1. Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * 2. Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in the
  46. * documentation and/or other materials provided with the distribution.
  47. * 3. The name of the author may not be used to endorse or promote products
  48. * derived from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  51. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  52. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  53. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  54. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  55. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  56. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  57. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  58. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  59. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. */
  61. #include <sys/cdefs.h>
  62. #ifndef lint
  63. __RCSID("$NetBSD: hack.objnam.c,v 1.6 2003/04/02 18:36:39 jsm Exp $");
  64. #endif /* not lint */
  65. #include <stdlib.h>
  66. #include "hack.h"
  67. #include "extern.h"
  68. #define Sprintf (void) sprintf
  69. #define Strcat (void) strcat
  70. #define Strcpy (void) strcpy
  71. #define PREFIX 15
  72. char *
  73. strprepend(s, pref)
  74. char *s, *pref;
  75. {
  76. int i = strlen(pref);
  77. if (i > PREFIX) {
  78. pline("WARNING: prefix too short.");
  79. return (s);
  80. }
  81. s -= i;
  82. (void) strncpy(s, pref, i); /* do not copy trailing 0 */
  83. return (s);
  84. }
  85. char *
  86. sitoa(a)
  87. int a;
  88. {
  89. static char buf[13];
  90. Sprintf(buf, (a < 0) ? "%d" : "+%d", a);
  91. return (buf);
  92. }
  93. char *
  94. typename(otyp)
  95. int otyp;
  96. {
  97. static char buf[BUFSZ];
  98. struct objclass *ocl = &objects[otyp];
  99. const char *an = ocl->oc_name;
  100. const char *dn = ocl->oc_descr;
  101. char *un = ocl->oc_uname;
  102. int nn = ocl->oc_name_known;
  103. switch (ocl->oc_olet) {
  104. case POTION_SYM:
  105. Strcpy(buf, "potion");
  106. break;
  107. case SCROLL_SYM:
  108. Strcpy(buf, "scroll");
  109. break;
  110. case WAND_SYM:
  111. Strcpy(buf, "wand");
  112. break;
  113. case RING_SYM:
  114. Strcpy(buf, "ring");
  115. break;
  116. default:
  117. if (nn) {
  118. Strcpy(buf, an);
  119. if (otyp >= TURQUOISE && otyp <= JADE)
  120. Strcat(buf, " stone");
  121. if (un)
  122. Sprintf(eos(buf), " called %s", un);
  123. if (dn)
  124. Sprintf(eos(buf), " (%s)", dn);
  125. } else {
  126. Strcpy(buf, dn ? dn : an);
  127. if (ocl->oc_olet == GEM_SYM)
  128. Strcat(buf, " gem");
  129. if (un)
  130. Sprintf(eos(buf), " called %s", un);
  131. }
  132. return (buf);
  133. }
  134. /* here for ring/scroll/potion/wand */
  135. if (nn)
  136. Sprintf(eos(buf), " of %s", an);
  137. if (un)
  138. Sprintf(eos(buf), " called %s", un);
  139. if (dn)
  140. Sprintf(eos(buf), " (%s)", dn);
  141. return (buf);
  142. }
  143. char *
  144. xname(obj)
  145. struct obj *obj;
  146. {
  147. static char bufr[BUFSZ];
  148. char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */
  149. int nn = objects[obj->otyp].oc_name_known;
  150. const char *an = objects[obj->otyp].oc_name;
  151. const char *dn = objects[obj->otyp].oc_descr;
  152. char *un = objects[obj->otyp].oc_uname;
  153. int pl = (obj->quan != 1);
  154. if (!obj->dknown && !Blind)
  155. obj->dknown = 1;/* %% doesnt belong here */
  156. switch (obj->olet) {
  157. case AMULET_SYM:
  158. Strcpy(buf, (obj->spe < 0 && obj->known)
  159. ? "cheap plastic imitation of the " : "");
  160. Strcat(buf, "Amulet of Yendor");
  161. break;
  162. case TOOL_SYM:
  163. if (!nn) {
  164. Strcpy(buf, dn);
  165. break;
  166. }
  167. Strcpy(buf, an);
  168. break;
  169. case FOOD_SYM:
  170. if (obj->otyp == DEAD_HOMUNCULUS && pl) {
  171. pl = 0;
  172. Strcpy(buf, "dead homunculi");
  173. break;
  174. }
  175. /* fungis ? */
  176. /* fall into next case */
  177. case WEAPON_SYM:
  178. if (obj->otyp == WORM_TOOTH && pl) {
  179. pl = 0;
  180. Strcpy(buf, "worm teeth");
  181. break;
  182. }
  183. if (obj->otyp == CRYSKNIFE && pl) {
  184. pl = 0;
  185. Strcpy(buf, "crysknives");
  186. break;
  187. }
  188. /* fall into next case */
  189. case ARMOR_SYM:
  190. case CHAIN_SYM:
  191. case ROCK_SYM:
  192. Strcpy(buf, an);
  193. break;
  194. case BALL_SYM:
  195. Sprintf(buf, "%sheavy iron ball",
  196. (obj->owt > objects[obj->otyp].oc_weight) ? "very " : "");
  197. break;
  198. case POTION_SYM:
  199. if (nn || un || !obj->dknown) {
  200. Strcpy(buf, "potion");
  201. if (pl) {
  202. pl = 0;
  203. Strcat(buf, "s");
  204. }
  205. if (!obj->dknown)
  206. break;
  207. if (un) {
  208. Strcat(buf, " called ");
  209. Strcat(buf, un);
  210. } else {
  211. Strcat(buf, " of ");
  212. Strcat(buf, an);
  213. }
  214. } else {
  215. Strcpy(buf, dn);
  216. Strcat(buf, " potion");
  217. }
  218. break;
  219. case SCROLL_SYM:
  220. Strcpy(buf, "scroll");
  221. if (pl) {
  222. pl = 0;
  223. Strcat(buf, "s");
  224. }
  225. if (!obj->dknown)
  226. break;
  227. if (nn) {
  228. Strcat(buf, " of ");
  229. Strcat(buf, an);
  230. } else if (un) {
  231. Strcat(buf, " called ");
  232. Strcat(buf, un);
  233. } else {
  234. Strcat(buf, " labeled ");
  235. Strcat(buf, dn);
  236. }
  237. break;
  238. case WAND_SYM:
  239. if (!obj->dknown)
  240. Sprintf(buf, "wand");
  241. else if (nn)
  242. Sprintf(buf, "wand of %s", an);
  243. else if (un)
  244. Sprintf(buf, "wand called %s", un);
  245. else
  246. Sprintf(buf, "%s wand", dn);
  247. break;
  248. case RING_SYM:
  249. if (!obj->dknown)
  250. Sprintf(buf, "ring");
  251. else if (nn)
  252. Sprintf(buf, "ring of %s", an);
  253. else if (un)
  254. Sprintf(buf, "ring called %s", un);
  255. else
  256. Sprintf(buf, "%s ring", dn);
  257. break;
  258. case GEM_SYM:
  259. if (!obj->dknown) {
  260. Strcpy(buf, "gem");
  261. break;
  262. }
  263. if (!nn) {
  264. Sprintf(buf, "%s gem", dn);
  265. break;
  266. }
  267. Strcpy(buf, an);
  268. if (obj->otyp >= TURQUOISE && obj->otyp <= JADE)
  269. Strcat(buf, " stone");
  270. break;
  271. default:
  272. Sprintf(buf, "glorkum %c (0%o) %u %d",
  273. obj->olet, obj->olet, obj->otyp, obj->spe);
  274. }
  275. if (pl) {
  276. char *p;
  277. for (p = buf; *p; p++) {
  278. if (!strncmp(" of ", p, 4)) {
  279. /* pieces of, cloves of, lumps of */
  280. int c1, c2 = 's';
  281. do {
  282. c1 = c2;
  283. c2 = *p;
  284. *p++ = c1;
  285. } while (c1);
  286. goto nopl;
  287. }
  288. }
  289. p = eos(buf) - 1;
  290. if (*p == 's' || *p == 'z' || *p == 'x' ||
  291. (*p == 'h' && p[-1] == 's'))
  292. Strcat(buf, "es"); /* boxes */
  293. else if (*p == 'y' && !strchr(vowels, p[-1]))
  294. Strcpy(p, "ies"); /* rubies, zruties */
  295. else
  296. Strcat(buf, "s");
  297. }
  298. nopl:
  299. if (obj->onamelth) {
  300. Strcat(buf, " named ");
  301. Strcat(buf, ONAME(obj));
  302. }
  303. return (buf);
  304. }
  305. char *
  306. doname(obj)
  307. struct obj *obj;
  308. {
  309. char prefix[PREFIX];
  310. char *bp = xname(obj);
  311. if (obj->quan != 1)
  312. Sprintf(prefix, "%u ", obj->quan);
  313. else
  314. Strcpy(prefix, "a ");
  315. switch (obj->olet) {
  316. case AMULET_SYM:
  317. if (strncmp(bp, "cheap ", 6))
  318. Strcpy(prefix, "the ");
  319. break;
  320. case ARMOR_SYM:
  321. if (obj->owornmask & W_ARMOR)
  322. Strcat(bp, " (being worn)");
  323. /* fall into next case */
  324. case WEAPON_SYM:
  325. if (obj->known) {
  326. Strcat(prefix, sitoa(obj->spe));
  327. Strcat(prefix, " ");
  328. }
  329. break;
  330. case WAND_SYM:
  331. if (obj->known)
  332. Sprintf(eos(bp), " (%d)", obj->spe);
  333. break;
  334. case RING_SYM:
  335. if (obj->owornmask & W_RINGR)
  336. Strcat(bp, " (on right hand)");
  337. if (obj->owornmask & W_RINGL)
  338. Strcat(bp, " (on left hand)");
  339. if (obj->known && (objects[obj->otyp].bits & SPEC)) {
  340. Strcat(prefix, sitoa(obj->spe));
  341. Strcat(prefix, " ");
  342. }
  343. break;
  344. }
  345. if (obj->owornmask & W_WEP)
  346. Strcat(bp, " (weapon in hand)");
  347. if (obj->unpaid)
  348. Strcat(bp, " (unpaid)");
  349. if (!strcmp(prefix, "a ") && strchr(vowels, *bp))
  350. Strcpy(prefix, "an ");
  351. bp = strprepend(bp, prefix);
  352. return (bp);
  353. }
  354. /* used only in hack.fight.c (thitu) */
  355. void
  356. setan(const char *str, char *buf)
  357. {
  358. if (strchr(vowels, *str))
  359. Sprintf(buf, "an %s", str);
  360. else
  361. Sprintf(buf, "a %s", str);
  362. }
  363. char *
  364. aobjnam(otmp, verb)
  365. struct obj *otmp;
  366. const char *verb;
  367. {
  368. char *bp = xname(otmp);
  369. char prefix[PREFIX];
  370. if (otmp->quan != 1) {
  371. Sprintf(prefix, "%u ", otmp->quan);
  372. bp = strprepend(bp, prefix);
  373. }
  374. if (verb) {
  375. /* verb is given in plural (i.e., without trailing s) */
  376. Strcat(bp, " ");
  377. if (otmp->quan != 1)
  378. Strcat(bp, verb);
  379. else if (!strcmp(verb, "are"))
  380. Strcat(bp, "is");
  381. else {
  382. Strcat(bp, verb);
  383. Strcat(bp, "s");
  384. }
  385. }
  386. return (bp);
  387. }
  388. char *
  389. Doname(obj)
  390. struct obj *obj;
  391. {
  392. char *s = doname(obj);
  393. if ('a' <= *s && *s <= 'z')
  394. *s -= ('a' - 'A');
  395. return (s);
  396. }
  397. const char *const wrp[] = {"wand", "ring", "potion", "scroll", "gem"};
  398. const char wrpsym[] = {WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM};
  399. struct obj *
  400. readobjnam(bp)
  401. char *bp;
  402. {
  403. char *p;
  404. int i;
  405. int cnt, spe, spesgn, typ, heavy;
  406. char let;
  407. char *un, *dn, *an;
  408. /* int the = 0; char *oname = 0; */
  409. cnt = spe = spesgn = typ = heavy = 0;
  410. let = 0;
  411. an = dn = un = 0;
  412. for (p = bp; *p; p++)
  413. if ('A' <= *p && *p <= 'Z')
  414. *p += 'a' - 'A';
  415. if (!strncmp(bp, "the ", 4)) {
  416. /* the = 1; */
  417. bp += 4;
  418. } else if (!strncmp(bp, "an ", 3)) {
  419. cnt = 1;
  420. bp += 3;
  421. } else if (!strncmp(bp, "a ", 2)) {
  422. cnt = 1;
  423. bp += 2;
  424. }
  425. if (!cnt && digit(*bp)) {
  426. cnt = atoi(bp);
  427. while (digit(*bp))
  428. bp++;
  429. while (*bp == ' ')
  430. bp++;
  431. }
  432. if (!cnt)
  433. cnt = 1; /* %% what with "gems" etc. ? */
  434. if (*bp == '+' || *bp == '-') {
  435. spesgn = (*bp++ == '+') ? 1 : -1;
  436. spe = atoi(bp);
  437. while (digit(*bp))
  438. bp++;
  439. while (*bp == ' ')
  440. bp++;
  441. } else {
  442. p = strrchr(bp, '(');
  443. if (p) {
  444. if (p > bp && p[-1] == ' ')
  445. p[-1] = 0;
  446. else
  447. *p = 0;
  448. p++;
  449. spe = atoi(p);
  450. while (digit(*p))
  451. p++;
  452. if (strcmp(p, ")"))
  453. spe = 0;
  454. else
  455. spesgn = 1;
  456. }
  457. }
  458. /*
  459. * now we have the actual name, as delivered by xname, say green
  460. * potions called whisky scrolls labeled "QWERTY" egg dead zruties
  461. * fortune cookies very heavy iron ball named hoei wand of wishing
  462. * elven cloak
  463. */
  464. for (p = bp; *p; p++)
  465. if (!strncmp(p, " named ", 7)) {
  466. *p = 0;
  467. /* oname = p+7; */
  468. }
  469. for (p = bp; *p; p++)
  470. if (!strncmp(p, " called ", 8)) {
  471. *p = 0;
  472. un = p + 8;
  473. }
  474. for (p = bp; *p; p++)
  475. if (!strncmp(p, " labeled ", 9)) {
  476. *p = 0;
  477. dn = p + 9;
  478. }
  479. /* first change to singular if necessary */
  480. if (cnt != 1) {
  481. /* find "cloves of garlic", "worthless pieces of blue glass" */
  482. for (p = bp; *p; p++)
  483. if (!strncmp(p, "s of ", 5)) {
  484. while ((*p = p[1]) != '\0')
  485. p++;
  486. goto sing;
  487. }
  488. /* remove -s or -es (boxes) or -ies (rubies, zruties) */
  489. p = eos(bp);
  490. if (p[-1] == 's') {
  491. if (p[-2] == 'e') {
  492. if (p[-3] == 'i') {
  493. if (!strcmp(p - 7, "cookies"))
  494. goto mins;
  495. Strcpy(p - 3, "y");
  496. goto sing;
  497. }
  498. /* note: cloves / knives from clove / knife */
  499. if (!strcmp(p - 6, "knives")) {
  500. Strcpy(p - 3, "fe");
  501. goto sing;
  502. }
  503. /* note: nurses, axes but boxes */
  504. if (!strcmp(p - 5, "boxes")) {
  505. p[-2] = 0;
  506. goto sing;
  507. }
  508. }
  509. mins:
  510. p[-1] = 0;
  511. } else {
  512. if (!strcmp(p - 9, "homunculi")) {
  513. Strcpy(p - 1, "us"); /* !! makes string
  514. * longer */
  515. goto sing;
  516. }
  517. if (!strcmp(p - 5, "teeth")) {
  518. Strcpy(p - 5, "tooth");
  519. goto sing;
  520. }
  521. /* here we cannot find the plural suffix */
  522. }
  523. }
  524. sing:
  525. if (!strcmp(bp, "amulet of yendor")) {
  526. typ = AMULET_OF_YENDOR;
  527. goto typfnd;
  528. }
  529. p = eos(bp);
  530. if (!strcmp(p - 5, " mail")) { /* Note: ring mail is not a ring ! */
  531. let = ARMOR_SYM;
  532. an = bp;
  533. goto srch;
  534. }
  535. for (i = 0; i < (int)sizeof(wrpsym); i++) {
  536. int j = strlen(wrp[i]);
  537. if (!strncmp(bp, wrp[i], j)) {
  538. let = wrpsym[i];
  539. bp += j;
  540. if (!strncmp(bp, " of ", 4))
  541. an = bp + 4;
  542. /* else if(*bp) ?? */
  543. goto srch;
  544. }
  545. if (!strcmp(p - j, wrp[i])) {
  546. let = wrpsym[i];
  547. p -= j;
  548. *p = 0;
  549. if (p[-1] == ' ')
  550. p[-1] = 0;
  551. dn = bp;
  552. goto srch;
  553. }
  554. }
  555. if (!strcmp(p - 6, " stone")) {
  556. p[-6] = 0;
  557. let = GEM_SYM;
  558. an = bp;
  559. goto srch;
  560. }
  561. if (!strcmp(bp, "very heavy iron ball")) {
  562. heavy = 1;
  563. typ = HEAVY_IRON_BALL;
  564. goto typfnd;
  565. }
  566. an = bp;
  567. srch:
  568. if (!an && !dn && !un)
  569. goto any;
  570. i = 1;
  571. if (let)
  572. i = bases[letindex(let)];
  573. while (i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)) {
  574. const char *zn = objects[i].oc_name;
  575. if (!zn)
  576. goto nxti;
  577. if (an && strcmp(an, zn))
  578. goto nxti;
  579. if (dn && (!(zn = objects[i].oc_descr) || strcmp(dn, zn)))
  580. goto nxti;
  581. if (un && (!(zn = objects[i].oc_uname) || strcmp(un, zn)))
  582. goto nxti;
  583. typ = i;
  584. goto typfnd;
  585. nxti:
  586. i++;
  587. }
  588. any:
  589. if (!let)
  590. let = wrpsym[rn2(sizeof(wrpsym))];
  591. typ = probtype(let);
  592. typfnd:
  593. {
  594. struct obj *otmp;
  595. let = objects[typ].oc_olet;
  596. otmp = mksobj(typ);
  597. if (heavy)
  598. otmp->owt += 15;
  599. if (cnt > 0 && strchr("%?!*)", let) &&
  600. (cnt < 4 || (let == WEAPON_SYM && typ <= ROCK && cnt < 20)))
  601. otmp->quan = cnt;
  602. if (spe > 3 && spe > otmp->spe)
  603. spe = 0;
  604. else if (let == WAND_SYM)
  605. spe = otmp->spe;
  606. if (spe == 3 && u.uluck < 0)
  607. spesgn = -1;
  608. if (let != WAND_SYM && spesgn == -1)
  609. spe = -spe;
  610. if (let == BALL_SYM)
  611. spe = 0;
  612. else if (let == AMULET_SYM)
  613. spe = -1;
  614. else if (typ == WAN_WISHING && rn2(10))
  615. spe = (rn2(10) ? -1 : 0);
  616. otmp->spe = spe;
  617. if (spesgn == -1)
  618. otmp->cursed = 1;
  619. return (otmp);
  620. }
  621. }