Closed armoha closed 2 years ago
Related lines of code: https://github.com/armoha/eudplib/blob/655b18683d262f46a89d7b31b02547da0e37742d/eudplib/epscript/helper.py#L125-L151
class _ARRW:
def __init__(self, obj, index):
self.obj = obj
self.index = index
def __lshift__(self, r):
self.obj[self.index] = r
def __iadd__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov + v
def __isub__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov - v
def __imul__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov * v
def __ifloordiv__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov // v
def __iand__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov & v
def __ior__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov | v
def __ixor__(self, v):
ov = self.obj[self.index]
self.obj[self.index] = ov ^
Current status
Most of
EUDArray
andEUDVArray
operations are implemented in armoha/eudplib#18 and https://github.com/armoha/eudplib/commit/3a1287507cda4d9988b96e983a22b9d7c61c170cTODO
Should we expose operator for
Subtract
modifier?Original issue
All assignment statements except substitution use
_ARRW
for array types, which actually does NOT use in-place operation, and instead reads array and does binary operation:Since in-place operations are much more efficient than binary operations for SC triggers, this should be fixed!
We also needs to stop calculating
epd_size_of(array_member) * index
twice.