永恒的灌水帝吧 关注:586贴子:1,695
  • 7回复贴,共1

可破坏物组 = =

只看楼主收藏回复



1楼2010-08-08 19:20回复
    library DestructableGroup
    type destructablegroup extends destructable array [100]
    globals
        destructablegroup DG
        destructable EnumDestr
        integer array Count
    endglobals
    function IsDestructableInDestructableGroup takes destructablegroup dg,destructable de returns boolean
        local integer i=0
        loop
            exitwhen dg[i]==de or i > 99
            set i=i+1
        endloop
        if i==100 and de != dg[99] then
            return false
        endif
        return true
    endfunction
    function IsDestructableEmpty takes destructablegroup dg returns boolean
        return Count[dg]==0
    endfunction
    function CreateDestructableGroup takes nothing returns destructablegroup
        return destructablegroup.create()
    endfunction
    function DestroyDestructableGroup takes destructablegroup dg returns nothing
        local integer i=0
        loop
            exitwhen i >99
            set dg[i] = null
            set i=i+1
        endloop
        set Count[dg]=0
        call dg.destroy()
    endfunction
    function DestructableGroupAddDestructable takes destructablegroup dg,destructable de returns boolean
        if Count[dg] < 98 then
            set dg[Count[dg]] = de
            set Count[dg] = Count[dg] + 1
            return true
        endif
        return false
    endfunction
    function DestructableGroupRemoveDestructable takes destructablegroup dg,destructable de returns boolean
        local integer i=0
        if IsDestructableInDestructableGroup(dg,de) then
            loop
                exitwhen dg[i]==de
                set i=i+1
            endloop
    


    2楼2010-08-08 19:20
    回复
      2025-05-09 21:20:32
      广告
              set dg[i]=dg[Count[dg]]
              set Count[dg]=Count[dg]-1
              set dg[Count[dg]]=null
              return true
          endif
          return false
      endfunction
      function DestructableGroupClear takes destructablegroup dg returns nothing
          local integer i=0
          loop
              exitwhen i >99
              set dg[i] = null
              set i=i+1
          endloop
          set Count[dg]=0
      endfunction
      function EnumDestructable takes nothing returns nothing
          local destructable d=GetEnumDestructable()
          call DestructableGroupAddDestructable(DG,d)
          set d=null
      endfunction
      function EnumDestructableInCircle takes destructablegroup g,location l,real r returns nothing
          set DG=g
          call EnumDestructablesInCircleBJ(r,l,function EnumDestructable)
          call RemoveLocation(l)
      endfunction
      function EnumDestructablesInRectEx takes destructablegroup g,rect r,boolexpr f returns nothing
          set DG=g
          call EnumDestructablesInRect(r,f,function EnumDestructable)
      endfunction
      function DestructableGroupAddDestructableGroup takes destructablegroup a,destructablegroup b returns nothing
          //add a  to b
          local integer i=0
          loop
              exitwhen i > Count[a]
              if IsDestructableInDestructableGroup(b,a[i]) == false then
                  call DestructableGroupAddDestructable(b,a[i])
              endif
              set i=i+1
          endloop
      endfunction
      function DestructableGroupRemoveDestructableGroup takes destructablegroup a,destructablegroup b returns nothing
          //remove a  from b
          local integer i=0
          loop
              exitwhen i > Count[a]
              call DestructableGroupRemoveDestructable(b,a[i])
              set i=i+1
          endloop
      endfunction
      function GetEnumDestructableEx takes nothing returns destructable
          return EnumDestr
      endfunction
      function ForDestructableGroup takes destructablegroup g,code c returns nothing
          local integer i=0
          local trigger t=CreateTrigger()
          call TriggerAddCondition(t,Condition©)
          loop
              exitwhen i > Count[g]
              set EnumDestr=g[i]
              call TriggerEvaluate(t)
              set i=i+1
          endloop
          call DestroyTrigger(t)
          set t=null
          //return
      endfunction
      endlibrary


      3楼2010-08-08 19:20
      回复
        - - 精了。。。


        5楼2010-08-08 20:04
        回复
          不顶不行啊


          IP属地:广东6楼2010-08-08 23:06
          回复
            不顶不行啊


            IP属地:广东7楼2010-08-08 23:06
            回复
              厉害啊


              IP属地:安徽8楼2012-03-09 00:22
              回复
                小白表示这玩意怎么用?有没有个说明书什么的


                IP属地:河北9楼2016-11-08 17:07
                回复