Goldify spellbooks

Questions, Explanations, Howtos


Cocytus Succeeder

Posts: 2145

Joined: Tuesday, 3rd February 2015, 22:05

Post Thursday, 5th January 2017, 03:28

Goldify spellbooks

I submitted this patch to mantis. From the commit message:
There are some issues with this (saving/reloading does not work yet).

Goldify (or runify) spellbooks. This is achieved by having a vector member in class "player" called "books_in_inventory". Picked up books go there instead of in the inventory. For characters which start with a book, the book is initially placed in the inventory, identified, then goldified and removed from inventory (an awful hack, but I don't know enough about the code to do it more elegantly).

Manuals are still treated normally. I tried to goldify them as well, but the code went into an infinite loop. In any case, there's no obvious way to show multiple manuals in the display otherwise, so it's probably better to keep them as it is.

Breaks old savefiles because books_in_inventory needs to be marshalled/unmarshalled. Saving/reloading does not actually work because crashes with an error ("ERROR in '' at line 4089: Invalid item: book of Changes"). The code in is currently commented out. If someone can tell me what's causing it, I'll fix it.

TODO: Fix saving/reloading. Optional: Remove Trog's book burning. Make Vehumet gift an artifact spellbook containing 1/3 spells, instead of a spell using the "M" screen.

Saving/reloading doesn't work yet. If someone can tell me how to fix it, I'll do it.

For this message the author bel has received thanks: 2
Hellmonk, VeryAngryFelid

Blades Runner

Posts: 638

Joined: Saturday, 12th December 2015, 23:54

Post Saturday, 4th February 2017, 17:08

Re: Goldify spellbooks

I keep meaning to reply to this. You can avoid breaking old saves (I think?) with a minor version tag, just check that the version is >= the minor version before unmarshalling. The crash appears to be caused by the check for appearance_initialized in item_def::is_valid. My best guess is that the appearance doesn't get set up until after the book moved to your book inventory. I "solved" the problem by deleting that part of is_valid but I don't know if that's a viable solution for regular crawl.
Remove spell hunger.

For this message the author Hellmonk has received thanks:

Spider Stomper

Posts: 242

Joined: Friday, 17th April 2015, 16:22

Post Wednesday, 1st March 2017, 19:44

Re: Goldify spellbooks

Hey, I'm using this for the fork I'm working on. The crashes seem to be caused by the books in the player's starting inventory not being set up right since they're removed right away. Books should probably just not be given out with other stuff in character creation.

Actually wound up overhauling the whole thing to just use a FixedBitVector and store the spells in the library instead of all the books in the end, though.

Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.