wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

[compiletime] `BlzGroupAddGroupFast` must return the number of added units #1010

Closed GetLocalPlayer closed 3 years ago

GetLocalPlayer commented 3 years ago

In addition, it must check if added unit is already in the group.

@Test
function test()
    let list = new LinkedList<unit>
    for i = 0 to 9
        list.add(createUnit(localPlayer, 'hfoo', ZERO2, angle(0)))
    let g = CreateGroup()
    let a = CreateGroup()
    ..add(list.get(0), list.get(1), list.get(2), list.get(3), list.get(4))
    let b = CreateGroup()
    ..add(list.get(2), list.get(3), list.get(4), list.get(5))
    print(BlzGroupAddGroupFast(a, g))
    print(BlzGroupAddGroupFast(b, g))
    print("size = " + g.size().toString())

init
    doAfter(1) ->
        test()

Ingame output: Screenshot_5

Compiletime output:

Running <Hello:7 - test>..
5
9
size = 9
    OK!
Tests succeeded: 1/1