[ADOMSage] Bug?

Archived from groups: rec.games.roguelike.adom (More info?)

Hmm, I think I've noticed a bug in ADOM Sage that I don't recall being
discussed before.


Beastfighter melee damage seems to be incorrectly reported by the
averaging function. I'm guessing it's a bug in ADOM Sage, not ADOM? Which
is telling the truth?


Screenshot:

-------------

Right hand: +5 bonus to hit, 1d4+2 damage (2-2, avg 2.0)

.............
...............
...............
.................
........@........
¦¦¦¦.............
¦.....¦¦¦¦¦¦.
........¦
¦¦..t..¦
t......¦
......¦
.....
¦¦¦


Eubank St:16 Le:12 Wi: 7 Dx:22 To:15 Ch:10 Ap:14 Ma:12
Pe:16 L
DV/PV: 17/2 H: 19(19) P: 2(2) Exp: 1/0 Vlge Sp:
102

-------------

Anyone else notice this?

g.
1 answer Last reply
More about adomsage
  1. Archived from groups: rec.games.roguelike.adom (More info?)

    On 20 Jan 2005 13:32:26 GMT, goldaryn wrote:

    > Hmm, I think I've noticed a bug in ADOM Sage that I don't recall being
    > discussed before.
    >
    >
    > Beastfighter melee damage seems to be incorrectly reported by the
    > averaging function. I'm guessing it's a bug in ADOM Sage, not ADOM? Which
    > is telling the truth?
    >
    >
    > Screenshot:
    >
    > -------------
    >
    > Right hand: +5 bonus to hit, 1d4+2 damage (2-2, avg 2.0)
    >
    > .............
    > ...............
    > ...............
    > .................
    > ........@........
    > ¦¦¦¦.............
    > ¦.....¦¦¦¦¦¦.
    > ........¦
    > ¦¦..t..¦
    > t......¦
    > ......¦
    > .....
    > ¦¦¦
    >
    >
    > Eubank St:16 Le:12 Wi: 7 Dx:22 To:15 Ch:10 Ap:14 Ma:12
    > Pe:16 L
    > DV/PV: 17/2 H: 19(19) P: 2(2) Exp: 1/0 Vlge Sp:
    > 102
    >
    > -------------
    >
    > Anyone else notice this?
    >
    > g.

    Looking at the source code, it looks like that particular feature is
    broken:


    int StateWeaponStats::sprintf(char *str, const char *format, va_list ap)
    {
    const char *dice_format = "%dd%d";
    const char *hand_format = "\x03\xC6%s_hand:_\x03\xCE%+d\x03\xC6_bonus to hit,_%s\x03\xCE%s%+d%s\x03\xC6_damage%s";
    const char *kick_format = "\x03\xCE%+d\x03\xC6_bonus to hit,_\x03\xCE" "1d%d%+d\x03\xC6_damage";
    const char *missile_dice_format = "%s%+d";
    const char *missile_fraction_dice_format = "[(%s)/%d]%+d";
    const char *missile_format = "\x03\xC6" "Ammunition:_\x03\xCE%ld\x03\xC6, base range:_\x03\xCE%d\x03\xC6,_\x03\xCE%+d\x03\xC6_bonus to hit,_\x03\xCE%s\x03\xC6_damage";
    if (strcmp(format, dice_format) == 0) {
    dice = va_arg(ap, int);
    sides = va_arg(ap, int);
    fraction = 1;
    return real_sprintf(str, format, dice, sides);
    } else if (strcmp(format, missile_dice_format) == 0) {
    char *dicestr;
    dicestr = va_arg(ap, char*);
    plus = va_arg(ap, int);
    fraction = 1;
    return real_sprintf(str, format, dicestr, plus);
    } else if (strcmp(format, missile_fraction_dice_format) == 0) {
    char *dicestr;
    dicestr = va_arg(ap, char*);
    fraction = va_arg(ap, int);
    plus = va_arg(ap, int);
    return real_sprintf(str, format, dicestr, fraction, plus);
    } else if (strcmp(format, hand_format) == 0) {
    char *hand, *dicestr, *open_paren, *unk, *close_paren;
    int tohit;
    hand = va_arg(ap, char*);
    tohit = va_arg(ap, int);
    open_paren = va_arg(ap, char*);
    dicestr = va_arg(ap, char*);
    plus = va_arg(ap, int);
    unk = va_arg(ap, char*);
    close_paren = va_arg(ap, char*);
    return real_sprintf(str,
    "%s hand: %+d bonus to hit, %s%s%+d%s damage%s (%i-%i, avg %.1f)",
    hand, tohit, open_paren, dicestr, plus, unk, close_paren,
    (dice + plus) / fraction, (dice * sides + plus) / fraction,
    ((double) dice * (sides + 1) / 2 + plus) / fraction);
    } else if (strcmp(format, kick_format) == 0) {
    int tohit;
    tohit = va_arg(ap, int);
    sides = va_arg(ap, int);
    plus = va_arg(ap, int);
    return real_sprintf(str,
    "%+d bonus to hit, 1d%d+%d damage (%i-%i, avg %.1f)",
    tohit, sides, plus,
    1 + plus, sides + plus,
    (double) (sides + 1) / 2 + plus);
    } else if (strcmp(format, missile_format) == 0) {
    char *dmgstr;
    int ammo, range, tohit;
    ammo = va_arg(ap, int);
    range = va_arg(ap, int);
    tohit = va_arg(ap, int);
    dmgstr = va_arg(ap, char*);
    return real_sprintf(str,
    "Ammo: %i, base range: %i, %+d to hit, %s damage (%i-%i, avg %.1f)",
    ammo, range, tohit, dmgstr,
    dice / fraction + plus, (dice * sides) / fraction + plus,
    (double) dice * (sides + 1) / 2 / fraction + plus);
    } else
    return real_vsprintf(str, format, ap);
    }

    Notice that in all cases except for hand_format the variables are
    populated with values from calls to va_arg before they are used in
    real_sprintf. But not for hand_format - dice and fraction don't seem to
    be initialized.

    --
    A blessed ElDeR cHaOs GoD figurine of wondrous power (25s) is lying
    here.

    AdomBot - bot, demos, sounds, cheats, and more
    http://www.geocities.com/adombot/
Ask a new question

Read More

Games Bug Video Games