http://rpg.hamsterrepublic.com/bugzilla/show_bug.cgi?id=792
Summary: "get attack name" argument off-by-one (or off-by-two)
Product: OHRRPGCE
Version: Nigtly WIP Builds (Ypsiliform)
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Plotscripts
AssignedTo: [email protected]
ReportedBy: [email protected]
Blocks: 683
Rimudora reports at http://castleparadox.com/ohr/viewtopic.php?t=6437
---
I used the following code to test the bug, using a blank .rpg file where the
attacks have been given names like "Zero", "One", "Two", and so on.
Code:
plotscript,test,begin
variable(temp)
for(temp,-3,3) do,begin
showvalue(temp)
getattackname(1,temp)
showstringat(1,0,0)
waitforkey(usekey)
end
end
The problem is that getattackname(1,0) gives me the name of attack #1,
getattackname(1,1) gives me the name of attack#2, and so on.
getattackname(1,-1) and earlier doesn't give me anything, so it's technically
impossible to get the attack name of attack #0.
I've tried this out on both the latest nightly and xocolatl+2
---
Here is the problem in yetmore.bas:
CASE 208'--get attack name(str,atk)
IF valid_plotstr(retvals(0)) = NO OR retvals(1) < 0 OR retvals(1) >
gen(genMaxAttack) THEN
scriptret = 0
ELSE
plotstr(retvals(0)).s = readattackname$(retvals(1) + 1)
scriptret = 1
END IF
See, the problem is that all the atk: constants are offset +1 and they have
always been that way. All the commands that accept an attack ID as an argument
expect ID + 1
The implementation of "get attack name" was supposed to subtract 1 from
retvals(1) but instead it is adding one, making this an off-by-two error.
This bug was introduced way the heck back in svn revision 256 in January 2006,
which means this bug has been present since the serendipity stable release.
I can fix it with two keystrokes, but it breaks every single dang game that has
ever use that command in the past 3 years. Perhaps that is fair punishment for
any authors who worked around this without reporting the bug, but I hate to
think so punitively ;)
--
Configure bugmail:
http://rpg.hamsterrepublic.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org