eff 发表于 2009-9-27 09:10:19

一个非常简单的堆栈代码(供参考)

    integerarray            SYS_BlotStack
    integer                     SYS_BlotTop = 8191
    integer                     SYS_BlotIndex

    unit   array            SYS_Blot
    integerarray            SYS_BlotCode
    integerarray            SYS_BlotData_I00
    integerarray            SYS_BlotData_I01
    integerarray            SYS_BlotData_I02
    integerarray            SYS_BlotData_I03
    integerarray            SYS_BlotData_I04

//=========================================
function FlushBlotData takes integer index returns nothing
    set SYS_Blot = null
    set SYS_BlotCode = 0
    set SYS_BlotData_I00 = 0
    set SYS_BlotData_I01 = 0
    set SYS_BlotData_I02 = 0
    set SYS_BlotData_I03 = 0
    set SYS_BlotData_I04 = 0
endfunction

function ReleaseBlot takes unit b returns nothing
    local integer bIndex = GetUnitUserData(b)
    set SYS_BlotStack = bIndex
    set SYS_BlotTop = SYS_BlotTop + 1
    call FlushBlotData(bIndex)
endfunction

function InitBlot takes unit u,real tInv returns integer
    local integer bIndex
    if(SYS_BlotStack==null)then
      set SYS_BlotStack = SYS_BlotTop
      set bIndex = SYS_BlotTop
    else
      set bIndex = SYS_BlotStack
    endif
    set SYS_BlotTop = SYS_BlotTop - 1
    call FlushBlotData(bIndex)
    set SYS_Blot = u
    return bIndex
endfunction

蟋有的蟀 发表于 2009-9-27 12:01:42

虽然看起来很简洁
不过对于我这种纯踢er来说还是看不懂
页: [1]
查看完整版本: 一个非常简单的堆栈代码(供参考)