setPropertyValue method
void
setPropertyValue(
- int? pnum,
- int? value
)
Implementation
void setPropertyValue(int? pnum, int? value) {
var addr = getPropertyAddress(pnum);
var len = propertyLength(addr - 1);
if (addr == 0) {
throw GameException('Property not found.');
}
if (len < 1 || len > 2) {
throw GameException('Cannot set property on properties > 2 bytes.');
}
if (len == 1) {
if (value! < 0) {
Debugger.todo('length is 1 & value < 0');
}
value &= 0xff;
Z.engine.mem.storeb(addr, value);
} else if (len == 2) {
Z.engine.mem.storew(addr, value!);
}
}