ruby: fix LinkList.next=

develop
jj 2012-08-13 02:06:56 +02:00
parent 53a0536506
commit e659d845ab
1 changed files with 8 additions and 6 deletions

@ -666,9 +666,9 @@ module DFHack
@_tg = tg @_tg = tg
end end
field(:_ptr, 0) { number 32, false } field(:_ptr, 0) { pointer }
field(:_prev, 4) { number 32, false } field(:_prev, 4) { pointer }
field(:_next, 8) { number 32, false } field(:_next, 8) { pointer }
def item def item
# With the current xml structure, currently _tg designate # With the current xml structure, currently _tg designate
@ -682,22 +682,24 @@ module DFHack
def item=(v) def item=(v)
#addr = _ptr #addr = _ptr
#raise 'null pointer' if addr == 0 #raise 'null pointer' if not addr
#@_tg.at(addr)._set(v) #@_tg.at(addr)._set(v)
raise 'null pointer' raise 'null pointer'
end end
def prev def prev
addr = _prev addr = _prev
return if addr == 0 return if not addr
@_tg._at(addr)._get @_tg._at(addr)._get
end end
def next def next
addr = _next addr = _next
return if addr == 0 return if not addr
@_tg._at(addr)._get @_tg._at(addr)._get
end end
alias next= _next=
alias prev= _prev=
include Enumerable include Enumerable
def each def each