getNextProperty method

int getNextProperty(
  1. int? pnum
)

Implementation

int getNextProperty(int? pnum) {
  if (pnum == 0) {
    //get first property
    return propertyNumber(propertyTableStart);
  }

  var addr = getPropertyAddress(pnum);

  if (addr == 0) {
    throw GameException('Attempted to get next property of a property'
        ' that doesn\'t exist ($pnum)');
  }

  var len = propertyLength(addr - 1);

  addr += len;

  len = ZMachine.verToInt(Z.engine.version) <= 3 ||
          !BinaryHelper.isSet(Z.engine.mem.loadb(addr), 7)
      ? propertyLength(addr)
      : propertyLength(addr + 1);

  return len == 0 ? len : propertyNumber(addr);
}