Opened 6 years ago

Closed 5 years ago

#1540 closed task (fixed (in v4))

Remove bogus pvals

Reported by: magnate Owned by: magnate
Milestone: v4 Keywords: items,affixes
Cc:

Description

Prior to lots of other object stuff (see Goals for 3.4 but in particular #1039) we need to stop using pvals for stuff that isn't a pval flag. The three cases are:

food: I suggest a simple o_ptr->food value would suffice, though there are probably better solutions long-term

fuel: again, o_ptr->fuel suggests itself. In fact this could do for both fuel and food, unless we envisage some sort of elvish draught that would have one value when quaffed and another when poured into a lamp. Decrementing this value for in-use lights would probably be easier than using o_ptr->timeout.

gold: IMO this ought to be fixed by making o_ptr->number u16b and multiplying by sval to get the gp value

Change History (8)

comment:1 Changed 6 years ago by magnate

  • Status changed from new to confirmed

Ooops. I forgot about case four: charges. ISTR discussion a while ago about moving to o_ptr->charges[] so that stacks of charged items remember their individual charges.

comment:2 Changed 6 years ago by takkaria

Moving to o_ptr->charges[] is really really difficult - it took me months to figure out how to do it, and that was independently of any other changes. The problem comes from the fact that the object management code is not set up to allow leak-free allocating and freeing of arrays within the object structs. It seems sensible for fuel/food/charges to all share the same field, though.

If number is u16b and we use that to store the GP value, why would multiplication be needed?

comment:3 Changed 6 years ago by magnate

I was envisaging o_ptr->number to be the number of coins, rather than the gp value. That's probably unnecessarily complicated though, and your way is better.

So in the first instance we move to o_ptr->fuel for light/food/charges, and charges remain munged together for a stack until we sort out the array-leakage ...

comment:4 Changed 6 years ago by takkaria

On a slightly pedantic and OT note, the game's exact wording is "ten gold pieces worth of silver" - it's a lump of metal rather than coins that the player picks up.

comment:5 Changed 5 years ago by magnate

  • Keywords items,affixes added; items removed

This ticket is addressed in (or enabled by) https://github.com/angband/angband/pull/94

comment:6 Changed 5 years ago by magnate

  • Status changed from confirmed to pending

comment:7 Changed 5 years ago by magnate

  • Milestone changed from 3.4.0 to 4.0

Initial assignment to v4 per http://trac.rephial.org/roadmap

comment:8 Changed 5 years ago by magnate

  • Resolution set to fixed (in v4)
  • Status changed from pending to closed

Fixed in the affixes merge [r48ccc16f]

Note: See TracTickets for help on using tickets.