Skip to content

Commit 5afd9f6

Browse files
committed
correct return value for BlzGroupAddGroupFast, fixes #1010
1 parent be796b2 commit 5afd9f6

File tree

1 file changed

+9
-2
lines changed
  • de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers

1 file changed

+9
-2
lines changed

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/GroupProvider.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,15 @@ else if(index.getVal() == 0)
101101

102102
public ILconstInt BlzGroupAddGroupFast(IlConstHandle group, IlConstHandle groupAdd) {
103103
LinkedHashSet<IlConstHandle> groupList = (LinkedHashSet<IlConstHandle>) groupAdd.getObj();
104-
groupList.addAll((LinkedHashSet<IlConstHandle>) group.getObj());
105-
return ILconstInt.create(groupList.size());
104+
LinkedHashSet<IlConstHandle> addList = (LinkedHashSet<IlConstHandle>) group.getObj();
105+
int addCount = 0;
106+
for (IlConstHandle unit : addList) {
107+
if (!groupList.contains(unit)) {
108+
groupList.add(unit);
109+
addCount++;
110+
}
111+
}
112+
return ILconstInt.create(addCount);
106113
}
107114

108115
public ILconstInt BlzGroupRemoveGroupFast(IlConstHandle group, IlConstHandle groupRm) {

0 commit comments

Comments
 (0)