DavidGriffith / frotz

Infocom-style interactive fiction player for Unix and DOS (moved to https://gitlab.com/DavidGriffith/frotz)
GNU General Public License v2.0
209 stars 64 forks source link

Terminal width of 256 overflows to report 0 width to story #34

Closed BroadcastGames closed 7 years ago

BroadcastGames commented 7 years ago

If I resize the Terminal window to 256 characters the game reports that it has zero. 255 width works fine. You can see this with the opening error in the game zracer.z5 http://ifdb.tads.org/viewgame?id=tnljfhvnzvybysqt Thank you and Merry Christmas!

DavidGriffith commented 7 years ago

Confirmed for the ao-curses branch.

DavidGriffith commented 7 years ago

The terminal width is stored as an unsigned short (see https://github.com/DavidGriffith/frotz/blob/master/src/common/frotz.h). Therefore it has a maximum value of 255 before rolling over to 0. There are a lot of other things about the Z-machine stored as unsigned shorts. Altering this to allow for terminals wider than 255 characters seems would be a big task for a very small payoff. Therefore I will make Frotz complain about the too-wide terminal and then terminate rather than continue and return an obviously bogus width.

BroadcastGames commented 7 years ago

Going to 0 is the real problem. Can't you add logic that if > 255 just set to 255?

DavidGriffith commented 7 years ago

I'm working on it now. I seem to have uncovered a problem with the os_fatal() function that causes it to append garbage to the error message. But just with this complaint -- not any of the other calls to os_fatal().

DavidGriffith commented 7 years ago

Fixed. See also a7b6e8f7fc85298707d448d2848ffce714fb47e1 for a weird problem that caused garbage to be printed if print_string() is called when the Z-machine is not running.

BroadcastGames commented 7 years ago

Thank you.

DavidGriffith commented 7 years ago

Reopening to add to "Pre-2.45 cleanup" milestone