View Single Post
Old November 17, 2013, 14:33   #10
chris
PosChengband Maintainer
 
Join Date: Jan 2008
Posts: 702
chris is on a distinguished road
Quote:
Originally Posted by clouded View Post
Though when 'x'ing a big stack of items you can scroll it with enter, would it be difficult to do the same for inventory?
Yes. Take a look at how the source implements this and you will see why (target_set_aux in xtra2.c around line 3795). Basically, items on the floor are in a linked list. When you press enter, the code removes the first item from the list and adds it to the tail of the list. Display code is hard coded to display the first 23 items (show_floor in object1.c around line 3286).

Making assumptions about display size was probably OK in the 1970's and 1980's but is now extremely poor practice. Ideally, all code would query the display size at run time and offer facilities for handling more choices than can be fit on the screen. Making design decisions (Pack size is 23 because displays at the time where 24 lines) is idiotic beyond words.

I could come up with cleaner display code I guess, but it's a rather low priority for me at the moment. The current code is a mess ...

Quote:
Anyway, a few other things: lite town and vanilla town both seem to have problems, lite crashes randomly and vanilla crashes after character creation.
Fixed.

Quote:
We've ran out of space in v_info! Or so it seems? When I just added mine to the end the game complained about 'out of memory' something or other.
I'll look into this. The initialization code uses a fixed size string buffer for all the various ?_info.txt files. The size chosen is just a guess for the biggest possible amount of string space required.
chris is offline   Reply With Quote