mbbsemu / MBBSEmu

The MajorBBS Emulation Project is an Open Source, Cross-Platform emulator for easily running The MajorBBS & Worldgroup Modules
https://www.mbbsemu.com
MIT License
132 stars 14 forks source link

[WCCMMUD] MajorMud - Topten Adventurers does not show name #204

Closed tuday2 closed 3 years ago

tuday2 commented 3 years ago

Module Information

Describe the bug Topten Adventurers does not show name

To Reproduce Steps to reproduce the behavior:

  1. Enter MajorMud module
  2. Select "T" Top Ten Adventurers
  3. See Error

Expected behavior Show names of adventurers

Screenshots

No Console Error

MMTOPTEN

Software Information:

enusbaum commented 3 years ago

This issue is being caused by nested SPR calls in MajorMUD for the Top Heroes screen.

The current implementation of SPR uses a single buffer for the result, which is reused with each subsequent call (to avoid leaking memory with each call). Because of this, the player name is sent to SPR using the format of %s %s, followed by their rank using %d. Because they're using the same buffer, the same pointer is being returned by SPR and the same value is being displayed for both Rank and Name.

The fix here is probably to establish a Ring Buffer in a dedicated segment of memory for SPR and just increment the pointer/overflow back to 0x0000 when the end of the segment is reached. This would allow up to 64k of nested SPR output with unique pointers to each value.

enusbaum commented 3 years ago

image