package de.peeeq.wurstio.jassinterpreter.providers;

import de.peeeq.wurstio.jassinterpreter.mocks.UnitMock;
import de.peeeq.wurstscript.intermediatelang.ILconstInt;
import de.peeeq.wurstscript.intermediatelang.ILconstReal;
import de.peeeq.wurstscript.intermediatelang.IlConstHandle;
import de.peeeq.wurstscript.intermediatelang.interpreter.AbstractInterpreter;

public class UnitProvider extends Provider {
    public UnitProvider(AbstractInterpreter interpreter) {
        super(interpreter);
    }

    public IlConstHandle CreateUnit(IlConstHandle owner, ILconstInt unitid, ILconstReal x, ILconstReal y, ILconstReal face) {
        return new IlConstHandle(NameProvider.getRandomName("unit"), new UnitMock(owner, unitid, x, y, face));
    }

    public ILconstInt GetUnitTypeId(IlConstHandle unit) {
        return ((UnitMock)unit.getObj()).unitid;
    }
}

@@ -356,16 +356,49 @@
 reter;%0A%0A
+import java.util.LinkedHashMap;%0A%0A
 public c
@@ -434,16 +434,113 @@
 vider %7B%0A
+    private final LinkedHashMap%3CIlConstHandle, ILconstInt%3E userDataMap = new LinkedHashMap%3C%3E();%0A%0A
     publ
@@ -981,11 +981,239 @@
 d;%0A    %7D
+%0A%0A    public ILconstInt GetUnitUserData(IlConstHandle unit) %7B%0A        return userDataMap.get(unit);%0A    %7D%0A%0A    public void SetUnitUserData(IlConstHandle unit, ILconstInt userData) %7B%0A        userDataMap.put(unit, userData);%0A    %7D
 %0A%7D%0A

Implement unit user data for compiletime (#1038)