Opened 11 months ago

#1973 new bug

coding arithmetic errors

Reported by: nckmccnnll Owned by:
Milestone: 4.1 Keywords:
Cc:

Description

Reported by t4nk074 on IRC:
"so i was reading gen-room.c (4.0.5 release)
the function room_build has this (lines 3002 and 3003)
x = ((bx1 + bx2 + 1) * dun->block_hgt) / 2;
(same for y-coordinate) why does it add 1 to bx1 + bx2? that doesn't look right to me... sorry if i'm missing something
for example, given the block 0, 0 (northwestern-most) and "simple" room (33x11 tiles), it will calculate its center (x-coordinate) as (0 + 3 + 1) * 11 / 2 which is 22... i'd expect the center to be at 16?
and vertical center will be at 11 ((0 + 1 + 1) * 11 / 2) instead of 5... is that correct?"

"line 121 of effects.c calculates effect damage, boosted by skill:
final *= (100 + context->boost) / 100;
context->boost is an int and calculated as follows: (line 546 of cmd-obj.c):
boost = MAX(player->state.skills[SKILL_DEVICE] - level, 0);
judging by ui-player.c (lines 791-792), state.skills[SKILL_DEVICE] is what is displayed on the char screen
a newborn gnome mage has 62 device skill
a wand of magic missile is a level 3 object
how is that possible that a gnome mage has 59% boost (as the game says) when
(100 + 59) / 100 equals 1? (integer arithmetic)
does anyone actually get a boost (that is less than 100%)?"

Change History (0)

Note: See TracTickets for help on using tickets.