Discussion N-Dimensional Arrays, Useful?

Jesus4Lyf

Good Idea™
Reaction score
397
Well if you don't want to use a JASS native hashtable there, I still have my old hashich system and my doublehashing algorithms lying around = )
I still have my own hash algorithm, too. I'm just fairly sure it's slower than the natives are. :)
(Not 100% sure, though.)

PS. Updated first post to correct implementation. ;)
 

Hatebreeder

So many apples
Reaction score
381
>With the N Dimensional Array, I could even detect Stacks(instances).
Do tell?

Actually, if people have a use for it, I can submit...
Just because it does actually work. Lol.

Struct[GetUnitTypeId(Unit)][STACKS[GetUnitTypeId(Unit)]] = struct

STACKS is a Global interger array. +1 OnCreate and -1 OnDestroy.
This is just off the Top of my Head. One could rearrange all of this to:

JASS:

struct Data

unit Caster
integer Stacks = 0

static method create takes unit u returns thistype
  local Data this = Data.allocate()

  set .Caster = u
  set .Stacks = .Stacks + 1

  set GLOBALUNITDATA[GetUnitTypeId(.Caster)] = this
      return this

endmethod

static method Blabla takes nothing returns nothing
 local Data this = GLOBALUNITDATA[GetUnitTypeId(GetTriggerUnit())]

if this == 0 then
   call Data.create(GetTriggerUnit())
else
   set .Stacks = .Stacks + 1
endif
endmethod

enstruct


This would also do the same, however, one would have to use this coding method over and over again... Which is annoying >_>
However I guess being able to use more dimensional arrays would also mean more options ( like, maybe have a third array either giving 0 or 1 back for event purposes... 0 meaning true, 1 false or w/e ).
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top