Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

LoadItemClass and itemclass pointers

2 replies · 884 views · Started 14 December 2007

LoadItemClass() is defined as:

itemclass LoadItemClass(int family)
* Retrieves the itemclass pointer corresponding to the given item family.
* Use the IC_ constants in std.zh as values of family.
Now, the IC_ constants are things like IC_POTION and IC_ROCS, which are, indeed, item classes in this sense:

itemclass Class
* The class (the type of item) to which this item belongs.

However, the "ItemClass Functions and Variables" consist of such variables as MaxIncrement, Level and Counter, which are variables for individual item definitions, as seen in the Item Editor. Hence, 'itemclass' pointers don't actually refer to item classes at all. (And for good reason: item classes are nothing more than integer values for an item's Class variable.)

Thus, from the evidence available, the following bugs are evident:
* Obviously, the Class variable for 'item' pointers must be of type 'int' instead of type 'itemclass'. Documentation error.
* Furthermore, the 'itemclass' keyword and LoadItemClass must be renamed. I suppose 'itemdata' and LoadItemData would be appropriate.

Yes; optimally, everything "itemclass" in ZASM and ZScripting should have been called "itemdata" from the start.

I'm certainly not opposed to doing such a renaming at this point, though we have to weigh future clarity against the harm caused by breaking old scripts.

I've decided to change itemclass to itemdata, and similarly for item->Class. I've also updated the zscript.txt documentation to reflect this change.

I've left the ZASM untouched, so that scripts that have already been compiled in old quests are not affected.