Subject: Re: Program in disorder (Eek!)

From: [email-masked] (Dylan O'Donnell)
Date: 05 Nov 2001 14:33:11 +0000

Tomasz Ostrowski <[email-masked]> writes:
> On 05 Nov 2001 10:12:22 +0000, Dylan O'Donnell wrote:
> 
> >  (I posted a fix a few weeks ago, which Ali Harlow archived on his
> >  site at http://avrc.city.ac.uk/nethack/ODonnell/c331-30.patch )
> 
> I do not understand this patch.

[snip brown-paper-bag error]

Thank you. You're supposed to point out my idiotic mistakes,
people.

--- nethack-3.3.1/src/weapon.c  Thu Aug 31 12:33:50 2000
+++ nethack-3.3.1bis/src/weapon.c       Mon Nov  5 14:29:00 2001
@@ -1008,9 +1008,9 @@
        }
     } else if (type == P_TWO_WEAPON_COMBAT) {
        skill = P_SKILL(P_TWO_WEAPON_COMBAT);
-       if (P_SKILL(weapon->otyp) < skill) skill = P_SKILL(weapon->otyp);
+       if (P_SKILL(weapon_type(weapon)) < skill) skill = P_SKILL(weapon_type(weapon));
        switch (skill) {
-           default: impossible(bad_skill, P_SKILL(type)); /* fall through */
+           default: impossible(bad_skill, skill); /* fall through */
            case P_ISRESTRICTED:
            case P_UNSKILLED:   bonus = -9; break;
            case P_BASIC:       bonus = -7; break;
@@ -1064,9 +1064,10 @@
        }
     } else if (type == P_TWO_WEAPON_COMBAT) {
        skill = P_SKILL(P_TWO_WEAPON_COMBAT);
-       if (P_SKILL(weapon->otyp) < skill) skill = P_SKILL(weapon->otyp);
+       if (P_SKILL(weapon_type(weapon)) < skill) skill = P_SKILL(weapon_type(weapon));
        switch (skill) {
-           default:
+           default:  impossible("weapon_dam_bonus: bad skill %d", skill);
+                     /* fall through */
            case P_ISRESTRICTED:
            case P_UNSKILLED:   bonus = -3; break;
            case P_BASIC:       bonus = -1; break;

-- 
:  Dylan O'Donnell                     http://www.spod-central.org/~psmith/  :
:   microHamlet: the average coherency of prose created by a single monkey   :
:   typing randomly on a keyboard. Usenet postings may be measured in uHm.   :