Creating objects list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lonadar
    Rookie
    • Nov 2019
    • 12

    Creating objects list

    I tend to run things in systems, and to that end a long time ago I generated a spreadsheet of all of the objects in the game to help me prune the wheat from the chaff as I delved in determining what to keep to sell. As I'd delve deeper, I'd (I)gnore certain items based on their value.

    One thing that has always baffled me, though, is how the game determines the order that it displays objects, either in stores or in the player's inventory. It doesn't appear to be based on the order the items are in objects.txt, it isn't necessarily based on the types of items; aside from the significant groupings I haven't been able to find any flag that's used to sort them.

    If anyone can provide any insight, I'd appreciate it. It's so much handier if I can have the spreadsheet sorted in the same order the game would.
  • backwardsEric
    Knight
    • Aug 2019
    • 527

    #2
    If you want to look at the code involved, it is earlier_object() in src/player-calcs.c. Stores get somewhat different treatment than the player inventory, but this is the general ordering:
    1. Objects are sorted in reverse order of the broad classification ("tval") of the object (see the list in src/list-tvals.h)
    2. Within the same "tval", books that are readable by the player appear before other books (only applies to the player's inventory). Ammunition which is usable with the current launcher appears before other ammunition. Otherwise, objects appear in order of increasing "sval" (their kind index within the "tval") which should correspond to the order in which they appear in object.txt.

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎