dungeons-of-moria / umoria

Moria: a roguelike Dungeon Crawler game | Umoria Source Code
https://umoria.org
GNU General Public License v3.0
343 stars 71 forks source link

Display of "To AC" and "Total AC" are switched #5

Closed mrcook closed 7 years ago

mrcook commented 7 years ago

When displaying the character's stats, the To AC and Total AC are using each others values (https://github.com/dungeons-of-moria/umoria/blob/master/src/misc3.cpp#L944-L945):

printHeaderNumber("+ To AC     ", py.misc.dis_tac, 11, 1);
printHeaderNumber("  Total AC  ", py.misc.dis_ac, 12, 1);

The comments on the struct fields are:

int16_t dis_ac;              // Display +ToAC
int16_t dis_tac;             // Display +ToTAC

The assumption here is that ToTAC means Total AC.

The same happens when writing the character sheet to a file: https://github.com/dungeons-of-moria/umoria/blob/master/src/files.cpp#L202-L205. At this point I'm not sure if other calculations made with these are actually correct.

This mixup exists in the original Umoria 5.6 source code (https://github.com/HunterZ/umoria/blob/master/source/misc3.c#L1021-L1022) so it looks to be a long standing error.

mrcook commented 7 years ago

This naming/assignment has been in place since Umoria v4.8.5 (https://github.com/dungeons-of-moria/umoria/blob/v4.8.5/misc2.c#L984-L985), so it's possible that the field naming/comment is what's wrong, but display/computations are correct.

Example output from the game is:

 + To Hit    :      4
 + To Damage :      3
 + To AC     :     13
   Total AC  :     28
mrcook commented 7 years ago

After a little more digging this does look like it's the comments that are wrong, as the field names have been in place since the original Pascal version: https://github.com/dungeons-of-moria/vms-moria/blob/master/source/include/misc.inc#L2384-L2385

To save future confusion I'll go ahead and update the comments on the struct.

mrcook commented 7 years ago

Fixed with commit https://github.com/dungeons-of-moria/umoria/commit/3a0e121472e4749924852e67065f4e085795fb84