Manual:DIL Manual/UNIT ST OBJ
Jump to navigation
Jump to search
UNIT_ST_OBJ
Constant (integer, vme.h: 0x08).
An object: a weapon, a container, a key, money, a corpse. u.type == UNIT_ST_OBJ. The type of a unit is in its type field; the four unit types are bits, so they can be combined with |.
Fields
Only objects have: objecttype, value, objectflags, cost, rent, equip. What the five value[] numbers mean depends on objecttype (ITEM_* in values.h).
Notes
- Every unit, whatever its type, has the general fields: name, names, title, descr, outside_descr, inside_descr, extra, type, symname, nameidx, zoneidx, zone, key, outside, inside, next, gnext, gprevious, flags, manipulate, openflags, opendiff, weight, baseweight, capacity, height, light, bright, illum, minv, alignment, hp, max_hp, loadcount, hasfunc, spells.
spells[]on an object is its magic resistance; the index is not used.- An object that is worn has a
equipposition other than 0;addequip()andunequip()change it. - Reading a field the unit doesn't have fails, and a failed value is false in every comparison: test the type first.
Example
dilbegin integer pricey(obj : unitptr);
code
{
if (obj.type != UNIT_ST_OBJ)
return (FALSE);
return (obj.cost > 10000);
}
dilend
Tells whether a unit is an expensive object.