diff -c -r sl6e4f5/src/engrave.c slengr/src/engrave.c *** sl6e4f5/src/engrave.c Fri Aug 31 14:25:34 2001 --- slengr/src/engrave.c Sat Nov 3 12:03:40 2001 *************** *** 1016,1034 **** Sprintf(qbuf,"What do you want to %s the %s here?", everb, eloc); getlin(qbuf, ebuf); ! /* Mix up engraving if surface or state of mind is unsound. */ ! /* Original kludge by stewr 870708. modified by njm 910722. */ ! for (sp = ebuf; *sp; sp++) ! if ( ((type == DUST || type == ENGR_BLOOD) && !rn2(25)) || ! (Blind && !rn2(9)) || (Confusion && !rn2(12)) || ! (Stunned && !rn2(4)) || (Hallucination && !rn2(1)) ) ! *sp = '!' + rn2(93); /* ASCII-code only */ ! ! /* Count the actual # of chars engraved not including spaces */ len = strlen(ebuf); for (sp = ebuf, spct = 0; *sp; sp++) if (isspace((int)*sp)) spct++; if ( (len == spct) || index(ebuf, '\033') ) { if (zapwand) { if (!Blind) --- 1016,1032 ---- Sprintf(qbuf,"What do you want to %s the %s here?", everb, eloc); getlin(qbuf, ebuf); ! /* Count the actual # of chars engraved not including spaces */ len = strlen(ebuf); + /* D: Count the number of spaces twice - once before and once after + * (possibly) mixing up engraving. + */ for (sp = ebuf, spct = 0; *sp; sp++) if (isspace((int)*sp)) spct++; + /* D: Moved the check for a 'nothing' engraving before the munging. + * I believe this is more in line with the _intent_ of the code. + */ if ( (len == spct) || index(ebuf, '\033') ) { if (zapwand) { if (!Blind) *************** *** 1040,1051 **** } } - len -= spct; - /* A single `x' is the traditional signature of an illiterate person */ ! if (len != 1 || (!index(ebuf, 'x') && !index(ebuf, 'X'))) u.uconduct.literate++; /* Previous engraving is overwritten */ if (eow) { del_engr(oep); --- 1038,1062 ---- } } /* A single `x' is the traditional signature of an illiterate person */ ! if (len - spct != 1 || (!index(ebuf, 'x') && !index(ebuf, 'X'))) u.uconduct.literate++; + /* Mix up engraving if surface or state of mind is unsound. */ + /* Original kludge by stewr 870708. modified by njm 910722. */ + for (sp = ebuf; *sp; sp++) + if ( ((type == DUST || type == ENGR_BLOOD) && !rn2(25)) || + (Blind && !rn2(9)) || (Confusion && !rn2(12)) || + (Stunned && !rn2(4)) || (Hallucination && !rn2(1)) ) + *sp = '!' + rn2(93); /* ASCII-code only */ + + /* Space count must be recalculated, since the mixing up may + * have turned a space into some other character + */ + for (sp = ebuf, spct = 0; *sp; sp++) if (isspace((int)*sp)) spct++; + + len -= spct; + /* Previous engraving is overwritten */ if (eow) { del_engr(oep);